@splenddev/kreativ-ui 0.2.9 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -1511
- package/dist/index.cjs +2450 -1255
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -908
- package/dist/index.d.ts +328 -908
- package/dist/index.js +2306 -1149
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +2 -2
- package/package.json +7 -2
package/dist/index.cjs
CHANGED
|
@@ -3,230 +3,187 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
|
-
var framerMotion = require('framer-motion');
|
|
7
6
|
var clsx = require('clsx');
|
|
8
7
|
var tailwindMerge = require('tailwind-merge');
|
|
9
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
var kreativCore = require('@splenddev/kreativ-core');
|
|
10
|
+
var hooks_star = require('@splenddev/kreativ-core/hooks');
|
|
11
|
+
var framerMotion = require('framer-motion');
|
|
10
12
|
var lucideReact = require('lucide-react');
|
|
11
13
|
var classVarianceAuthority = require('class-variance-authority');
|
|
14
|
+
var types_star = require('@splenddev/kreativ-core/types');
|
|
12
15
|
|
|
13
16
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
17
|
+
function _interopNamespace(e) {
|
|
18
|
+
if (e && e.__esModule) return e;
|
|
19
|
+
var n = Object.create(null);
|
|
20
|
+
if (e) {
|
|
21
|
+
Object.keys(e).forEach(function (k) {
|
|
22
|
+
if (k !== 'default') {
|
|
23
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
24
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return e[k]; }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
n.default = e;
|
|
32
|
+
return Object.freeze(n);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var hooks_star__namespace = /*#__PURE__*/_interopNamespace(hooks_star);
|
|
36
|
+
var types_star__namespace = /*#__PURE__*/_interopNamespace(types_star);
|
|
37
|
+
|
|
14
38
|
console.log("BANNER TEST");
|
|
15
39
|
var __defProp = Object.defineProperty;
|
|
40
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
41
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
42
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
43
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
44
|
+
var __export = (target, all) => {
|
|
45
|
+
for (var name in all)
|
|
46
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
47
|
+
};
|
|
48
|
+
var __copyProps = (to, from, except, desc) => {
|
|
49
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
50
|
+
for (let key of __getOwnPropNames(from))
|
|
51
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
52
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
53
|
+
}
|
|
54
|
+
return to;
|
|
55
|
+
};
|
|
56
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget);
|
|
57
|
+
|
|
58
|
+
// src/index.ts
|
|
59
|
+
var index_exports = {};
|
|
60
|
+
__export(index_exports, {
|
|
61
|
+
Adornment: () => Adornment,
|
|
62
|
+
Button: () => Button,
|
|
63
|
+
ButtonGroup: () => ButtonGroup,
|
|
64
|
+
ButtonGroupContext: () => ButtonGroupContext,
|
|
65
|
+
ButtonGroupItemContext: () => ButtonGroupItemContext,
|
|
66
|
+
Card: () => Card,
|
|
67
|
+
Checkbox: () => Checkbox,
|
|
68
|
+
Combobox: () => Combobox,
|
|
69
|
+
ComboboxContent: () => ComboboxContent,
|
|
70
|
+
ComboboxInput: () => ComboboxInput,
|
|
71
|
+
ComboboxItem: () => ComboboxItem,
|
|
72
|
+
Container: () => Container,
|
|
73
|
+
Flex: () => Flex,
|
|
74
|
+
FormField: () => FormField,
|
|
75
|
+
FormFieldControl: () => FormFieldControl,
|
|
76
|
+
FormFieldDescription: () => FormFieldDescription,
|
|
77
|
+
FormFieldLabel: () => FormFieldLabel,
|
|
78
|
+
FormFieldMessage: () => FormFieldMessage,
|
|
79
|
+
Grid: () => Grid,
|
|
80
|
+
Input: () => Input,
|
|
81
|
+
InputField: () => InputField,
|
|
82
|
+
MarkdownEditor: () => MarkdownEditor,
|
|
83
|
+
MultiSelect: () => MultiSelect,
|
|
84
|
+
MultiSelectContent: () => MultiSelectContent,
|
|
85
|
+
MultiSelectItem: () => MultiSelectItem,
|
|
86
|
+
MultiSelectTrigger: () => MultiSelectTrigger,
|
|
87
|
+
Radio: () => Radio,
|
|
88
|
+
RadioGroup: () => RadioGroup,
|
|
89
|
+
Select: () => Select,
|
|
90
|
+
SelectContent: () => SelectContent,
|
|
91
|
+
SelectGroup: () => SelectGroup,
|
|
92
|
+
SelectItem: () => SelectItem,
|
|
93
|
+
SelectTrigger: () => SelectTrigger,
|
|
94
|
+
SelectValue: () => SelectValue,
|
|
95
|
+
Stack: () => Stack,
|
|
96
|
+
Switch: () => Switch,
|
|
97
|
+
Textarea: () => Textarea,
|
|
98
|
+
ThemeContext: () => kreativCore.ThemeContext,
|
|
99
|
+
ThemeToggler: () => ThemeToggler,
|
|
100
|
+
UIProvider: () => UIProvider,
|
|
101
|
+
cardSkeleton: () => cardSkeleton,
|
|
102
|
+
cn: () => cn,
|
|
103
|
+
defineRecipe: () => defineRecipe,
|
|
104
|
+
defineSemanticToken: () => defineSemanticToken2,
|
|
105
|
+
defineSemanticTokens: () => defineSemanticTokens,
|
|
106
|
+
defineTheme: () => defineTheme2,
|
|
107
|
+
defineToken: () => defineToken2,
|
|
108
|
+
defineTokens: () => defineTokens,
|
|
109
|
+
defineTypography: () => defineTypography2,
|
|
110
|
+
extendRecipe: () => extendRecipe,
|
|
111
|
+
extendRecipes: () => extendRecipes,
|
|
112
|
+
extendSemanticTokens: () => extendSemanticTokens,
|
|
113
|
+
extendTheme: () => extendTheme,
|
|
114
|
+
extendTokens: () => extendTokens,
|
|
115
|
+
extendTypography: () => extendTypography,
|
|
116
|
+
getRecipeNames: () => getRecipeNames,
|
|
117
|
+
hexToRgbString: () => hexToRgbString,
|
|
118
|
+
rgbToHex: () => rgbToHex,
|
|
119
|
+
useButtonGroupContext: () => useButtonGroupContext,
|
|
120
|
+
useButtonGroupItemContext: () => useButtonGroupItemContext,
|
|
121
|
+
useClearableField: () => useClearableField,
|
|
122
|
+
useFloatingSide: () => useFloatingSide,
|
|
123
|
+
useKeyboardShortcuts: () => useKeyboardShortcuts,
|
|
124
|
+
useOptionalButtonGroupContext: () => useOptionalButtonGroupContext,
|
|
125
|
+
useOptionalButtonGroupItemContext: () => useOptionalButtonGroupItemContext,
|
|
126
|
+
useStatusTransition: () => useStatusTransition
|
|
127
|
+
});
|
|
17
128
|
function cn(...inputs) {
|
|
18
129
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
19
130
|
}
|
|
20
131
|
__name(cn, "cn");
|
|
21
|
-
var ThemeContext = react.createContext(null);
|
|
22
|
-
|
|
23
|
-
// src/hooks/useTheme.ts
|
|
24
|
-
function useTheme() {
|
|
25
|
-
const ctx = react.useContext(ThemeContext);
|
|
26
|
-
if (!ctx) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
"useTheme() was called outside <UIProvider>. Wrap your app in <UIProvider> from 'kreativ-ui'."
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
return ctx;
|
|
32
|
-
}
|
|
33
|
-
__name(useTheme, "useTheme");
|
|
34
|
-
var applySizeOffset = /* @__PURE__ */ __name((value, offset) => {
|
|
35
|
-
if (!value || !offset) return value;
|
|
36
|
-
return `calc(${value} - ${offset})`;
|
|
37
|
-
}, "applySizeOffset");
|
|
38
|
-
function useSizeStyle(size, iconOnly = false, componentName = "componentName", options = {}) {
|
|
39
|
-
const { widthFromHeight = false, includeHeight = true, sizeOffset, fontSizeOffset } = options;
|
|
40
|
-
const { theme, fallbackSize } = useTheme();
|
|
41
|
-
return react.useMemo(() => {
|
|
42
|
-
const scale = theme.sizes;
|
|
43
|
-
const token = scale[size] ?? scale[fallbackSize] ?? Object.values(scale)[0] ?? {};
|
|
44
|
-
const style = {};
|
|
45
|
-
if (includeHeight && token.height) {
|
|
46
|
-
style.height = applySizeOffset(token.height, sizeOffset);
|
|
47
|
-
}
|
|
48
|
-
if (token.width) {
|
|
49
|
-
style.width = applySizeOffset(token.width, sizeOffset);
|
|
50
|
-
} else if ((iconOnly || widthFromHeight) && includeHeight && token.height) {
|
|
51
|
-
style.width = applySizeOffset(token.height, sizeOffset);
|
|
52
|
-
}
|
|
53
|
-
if (!iconOnly && token.paddingX) {
|
|
54
|
-
style.paddingLeft = token.paddingX;
|
|
55
|
-
style.paddingRight = token.paddingX;
|
|
56
|
-
}
|
|
57
|
-
if (token.paddingY) {
|
|
58
|
-
style.paddingTop = token.paddingY;
|
|
59
|
-
style.paddingBottom = token.paddingY;
|
|
60
|
-
}
|
|
61
|
-
if (token.fontSize) {
|
|
62
|
-
style.fontSize = applySizeOffset(token.fontSize, fontSizeOffset);
|
|
63
|
-
}
|
|
64
|
-
if (token.gap) {
|
|
65
|
-
style.gap = iconOnly ? 0 : token.gap;
|
|
66
|
-
}
|
|
67
|
-
if (token.radius) {
|
|
68
|
-
const varName = `--kui-${componentName}-radius`;
|
|
69
|
-
style[varName] = token.radius;
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
style,
|
|
73
|
-
iconSize: token.iconSize,
|
|
74
|
-
fontSize: applySizeOffset(token.fontSize, fontSizeOffset),
|
|
75
|
-
gap: token.gap
|
|
76
|
-
};
|
|
77
|
-
}, [
|
|
78
|
-
theme.sizes,
|
|
79
|
-
size,
|
|
80
|
-
fallbackSize,
|
|
81
|
-
iconOnly,
|
|
82
|
-
includeHeight,
|
|
83
|
-
componentName,
|
|
84
|
-
widthFromHeight
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
__name(useSizeStyle, "useSizeStyle");
|
|
88
|
-
var BREAKPOINTS = {
|
|
89
|
-
sm: 640,
|
|
90
|
-
md: 768,
|
|
91
|
-
lg: 1024,
|
|
92
|
-
xl: 1280,
|
|
93
|
-
"2xl": 1536
|
|
94
|
-
};
|
|
95
|
-
function useBreakpoint(breakpoint) {
|
|
96
|
-
const query = `(min-width: ${BREAKPOINTS[breakpoint]}px)`;
|
|
97
|
-
const [matches, setMatches] = react.useState(
|
|
98
|
-
() => typeof window !== "undefined" && window.matchMedia(query).matches
|
|
99
|
-
);
|
|
100
|
-
react.useEffect(() => {
|
|
101
|
-
const mql = window.matchMedia(query);
|
|
102
|
-
const listener = /* @__PURE__ */ __name((e) => setMatches(e.matches), "listener");
|
|
103
|
-
mql.addEventListener("change", listener);
|
|
104
|
-
setMatches(mql.matches);
|
|
105
|
-
return () => mql.removeEventListener("change", listener);
|
|
106
|
-
}, [query]);
|
|
107
|
-
return matches;
|
|
108
|
-
}
|
|
109
|
-
__name(useBreakpoint, "useBreakpoint");
|
|
110
|
-
var VIEWPORT_PADDING = 8;
|
|
111
|
-
function useFloatingSide(triggerRef, open) {
|
|
112
|
-
const contentRef = react.useRef(null);
|
|
113
|
-
const [side, setSide] = react.useState("bottom");
|
|
114
|
-
react.useLayoutEffect(() => {
|
|
115
|
-
if (!open) return;
|
|
116
|
-
const trigger = triggerRef.current;
|
|
117
|
-
const content = contentRef.current;
|
|
118
|
-
if (!trigger || !content) return;
|
|
119
|
-
function measure() {
|
|
120
|
-
const triggerRect = trigger.getBoundingClientRect();
|
|
121
|
-
const contentHeight = content.offsetHeight;
|
|
122
|
-
const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING;
|
|
123
|
-
const spaceAbove = triggerRect.top - VIEWPORT_PADDING;
|
|
124
|
-
setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
|
|
125
|
-
}
|
|
126
|
-
__name(measure, "measure");
|
|
127
|
-
measure();
|
|
128
|
-
window.addEventListener("resize", measure);
|
|
129
|
-
window.addEventListener("scroll", measure, true);
|
|
130
|
-
return () => {
|
|
131
|
-
window.removeEventListener("resize", measure);
|
|
132
|
-
window.removeEventListener("scroll", measure, true);
|
|
133
|
-
};
|
|
134
|
-
}, [open, triggerRef]);
|
|
135
|
-
return { contentRef, side };
|
|
136
|
-
}
|
|
137
|
-
__name(useFloatingSide, "useFloatingSide");
|
|
138
|
-
var TRANSITION_DURATION = 1500;
|
|
139
|
-
function useStatusTransition(status) {
|
|
140
|
-
const previousStatus = react.useRef(status);
|
|
141
|
-
const [transitionStatus, setTransitionStatus] = react.useState();
|
|
142
|
-
react.useEffect(() => {
|
|
143
|
-
if (status === previousStatus.current) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
previousStatus.current = status;
|
|
147
|
-
if (status === "none") {
|
|
148
|
-
setTransitionStatus(void 0);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
setTransitionStatus(status);
|
|
152
|
-
const timeout = window.setTimeout(() => {
|
|
153
|
-
setTransitionStatus(void 0);
|
|
154
|
-
}, TRANSITION_DURATION);
|
|
155
|
-
return () => window.clearTimeout(timeout);
|
|
156
|
-
}, [status]);
|
|
157
|
-
return transitionStatus;
|
|
158
|
-
}
|
|
159
|
-
__name(useStatusTransition, "useStatusTransition");
|
|
160
132
|
|
|
161
|
-
// src/utils/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
const path = match[1].split(".");
|
|
171
|
-
let current = tokens;
|
|
172
|
-
for (const key of path) {
|
|
173
|
-
if (typeof current !== "object" || current === null || !(key in current)) {
|
|
174
|
-
return "";
|
|
133
|
+
// src/utils/color.ts
|
|
134
|
+
var HEX_RE = /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
|
|
135
|
+
function rgbToHex(value) {
|
|
136
|
+
const trimmed = value.trim();
|
|
137
|
+
if (HEX_RE.test(trimmed)) {
|
|
138
|
+
if (trimmed.length === 4 || trimmed.length === 3 && !trimmed.startsWith("#")) {
|
|
139
|
+
const clean = trimmed.replace("#", "");
|
|
140
|
+
const expanded = clean.split("").map((ch) => ch + ch).join("");
|
|
141
|
+
return `#${expanded.toUpperCase()}`;
|
|
175
142
|
}
|
|
176
|
-
|
|
143
|
+
return trimmed.startsWith("#") ? trimmed.toUpperCase() : `#${trimmed.toUpperCase()}`;
|
|
177
144
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
145
|
+
const stripped = trimmed.replace(/^rgba?\(/i, "").replace(/\)$/, "").trim();
|
|
146
|
+
const parts = stripped.split(/[\s,]+/).filter(Boolean);
|
|
147
|
+
const numbers = parts.slice(0, 3).map((p) => {
|
|
148
|
+
const cleaned = p.replace(/%$/, "");
|
|
149
|
+
return Number(cleaned);
|
|
150
|
+
}).filter((n) => Number.isFinite(n) && n >= 0 && n <= 255);
|
|
151
|
+
if (numbers.length !== 3) {
|
|
152
|
+
return "#000000";
|
|
184
153
|
}
|
|
185
|
-
|
|
154
|
+
const hex = numbers.map((n) => Math.round(n).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
155
|
+
return `#${hex}`;
|
|
186
156
|
}
|
|
187
|
-
__name(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
fontWeight: resolveTokenReference(typography.fontWeight, tokens),
|
|
196
|
-
lineHeight: resolveTokenReference(typography.lineHeight, tokens),
|
|
197
|
-
letterSpacing: resolveTokenReference(
|
|
198
|
-
typography.letterSpacing,
|
|
199
|
-
tokens
|
|
200
|
-
)
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
__name(resolveTypography, "resolveTypography");
|
|
204
|
-
|
|
205
|
-
// src/hooks/useTypography.ts
|
|
206
|
-
function useTypography(name) {
|
|
207
|
-
const { theme } = useTheme();
|
|
208
|
-
return resolveTypography(
|
|
209
|
-
name ? theme.typography[name] : void 0,
|
|
210
|
-
theme.tokens
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
__name(useTypography, "useTypography");
|
|
214
|
-
function useClearableField(elementRef, initialValue, onClear) {
|
|
215
|
-
const [hasValue, setHasValue] = react.useState(() => Boolean(initialValue ?? ""));
|
|
216
|
-
const clear = react.useCallback(() => {
|
|
217
|
-
const element = elementRef.current;
|
|
218
|
-
if (!element) return;
|
|
219
|
-
const prototype = element instanceof HTMLTextAreaElement ? window.HTMLTextAreaElement.prototype : window.HTMLInputElement.prototype;
|
|
220
|
-
const setter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
|
|
221
|
-
setter?.call(element, "");
|
|
222
|
-
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
223
|
-
element.focus();
|
|
224
|
-
setHasValue(false);
|
|
225
|
-
onClear?.();
|
|
226
|
-
}, [elementRef, onClear]);
|
|
227
|
-
return { hasValue, setHasValue, clear };
|
|
157
|
+
__name(rgbToHex, "rgbToHex");
|
|
158
|
+
function hexToRgbString(hex) {
|
|
159
|
+
if (!HEX_RE.test(hex)) return null;
|
|
160
|
+
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
161
|
+
const r = parseInt(full.slice(1, 3), 16);
|
|
162
|
+
const g = parseInt(full.slice(3, 5), 16);
|
|
163
|
+
const b = parseInt(full.slice(5, 7), 16);
|
|
164
|
+
return `${r} ${g} ${b}`;
|
|
228
165
|
}
|
|
229
|
-
__name(
|
|
166
|
+
__name(hexToRgbString, "hexToRgbString");
|
|
167
|
+
var Adornment = react.forwardRef(
|
|
168
|
+
({ children, position, className, ...props }, ref) => {
|
|
169
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
+
"span",
|
|
171
|
+
{
|
|
172
|
+
ref,
|
|
173
|
+
"data-kui-adornment": true,
|
|
174
|
+
"data-kui-adornment-position": position,
|
|
175
|
+
className: cn(
|
|
176
|
+
"flex shrink-0 items-center justify-center",
|
|
177
|
+
position === "end" && "gap-1.5",
|
|
178
|
+
className
|
|
179
|
+
),
|
|
180
|
+
...props,
|
|
181
|
+
children
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
);
|
|
186
|
+
Adornment.displayName = "Adornment";
|
|
230
187
|
|
|
231
188
|
// src/theme/recipes/resolveRecipe.ts
|
|
232
189
|
function matchesConditions(conditions, props) {
|
|
@@ -267,51 +224,198 @@ function resolveRecipe(recipe, props = {}) {
|
|
|
267
224
|
return cn(...classes);
|
|
268
225
|
}
|
|
269
226
|
__name(resolveRecipe, "resolveRecipe");
|
|
270
|
-
|
|
227
|
+
function ResponsiveStyle({ css }) {
|
|
228
|
+
if (!css) return null;
|
|
229
|
+
return /* @__PURE__ */ jsxRuntime.jsx("style", { "data-kui-responsive-style": true, children: css });
|
|
230
|
+
}
|
|
231
|
+
__name(ResponsiveStyle, "ResponsiveStyle");
|
|
232
|
+
var defaultButtonGroupContext = {
|
|
233
|
+
orientation: "horizontal",
|
|
234
|
+
attached: false,
|
|
235
|
+
spacing: "md",
|
|
236
|
+
size: "md"
|
|
237
|
+
};
|
|
238
|
+
var ButtonGroupContext = react.createContext(
|
|
239
|
+
defaultButtonGroupContext
|
|
240
|
+
);
|
|
241
|
+
var ButtonGroupItemContext = react.createContext(null);
|
|
242
|
+
function useButtonGroupContext() {
|
|
243
|
+
const context = react.useContext(ButtonGroupContext);
|
|
244
|
+
if (context === void 0) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
"useButtonGroupContext must be used inside a <ButtonGroup /> provider"
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
return context;
|
|
250
|
+
}
|
|
251
|
+
__name(useButtonGroupContext, "useButtonGroupContext");
|
|
252
|
+
function useOptionalButtonGroupContext() {
|
|
253
|
+
return react.useContext(ButtonGroupContext);
|
|
254
|
+
}
|
|
255
|
+
__name(useOptionalButtonGroupContext, "useOptionalButtonGroupContext");
|
|
256
|
+
function useButtonGroupItemContext() {
|
|
257
|
+
const context = react.useContext(ButtonGroupItemContext);
|
|
258
|
+
return context !== null;
|
|
259
|
+
}
|
|
260
|
+
__name(useButtonGroupItemContext, "useButtonGroupItemContext");
|
|
261
|
+
function useOptionalButtonGroupItemContext() {
|
|
262
|
+
return react.useContext(ButtonGroupItemContext);
|
|
263
|
+
}
|
|
264
|
+
__name(useOptionalButtonGroupItemContext, "useOptionalButtonGroupItemContext");
|
|
265
|
+
var ButtonGroupSeparator = react.forwardRef(({ orientation: explicitOrientation, className, ...rest }, ref) => {
|
|
266
|
+
const context = useButtonGroupContext();
|
|
267
|
+
const orientation = explicitOrientation ?? context?.orientation ?? "horizontal";
|
|
268
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
ref,
|
|
272
|
+
role: "separator",
|
|
273
|
+
"aria-orientation": orientation,
|
|
274
|
+
"data-kui-button-group-separator": "",
|
|
275
|
+
"data-orientation": orientation,
|
|
276
|
+
className: cn(
|
|
277
|
+
"bg-kui-border",
|
|
278
|
+
className
|
|
279
|
+
),
|
|
280
|
+
...rest
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
});
|
|
284
|
+
ButtonGroupSeparator.displayName = "ButtonGroup.Separator";
|
|
285
|
+
var ButtonGroupText = react.forwardRef(({ className, children, ...rest }, ref) => {
|
|
286
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
"span",
|
|
288
|
+
{
|
|
289
|
+
ref,
|
|
290
|
+
"data-kui-button-group-text": "",
|
|
291
|
+
className: cn(
|
|
292
|
+
"inline-flex items-center text-sm text-muted-foreground",
|
|
293
|
+
className
|
|
294
|
+
),
|
|
295
|
+
...rest,
|
|
296
|
+
children
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
});
|
|
300
|
+
ButtonGroupText.displayName = "ButtonGroup.Text";
|
|
301
|
+
var ButtonGroupLabel = react.forwardRef(({ className, children, ...rest }, ref) => {
|
|
302
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
303
|
+
"span",
|
|
304
|
+
{
|
|
305
|
+
ref,
|
|
306
|
+
"data-kui-button-group-label": "",
|
|
307
|
+
className: cn("text-sm font-medium text-foreground", className),
|
|
308
|
+
...rest,
|
|
309
|
+
children
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
ButtonGroupLabel.displayName = "ButtonGroup.Label";
|
|
314
|
+
var ButtonGroupItem = react.forwardRef(
|
|
315
|
+
({ className, children, ...props }, ref) => {
|
|
316
|
+
const { orientation, attached } = useButtonGroupContext();
|
|
317
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ButtonGroupItemContext.Provider, { value: { embedded: true }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
ref,
|
|
321
|
+
"data-kui-button-group-item": "true",
|
|
322
|
+
"data-orientation": orientation,
|
|
323
|
+
"data-attached": attached || void 0,
|
|
324
|
+
className: cn(
|
|
325
|
+
"relative flex min-w-0 items-center",
|
|
326
|
+
"transition-[background-color,box-shadow]",
|
|
327
|
+
className
|
|
328
|
+
),
|
|
329
|
+
...props,
|
|
330
|
+
children
|
|
331
|
+
}
|
|
332
|
+
) });
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
ButtonGroupItem.displayName = "ButtonGroup.Item";
|
|
336
|
+
var ButtonGroupRoot = react.forwardRef(
|
|
337
|
+
({
|
|
338
|
+
orientation = "horizontal",
|
|
339
|
+
attached = false,
|
|
340
|
+
spacing = "md",
|
|
341
|
+
className,
|
|
342
|
+
children,
|
|
343
|
+
size,
|
|
344
|
+
...rest
|
|
345
|
+
}, ref) => {
|
|
346
|
+
const { theme } = kreativCore.useTheme();
|
|
347
|
+
const recipeClasses = resolveRecipe(theme.recipes.ButtonGroup, {
|
|
348
|
+
orientation,
|
|
349
|
+
attached,
|
|
350
|
+
spacing
|
|
351
|
+
});
|
|
352
|
+
const contextValue = react.useMemo(
|
|
353
|
+
() => ({
|
|
354
|
+
orientation,
|
|
355
|
+
attached,
|
|
356
|
+
spacing,
|
|
357
|
+
size
|
|
358
|
+
}),
|
|
359
|
+
[orientation, attached, spacing, size]
|
|
360
|
+
);
|
|
361
|
+
const separatorSizeToken = hooks_star.useSizeToken(size, "separatorSize");
|
|
362
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ButtonGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
363
|
+
"div",
|
|
364
|
+
{
|
|
365
|
+
ref,
|
|
366
|
+
role: "group",
|
|
367
|
+
"data-kui-button-group": "",
|
|
368
|
+
"data-orientation": orientation,
|
|
369
|
+
"data-attached": attached || void 0,
|
|
370
|
+
className: cn(recipeClasses, className),
|
|
371
|
+
style: {
|
|
372
|
+
"--kui-button-group-separator-size": separatorSizeToken
|
|
373
|
+
},
|
|
374
|
+
...rest,
|
|
375
|
+
children
|
|
376
|
+
}
|
|
377
|
+
) });
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
ButtonGroupRoot.displayName = "ButtonGroup";
|
|
381
|
+
var ButtonGroup = Object.assign(ButtonGroupRoot, {
|
|
382
|
+
Separator: ButtonGroupSeparator,
|
|
383
|
+
Text: ButtonGroupText,
|
|
384
|
+
Label: ButtonGroupLabel,
|
|
385
|
+
Item: ButtonGroupItem
|
|
386
|
+
});
|
|
387
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
271
388
|
var Button = react.forwardRef(
|
|
272
389
|
({
|
|
273
390
|
variant = "solid",
|
|
274
391
|
color = "brand",
|
|
275
|
-
size
|
|
392
|
+
size,
|
|
276
393
|
isLoading = false,
|
|
277
394
|
leftIcon,
|
|
278
395
|
rightIcon,
|
|
279
396
|
fullWidth = false,
|
|
280
|
-
disabled,
|
|
397
|
+
disabled = false,
|
|
281
398
|
typography: typographyName = "body",
|
|
282
399
|
className,
|
|
283
400
|
style,
|
|
284
401
|
iconOnly,
|
|
285
402
|
children,
|
|
286
403
|
render,
|
|
287
|
-
onKeyDown,
|
|
288
|
-
onKeyUp,
|
|
289
404
|
...rest
|
|
290
405
|
}, ref) => {
|
|
291
|
-
const { theme } = useTheme();
|
|
292
|
-
const typography = useTypography(typographyName);
|
|
293
|
-
const
|
|
294
|
-
|
|
406
|
+
const { theme } = kreativCore.useTheme();
|
|
407
|
+
const typography = hooks_star.useTypography(typographyName);
|
|
408
|
+
const group = useOptionalButtonGroupContext();
|
|
409
|
+
const resolvedSize = size ?? group?.size ?? "md";
|
|
410
|
+
const { style: sizeStyle, responsiveStyles } = hooks_star.useSizeStyle(
|
|
411
|
+
resolvedSize,
|
|
295
412
|
iconOnly,
|
|
296
413
|
"button"
|
|
297
414
|
);
|
|
298
|
-
const
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
onKeyDown?.(e);
|
|
303
|
-
if (isInteractive && ACTIVATION_KEYS.has(e.key)) {
|
|
304
|
-
setIsKeyboardPressed(true);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
__name(handleKeyDown, "handleKeyDown");
|
|
308
|
-
function handleKeyUp(e) {
|
|
309
|
-
onKeyUp?.(e);
|
|
310
|
-
if (ACTIVATION_KEYS.has(e.key)) {
|
|
311
|
-
setIsKeyboardPressed(false);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
__name(handleKeyUp, "handleKeyUp");
|
|
415
|
+
const { attribute: responsiveAttribute, style: responsiveCss } = hooks_star.useResponsiveStyles(responsiveStyles);
|
|
416
|
+
const iconSize = hooks_star.useSizeToken(resolvedSize, "iconSize");
|
|
417
|
+
const isDisabled = disabled || isLoading;
|
|
418
|
+
const isInButtonGroup = !!group;
|
|
315
419
|
const recipeClasses = resolveRecipe(theme.recipes.Button, {
|
|
316
420
|
variant,
|
|
317
421
|
color
|
|
@@ -319,7 +423,7 @@ var Button = react.forwardRef(
|
|
|
319
423
|
const resolvedClassName = cn(
|
|
320
424
|
recipeClasses,
|
|
321
425
|
fullWidth && "w-full",
|
|
322
|
-
isLoading && "
|
|
426
|
+
isLoading && "opacity-90 pointer-events-none",
|
|
323
427
|
className
|
|
324
428
|
);
|
|
325
429
|
const resolvedStyle = {
|
|
@@ -327,6 +431,11 @@ var Button = react.forwardRef(
|
|
|
327
431
|
...sizeStyle,
|
|
328
432
|
...style
|
|
329
433
|
};
|
|
434
|
+
const groupDataAttributes = {
|
|
435
|
+
"data-kui-button-group-item": isInButtonGroup || void 0,
|
|
436
|
+
"data-kui-group-attached": group?.attached || void 0,
|
|
437
|
+
"data-kui-group-orientation": group?.orientation || void 0
|
|
438
|
+
};
|
|
330
439
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
331
440
|
isLoading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
332
441
|
"span",
|
|
@@ -339,121 +448,347 @@ var Button = react.forwardRef(
|
|
|
339
448
|
"aria-hidden": "true"
|
|
340
449
|
}
|
|
341
450
|
),
|
|
342
|
-
!isLoading && leftIcon
|
|
451
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
452
|
+
"span",
|
|
453
|
+
{
|
|
454
|
+
className: "inline-flex shrink-0 items-center justify-center",
|
|
455
|
+
style: {
|
|
456
|
+
width: iconSize,
|
|
457
|
+
height: iconSize
|
|
458
|
+
},
|
|
459
|
+
"aria-hidden": "true",
|
|
460
|
+
children: leftIcon
|
|
461
|
+
}
|
|
462
|
+
),
|
|
343
463
|
iconOnly && isLoading ? null : children,
|
|
344
|
-
!isLoading && rightIcon
|
|
464
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
465
|
+
"span",
|
|
466
|
+
{
|
|
467
|
+
className: "inline-flex shrink-0 items-center justify-center",
|
|
468
|
+
style: {
|
|
469
|
+
width: iconSize,
|
|
470
|
+
height: iconSize
|
|
471
|
+
},
|
|
472
|
+
"aria-hidden": "true",
|
|
473
|
+
children: rightIcon
|
|
474
|
+
}
|
|
475
|
+
)
|
|
345
476
|
] });
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
framerMotion.motion.button,
|
|
477
|
+
const buttonElement = render ? render({
|
|
478
|
+
...rest,
|
|
479
|
+
className: resolvedClassName,
|
|
480
|
+
style: resolvedStyle,
|
|
481
|
+
disabled: isDisabled,
|
|
482
|
+
"aria-disabled": isDisabled || void 0,
|
|
483
|
+
"aria-busy": isLoading || void 0,
|
|
484
|
+
"data-kui-responsive": responsiveAttribute,
|
|
485
|
+
children: content
|
|
486
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
"button",
|
|
358
488
|
{
|
|
359
489
|
ref,
|
|
360
|
-
disabled:
|
|
490
|
+
disabled: isDisabled,
|
|
361
491
|
className: resolvedClassName,
|
|
362
492
|
style: resolvedStyle,
|
|
363
493
|
"aria-busy": isLoading || void 0,
|
|
364
|
-
"aria-disabled":
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
},
|
|
494
|
+
"aria-disabled": isDisabled || void 0,
|
|
495
|
+
"data-kui-themeable": true,
|
|
496
|
+
"data-kui-responsive": responsiveAttribute,
|
|
368
497
|
type: "button",
|
|
369
|
-
|
|
370
|
-
whileTap: isInteractive ? { scale: 0.975 } : void 0,
|
|
371
|
-
transition: prefersReducedMotion ? { duration: 0 } : {
|
|
372
|
-
type: "spring",
|
|
373
|
-
stiffness: 500,
|
|
374
|
-
damping: 30
|
|
375
|
-
},
|
|
376
|
-
onKeyDown: handleKeyDown,
|
|
377
|
-
onKeyUp: handleKeyUp,
|
|
498
|
+
...groupDataAttributes,
|
|
378
499
|
...rest,
|
|
379
500
|
children: content
|
|
380
501
|
}
|
|
381
502
|
);
|
|
503
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
504
|
+
responsiveCss && /* @__PURE__ */ jsxRuntime.jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
505
|
+
buttonElement
|
|
506
|
+
] });
|
|
382
507
|
}
|
|
383
508
|
);
|
|
384
509
|
Button.displayName = "Button";
|
|
385
510
|
|
|
386
|
-
// src/
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
511
|
+
// src/components/ThemeToggler/ThemeToggler.constants.ts
|
|
512
|
+
var defaultTransition = {
|
|
513
|
+
type: "rotate",
|
|
514
|
+
duration: 300,
|
|
515
|
+
delay: 0,
|
|
516
|
+
easing: "easeInOut"
|
|
517
|
+
};
|
|
518
|
+
var getIconVariants = /* @__PURE__ */ __name((type) => {
|
|
519
|
+
switch (type) {
|
|
520
|
+
case "fade":
|
|
521
|
+
return {
|
|
522
|
+
initial: { opacity: 0 },
|
|
523
|
+
animate: { opacity: 1 },
|
|
524
|
+
exit: { opacity: 0 }
|
|
525
|
+
};
|
|
526
|
+
case "slide":
|
|
527
|
+
return {
|
|
528
|
+
initial: { opacity: 0, x: -20 },
|
|
529
|
+
animate: { opacity: 1, x: 0 },
|
|
530
|
+
exit: { opacity: 0, x: 20 }
|
|
531
|
+
};
|
|
532
|
+
case "scale":
|
|
533
|
+
return {
|
|
534
|
+
initial: { opacity: 0, scale: 0.5 },
|
|
535
|
+
animate: { opacity: 1, scale: 1 },
|
|
536
|
+
exit: { opacity: 0, scale: 1.5 }
|
|
537
|
+
};
|
|
538
|
+
case "rotate":
|
|
539
|
+
return {
|
|
540
|
+
initial: {
|
|
541
|
+
opacity: 0,
|
|
542
|
+
rotate: -90,
|
|
543
|
+
scale: 0.8
|
|
544
|
+
},
|
|
545
|
+
animate: {
|
|
546
|
+
opacity: 1,
|
|
547
|
+
rotate: 0,
|
|
548
|
+
scale: 1
|
|
549
|
+
},
|
|
550
|
+
exit: {
|
|
551
|
+
opacity: 0,
|
|
552
|
+
rotate: 90,
|
|
553
|
+
scale: 0.8
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
case "none":
|
|
557
|
+
default:
|
|
558
|
+
return {
|
|
559
|
+
initial: { opacity: 1 },
|
|
560
|
+
animate: { opacity: 1 },
|
|
561
|
+
exit: { opacity: 1 }
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}, "getIconVariants");
|
|
565
|
+
var CycleMode = /* @__PURE__ */ __name(({
|
|
566
|
+
size,
|
|
567
|
+
variant,
|
|
568
|
+
color,
|
|
569
|
+
iconOnly,
|
|
570
|
+
buttonProps,
|
|
571
|
+
animated,
|
|
572
|
+
transition = { type: "none" },
|
|
573
|
+
rounded,
|
|
574
|
+
currentMode,
|
|
575
|
+
onCycle
|
|
576
|
+
}) => {
|
|
577
|
+
const animateIcon = animated && transition.type !== "none";
|
|
578
|
+
const iconVariants = getIconVariants(transition.type ?? "none");
|
|
579
|
+
const motionTransition = {
|
|
580
|
+
duration: (transition.duration ?? 300) / 1e3,
|
|
581
|
+
delay: (transition.delay ?? 0) / 1e3,
|
|
582
|
+
ease: transition.easing
|
|
583
|
+
};
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
585
|
+
Button,
|
|
586
|
+
{
|
|
587
|
+
size,
|
|
588
|
+
variant,
|
|
589
|
+
color,
|
|
590
|
+
onClick: onCycle,
|
|
591
|
+
"aria-label": `Current theme: ${currentMode.label}`,
|
|
592
|
+
className: cn(rounded && "rounded-full", "py-5 overflow-hidden", buttonProps?.className),
|
|
593
|
+
...buttonProps,
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
596
|
+
framerMotion.motion.span,
|
|
597
|
+
{
|
|
598
|
+
initial: animateIcon ? iconVariants.initial : void 0,
|
|
599
|
+
animate: animateIcon ? iconVariants.animate : void 0,
|
|
600
|
+
exit: animateIcon ? iconVariants.exit : void 0,
|
|
601
|
+
transition: motionTransition,
|
|
602
|
+
children: currentMode.icon
|
|
603
|
+
},
|
|
604
|
+
currentMode.key
|
|
605
|
+
),
|
|
606
|
+
!iconOnly && currentMode.label
|
|
607
|
+
]
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
}, "CycleMode");
|
|
611
|
+
var useIndicator = /* @__PURE__ */ __name((activeKey, deps = []) => {
|
|
612
|
+
const groupRef = react.useRef(null);
|
|
613
|
+
const buttonRefs = react.useRef(/* @__PURE__ */ new Map());
|
|
614
|
+
const [indicatorRect, setIndicatorRect] = react.useState(
|
|
615
|
+
null
|
|
616
|
+
);
|
|
617
|
+
const measure = react.useCallback(() => {
|
|
618
|
+
const group = groupRef.current;
|
|
619
|
+
const activeEl = buttonRefs.current.get(activeKey);
|
|
620
|
+
if (!group || !activeEl) return;
|
|
621
|
+
const groupBox = group.getBoundingClientRect();
|
|
622
|
+
const activeBox = activeEl.getBoundingClientRect();
|
|
623
|
+
const style = getComputedStyle(group);
|
|
624
|
+
const borderLeft = parseFloat(style.borderLeftWidth) || 0;
|
|
625
|
+
const borderTop = parseFloat(style.borderTopWidth) || 0;
|
|
626
|
+
setIndicatorRect({
|
|
627
|
+
top: activeBox.top - groupBox.top - borderTop,
|
|
628
|
+
left: activeBox.left - groupBox.left - borderLeft,
|
|
629
|
+
width: activeBox.width,
|
|
630
|
+
height: activeBox.height
|
|
631
|
+
});
|
|
632
|
+
}, [activeKey]);
|
|
633
|
+
react.useLayoutEffect(() => {
|
|
634
|
+
measure();
|
|
635
|
+
}, [activeKey, ...deps]);
|
|
636
|
+
react.useLayoutEffect(() => {
|
|
637
|
+
window.addEventListener("resize", measure);
|
|
638
|
+
return () => {
|
|
639
|
+
window.removeEventListener("resize", measure);
|
|
640
|
+
};
|
|
641
|
+
}, [measure]);
|
|
642
|
+
return {
|
|
643
|
+
groupRef,
|
|
644
|
+
buttonRefs,
|
|
645
|
+
indicatorRect,
|
|
646
|
+
measure
|
|
647
|
+
};
|
|
648
|
+
}, "useIndicator");
|
|
649
|
+
var ButtonsMode = /* @__PURE__ */ __name(({
|
|
650
|
+
size,
|
|
651
|
+
color,
|
|
652
|
+
iconOnly,
|
|
653
|
+
buttonProps,
|
|
654
|
+
rounded,
|
|
655
|
+
unstyled,
|
|
656
|
+
className,
|
|
657
|
+
modes,
|
|
658
|
+
activeMode,
|
|
659
|
+
onSelect,
|
|
660
|
+
containerStyle,
|
|
661
|
+
isActive,
|
|
662
|
+
orientation,
|
|
663
|
+
indicatorClasses,
|
|
664
|
+
indicatorRadius,
|
|
665
|
+
buttonWidth,
|
|
666
|
+
indicatorTransition
|
|
667
|
+
}) => {
|
|
668
|
+
const { groupRef, buttonRefs, indicatorRect } = useIndicator(activeMode, [
|
|
669
|
+
size,
|
|
670
|
+
orientation,
|
|
671
|
+
iconOnly,
|
|
672
|
+
unstyled,
|
|
673
|
+
rounded
|
|
674
|
+
]);
|
|
675
|
+
const effectiveRounded = rounded && !(orientation === "vertical" && !iconOnly && !unstyled);
|
|
676
|
+
const containerClasses = cn(
|
|
677
|
+
"inline-flex gap-1",
|
|
678
|
+
orientation === "vertical" && "flex-col",
|
|
679
|
+
!unstyled && [
|
|
680
|
+
"border border-kui-border bg-kui-surface p-1",
|
|
681
|
+
effectiveRounded ? "rounded-full" : "rounded-[var(--kui-theme-toggler-radius)]"
|
|
682
|
+
],
|
|
683
|
+
className
|
|
684
|
+
);
|
|
685
|
+
const isVerticalIconOnly = orientation === "vertical" && iconOnly;
|
|
686
|
+
const buttons = modes.map(({ key, label, icon }) => {
|
|
687
|
+
const active = isActive(key);
|
|
688
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
689
|
+
"div",
|
|
690
|
+
{
|
|
691
|
+
ref: (element) => {
|
|
692
|
+
if (element) {
|
|
693
|
+
buttonRefs.current.set(key, element);
|
|
694
|
+
} else {
|
|
695
|
+
buttonRefs.current.delete(key);
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
className: cn(
|
|
699
|
+
"relative flex",
|
|
700
|
+
orientation === "vertical" && "w-full",
|
|
701
|
+
isVerticalIconOnly && "justify-start"
|
|
702
|
+
),
|
|
703
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
704
|
+
Button,
|
|
705
|
+
{
|
|
706
|
+
size,
|
|
707
|
+
variant: "ghost",
|
|
708
|
+
color,
|
|
709
|
+
onClick: () => onSelect(key),
|
|
710
|
+
fullWidth: orientation === "vertical" && !iconOnly,
|
|
711
|
+
className: cn(
|
|
712
|
+
"relative z-10",
|
|
713
|
+
"bg-transparent hover:bg-transparent",
|
|
714
|
+
!effectiveRounded && "rounded-(--kui-theme-toggler-radius)",
|
|
715
|
+
effectiveRounded && "rounded-full",
|
|
716
|
+
active && "text-kui-brand-fg",
|
|
717
|
+
iconOnly && "aspect-square",
|
|
718
|
+
buttonProps?.className
|
|
719
|
+
),
|
|
720
|
+
"aria-pressed": active,
|
|
721
|
+
leftIcon: icon,
|
|
722
|
+
...buttonProps,
|
|
723
|
+
children: !iconOnly && label
|
|
724
|
+
}
|
|
725
|
+
)
|
|
726
|
+
},
|
|
727
|
+
key
|
|
728
|
+
);
|
|
729
|
+
});
|
|
730
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
731
|
+
"div",
|
|
732
|
+
{
|
|
733
|
+
ref: groupRef,
|
|
734
|
+
role: "group",
|
|
735
|
+
"aria-label": "Theme selector",
|
|
736
|
+
className: cn(containerClasses, "relative"),
|
|
737
|
+
style: containerStyle,
|
|
738
|
+
"data-kui-theme-toggler": "",
|
|
739
|
+
"data-kui-display": "buttons",
|
|
740
|
+
"data-kui-orientation": orientation,
|
|
741
|
+
children: [
|
|
742
|
+
indicatorRect && /* @__PURE__ */ jsxRuntime.jsx(
|
|
743
|
+
framerMotion.motion.div,
|
|
744
|
+
{
|
|
745
|
+
"data-kui-theme-transition": "none",
|
|
746
|
+
className: cn("pointer-events-none absolute z-0", indicatorClasses),
|
|
747
|
+
style: {
|
|
748
|
+
borderRadius: effectiveRounded ? "999px" : indicatorRadius
|
|
749
|
+
},
|
|
750
|
+
initial: false,
|
|
751
|
+
animate: {
|
|
752
|
+
top: indicatorRect.top,
|
|
753
|
+
left: indicatorRect.left,
|
|
754
|
+
width: isVerticalIconOnly ? buttonWidth : indicatorRect.width,
|
|
755
|
+
height: indicatorRect.height
|
|
756
|
+
},
|
|
757
|
+
transition: { duration: 0 },
|
|
758
|
+
"aria-hidden": "true"
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
buttons
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
}, "ButtonsMode");
|
|
766
|
+
var getModeIcons = /* @__PURE__ */ __name((allowSystem, labels, icons) => {
|
|
767
|
+
const modes = [
|
|
768
|
+
{
|
|
769
|
+
key: "light",
|
|
770
|
+
label: labels?.light ?? "Light",
|
|
771
|
+
icon: icons?.light ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, {})
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
key: "dark",
|
|
775
|
+
label: labels?.dark ?? "Dark",
|
|
776
|
+
icon: icons?.dark ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, {})
|
|
393
777
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
__name(rgbToHex, "rgbToHex");
|
|
403
|
-
function hexToRgbString(hex) {
|
|
404
|
-
if (!HEX_RE.test(hex)) return null;
|
|
405
|
-
const full = hex.length === 4 ? "#" + [...hex.slice(1)].map((c) => c + c).join("") : hex;
|
|
406
|
-
const r = parseInt(full.slice(1, 3), 16);
|
|
407
|
-
const g = parseInt(full.slice(3, 5), 16);
|
|
408
|
-
const b = parseInt(full.slice(5, 7), 16);
|
|
409
|
-
return `${r} ${g} ${b}`;
|
|
410
|
-
}
|
|
411
|
-
__name(hexToRgbString, "hexToRgbString");
|
|
412
|
-
var defaultTransition = {
|
|
413
|
-
type: "none",
|
|
414
|
-
duration: 300,
|
|
415
|
-
delay: 0,
|
|
416
|
-
easing: "ease-in-out"
|
|
417
|
-
};
|
|
418
|
-
var getIconVariants = /* @__PURE__ */ __name((type) => {
|
|
419
|
-
switch (type) {
|
|
420
|
-
case "fade":
|
|
421
|
-
return {
|
|
422
|
-
initial: { opacity: 0 },
|
|
423
|
-
animate: { opacity: 1 },
|
|
424
|
-
exit: { opacity: 0 }
|
|
425
|
-
};
|
|
426
|
-
case "slide":
|
|
427
|
-
return {
|
|
428
|
-
initial: { opacity: 0, x: -20 },
|
|
429
|
-
animate: { opacity: 1, x: 0 },
|
|
430
|
-
exit: { opacity: 0, x: 20 }
|
|
431
|
-
};
|
|
432
|
-
case "scale":
|
|
433
|
-
return {
|
|
434
|
-
initial: { opacity: 0, scale: 0.5 },
|
|
435
|
-
animate: { opacity: 1, scale: 1 },
|
|
436
|
-
exit: { opacity: 0, scale: 1.5 }
|
|
437
|
-
};
|
|
438
|
-
case "rotate":
|
|
439
|
-
return {
|
|
440
|
-
initial: { opacity: 0, rotate: -90 },
|
|
441
|
-
animate: { opacity: 1, rotate: 0 },
|
|
442
|
-
exit: { opacity: 0, rotate: 90 }
|
|
443
|
-
};
|
|
444
|
-
case "none":
|
|
445
|
-
default:
|
|
446
|
-
return {
|
|
447
|
-
initial: { opacity: 1 },
|
|
448
|
-
animate: { opacity: 1 },
|
|
449
|
-
exit: { opacity: 1 }
|
|
450
|
-
};
|
|
778
|
+
];
|
|
779
|
+
if (allowSystem) {
|
|
780
|
+
modes.push({
|
|
781
|
+
key: "system",
|
|
782
|
+
label: labels?.system ?? "System",
|
|
783
|
+
icon: icons?.system ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Monitor, {})
|
|
784
|
+
});
|
|
451
785
|
}
|
|
452
|
-
|
|
786
|
+
return modes;
|
|
787
|
+
}, "getModeIcons");
|
|
453
788
|
function ThemeToggler({
|
|
454
789
|
variant = "ghost",
|
|
455
|
-
activeVariant = "solid",
|
|
456
790
|
color = "neutral",
|
|
791
|
+
activeVariant = "solid",
|
|
457
792
|
activeColor = "brand",
|
|
458
793
|
size = "sm",
|
|
459
794
|
iconOnly = false,
|
|
@@ -466,130 +801,236 @@ function ThemeToggler({
|
|
|
466
801
|
className,
|
|
467
802
|
buttonProps = {},
|
|
468
803
|
display = "buttons",
|
|
804
|
+
animated = false,
|
|
469
805
|
transition = defaultTransition
|
|
470
806
|
}) {
|
|
471
|
-
const { mode, setMode, resolvedMode } = useTheme();
|
|
807
|
+
const { mode, setMode, resolvedMode, theme } = kreativCore.useTheme();
|
|
808
|
+
const resolvedSize = size;
|
|
809
|
+
const wrapperRadius = hooks_star.useSizeToken(resolvedSize, "radius");
|
|
810
|
+
const indicatorRadius = hooks_star.useSizeToken(resolvedSize, "radius", "4px");
|
|
811
|
+
const buttonWidth = hooks_star.useSizeToken(resolvedSize, "width");
|
|
472
812
|
const activeMode = allowSystem ? mode : resolvedMode;
|
|
473
|
-
const modes =
|
|
474
|
-
{
|
|
475
|
-
key: "light",
|
|
476
|
-
label: labels?.light ?? "Light",
|
|
477
|
-
icon: icons?.light ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, { size: 16 })
|
|
478
|
-
},
|
|
479
|
-
{
|
|
480
|
-
key: "dark",
|
|
481
|
-
label: labels?.dark ?? "Dark",
|
|
482
|
-
icon: icons?.dark ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, { size: 16 })
|
|
483
|
-
},
|
|
484
|
-
...allowSystem ? [
|
|
485
|
-
{
|
|
486
|
-
key: "system",
|
|
487
|
-
label: labels?.system ?? "System",
|
|
488
|
-
icon: icons?.system ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Monitor, { size: 16 })
|
|
489
|
-
}
|
|
490
|
-
] : []
|
|
491
|
-
];
|
|
813
|
+
const modes = getModeIcons(allowSystem, labels, icons);
|
|
492
814
|
const allowedModes = modes.map((item) => item.key);
|
|
493
815
|
const currentMode = modes.find(({ key }) => key === activeMode) ?? modes[0];
|
|
494
|
-
const
|
|
816
|
+
const indicatorClasses = resolveRecipe(theme.recipes.Button, {
|
|
817
|
+
variant: activeVariant,
|
|
818
|
+
color: activeColor
|
|
819
|
+
});
|
|
820
|
+
const effectiveRounded = rounded && !(orientation === "vertical" && !iconOnly && !unstyled);
|
|
495
821
|
react.useEffect(() => {
|
|
496
|
-
if (rounded
|
|
822
|
+
if (!rounded || effectiveRounded) return;
|
|
823
|
+
const reasons = [];
|
|
824
|
+
if (orientation === "vertical" && !iconOnly) {
|
|
825
|
+
reasons.push("orientation='vertical' with iconOnly={false}");
|
|
826
|
+
}
|
|
827
|
+
if (unstyled) reasons.push("unstyled={true}");
|
|
828
|
+
if (reasons.length > 0) {
|
|
497
829
|
console.warn(
|
|
498
|
-
|
|
830
|
+
`[kreativ-ui/ThemeToggler] \`rounded\` is ignored when ${reasons.join(" and ")}.`
|
|
499
831
|
);
|
|
500
832
|
}
|
|
501
|
-
}, [rounded, effectiveRounded]);
|
|
833
|
+
}, [rounded, effectiveRounded, orientation, iconOnly, unstyled]);
|
|
502
834
|
const handleCycle = /* @__PURE__ */ __name(() => {
|
|
503
|
-
const index = allowedModes.indexOf(
|
|
504
|
-
activeMode
|
|
505
|
-
);
|
|
835
|
+
const index = allowedModes.indexOf(activeMode);
|
|
506
836
|
setMode(allowedModes[(index + 1) % allowedModes.length]);
|
|
507
837
|
}, "handleCycle");
|
|
508
838
|
const isActive = /* @__PURE__ */ __name((key) => key === "system" ? mode === "system" : activeMode === key, "isActive");
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
"border border-border bg-surface p-1",
|
|
514
|
-
effectiveRounded ? "rounded-full" : "rounded-lg"
|
|
515
|
-
],
|
|
516
|
-
className
|
|
517
|
-
);
|
|
518
|
-
const buttonRadius = effectiveRounded ? "rounded-full" : "rounded-lg";
|
|
519
|
-
const animateIcon = display === "cycle" && transition.type !== "none";
|
|
520
|
-
const iconVariants = getIconVariants(transition.type || "none");
|
|
521
|
-
const motionTransition = {
|
|
522
|
-
duration: (transition.duration || 300) / 1e3,
|
|
523
|
-
delay: (transition.delay || 0) / 1e3,
|
|
524
|
-
ease: transition.easing || "ease-in-out"
|
|
839
|
+
const containerStyle = {
|
|
840
|
+
...!effectiveRounded && {
|
|
841
|
+
"--kui-theme-toggler-radius": wrapperRadius
|
|
842
|
+
}
|
|
525
843
|
};
|
|
844
|
+
const indicatorTransition = animated ? { type: "spring", stiffness: 300, damping: 30, mass: 0.8 } : { duration: 0 };
|
|
526
845
|
if (display === "cycle") {
|
|
527
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
528
|
-
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
847
|
+
CycleMode,
|
|
529
848
|
{
|
|
530
|
-
size,
|
|
849
|
+
size: resolvedSize,
|
|
531
850
|
variant,
|
|
532
851
|
color,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
children: [
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
-
framerMotion.motion.span,
|
|
543
|
-
{
|
|
544
|
-
initial: animateIcon ? iconVariants.initial : void 0,
|
|
545
|
-
animate: animateIcon ? iconVariants.animate : void 0,
|
|
546
|
-
exit: animateIcon ? iconVariants.exit : void 0,
|
|
547
|
-
transition: motionTransition,
|
|
548
|
-
children: currentMode.icon
|
|
549
|
-
},
|
|
550
|
-
currentMode.key
|
|
551
|
-
) }),
|
|
552
|
-
!iconOnly && currentMode.label
|
|
553
|
-
]
|
|
554
|
-
}
|
|
555
|
-
);
|
|
556
|
-
}
|
|
557
|
-
const buttons = modes.map(({ key, label, icon }) => {
|
|
558
|
-
const active = isActive(key);
|
|
559
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
560
|
-
Button,
|
|
561
|
-
{
|
|
562
|
-
size,
|
|
563
|
-
variant: active ? activeVariant : variant,
|
|
564
|
-
color: active ? activeColor : color,
|
|
565
|
-
onClick: () => setMode(key),
|
|
566
|
-
className: cn(buttonRadius, buttonProps.className),
|
|
567
|
-
leftIcon: icon,
|
|
568
|
-
"aria-pressed": active,
|
|
569
|
-
...buttonProps,
|
|
570
|
-
children: !iconOnly && label
|
|
571
|
-
},
|
|
572
|
-
key
|
|
573
|
-
);
|
|
574
|
-
});
|
|
575
|
-
if (unstyled) {
|
|
576
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
577
|
-
"div",
|
|
578
|
-
{
|
|
579
|
-
role: "group",
|
|
580
|
-
"aria-label": "Theme selector",
|
|
581
|
-
className: cn(
|
|
582
|
-
"inline-flex gap-1",
|
|
583
|
-
orientation === "vertical" && "flex-col",
|
|
584
|
-
className
|
|
585
|
-
),
|
|
586
|
-
children: buttons
|
|
852
|
+
iconOnly,
|
|
853
|
+
buttonProps,
|
|
854
|
+
animated,
|
|
855
|
+
transition,
|
|
856
|
+
rounded: effectiveRounded,
|
|
857
|
+
currentMode,
|
|
858
|
+
onCycle: handleCycle
|
|
587
859
|
}
|
|
588
860
|
);
|
|
589
861
|
}
|
|
590
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
862
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
863
|
+
ButtonsMode,
|
|
864
|
+
{
|
|
865
|
+
size: resolvedSize,
|
|
866
|
+
color,
|
|
867
|
+
iconOnly,
|
|
868
|
+
buttonProps,
|
|
869
|
+
rounded,
|
|
870
|
+
unstyled,
|
|
871
|
+
className,
|
|
872
|
+
modes,
|
|
873
|
+
activeMode,
|
|
874
|
+
onSelect: setMode,
|
|
875
|
+
containerStyle,
|
|
876
|
+
isActive,
|
|
877
|
+
orientation,
|
|
878
|
+
indicatorClasses,
|
|
879
|
+
indicatorRadius,
|
|
880
|
+
buttonWidth,
|
|
881
|
+
indicatorTransition
|
|
882
|
+
}
|
|
883
|
+
);
|
|
591
884
|
}
|
|
592
885
|
__name(ThemeToggler, "ThemeToggler");
|
|
886
|
+
|
|
887
|
+
// src/hooks/index.ts
|
|
888
|
+
var hooks_exports = {};
|
|
889
|
+
__export(hooks_exports, {
|
|
890
|
+
useClearableField: () => useClearableField,
|
|
891
|
+
useFloatingSide: () => useFloatingSide,
|
|
892
|
+
useKeyboardShortcuts: () => useKeyboardShortcuts,
|
|
893
|
+
useStatusTransition: () => useStatusTransition
|
|
894
|
+
});
|
|
895
|
+
var VIEWPORT_PADDING = 8;
|
|
896
|
+
function useFloatingSide(triggerRef, open) {
|
|
897
|
+
const contentRef = react.useRef(null);
|
|
898
|
+
const [side, setSide] = react.useState("bottom");
|
|
899
|
+
react.useLayoutEffect(() => {
|
|
900
|
+
if (!open) return;
|
|
901
|
+
const trigger = triggerRef.current;
|
|
902
|
+
const content = contentRef.current;
|
|
903
|
+
if (!trigger || !content) return;
|
|
904
|
+
function measure() {
|
|
905
|
+
const triggerRect = trigger.getBoundingClientRect();
|
|
906
|
+
const contentHeight = content.offsetHeight;
|
|
907
|
+
const spaceBelow = window.innerHeight - triggerRect.bottom - VIEWPORT_PADDING;
|
|
908
|
+
const spaceAbove = triggerRect.top - VIEWPORT_PADDING;
|
|
909
|
+
setSide(contentHeight > spaceBelow && spaceAbove > spaceBelow ? "top" : "bottom");
|
|
910
|
+
}
|
|
911
|
+
__name(measure, "measure");
|
|
912
|
+
measure();
|
|
913
|
+
window.addEventListener("resize", measure);
|
|
914
|
+
window.addEventListener("scroll", measure, true);
|
|
915
|
+
return () => {
|
|
916
|
+
window.removeEventListener("resize", measure);
|
|
917
|
+
window.removeEventListener("scroll", measure, true);
|
|
918
|
+
};
|
|
919
|
+
}, [open, triggerRef]);
|
|
920
|
+
return { contentRef, side };
|
|
921
|
+
}
|
|
922
|
+
__name(useFloatingSide, "useFloatingSide");
|
|
923
|
+
var TRANSITION_DURATION = 1500;
|
|
924
|
+
function useStatusTransition(status) {
|
|
925
|
+
const previousStatus = react.useRef(status);
|
|
926
|
+
const [transitionStatus, setTransitionStatus] = react.useState();
|
|
927
|
+
react.useEffect(() => {
|
|
928
|
+
if (status === previousStatus.current) {
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
previousStatus.current = status;
|
|
932
|
+
if (status === "none") {
|
|
933
|
+
setTransitionStatus(void 0);
|
|
934
|
+
return;
|
|
935
|
+
}
|
|
936
|
+
setTransitionStatus(status);
|
|
937
|
+
const timeout = window.setTimeout(() => {
|
|
938
|
+
setTransitionStatus(void 0);
|
|
939
|
+
}, TRANSITION_DURATION);
|
|
940
|
+
return () => window.clearTimeout(timeout);
|
|
941
|
+
}, [status]);
|
|
942
|
+
return transitionStatus;
|
|
943
|
+
}
|
|
944
|
+
__name(useStatusTransition, "useStatusTransition");
|
|
945
|
+
function useClearableField(elementRef, initialValue, { onClear, onUndo, onRedo } = {}) {
|
|
946
|
+
const initial = String(initialValue ?? "");
|
|
947
|
+
const [hasValue, setHasValue] = react.useState(Boolean(initial));
|
|
948
|
+
const [history, setHistory] = react.useState(
|
|
949
|
+
() => initial ? [initial] : []
|
|
950
|
+
);
|
|
951
|
+
const [historyIndex, setHistoryIndex] = react.useState(initial ? 0 : -1);
|
|
952
|
+
const setElementValue = react.useCallback(
|
|
953
|
+
(value) => {
|
|
954
|
+
const element = elementRef.current;
|
|
955
|
+
if (!element) return;
|
|
956
|
+
const prototype = element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
957
|
+
const setter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
|
|
958
|
+
setter?.call(element, value);
|
|
959
|
+
element.dispatchEvent(new Event("input", { bubbles: true }));
|
|
960
|
+
setHasValue(Boolean(value));
|
|
961
|
+
},
|
|
962
|
+
[elementRef]
|
|
963
|
+
);
|
|
964
|
+
const clear = react.useCallback(() => {
|
|
965
|
+
const element = elementRef.current;
|
|
966
|
+
if (!element) return;
|
|
967
|
+
const currentValue = element.value;
|
|
968
|
+
if (!currentValue) return;
|
|
969
|
+
setHistory((current) => {
|
|
970
|
+
const next = current.slice(0, historyIndex + 1);
|
|
971
|
+
next.push(currentValue);
|
|
972
|
+
return next;
|
|
973
|
+
});
|
|
974
|
+
setHistoryIndex((index) => index + 1);
|
|
975
|
+
setElementValue("");
|
|
976
|
+
element.focus();
|
|
977
|
+
onClear?.();
|
|
978
|
+
}, [elementRef, historyIndex, onClear, setElementValue]);
|
|
979
|
+
const undo = react.useCallback(() => {
|
|
980
|
+
if (historyIndex < 0) return;
|
|
981
|
+
const previousValue = history[historyIndex];
|
|
982
|
+
setElementValue(previousValue ?? "");
|
|
983
|
+
setHistoryIndex((index) => index - 1);
|
|
984
|
+
onUndo?.(previousValue ?? "");
|
|
985
|
+
}, [history, historyIndex, onUndo, setElementValue]);
|
|
986
|
+
const redo = react.useCallback(() => {
|
|
987
|
+
const nextIndex = historyIndex + 1;
|
|
988
|
+
if (nextIndex >= history.length) return;
|
|
989
|
+
const nextValue = history[nextIndex];
|
|
990
|
+
setElementValue(nextValue);
|
|
991
|
+
setHistoryIndex(nextIndex);
|
|
992
|
+
onRedo?.(nextValue);
|
|
993
|
+
}, [history, historyIndex, onRedo, setElementValue]);
|
|
994
|
+
return {
|
|
995
|
+
hasValue,
|
|
996
|
+
setHasValue,
|
|
997
|
+
clear,
|
|
998
|
+
undo,
|
|
999
|
+
redo,
|
|
1000
|
+
canUndo: historyIndex >= 0,
|
|
1001
|
+
canRedo: historyIndex < history.length - 1
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
__name(useClearableField, "useClearableField");
|
|
1005
|
+
|
|
1006
|
+
// src/hooks/index.ts
|
|
1007
|
+
__reExport(hooks_exports, hooks_star__namespace);
|
|
1008
|
+
function useKeyboardShortcuts(enabled, shortcuts, deps = []) {
|
|
1009
|
+
const ref = react.useRef(null);
|
|
1010
|
+
react.useEffect(() => {
|
|
1011
|
+
if (!enabled) return;
|
|
1012
|
+
const handleKeyDown = /* @__PURE__ */ __name((e) => {
|
|
1013
|
+
const isCtrlOrMeta = e.ctrlKey || e.metaKey;
|
|
1014
|
+
const key = e.key.toLowerCase();
|
|
1015
|
+
let keyStr = "";
|
|
1016
|
+
if (isCtrlOrMeta) keyStr += "ctrl+";
|
|
1017
|
+
if (e.shiftKey) keyStr += "shift+";
|
|
1018
|
+
keyStr += key;
|
|
1019
|
+
const handler = shortcuts[keyStr];
|
|
1020
|
+
if (handler) {
|
|
1021
|
+
e.preventDefault();
|
|
1022
|
+
handler(e);
|
|
1023
|
+
}
|
|
1024
|
+
}, "handleKeyDown");
|
|
1025
|
+
const input = ref.current;
|
|
1026
|
+
if (input) {
|
|
1027
|
+
input.addEventListener("keydown", handleKeyDown);
|
|
1028
|
+
return () => input.removeEventListener("keydown", handleKeyDown);
|
|
1029
|
+
}
|
|
1030
|
+
}, [enabled, ...deps]);
|
|
1031
|
+
return ref;
|
|
1032
|
+
}
|
|
1033
|
+
__name(useKeyboardShortcuts, "useKeyboardShortcuts");
|
|
593
1034
|
var inputKindIcons = {
|
|
594
1035
|
email: lucideReact.Mail,
|
|
595
1036
|
tel: lucideReact.Phone,
|
|
@@ -611,7 +1052,7 @@ function Spinner({ size = 14 }) {
|
|
|
611
1052
|
}
|
|
612
1053
|
__name(Spinner, "Spinner");
|
|
613
1054
|
|
|
614
|
-
// src/components/Input/Input.constants.ts
|
|
1055
|
+
// src/components/forms/Input/Input.constants.ts
|
|
615
1056
|
var inputKindDefaults = {
|
|
616
1057
|
text: { placeholder: "Type something..." },
|
|
617
1058
|
email: {
|
|
@@ -725,6 +1166,7 @@ var Input = react.forwardRef(
|
|
|
725
1166
|
error,
|
|
726
1167
|
success,
|
|
727
1168
|
warning,
|
|
1169
|
+
scrollIntoViewOnError,
|
|
728
1170
|
startIcon,
|
|
729
1171
|
endIcon,
|
|
730
1172
|
fullWidth = true,
|
|
@@ -733,6 +1175,8 @@ var Input = react.forwardRef(
|
|
|
733
1175
|
isLoading = false,
|
|
734
1176
|
clearable = false,
|
|
735
1177
|
onClear,
|
|
1178
|
+
onUndo,
|
|
1179
|
+
onRedo,
|
|
736
1180
|
kind = "text",
|
|
737
1181
|
hideKindIcon = false,
|
|
738
1182
|
id: externalId,
|
|
@@ -747,25 +1191,39 @@ var Input = react.forwardRef(
|
|
|
747
1191
|
value,
|
|
748
1192
|
defaultValue,
|
|
749
1193
|
style,
|
|
1194
|
+
typography: typographyName = "body",
|
|
750
1195
|
...props
|
|
751
1196
|
}, ref) => {
|
|
752
1197
|
const autoId = react.useId();
|
|
753
1198
|
const internalRef = react.useRef(null);
|
|
754
|
-
const {
|
|
1199
|
+
const { hasValue, setHasValue, clear, undo, redo, canUndo, canRedo } = useClearableField(internalRef, value ?? defaultValue, {
|
|
1200
|
+
onClear,
|
|
1201
|
+
onRedo,
|
|
1202
|
+
onUndo
|
|
1203
|
+
});
|
|
1204
|
+
const shortcutRef = useKeyboardShortcuts(
|
|
1205
|
+
clearable,
|
|
1206
|
+
{
|
|
1207
|
+
"ctrl+z": undo,
|
|
1208
|
+
"ctrl+shift+z": redo
|
|
1209
|
+
},
|
|
1210
|
+
[clearable, canUndo, canRedo, undo, redo]
|
|
1211
|
+
);
|
|
1212
|
+
const { theme } = kreativCore.useTheme();
|
|
755
1213
|
const field = useOptionalFormField();
|
|
1214
|
+
const group = useOptionalButtonGroupContext();
|
|
1215
|
+
const groupItem = useOptionalButtonGroupItemContext();
|
|
1216
|
+
const typography = hooks_star.useTypography(typographyName);
|
|
756
1217
|
const id = externalId ?? field?.id ?? autoId;
|
|
757
1218
|
const isRequired = field?.required ?? props.required;
|
|
1219
|
+
const isInButtonGroup = !!group;
|
|
1220
|
+
const isGroupItem = groupItem?.embedded;
|
|
758
1221
|
const describedBy = field?.describedBy;
|
|
759
1222
|
const state = error ? "error" : success ? "success" : warning ? "warning" : field?.status ?? "none";
|
|
760
1223
|
const isInvalid = state === "error";
|
|
761
1224
|
const statusTransition = useStatusTransition(state);
|
|
762
|
-
const { style: sizeStyle, iconSize } = useSizeStyle(size, false, "input");
|
|
1225
|
+
const { style: sizeStyle, iconSize } = hooks_star.useSizeStyle(size, false, "input");
|
|
763
1226
|
const [visible, setVisible] = react.useState(false);
|
|
764
|
-
const { hasValue, setHasValue, clear } = useClearableField(
|
|
765
|
-
internalRef,
|
|
766
|
-
value ?? defaultValue,
|
|
767
|
-
onClear
|
|
768
|
-
);
|
|
769
1227
|
react.useEffect(() => {
|
|
770
1228
|
if (value !== void 0) {
|
|
771
1229
|
setHasValue(Boolean(value));
|
|
@@ -777,21 +1235,7 @@ var Input = react.forwardRef(
|
|
|
777
1235
|
const effectiveType = isPasswordField ? visible ? "text" : "password" : resolvedType;
|
|
778
1236
|
const KindIcon = inputKindIcons[kind];
|
|
779
1237
|
const defaultStartIcon = !hideKindIcon && KindIcon ? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}) : void 0;
|
|
780
|
-
const startAdornment =
|
|
781
|
-
const icon = startIcon ?? defaultStartIcon;
|
|
782
|
-
if (!icon) return null;
|
|
783
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
784
|
-
"span",
|
|
785
|
-
{
|
|
786
|
-
className: "flex shrink-0 items-center justify-center",
|
|
787
|
-
style: {
|
|
788
|
-
width: iconSize,
|
|
789
|
-
height: iconSize
|
|
790
|
-
},
|
|
791
|
-
children: icon
|
|
792
|
-
}
|
|
793
|
-
);
|
|
794
|
-
}, [startIcon, defaultStartIcon, iconSize]);
|
|
1238
|
+
const startAdornment = startIcon ?? defaultStartIcon;
|
|
795
1239
|
const builtInEnd = [];
|
|
796
1240
|
if (isPasswordField) {
|
|
797
1241
|
builtInEnd.push(
|
|
@@ -802,7 +1246,7 @@ var Input = react.forwardRef(
|
|
|
802
1246
|
onClick: () => setVisible((current) => !current),
|
|
803
1247
|
"aria-label": visible ? "Hide password" : "Show password",
|
|
804
1248
|
"aria-pressed": visible,
|
|
805
|
-
className: "\
|
|
1249
|
+
className: "\n flex items-center justify-center\n text-kui-text-muted\n transition-colors\n hover:text-kui-text\n focus-visible:outline\n focus-visible:outline-2\n focus-visible:outline-offset-2\n ",
|
|
806
1250
|
children: visible ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
807
1251
|
lucideReact.EyeOff,
|
|
808
1252
|
{
|
|
@@ -833,7 +1277,7 @@ var Input = react.forwardRef(
|
|
|
833
1277
|
type: "button",
|
|
834
1278
|
onClick: clear,
|
|
835
1279
|
"aria-label": "Clear input",
|
|
836
|
-
className: "\
|
|
1280
|
+
className: "\n flex items-center justify-center\n text-kui-text-muted\n transition-colors\n hover:text-kui-text\n focus-visible:outline\n focus-visible:outline-2\n focus-visible:outline-offset-2\n ",
|
|
837
1281
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
838
1282
|
lucideReact.X,
|
|
839
1283
|
{
|
|
@@ -848,15 +1292,16 @@ var Input = react.forwardRef(
|
|
|
848
1292
|
)
|
|
849
1293
|
);
|
|
850
1294
|
}
|
|
851
|
-
const endAdornment = isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: iconSize || 14 }) : endIcon || builtInEnd.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1295
|
+
const endAdornment = isLoading ? /* @__PURE__ */ jsxRuntime.jsx(Adornment, { position: "end", children: /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: iconSize || 14 }) }) : endIcon || builtInEnd.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(Adornment, { position: "end", children: [
|
|
852
1296
|
endIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
853
1297
|
"span",
|
|
854
1298
|
{
|
|
855
|
-
className: "flex items-center justify-center",
|
|
1299
|
+
className: "flex shrink-0 items-center justify-center",
|
|
856
1300
|
style: {
|
|
857
1301
|
width: iconSize,
|
|
858
1302
|
height: iconSize
|
|
859
1303
|
},
|
|
1304
|
+
"aria-hidden": "true",
|
|
860
1305
|
children: endIcon
|
|
861
1306
|
}
|
|
862
1307
|
),
|
|
@@ -870,7 +1315,9 @@ var Input = react.forwardRef(
|
|
|
870
1315
|
rounded,
|
|
871
1316
|
fullWidth,
|
|
872
1317
|
disabled: disabled || isLoading,
|
|
873
|
-
hasAdornment
|
|
1318
|
+
hasAdornment,
|
|
1319
|
+
attached: group?.attached
|
|
1320
|
+
// groupItem: !!groupItem,
|
|
874
1321
|
}),
|
|
875
1322
|
className
|
|
876
1323
|
);
|
|
@@ -881,9 +1328,16 @@ var Input = react.forwardRef(
|
|
|
881
1328
|
inputClassName
|
|
882
1329
|
);
|
|
883
1330
|
const resolvedStyle = {
|
|
1331
|
+
...typography,
|
|
884
1332
|
...sizeStyle,
|
|
885
1333
|
...style
|
|
886
1334
|
};
|
|
1335
|
+
const groupDataAttributes = {
|
|
1336
|
+
"data-kui-button-group-item": isInButtonGroup && isGroupItem ? true : void 0,
|
|
1337
|
+
"data-kui-button-group-item-embedded": isGroupItem || void 0,
|
|
1338
|
+
"data-kui-group-attached": group?.attached || void 0,
|
|
1339
|
+
"data-kui-group-orientation": group?.orientation || void 0
|
|
1340
|
+
};
|
|
887
1341
|
function handleChange(event) {
|
|
888
1342
|
setHasValue(Boolean(event.target.value));
|
|
889
1343
|
onChangeProp?.(event);
|
|
@@ -906,14 +1360,14 @@ var Input = react.forwardRef(
|
|
|
906
1360
|
react.useEffect(() => {
|
|
907
1361
|
const justBecameInvalid = isInvalid && !wasInvalidRef.current;
|
|
908
1362
|
wasInvalidRef.current = isInvalid;
|
|
909
|
-
if (!justBecameInvalid) {
|
|
1363
|
+
if (!justBecameInvalid || !scrollIntoViewOnError) {
|
|
910
1364
|
return;
|
|
911
1365
|
}
|
|
912
1366
|
internalRef.current?.scrollIntoView({
|
|
913
1367
|
behavior: "smooth",
|
|
914
1368
|
block: "center"
|
|
915
1369
|
});
|
|
916
|
-
}, [isInvalid]);
|
|
1370
|
+
}, [isInvalid, scrollIntoViewOnError]);
|
|
917
1371
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
918
1372
|
"div",
|
|
919
1373
|
{
|
|
@@ -921,13 +1375,24 @@ var Input = react.forwardRef(
|
|
|
921
1375
|
style: resolvedStyle,
|
|
922
1376
|
"data-state": state,
|
|
923
1377
|
"data-state-transition": statusTransition,
|
|
1378
|
+
...groupDataAttributes,
|
|
924
1379
|
children: [
|
|
925
|
-
startAdornment,
|
|
1380
|
+
startAdornment && /* @__PURE__ */ jsxRuntime.jsx(Adornment, { position: "start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
|
+
"span",
|
|
1382
|
+
{
|
|
1383
|
+
className: "flex shrink-0 items-center justify-center",
|
|
1384
|
+
style: {
|
|
1385
|
+
width: iconSize,
|
|
1386
|
+
height: iconSize
|
|
1387
|
+
},
|
|
1388
|
+
children: startAdornment
|
|
1389
|
+
}
|
|
1390
|
+
) }),
|
|
926
1391
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
927
1392
|
"input",
|
|
928
1393
|
{
|
|
929
1394
|
...props,
|
|
930
|
-
ref: mergeRefs(internalRef, ref),
|
|
1395
|
+
ref: mergeRefs(internalRef, ref, shortcutRef),
|
|
931
1396
|
id,
|
|
932
1397
|
type: effectiveType,
|
|
933
1398
|
inputMode: inputModeProp ?? kindDefaults.inputMode,
|
|
@@ -1081,10 +1546,10 @@ function FormFieldLabel({
|
|
|
1081
1546
|
{
|
|
1082
1547
|
id: field.labelId,
|
|
1083
1548
|
htmlFor: field.id,
|
|
1084
|
-
className: cn("font-medium text-text text-sm", className),
|
|
1549
|
+
className: cn("font-medium text-kui-text text-sm", className),
|
|
1085
1550
|
children: [
|
|
1086
1551
|
children,
|
|
1087
|
-
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "ml-1 text-destructive", children: "*" })
|
|
1552
|
+
field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "ml-1 text-kui-destructive", children: "*" })
|
|
1088
1553
|
]
|
|
1089
1554
|
}
|
|
1090
1555
|
);
|
|
@@ -1093,23 +1558,14 @@ __name(FormFieldLabel, "FormFieldLabel");
|
|
|
1093
1558
|
function FormFieldDescription({
|
|
1094
1559
|
children
|
|
1095
1560
|
}) {
|
|
1096
|
-
const {
|
|
1097
|
-
|
|
1098
|
-
} = useFormField();
|
|
1099
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1100
|
-
"p",
|
|
1101
|
-
{
|
|
1102
|
-
id: descriptionId,
|
|
1103
|
-
className: "text-sm text-text-muted",
|
|
1104
|
-
children
|
|
1105
|
-
}
|
|
1106
|
-
);
|
|
1561
|
+
const { descriptionId } = useFormField();
|
|
1562
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { id: descriptionId, className: "text-sm text-kui-text-muted", children });
|
|
1107
1563
|
}
|
|
1108
1564
|
__name(FormFieldDescription, "FormFieldDescription");
|
|
1109
1565
|
var statusClasses = {
|
|
1110
|
-
error: "text-destructive animate-kui-shake [animation-delay:500ms]",
|
|
1111
|
-
success: "text-success",
|
|
1112
|
-
warning: "text-warning"
|
|
1566
|
+
error: "text-kui-destructive animate-kui-shake [animation-delay:500ms]",
|
|
1567
|
+
success: "text-kui-success",
|
|
1568
|
+
warning: "text-kui-warning"
|
|
1113
1569
|
};
|
|
1114
1570
|
function FormFieldMessage({ children }) {
|
|
1115
1571
|
const { messageId, message, status, invalid } = useFormField();
|
|
@@ -1157,8 +1613,8 @@ __name(orderedEnabledValues, "orderedEnabledValues");
|
|
|
1157
1613
|
var SelectTrigger = react.forwardRef(
|
|
1158
1614
|
({ className, children, onKeyDown, ...props }, ref) => {
|
|
1159
1615
|
const ctx = useSelectContext("SelectTrigger");
|
|
1160
|
-
const { theme } = useTheme();
|
|
1161
|
-
const { style: sizeStyle, iconSize } = useSizeStyle(
|
|
1616
|
+
const { theme } = kreativCore.useTheme();
|
|
1617
|
+
const { style: sizeStyle, iconSize } = hooks_star.useSizeStyle(
|
|
1162
1618
|
ctx.size,
|
|
1163
1619
|
false,
|
|
1164
1620
|
"select"
|
|
@@ -1268,7 +1724,7 @@ var SelectTrigger = react.forwardRef(
|
|
|
1268
1724
|
"span",
|
|
1269
1725
|
{
|
|
1270
1726
|
"aria-hidden": true,
|
|
1271
|
-
className: "pointer-events-none absolute right-0 top-1/2 flex -translate-y-1/2 items-center gap-1.5 text-text-muted",
|
|
1727
|
+
className: "pointer-events-none absolute right-0 top-1/2 flex -translate-y-1/2 items-center gap-1.5 text-kui-text-muted",
|
|
1272
1728
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1273
1729
|
lucideReact.ChevronDown,
|
|
1274
1730
|
{
|
|
@@ -1299,7 +1755,7 @@ var SelectTrigger = react.forwardRef(
|
|
|
1299
1755
|
e.preventDefault();
|
|
1300
1756
|
e.stopPropagation();
|
|
1301
1757
|
},
|
|
1302
|
-
className: "flex h-4 w-4 items-center justify-center text-text-muted transition-colors hover:text-text",
|
|
1758
|
+
className: "flex h-4 w-4 items-center justify-center text-kui-text-muted transition-colors hover:text-kui-text",
|
|
1303
1759
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: Number(iconSize) || 14 })
|
|
1304
1760
|
}
|
|
1305
1761
|
)
|
|
@@ -1339,7 +1795,6 @@ function SelectContent({
|
|
|
1339
1795
|
window.removeEventListener("scroll", measure, true);
|
|
1340
1796
|
};
|
|
1341
1797
|
}, [ctx.open, ctx.triggerRef]);
|
|
1342
|
-
if (!ctx.open) return null;
|
|
1343
1798
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1344
1799
|
"div",
|
|
1345
1800
|
{
|
|
@@ -1350,10 +1805,16 @@ function SelectContent({
|
|
|
1350
1805
|
"data-state": ctx.open ? "open" : "closed",
|
|
1351
1806
|
"data-side": side,
|
|
1352
1807
|
className: cn(
|
|
1353
|
-
"
|
|
1808
|
+
"absolute z-50 max-h-64 w-full overflow-auto rounded-(--kui-radii-md) border border-kui-border bg-kui-surface p-1 shadow-lg kui-scrollbar space-y-0.75",
|
|
1809
|
+
"pointer-events-none opacity-0 scale-95",
|
|
1810
|
+
"data-[state=open]:pointer-events-auto data-[state=open]:opacity-100 data-[state=open]:scale-100",
|
|
1811
|
+
"transition-[opacity,transform] duration-150 ease-out",
|
|
1354
1812
|
side === "bottom" ? "top-full mt-1" : "bottom-full mb-1",
|
|
1355
1813
|
className
|
|
1356
1814
|
),
|
|
1815
|
+
onMouseLeave: () => {
|
|
1816
|
+
ctx.setActiveValue(void 0);
|
|
1817
|
+
},
|
|
1357
1818
|
...props,
|
|
1358
1819
|
children
|
|
1359
1820
|
}
|
|
@@ -1372,10 +1833,17 @@ function SelectItem({
|
|
|
1372
1833
|
const active = ctx.activeValue === value;
|
|
1373
1834
|
const ref = react.useRef(null);
|
|
1374
1835
|
react.useLayoutEffect(() => {
|
|
1375
|
-
return ctx.registerItem(value, {
|
|
1836
|
+
return ctx.registerItem(value, {
|
|
1837
|
+
label: children,
|
|
1838
|
+
disabled
|
|
1839
|
+
});
|
|
1376
1840
|
}, [value, disabled, children]);
|
|
1377
1841
|
react.useEffect(() => {
|
|
1378
|
-
if (active)
|
|
1842
|
+
if (active) {
|
|
1843
|
+
ref.current?.scrollIntoView({
|
|
1844
|
+
block: "nearest"
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1379
1847
|
}, [active]);
|
|
1380
1848
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
1849
|
"div",
|
|
@@ -1388,12 +1856,20 @@ function SelectItem({
|
|
|
1388
1856
|
"data-state": selected ? "selected" : void 0,
|
|
1389
1857
|
"data-active": active || void 0,
|
|
1390
1858
|
"data-disabled": disabled || void 0,
|
|
1391
|
-
onMouseEnter: () =>
|
|
1392
|
-
|
|
1859
|
+
onMouseEnter: () => {
|
|
1860
|
+
if (!disabled) {
|
|
1861
|
+
ctx.setActiveValue(value);
|
|
1862
|
+
}
|
|
1863
|
+
},
|
|
1864
|
+
onClick: () => {
|
|
1865
|
+
if (!disabled) {
|
|
1866
|
+
ctx.onValueChange(value);
|
|
1867
|
+
}
|
|
1868
|
+
},
|
|
1393
1869
|
className: cn(
|
|
1394
|
-
"flex cursor-pointer items-center rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-text transition-colors",
|
|
1395
|
-
|
|
1396
|
-
|
|
1870
|
+
"flex cursor-pointer items-center rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-kui-text transition-colors",
|
|
1871
|
+
selected && "bg-kui-brand/10 text-kui-brand hover:bg-kui-brand/20",
|
|
1872
|
+
active && !selected && "bg-kui-surface-sunken",
|
|
1397
1873
|
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
1398
1874
|
className
|
|
1399
1875
|
),
|
|
@@ -1421,7 +1897,7 @@ function SelectLabel({ children, className }) {
|
|
|
1421
1897
|
react.useEffect(() => {
|
|
1422
1898
|
group?.setHasLabel(id);
|
|
1423
1899
|
}, [group, id]);
|
|
1424
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: cn("px-2.5 py-1.5 font-mono text-[11px] text-text-muted", className), children });
|
|
1900
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { id, className: cn("px-2.5 py-1.5 font-mono text-[11px] text-kui-text-muted", className), children });
|
|
1425
1901
|
}
|
|
1426
1902
|
__name(SelectLabel, "SelectLabel");
|
|
1427
1903
|
function Select({
|
|
@@ -1598,19 +2074,6 @@ Select.Item = SelectItem;
|
|
|
1598
2074
|
Select.Value = SelectValue;
|
|
1599
2075
|
Select.Group = SelectGroup;
|
|
1600
2076
|
Select.Label = SelectLabel;
|
|
1601
|
-
function mergeRefs2(...refs) {
|
|
1602
|
-
return (node) => {
|
|
1603
|
-
refs.forEach((ref) => {
|
|
1604
|
-
if (!ref) return;
|
|
1605
|
-
if (typeof ref === "function") {
|
|
1606
|
-
ref(node);
|
|
1607
|
-
} else {
|
|
1608
|
-
ref.current = node;
|
|
1609
|
-
}
|
|
1610
|
-
});
|
|
1611
|
-
};
|
|
1612
|
-
}
|
|
1613
|
-
__name(mergeRefs2, "mergeRefs");
|
|
1614
2077
|
function resolveFieldState({
|
|
1615
2078
|
error,
|
|
1616
2079
|
success,
|
|
@@ -1635,6 +2098,7 @@ var TextareaCore = react.forwardRef(
|
|
|
1635
2098
|
onBlur: onBlurProp,
|
|
1636
2099
|
className,
|
|
1637
2100
|
style: customStyle,
|
|
2101
|
+
typography: typographyName = "body",
|
|
1638
2102
|
size = "md",
|
|
1639
2103
|
variant = "outline",
|
|
1640
2104
|
resize = "vertical",
|
|
@@ -1662,12 +2126,12 @@ var TextareaCore = react.forwardRef(
|
|
|
1662
2126
|
}, ref) => {
|
|
1663
2127
|
const autoId = react.useId();
|
|
1664
2128
|
const field = useOptionalFormField();
|
|
1665
|
-
const { theme } = useTheme();
|
|
2129
|
+
const { theme } = kreativCore.useTheme();
|
|
1666
2130
|
const id = field?.id ?? externalId ?? autoId;
|
|
1667
2131
|
const internalRef = react.useRef(null);
|
|
1668
2132
|
const debounceTimer = react.useRef(null);
|
|
1669
|
-
const typography = useTypography(
|
|
1670
|
-
const { style: sizeStyle } = useSizeStyle(size, false, "textarea", {
|
|
2133
|
+
const typography = hooks_star.useTypography(typographyName);
|
|
2134
|
+
const { style: sizeStyle } = hooks_star.useSizeStyle(size, false, "textarea", {
|
|
1671
2135
|
includeHeight: false
|
|
1672
2136
|
});
|
|
1673
2137
|
const [draft, setDraft] = react.useState(() => valueProp ?? defaultValue ?? "");
|
|
@@ -1849,13 +2313,13 @@ var TextareaCore = react.forwardRef(
|
|
|
1849
2313
|
"pointer-events-none absolute",
|
|
1850
2314
|
"bottom-1.5 right-2.5",
|
|
1851
2315
|
"font-mono text-[11px]",
|
|
1852
|
-
maxLengthExceeded ? "text-destructive" : hasReachedMaxLength ? "text-warning" : nearLimit ? "text-warning" : "text-text-muted"
|
|
2316
|
+
maxLengthExceeded ? "text-kui-destructive" : hasReachedMaxLength ? "text-kui-warning" : nearLimit ? "text-kui-warning" : "text-kui-text-muted"
|
|
1853
2317
|
);
|
|
1854
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClassName, "items-start"), children: [
|
|
2318
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClassName, "items-start py-2"), children: [
|
|
1855
2319
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1856
2320
|
"textarea",
|
|
1857
2321
|
{
|
|
1858
|
-
ref:
|
|
2322
|
+
ref: mergeRefs(internalRef, ref),
|
|
1859
2323
|
id,
|
|
1860
2324
|
value: draft,
|
|
1861
2325
|
onChange: handleChange,
|
|
@@ -1868,7 +2332,7 @@ var TextareaCore = react.forwardRef(
|
|
|
1868
2332
|
"aria-required": required,
|
|
1869
2333
|
required,
|
|
1870
2334
|
style: textareaStyle,
|
|
1871
|
-
className: cn(textareaClasses,
|
|
2335
|
+
className: cn(textareaClasses, className),
|
|
1872
2336
|
"data-size": size,
|
|
1873
2337
|
"data-invalid": isInvalid || void 0,
|
|
1874
2338
|
"data-success": isSuccess || void 0,
|
|
@@ -1888,9 +2352,9 @@ var TextareaCore = react.forwardRef(
|
|
|
1888
2352
|
className: cn(
|
|
1889
2353
|
"absolute right-2 top-2",
|
|
1890
2354
|
"flex items-center justify-center",
|
|
1891
|
-
"text-text-muted",
|
|
2355
|
+
"text-kui-text-muted",
|
|
1892
2356
|
"transition-colors",
|
|
1893
|
-
"hover:text-text"
|
|
2357
|
+
"hover:text-kui-text"
|
|
1894
2358
|
),
|
|
1895
2359
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
1896
2360
|
}
|
|
@@ -1904,7 +2368,7 @@ var TextareaCore = react.forwardRef(
|
|
|
1904
2368
|
{
|
|
1905
2369
|
id: messageId,
|
|
1906
2370
|
role: "alert",
|
|
1907
|
-
className: cn("mt-1.5 px-0.5", "text-xs text-destructive"),
|
|
2371
|
+
className: cn("mt-1.5 px-0.5", "text-xs text-kui-destructive"),
|
|
1908
2372
|
children: internalValidation.message
|
|
1909
2373
|
}
|
|
1910
2374
|
)
|
|
@@ -1913,7 +2377,7 @@ var TextareaCore = react.forwardRef(
|
|
|
1913
2377
|
);
|
|
1914
2378
|
TextareaCore.displayName = "TextareaCore";
|
|
1915
2379
|
|
|
1916
|
-
// src/components/MarkdownEditor/markdownActions.ts
|
|
2380
|
+
// src/components/forms/MarkdownEditor/markdownActions.ts
|
|
1917
2381
|
function lineBounds(value, index) {
|
|
1918
2382
|
const start = value.lastIndexOf("\n", index - 1) + 1;
|
|
1919
2383
|
const nextBreak = value.indexOf("\n", index);
|
|
@@ -2051,7 +2515,7 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2051
2515
|
defaultTab
|
|
2052
2516
|
);
|
|
2053
2517
|
const tab = tabProp ?? uncontrolledTab;
|
|
2054
|
-
const { theme } = useTheme();
|
|
2518
|
+
const { theme } = kreativCore.useTheme();
|
|
2055
2519
|
const field = useOptionalFormField();
|
|
2056
2520
|
const footerMessage = hint;
|
|
2057
2521
|
const [draft, setDraft] = react.useState(() => valueProp ?? defaultValue ?? "");
|
|
@@ -2115,7 +2579,7 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2115
2579
|
role: "tablist",
|
|
2116
2580
|
"aria-label": "Markdown editor mode",
|
|
2117
2581
|
id: tablistId,
|
|
2118
|
-
className: "flex items-center gap-4 border-b border-border px-3",
|
|
2582
|
+
className: "flex items-center gap-4 border-b border-kui-border px-3",
|
|
2119
2583
|
children: [
|
|
2120
2584
|
["write", "preview"].map((t) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2121
2585
|
"button",
|
|
@@ -2130,7 +2594,7 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2130
2594
|
className: cn(
|
|
2131
2595
|
"border-b-2 py-2.5 text-sm capitalize transition-colors",
|
|
2132
2596
|
"disabled:pointer-events-none disabled:cursor-not-allowed",
|
|
2133
|
-
tab === t ? "border-brand text-text" : "border-transparent text-text-muted hover:text-text"
|
|
2597
|
+
tab === t ? "border-kui-brand text-kui-text" : "border-transparent text-kui-text-muted hover:text-kui-text"
|
|
2134
2598
|
),
|
|
2135
2599
|
children: t
|
|
2136
2600
|
},
|
|
@@ -2143,7 +2607,7 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2143
2607
|
"aria-label": label,
|
|
2144
2608
|
onClick: () => runAction(action),
|
|
2145
2609
|
disabled,
|
|
2146
|
-
className: "rounded-(--kui-radii-sm) p-1.5 text-text-muted transition-colors hover:bg-surface-raised hover:text-text disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
2610
|
+
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",
|
|
2147
2611
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 15 })
|
|
2148
2612
|
},
|
|
2149
2613
|
label
|
|
@@ -2187,11 +2651,11 @@ var MarkdownEditor = react.forwardRef(
|
|
|
2187
2651
|
role: "tabpanel",
|
|
2188
2652
|
"aria-labelledby": `${baseId}-preview-tab`,
|
|
2189
2653
|
hidden: tab !== "preview",
|
|
2190
|
-
className: "min-h-32 p-3 text-sm text-text",
|
|
2191
|
-
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
2654
|
+
className: "min-h-32 p-3 text-sm text-kui-text",
|
|
2655
|
+
children: renderMarkdown ? renderedPreview : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-kui-text-muted", children: "No renderMarkdown provided \u2014 showing raw text." })
|
|
2192
2656
|
}
|
|
2193
2657
|
),
|
|
2194
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 border-t border-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
2658
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 border-t border-kui-border px-3 py-2 text-xs z-1", children: footerMessage })
|
|
2195
2659
|
] });
|
|
2196
2660
|
}
|
|
2197
2661
|
);
|
|
@@ -2199,7 +2663,14 @@ MarkdownEditor.displayName = "MarkdownEditor";
|
|
|
2199
2663
|
var Textarea = react.forwardRef(
|
|
2200
2664
|
({ allowMarkdown, ...props }, ref) => {
|
|
2201
2665
|
if (allowMarkdown) {
|
|
2202
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2666
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2667
|
+
MarkdownEditor,
|
|
2668
|
+
{
|
|
2669
|
+
ref,
|
|
2670
|
+
...props,
|
|
2671
|
+
embedded: true
|
|
2672
|
+
}
|
|
2673
|
+
);
|
|
2203
2674
|
}
|
|
2204
2675
|
return /* @__PURE__ */ jsxRuntime.jsx(TextareaCore, { ref, ...props });
|
|
2205
2676
|
}
|
|
@@ -2226,7 +2697,7 @@ var Checkbox = react.forwardRef(
|
|
|
2226
2697
|
}, ref) => {
|
|
2227
2698
|
const autoId = react.useId();
|
|
2228
2699
|
const field = useOptionalFormField();
|
|
2229
|
-
const { theme } = useTheme();
|
|
2700
|
+
const { theme } = kreativCore.useTheme();
|
|
2230
2701
|
const id = field?.id ?? externalId ?? autoId;
|
|
2231
2702
|
const inputRef = react.useRef(null);
|
|
2232
2703
|
const [internalChecked, setInternalChecked] = react.useState(
|
|
@@ -2257,7 +2728,7 @@ var Checkbox = react.forwardRef(
|
|
|
2257
2728
|
style: sizeStyle,
|
|
2258
2729
|
iconSize,
|
|
2259
2730
|
fontSize
|
|
2260
|
-
} = useSizeStyle(size, !hasLabels, "checkbox", {
|
|
2731
|
+
} = hooks_star.useSizeStyle(size, !hasLabels, "checkbox", {
|
|
2261
2732
|
widthFromHeight: true,
|
|
2262
2733
|
sizeOffset: "7px"
|
|
2263
2734
|
});
|
|
@@ -2341,12 +2812,12 @@ var Checkbox = react.forwardRef(
|
|
|
2341
2812
|
!disabled && "cursor-pointer"
|
|
2342
2813
|
),
|
|
2343
2814
|
children: [
|
|
2344
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text", style: { fontSize }, children: label }),
|
|
2815
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-kui-text", style: { fontSize }, children: label }),
|
|
2345
2816
|
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2346
2817
|
"span",
|
|
2347
2818
|
{
|
|
2348
2819
|
id: descriptionId,
|
|
2349
|
-
className: "text-text-muted",
|
|
2820
|
+
className: "text-kui-text-muted",
|
|
2350
2821
|
style: {
|
|
2351
2822
|
fontSize: fontSize ? `calc(${fontSize} - 1px)` : void 0
|
|
2352
2823
|
},
|
|
@@ -2404,7 +2875,15 @@ function RadioGroup({
|
|
|
2404
2875
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2405
2876
|
RadioGroupContext.Provider,
|
|
2406
2877
|
{
|
|
2407
|
-
value: {
|
|
2878
|
+
value: {
|
|
2879
|
+
name,
|
|
2880
|
+
value,
|
|
2881
|
+
onValueChange: handleValueChange,
|
|
2882
|
+
disabled,
|
|
2883
|
+
size,
|
|
2884
|
+
state,
|
|
2885
|
+
groupRequired
|
|
2886
|
+
},
|
|
2408
2887
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2409
2888
|
"div",
|
|
2410
2889
|
{
|
|
@@ -2436,12 +2915,12 @@ var radioBubbleVariants = classVarianceAuthority.cva(
|
|
|
2436
2915
|
},
|
|
2437
2916
|
state: {
|
|
2438
2917
|
none: "",
|
|
2439
|
-
error: "border-destructive",
|
|
2440
|
-
success: "border-success"
|
|
2918
|
+
error: "border-kui-destructive",
|
|
2919
|
+
success: "border-kui-success"
|
|
2441
2920
|
},
|
|
2442
2921
|
checked: {
|
|
2443
|
-
true: "border-brand",
|
|
2444
|
-
false: "border-border bg-transparent"
|
|
2922
|
+
true: "border-kui-brand",
|
|
2923
|
+
false: "border-kui-border bg-transparent"
|
|
2445
2924
|
},
|
|
2446
2925
|
disabled: {
|
|
2447
2926
|
true: "cursor-not-allowed",
|
|
@@ -2455,8 +2934,8 @@ var radioBubbleVariants = classVarianceAuthority.cva(
|
|
|
2455
2934
|
disabled: false
|
|
2456
2935
|
},
|
|
2457
2936
|
compoundVariants: [
|
|
2458
|
-
{ checked: false, state: "error", class: "border-destructive" },
|
|
2459
|
-
{ checked: false, state: "success", class: "border-success" }
|
|
2937
|
+
{ checked: false, state: "error", class: "border-kui-destructive" },
|
|
2938
|
+
{ checked: false, state: "success", class: "border-kui-success" }
|
|
2460
2939
|
]
|
|
2461
2940
|
}
|
|
2462
2941
|
);
|
|
@@ -2502,195 +2981,180 @@ function Radio({
|
|
|
2502
2981
|
"aria-hidden": "true",
|
|
2503
2982
|
className: cn(
|
|
2504
2983
|
radioBubbleVariants({ size: group.size, state: group.state, checked, disabled }),
|
|
2505
|
-
"peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1"
|
|
2984
|
+
"peer-focus-visible:ring-2 peer-focus-visible:ring-kui-brand peer-focus-visible:ring-offset-1"
|
|
2506
2985
|
),
|
|
2507
|
-
children: checked && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("rounded-full bg-brand", radioDotSizes[group.size]) })
|
|
2986
|
+
children: checked && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("rounded-full bg-kui-brand", radioDotSizes[group.size]) })
|
|
2508
2987
|
}
|
|
2509
2988
|
)
|
|
2510
2989
|
] }),
|
|
2511
2990
|
(label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
2512
|
-
label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: cn("text-sm text-text", !disabled && "cursor-pointer", group.size === "sm" && "text-xs"), children: label }),
|
|
2513
|
-
description && /* @__PURE__ */ jsxRuntime.jsx("p", { id: descriptionId, className: cn("text-xs text-text-muted", group.size === "sm" && "text-[10px]"), children: description })
|
|
2991
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: cn("text-sm text-kui-text", !disabled && "cursor-pointer", group.size === "sm" && "text-xs"), children: label }),
|
|
2992
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("p", { id: descriptionId, className: cn("text-xs text-kui-text-muted", group.size === "sm" && "text-[10px]"), children: description })
|
|
2514
2993
|
] })
|
|
2515
2994
|
] });
|
|
2516
2995
|
}
|
|
2517
2996
|
__name(Radio, "Radio");
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
{
|
|
2521
|
-
variants: {
|
|
2522
|
-
size: {
|
|
2523
|
-
sm: "h-4 w-7",
|
|
2524
|
-
md: "h-5 w-9",
|
|
2525
|
-
lg: "h-6 w-11"
|
|
2526
|
-
},
|
|
2527
|
-
checked: {
|
|
2528
|
-
true: "bg-brand",
|
|
2529
|
-
false: "bg-surface-raised"
|
|
2530
|
-
},
|
|
2531
|
-
disabled: {
|
|
2532
|
-
true: "cursor-not-allowed",
|
|
2533
|
-
false: "cursor-pointer"
|
|
2534
|
-
}
|
|
2535
|
-
},
|
|
2536
|
-
defaultVariants: { size: "md", checked: false, disabled: false }
|
|
2537
|
-
}
|
|
2538
|
-
);
|
|
2997
|
+
|
|
2998
|
+
// src/components/forms/Switch/Switch.constants.ts
|
|
2539
2999
|
var switchThumbConfig = {
|
|
2540
3000
|
xs: { thumb: "h-3 w-3", translate: "translate-x-3" },
|
|
2541
3001
|
sm: { thumb: "h-3 w-3", translate: "translate-x-3" },
|
|
2542
3002
|
md: { thumb: "h-4 w-4", translate: "translate-x-4" },
|
|
2543
3003
|
lg: { thumb: "h-5 w-5", translate: "translate-x-5" }
|
|
2544
3004
|
};
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
const
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
3005
|
+
var Switch = react.forwardRef(
|
|
3006
|
+
({
|
|
3007
|
+
checked: checkedProp,
|
|
3008
|
+
defaultChecked = false,
|
|
3009
|
+
onCheckedChange,
|
|
3010
|
+
size = "md",
|
|
3011
|
+
disabled = false,
|
|
3012
|
+
label,
|
|
3013
|
+
description,
|
|
3014
|
+
className,
|
|
3015
|
+
id: externalId,
|
|
3016
|
+
onChange: onChangeProp,
|
|
3017
|
+
error,
|
|
3018
|
+
success,
|
|
3019
|
+
children,
|
|
3020
|
+
...props
|
|
3021
|
+
}, ref) => {
|
|
3022
|
+
const autoId = react.useId();
|
|
3023
|
+
const field = useOptionalFormField();
|
|
3024
|
+
const { theme } = kreativCore.useTheme();
|
|
3025
|
+
const id = externalId ?? field?.id ?? autoId;
|
|
3026
|
+
const [internalChecked, setInternalChecked] = react.useState(defaultChecked);
|
|
3027
|
+
const checked = checkedProp !== void 0 ? checkedProp : internalChecked;
|
|
3028
|
+
const descriptionId = description ? `${id}-description` : void 0;
|
|
3029
|
+
const { thumb, translate } = switchThumbConfig[size];
|
|
3030
|
+
const state = error ? "error" : success ? "success" : "none";
|
|
3031
|
+
const switchClasses = resolveRecipe(theme.recipes.Switch, {
|
|
3032
|
+
checked,
|
|
3033
|
+
disabled,
|
|
3034
|
+
state
|
|
3035
|
+
});
|
|
3036
|
+
const fontSize = hooks_star.useSizeToken(size, "fontSize");
|
|
3037
|
+
const width = hooks_star.useSizeToken(size, "width", "-2px");
|
|
3038
|
+
const height = hooks_star.useSizeToken(size, "height", "12px");
|
|
3039
|
+
function handleChange(event) {
|
|
3040
|
+
const next = event.target.checked;
|
|
3041
|
+
if (checkedProp === void 0) {
|
|
3042
|
+
setInternalChecked(next);
|
|
3043
|
+
}
|
|
3044
|
+
onCheckedChange?.(next);
|
|
3045
|
+
onChangeProp?.(event);
|
|
3046
|
+
}
|
|
3047
|
+
__name(handleChange, "handleChange");
|
|
3048
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3049
|
+
"div",
|
|
3050
|
+
{
|
|
3051
|
+
className: cn(
|
|
3052
|
+
"flex gap-2.5",
|
|
3053
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
3054
|
+
className
|
|
3055
|
+
),
|
|
3056
|
+
children: [
|
|
3057
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex shrink-0", children: [
|
|
3058
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3059
|
+
"input",
|
|
3060
|
+
{
|
|
3061
|
+
...props,
|
|
3062
|
+
type: "checkbox",
|
|
3063
|
+
role: "switch",
|
|
3064
|
+
ref,
|
|
3065
|
+
id,
|
|
3066
|
+
checked,
|
|
3067
|
+
disabled,
|
|
3068
|
+
onChange: handleChange,
|
|
3069
|
+
"aria-describedby": field?.describedBy ?? descriptionId,
|
|
3070
|
+
"aria-invalid": field?.status === "error" || void 0,
|
|
3071
|
+
className: "peer absolute inset-0 z-10 m-0\r\n cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
3072
|
+
}
|
|
3073
|
+
),
|
|
3074
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3075
|
+
"div",
|
|
3076
|
+
{
|
|
3077
|
+
"aria-hidden": "true",
|
|
3078
|
+
className: cn(switchClasses, ""),
|
|
3079
|
+
style: { width, height },
|
|
3080
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3081
|
+
"div",
|
|
3082
|
+
{
|
|
3083
|
+
className: cn(
|
|
3084
|
+
"absolute left-1 rounded-full bg-white shadow top-1/2 -translate-y-1/2",
|
|
3085
|
+
"transition-transform duration-(--kui-duration-fast)",
|
|
3086
|
+
thumb,
|
|
3087
|
+
checked && translate
|
|
3088
|
+
)
|
|
3089
|
+
}
|
|
3090
|
+
)
|
|
3091
|
+
}
|
|
3092
|
+
)
|
|
3093
|
+
] }),
|
|
3094
|
+
(label || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-0.5", children: [
|
|
3095
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3096
|
+
"label",
|
|
3097
|
+
{
|
|
3098
|
+
htmlFor: id,
|
|
3099
|
+
className: cn("text-kui-text", !disabled && "cursor-pointer"),
|
|
3100
|
+
style: { fontSize },
|
|
3101
|
+
children: label
|
|
3102
|
+
}
|
|
3103
|
+
),
|
|
3104
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3105
|
+
"p",
|
|
3106
|
+
{
|
|
3107
|
+
id: descriptionId,
|
|
3108
|
+
className: "text-kui-text-muted",
|
|
3109
|
+
style: {
|
|
3110
|
+
fontSize: fontSize ? `calc(${fontSize} - 3px)` : void 0
|
|
3111
|
+
},
|
|
3112
|
+
children: description
|
|
3113
|
+
}
|
|
3114
|
+
)
|
|
3115
|
+
] }),
|
|
3116
|
+
children && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3117
|
+
"label",
|
|
2598
3118
|
{
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
)
|
|
3119
|
+
htmlFor: id,
|
|
3120
|
+
className: cn("text-kui-text inline-flex items-center", !disabled && "cursor-pointer"),
|
|
3121
|
+
style: { fontSize },
|
|
3122
|
+
children
|
|
2604
3123
|
}
|
|
2605
3124
|
)
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
] })
|
|
2613
|
-
] });
|
|
2614
|
-
}
|
|
2615
|
-
__name(Switch, "Switch");
|
|
3125
|
+
]
|
|
3126
|
+
}
|
|
3127
|
+
);
|
|
3128
|
+
}
|
|
3129
|
+
);
|
|
3130
|
+
Switch.displayName = "Switch";
|
|
2616
3131
|
var ComboboxContext = react.createContext(null);
|
|
2617
3132
|
function useComboboxContext(componentName) {
|
|
2618
3133
|
const ctx = react.useContext(ComboboxContext);
|
|
2619
|
-
if (!ctx)
|
|
3134
|
+
if (!ctx)
|
|
3135
|
+
throw new Error(`<${componentName} /> must be rendered inside <Combobox>.`);
|
|
2620
3136
|
return ctx;
|
|
2621
3137
|
}
|
|
2622
3138
|
__name(useComboboxContext, "useComboboxContext");
|
|
2623
|
-
var inputBase = [
|
|
2624
|
-
"flex",
|
|
2625
|
-
"items-center",
|
|
2626
|
-
"font-sans",
|
|
2627
|
-
"transition-colors",
|
|
2628
|
-
"duration-[var(--kui-duration-fast)]",
|
|
2629
|
-
"outline-none",
|
|
2630
|
-
"placeholder:text-text-muted",
|
|
2631
|
-
"disabled:opacity-50",
|
|
2632
|
-
"disabled:pointer-events-none",
|
|
2633
|
-
"disabled:cursor-not-allowed"
|
|
2634
|
-
].join(" ");
|
|
2635
|
-
var inputWrapperVariants = classVarianceAuthority.cva(
|
|
2636
|
-
"group relative inline-flex items-center gap-2 transition-colors",
|
|
2637
|
-
{
|
|
2638
|
-
variants: {
|
|
2639
|
-
variant: {
|
|
2640
|
-
outline: "border border-border bg-transparent text-text hover:border-brand",
|
|
2641
|
-
filled: "border border-transparent bg-surface-raised text-text hover:bg-surface",
|
|
2642
|
-
ghost: "border border-transparent bg-transparent text-text hover:bg-surface-raised"
|
|
2643
|
-
},
|
|
2644
|
-
state: {
|
|
2645
|
-
none: "focus-within:ring-2 focus-within:ring-brand/20",
|
|
2646
|
-
error: "border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
2647
|
-
success: "border-success focus-within:ring-2 focus-within:ring-success/20"
|
|
2648
|
-
},
|
|
2649
|
-
rounded: {
|
|
2650
|
-
true: "rounded-full",
|
|
2651
|
-
false: "rounded-[var(--kui-radii-md)]"
|
|
2652
|
-
},
|
|
2653
|
-
fullWidth: {
|
|
2654
|
-
true: "w-full",
|
|
2655
|
-
false: ""
|
|
2656
|
-
},
|
|
2657
|
-
hasIcon: {
|
|
2658
|
-
true: "px-2",
|
|
2659
|
-
false: ""
|
|
2660
|
-
},
|
|
2661
|
-
disabled: {
|
|
2662
|
-
true: "pointer-events-none cursor-not-allowed opacity-50",
|
|
2663
|
-
false: ""
|
|
2664
|
-
}
|
|
2665
|
-
},
|
|
2666
|
-
defaultVariants: {
|
|
2667
|
-
variant: "outline",
|
|
2668
|
-
state: "none",
|
|
2669
|
-
rounded: false,
|
|
2670
|
-
fullWidth: true,
|
|
2671
|
-
hasIcon: false,
|
|
2672
|
-
disabled: false
|
|
2673
|
-
}
|
|
2674
|
-
}
|
|
2675
|
-
);
|
|
2676
|
-
var inputSizeVariants = {
|
|
2677
|
-
xs: "h-8 px-2 text-xs",
|
|
2678
|
-
sm: "h-8 px-2 text-xs",
|
|
2679
|
-
md: "h-10 px-3 text-sm",
|
|
2680
|
-
lg: "h-12 px-4 text-base"
|
|
2681
|
-
};
|
|
2682
3139
|
function orderedFilteredValues(ctx, query) {
|
|
2683
3140
|
const q = query.trim().toLowerCase();
|
|
2684
3141
|
return [...ctx.items.entries()].filter(([, meta]) => !meta.disabled).filter(([, meta]) => !q || String(meta.label).toLowerCase().includes(q)).map(([val]) => val);
|
|
2685
3142
|
}
|
|
2686
3143
|
__name(orderedFilteredValues, "orderedFilteredValues");
|
|
2687
3144
|
var ComboboxInput = react.forwardRef(
|
|
2688
|
-
({
|
|
3145
|
+
({
|
|
3146
|
+
variant = "outline",
|
|
3147
|
+
size = "md",
|
|
3148
|
+
placeholder,
|
|
3149
|
+
clearable = false,
|
|
3150
|
+
allowFreeText = false,
|
|
3151
|
+
className,
|
|
3152
|
+
rounded,
|
|
3153
|
+
...props
|
|
3154
|
+
}, ref) => {
|
|
2689
3155
|
const ctx = useComboboxContext("ComboboxInput");
|
|
2690
|
-
const
|
|
2691
|
-
const showClear = clearable && ctx.inputValue.length > 0 && !ctx.disabled;
|
|
3156
|
+
const showClear = clearable && ctx?.inputValue?.length > 0 && !ctx.disabled;
|
|
2692
3157
|
react.useEffect(() => {
|
|
2693
|
-
console.log(ctx);
|
|
2694
3158
|
if (ctx.value === void 0) return;
|
|
2695
3159
|
const meta = ctx.items.get(ctx.value);
|
|
2696
3160
|
if (meta && !ctx.open) {
|
|
@@ -2746,61 +3210,43 @@ var ComboboxInput = react.forwardRef(
|
|
|
2746
3210
|
setTimeout(() => ctx.setOpen(false), 120);
|
|
2747
3211
|
}
|
|
2748
3212
|
__name(handleBlur, "handleBlur");
|
|
2749
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2750
|
-
|
|
3213
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3214
|
+
Input,
|
|
2751
3215
|
{
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
"
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
}
|
|
2785
|
-
),
|
|
2786
|
-
showClear && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2787
|
-
"button",
|
|
2788
|
-
{
|
|
2789
|
-
type: "button",
|
|
2790
|
-
tabIndex: -1,
|
|
2791
|
-
"aria-label": "Clear",
|
|
2792
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
2793
|
-
onClick: () => {
|
|
2794
|
-
ctx.setInputValue("");
|
|
2795
|
-
ctx.onValueChange(void 0);
|
|
2796
|
-
},
|
|
2797
|
-
className: "flex items-center justify-center text-text-muted transition-colors hover:text-text",
|
|
2798
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
2799
|
-
}
|
|
2800
|
-
)
|
|
2801
|
-
]
|
|
3216
|
+
ref: (node) => {
|
|
3217
|
+
ctx.triggerRef.current = node;
|
|
3218
|
+
if (typeof ref === "function") ref(node);
|
|
3219
|
+
else if (ref)
|
|
3220
|
+
ref.current = node;
|
|
3221
|
+
},
|
|
3222
|
+
id: ctx.triggerId,
|
|
3223
|
+
role: "combobox",
|
|
3224
|
+
"aria-autocomplete": "list",
|
|
3225
|
+
"aria-haspopup": "listbox",
|
|
3226
|
+
"aria-expanded": ctx.open,
|
|
3227
|
+
"aria-controls": ctx.contentId,
|
|
3228
|
+
"aria-activedescendant": ctx.open && ctx.activeValue ? ctx.optionId(ctx.activeValue) : void 0,
|
|
3229
|
+
variant,
|
|
3230
|
+
size,
|
|
3231
|
+
className,
|
|
3232
|
+
"aria-invalid": ctx.isInvalid || void 0,
|
|
3233
|
+
"aria-describedby": ctx.describedBy,
|
|
3234
|
+
disabled: ctx.disabled,
|
|
3235
|
+
value: ctx.inputValue,
|
|
3236
|
+
placeholder,
|
|
3237
|
+
defaultValue: ctx.defaultValue,
|
|
3238
|
+
onChange: handleChange,
|
|
3239
|
+
onFocus: () => ctx.setOpen(true),
|
|
3240
|
+
onKeyDown: handleKeyDown,
|
|
3241
|
+
onBlur: handleBlur,
|
|
3242
|
+
error: ctx.isInvalid,
|
|
3243
|
+
success: ctx.isSuccess,
|
|
3244
|
+
warning: ctx.isWarning,
|
|
3245
|
+
clearable: showClear,
|
|
3246
|
+
"data-state": ctx.open ? "open" : "closed",
|
|
3247
|
+
...props
|
|
2802
3248
|
}
|
|
2803
|
-
);
|
|
3249
|
+
) });
|
|
2804
3250
|
}
|
|
2805
3251
|
);
|
|
2806
3252
|
ComboboxInput.displayName = "ComboboxInput";
|
|
@@ -2839,9 +3285,9 @@ function ComboboxItem({
|
|
|
2839
3285
|
onMouseDown: (e) => e.preventDefault(),
|
|
2840
3286
|
onClick: () => !disabled && ctx.onValueChange(value),
|
|
2841
3287
|
className: cn(
|
|
2842
|
-
"flex cursor-pointer items-center rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-text transition-colors",
|
|
2843
|
-
active && "bg-brand/15 text-brand",
|
|
2844
|
-
selected && !active && "bg-surface-raised",
|
|
3288
|
+
"flex cursor-pointer items-center rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-kui-text transition-colors",
|
|
3289
|
+
active && "bg-kui-brand/15 text-kui-brand",
|
|
3290
|
+
selected && !active && "bg-kui-surface-raised",
|
|
2845
3291
|
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
2846
3292
|
className
|
|
2847
3293
|
),
|
|
@@ -2866,7 +3312,7 @@ function ComboboxContent({
|
|
|
2866
3312
|
"aria-labelledby": ctx.triggerId,
|
|
2867
3313
|
"data-side": side,
|
|
2868
3314
|
className: cn(
|
|
2869
|
-
"animate-kui-scale-in absolute z-50 max-h-64 w-full overflow-auto rounded-[var(--kui-radii-md)] border border-border bg-surface p-1 shadow-lg",
|
|
3315
|
+
"animate-kui-scale-in absolute z-50 max-h-64 w-full overflow-auto rounded-[var(--kui-radii-md)] border border-kui-border bg-kui-surface p-1 shadow-lg",
|
|
2870
3316
|
side === "bottom" ? "top-full mt-1" : "bottom-full mb-1",
|
|
2871
3317
|
className
|
|
2872
3318
|
),
|
|
@@ -2879,7 +3325,7 @@ function ComboboxEmpty({ children }) {
|
|
|
2879
3325
|
const ctx = useComboboxContext("ComboboxEmpty");
|
|
2880
3326
|
const visibleCount = [...ctx.items.values()].filter((item) => item.visible && !item.disabled).length;
|
|
2881
3327
|
if (visibleCount > 0) return null;
|
|
2882
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-3 text-center text-sm text-text-muted", children: children ?? "No results found" });
|
|
3328
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-3 text-center text-sm text-kui-text-muted", children: children ?? "No results found" });
|
|
2883
3329
|
}
|
|
2884
3330
|
__name(ComboboxEmpty, "ComboboxEmpty");
|
|
2885
3331
|
function ComboboxLoading({
|
|
@@ -2892,7 +3338,7 @@ function ComboboxLoading({
|
|
|
2892
3338
|
role: "status",
|
|
2893
3339
|
"aria-live": "polite",
|
|
2894
3340
|
className: cn(
|
|
2895
|
-
"px-2 py-3 text-center text-sm text-text-muted",
|
|
3341
|
+
"px-2 py-3 text-center text-sm text-kui-text-muted",
|
|
2896
3342
|
className
|
|
2897
3343
|
),
|
|
2898
3344
|
children
|
|
@@ -2912,6 +3358,7 @@ function Combobox({
|
|
|
2912
3358
|
success,
|
|
2913
3359
|
rounded,
|
|
2914
3360
|
className,
|
|
3361
|
+
// status,
|
|
2915
3362
|
children
|
|
2916
3363
|
}) {
|
|
2917
3364
|
const autoId = react.useId();
|
|
@@ -2931,22 +3378,19 @@ function Combobox({
|
|
|
2931
3378
|
const [activeValue, setActiveValue] = react.useState(void 0);
|
|
2932
3379
|
const itemsRef = react.useRef(/* @__PURE__ */ new Map());
|
|
2933
3380
|
const [items, setItems] = react.useState(/* @__PURE__ */ new Map());
|
|
2934
|
-
const registerItem = react.useCallback(
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
},
|
|
2948
|
-
[]
|
|
2949
|
-
);
|
|
3381
|
+
const registerItem = react.useCallback((value2, meta) => {
|
|
3382
|
+
const item = {
|
|
3383
|
+
...meta,
|
|
3384
|
+
visible: true
|
|
3385
|
+
};
|
|
3386
|
+
itemsRef.current.set(value2, item);
|
|
3387
|
+
setItems((prev) => {
|
|
3388
|
+
const next = new Map(prev);
|
|
3389
|
+
next.set(value2, item);
|
|
3390
|
+
return next;
|
|
3391
|
+
});
|
|
3392
|
+
return () => unregisterItem(value2);
|
|
3393
|
+
}, []);
|
|
2950
3394
|
function setItemVisibility(value2, visible) {
|
|
2951
3395
|
setItems((prev) => {
|
|
2952
3396
|
const item2 = prev.get(value2);
|
|
@@ -2984,13 +3428,17 @@ function Combobox({
|
|
|
2984
3428
|
react.useEffect(() => {
|
|
2985
3429
|
if (!open) return;
|
|
2986
3430
|
function handlePointerDown(e) {
|
|
2987
|
-
if (rootRef.current && !rootRef.current.contains(e.target))
|
|
3431
|
+
if (rootRef.current && !rootRef.current.contains(e.target))
|
|
3432
|
+
setOpen(false);
|
|
2988
3433
|
}
|
|
2989
3434
|
__name(handlePointerDown, "handlePointerDown");
|
|
2990
3435
|
document.addEventListener("mousedown", handlePointerDown);
|
|
2991
3436
|
return () => document.removeEventListener("mousedown", handlePointerDown);
|
|
2992
3437
|
}, [open]);
|
|
2993
|
-
const optionId = react.useCallback(
|
|
3438
|
+
const optionId = react.useCallback(
|
|
3439
|
+
(val) => `${contentId}-option-${val}`,
|
|
3440
|
+
[contentId]
|
|
3441
|
+
);
|
|
2994
3442
|
react.useEffect(() => {
|
|
2995
3443
|
if (!value) {
|
|
2996
3444
|
setInputValue("");
|
|
@@ -3004,6 +3452,7 @@ function Combobox({
|
|
|
3004
3452
|
const ctxValue = react.useMemo(
|
|
3005
3453
|
() => ({
|
|
3006
3454
|
value,
|
|
3455
|
+
defaultValue: "",
|
|
3007
3456
|
inputValue,
|
|
3008
3457
|
setInputValue,
|
|
3009
3458
|
onValueChange: /* @__PURE__ */ __name((v) => {
|
|
@@ -3032,11 +3481,37 @@ function Combobox({
|
|
|
3032
3481
|
setItemVisibility,
|
|
3033
3482
|
unregisterItem
|
|
3034
3483
|
}),
|
|
3035
|
-
[
|
|
3484
|
+
[
|
|
3485
|
+
value,
|
|
3486
|
+
inputValue,
|
|
3487
|
+
onValueChange,
|
|
3488
|
+
disabled,
|
|
3489
|
+
open,
|
|
3490
|
+
triggerId,
|
|
3491
|
+
contentId,
|
|
3492
|
+
field?.invalid,
|
|
3493
|
+
field?.describedBy,
|
|
3494
|
+
activeValue,
|
|
3495
|
+
registerItem,
|
|
3496
|
+
optionId,
|
|
3497
|
+
success,
|
|
3498
|
+
rounded,
|
|
3499
|
+
items,
|
|
3500
|
+
setItemVisibility,
|
|
3501
|
+
unregisterItem
|
|
3502
|
+
]
|
|
3036
3503
|
);
|
|
3037
3504
|
return /* @__PURE__ */ jsxRuntime.jsx(ComboboxContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: className ?? "relative w-full", children: [
|
|
3038
3505
|
children,
|
|
3039
|
-
name && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3506
|
+
name && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3507
|
+
"input",
|
|
3508
|
+
{
|
|
3509
|
+
type: "hidden",
|
|
3510
|
+
name,
|
|
3511
|
+
value: value ?? "",
|
|
3512
|
+
disabled
|
|
3513
|
+
}
|
|
3514
|
+
)
|
|
3040
3515
|
] }) });
|
|
3041
3516
|
}
|
|
3042
3517
|
__name(Combobox, "Combobox");
|
|
@@ -3045,13 +3520,59 @@ Combobox.Item = ComboboxItem;
|
|
|
3045
3520
|
Combobox.Content = ComboboxContent;
|
|
3046
3521
|
Combobox.Empty = ComboboxEmpty;
|
|
3047
3522
|
Combobox.Loading = ComboboxLoading;
|
|
3048
|
-
var MultiSelectContext = react.createContext(
|
|
3523
|
+
var MultiSelectContext = react.createContext(
|
|
3524
|
+
null
|
|
3525
|
+
);
|
|
3049
3526
|
function useMultiSelectContext(componentName) {
|
|
3050
3527
|
const ctx = react.useContext(MultiSelectContext);
|
|
3051
|
-
if (!ctx)
|
|
3528
|
+
if (!ctx)
|
|
3529
|
+
throw new Error(
|
|
3530
|
+
`<${componentName} /> must be rendered inside <MultiSelect>.`
|
|
3531
|
+
);
|
|
3052
3532
|
return ctx;
|
|
3053
3533
|
}
|
|
3054
3534
|
__name(useMultiSelectContext, "useMultiSelectContext");
|
|
3535
|
+
var inputWrapperVariants = classVarianceAuthority.cva(
|
|
3536
|
+
"group relative inline-flex items-center gap-2 transition-colors",
|
|
3537
|
+
{
|
|
3538
|
+
variants: {
|
|
3539
|
+
variant: {
|
|
3540
|
+
outline: "border border-kui-border bg-transparent text-kui-text hover:border-kui-brand",
|
|
3541
|
+
filled: "border border-transparent bg-kui-surface-raised text-kui-text hover:bg-kui-surface",
|
|
3542
|
+
ghost: "border border-transparent bg-transparent text-kui-text hover:bg-kui-surface-raised"
|
|
3543
|
+
},
|
|
3544
|
+
state: {
|
|
3545
|
+
none: "focus-within:ring-2 focus-within:ring-kui-brand/20",
|
|
3546
|
+
error: "border-kui-destructive focus-within:ring-2 focus-within:ring-kui-destructive/20",
|
|
3547
|
+
success: "border-kui-success focus-within:ring-2 focus-within:ring-kui-success/20"
|
|
3548
|
+
},
|
|
3549
|
+
rounded: {
|
|
3550
|
+
true: "rounded-full",
|
|
3551
|
+
false: "rounded-[var(--kui-radii-md)]"
|
|
3552
|
+
},
|
|
3553
|
+
fullWidth: {
|
|
3554
|
+
true: "w-full",
|
|
3555
|
+
false: ""
|
|
3556
|
+
},
|
|
3557
|
+
hasIcon: {
|
|
3558
|
+
true: "px-2",
|
|
3559
|
+
false: ""
|
|
3560
|
+
},
|
|
3561
|
+
disabled: {
|
|
3562
|
+
true: "pointer-events-none cursor-not-allowed opacity-50",
|
|
3563
|
+
false: ""
|
|
3564
|
+
}
|
|
3565
|
+
},
|
|
3566
|
+
defaultVariants: {
|
|
3567
|
+
variant: "outline",
|
|
3568
|
+
state: "none",
|
|
3569
|
+
rounded: false,
|
|
3570
|
+
fullWidth: true,
|
|
3571
|
+
hasIcon: false,
|
|
3572
|
+
disabled: false
|
|
3573
|
+
}
|
|
3574
|
+
}
|
|
3575
|
+
);
|
|
3055
3576
|
var multiSelectSizeVariants = classVarianceAuthority.cva("", {
|
|
3056
3577
|
variants: {
|
|
3057
3578
|
size: {
|
|
@@ -3080,141 +3601,148 @@ function orderedEnabledValues2(items) {
|
|
|
3080
3601
|
return [...items.entries()].filter(([, meta]) => !meta.disabled).map(([val]) => val);
|
|
3081
3602
|
}
|
|
3082
3603
|
__name(orderedEnabledValues2, "orderedEnabledValues");
|
|
3083
|
-
var MultiSelectTrigger = react.forwardRef(
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3604
|
+
var MultiSelectTrigger = react.forwardRef(({ className }, ref) => {
|
|
3605
|
+
const ctx = useMultiSelectContext("MultiSelectTrigger");
|
|
3606
|
+
const state = ctx.isInvalid ? "error" : ctx.isSuccess ? "success" : "none";
|
|
3607
|
+
const showClear = ctx.clearable && ctx.value.length > 0 && !ctx.disabled;
|
|
3608
|
+
const visible = ctx.maxVisibleChips ? ctx.value.slice(0, ctx.maxVisibleChips) : ctx.value;
|
|
3609
|
+
const overflow = ctx.value.length - visible.length;
|
|
3610
|
+
function move(delta) {
|
|
3611
|
+
const order = orderedEnabledValues2(ctx.items);
|
|
3612
|
+
if (!order.length) return;
|
|
3613
|
+
const i = ctx.activeValue ? order.indexOf(ctx.activeValue) : -1;
|
|
3614
|
+
ctx.setActiveValue(order[(i + delta + order.length) % order.length]);
|
|
3615
|
+
}
|
|
3616
|
+
__name(move, "move");
|
|
3617
|
+
function handleKeyDown(e) {
|
|
3618
|
+
switch (e.key) {
|
|
3619
|
+
case "ArrowDown":
|
|
3620
|
+
e.preventDefault();
|
|
3621
|
+
ctx.open ? move(1) : ctx.setOpen(true);
|
|
3622
|
+
break;
|
|
3623
|
+
case "ArrowUp":
|
|
3624
|
+
e.preventDefault();
|
|
3625
|
+
ctx.open ? move(-1) : ctx.setOpen(true);
|
|
3626
|
+
break;
|
|
3627
|
+
case "Enter":
|
|
3628
|
+
case " ":
|
|
3629
|
+
e.preventDefault();
|
|
3630
|
+
if (!ctx.open) ctx.setOpen(true);
|
|
3631
|
+
else if (ctx.activeValue) ctx.toggleValue(ctx.activeValue);
|
|
3632
|
+
break;
|
|
3633
|
+
case "Escape":
|
|
3634
|
+
if (ctx.open) {
|
|
3109
3635
|
e.preventDefault();
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
case "Escape":
|
|
3114
|
-
if (ctx.open) {
|
|
3115
|
-
e.preventDefault();
|
|
3116
|
-
ctx.setOpen(false);
|
|
3117
|
-
}
|
|
3118
|
-
break;
|
|
3119
|
-
}
|
|
3636
|
+
ctx.setOpen(false);
|
|
3637
|
+
}
|
|
3638
|
+
break;
|
|
3120
3639
|
}
|
|
3121
|
-
__name(handleKeyDown, "handleKeyDown");
|
|
3122
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3123
|
-
"div",
|
|
3124
|
-
{
|
|
3125
|
-
ref: ctx.triggerRef,
|
|
3126
|
-
className: cn(
|
|
3127
|
-
inputWrapperVariants({ variant: ctx.variant, state, fullWidth: true, disabled: ctx.disabled, rounded: ctx.rounded }),
|
|
3128
|
-
multiSelectSizeVariants({}),
|
|
3129
|
-
"flex flex-wrap items-center gap-1",
|
|
3130
|
-
className
|
|
3131
|
-
),
|
|
3132
|
-
children: [
|
|
3133
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3134
|
-
"button",
|
|
3135
|
-
{
|
|
3136
|
-
ref,
|
|
3137
|
-
type: "button",
|
|
3138
|
-
id: ctx.triggerId,
|
|
3139
|
-
role: "combobox",
|
|
3140
|
-
"aria-haspopup": "listbox",
|
|
3141
|
-
"aria-expanded": ctx.open,
|
|
3142
|
-
"aria-controls": ctx.contentId,
|
|
3143
|
-
"aria-invalid": ctx.isInvalid || void 0,
|
|
3144
|
-
"aria-describedby": ctx.describedBy,
|
|
3145
|
-
"aria-required": ctx.required || void 0,
|
|
3146
|
-
disabled: ctx.disabled,
|
|
3147
|
-
onClick: () => !ctx.disabled && ctx.setOpen(!ctx.open),
|
|
3148
|
-
onKeyDown: handleKeyDown,
|
|
3149
|
-
className: "flex flex-1 flex-wrap items-center gap-1 bg-transparent text-left outline-none cursor-pointer disabled:cursor-not-allowed",
|
|
3150
|
-
children: [
|
|
3151
|
-
ctx.value.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: ctx.placeholder }),
|
|
3152
|
-
visible.map((v) => {
|
|
3153
|
-
const meta = ctx.items.get(v);
|
|
3154
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3155
|
-
"span",
|
|
3156
|
-
{
|
|
3157
|
-
className: cn(
|
|
3158
|
-
chipSizeVariants({}),
|
|
3159
|
-
"bg-brand/15 text-brand"
|
|
3160
|
-
),
|
|
3161
|
-
children: [
|
|
3162
|
-
meta?.label ?? v,
|
|
3163
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3164
|
-
"span",
|
|
3165
|
-
{
|
|
3166
|
-
role: "button",
|
|
3167
|
-
tabIndex: -1,
|
|
3168
|
-
"aria-label": `Remove ${meta?.label ?? v}`,
|
|
3169
|
-
onClick: (e) => {
|
|
3170
|
-
e.stopPropagation();
|
|
3171
|
-
ctx.removeValue(v);
|
|
3172
|
-
},
|
|
3173
|
-
className: "hover:opacity-70",
|
|
3174
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3175
|
-
lucideReact.X,
|
|
3176
|
-
{
|
|
3177
|
-
size: ctx.size === "sm" ? 8 : ctx.size === "md" ? 10 : 12
|
|
3178
|
-
}
|
|
3179
|
-
)
|
|
3180
|
-
}
|
|
3181
|
-
)
|
|
3182
|
-
]
|
|
3183
|
-
},
|
|
3184
|
-
v
|
|
3185
|
-
);
|
|
3186
|
-
}),
|
|
3187
|
-
overflow > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn(
|
|
3188
|
-
"text-text-muted",
|
|
3189
|
-
ctx.size === "sm" ? "text-[10px]" : ctx.size === "md" ? "text-xs" : "text-sm"
|
|
3190
|
-
), children: [
|
|
3191
|
-
"+",
|
|
3192
|
-
overflow,
|
|
3193
|
-
" more"
|
|
3194
|
-
] })
|
|
3195
|
-
]
|
|
3196
|
-
}
|
|
3197
|
-
),
|
|
3198
|
-
showClear && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3199
|
-
"button",
|
|
3200
|
-
{
|
|
3201
|
-
type: "button",
|
|
3202
|
-
tabIndex: -1,
|
|
3203
|
-
"aria-label": "Clear selection",
|
|
3204
|
-
onClick: (e) => {
|
|
3205
|
-
e.preventDefault();
|
|
3206
|
-
e.stopPropagation();
|
|
3207
|
-
ctx.onClear();
|
|
3208
|
-
},
|
|
3209
|
-
className: "flex h-4 w-4 shrink-0 items-center justify-center text-text-muted transition-colors hover:text-text",
|
|
3210
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
3211
|
-
}
|
|
3212
|
-
)
|
|
3213
|
-
]
|
|
3214
|
-
}
|
|
3215
|
-
);
|
|
3216
3640
|
}
|
|
3217
|
-
);
|
|
3641
|
+
__name(handleKeyDown, "handleKeyDown");
|
|
3642
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3643
|
+
"div",
|
|
3644
|
+
{
|
|
3645
|
+
ref: ctx.triggerRef,
|
|
3646
|
+
className: cn(
|
|
3647
|
+
inputWrapperVariants({
|
|
3648
|
+
variant: ctx.variant,
|
|
3649
|
+
state,
|
|
3650
|
+
fullWidth: true,
|
|
3651
|
+
disabled: ctx.disabled,
|
|
3652
|
+
rounded: ctx.rounded
|
|
3653
|
+
}),
|
|
3654
|
+
multiSelectSizeVariants({}),
|
|
3655
|
+
"flex flex-wrap items-center gap-1",
|
|
3656
|
+
className
|
|
3657
|
+
),
|
|
3658
|
+
children: [
|
|
3659
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3660
|
+
"button",
|
|
3661
|
+
{
|
|
3662
|
+
ref,
|
|
3663
|
+
type: "button",
|
|
3664
|
+
id: ctx.triggerId,
|
|
3665
|
+
role: "combobox",
|
|
3666
|
+
"aria-haspopup": "listbox",
|
|
3667
|
+
"aria-expanded": ctx.open,
|
|
3668
|
+
"aria-controls": ctx.contentId,
|
|
3669
|
+
"aria-invalid": ctx.isInvalid || void 0,
|
|
3670
|
+
"aria-describedby": ctx.describedBy,
|
|
3671
|
+
"aria-required": ctx.required || void 0,
|
|
3672
|
+
disabled: ctx.disabled,
|
|
3673
|
+
onClick: () => !ctx.disabled && ctx.setOpen(!ctx.open),
|
|
3674
|
+
onKeyDown: handleKeyDown,
|
|
3675
|
+
className: "flex flex-1 flex-wrap items-center gap-1 bg-transparent text-left outline-none cursor-pointer disabled:cursor-not-allowed",
|
|
3676
|
+
children: [
|
|
3677
|
+
ctx.value.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-kui-text-muted", children: ctx.placeholder }),
|
|
3678
|
+
visible.map((v) => {
|
|
3679
|
+
const meta = ctx.items.get(v);
|
|
3680
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3681
|
+
"span",
|
|
3682
|
+
{
|
|
3683
|
+
className: cn(chipSizeVariants({}), "bg-kui-brand/15 text-kui-brand"),
|
|
3684
|
+
children: [
|
|
3685
|
+
meta?.label ?? v,
|
|
3686
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3687
|
+
"span",
|
|
3688
|
+
{
|
|
3689
|
+
role: "button",
|
|
3690
|
+
tabIndex: -1,
|
|
3691
|
+
"aria-label": `Remove ${meta?.label ?? v}`,
|
|
3692
|
+
onClick: (e) => {
|
|
3693
|
+
e.stopPropagation();
|
|
3694
|
+
ctx.removeValue(v);
|
|
3695
|
+
},
|
|
3696
|
+
className: "hover:opacity-70",
|
|
3697
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3698
|
+
lucideReact.X,
|
|
3699
|
+
{
|
|
3700
|
+
size: ctx.size === "sm" ? 8 : ctx.size === "md" ? 10 : 12
|
|
3701
|
+
}
|
|
3702
|
+
)
|
|
3703
|
+
}
|
|
3704
|
+
)
|
|
3705
|
+
]
|
|
3706
|
+
},
|
|
3707
|
+
v
|
|
3708
|
+
);
|
|
3709
|
+
}),
|
|
3710
|
+
overflow > 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3711
|
+
"span",
|
|
3712
|
+
{
|
|
3713
|
+
className: cn(
|
|
3714
|
+
"text-kui-text-muted",
|
|
3715
|
+
ctx.size === "sm" ? "text-[10px]" : ctx.size === "md" ? "text-xs" : "text-sm"
|
|
3716
|
+
),
|
|
3717
|
+
children: [
|
|
3718
|
+
"+",
|
|
3719
|
+
overflow,
|
|
3720
|
+
" more"
|
|
3721
|
+
]
|
|
3722
|
+
}
|
|
3723
|
+
)
|
|
3724
|
+
]
|
|
3725
|
+
}
|
|
3726
|
+
),
|
|
3727
|
+
showClear && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3728
|
+
"button",
|
|
3729
|
+
{
|
|
3730
|
+
type: "button",
|
|
3731
|
+
tabIndex: -1,
|
|
3732
|
+
"aria-label": "Clear selection",
|
|
3733
|
+
onClick: (e) => {
|
|
3734
|
+
e.preventDefault();
|
|
3735
|
+
e.stopPropagation();
|
|
3736
|
+
ctx.onClear();
|
|
3737
|
+
},
|
|
3738
|
+
className: "flex h-4 w-4 shrink-0 items-center justify-center text-kui-text-muted transition-colors hover:text-kui-text",
|
|
3739
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
|
|
3740
|
+
}
|
|
3741
|
+
)
|
|
3742
|
+
]
|
|
3743
|
+
}
|
|
3744
|
+
);
|
|
3745
|
+
});
|
|
3218
3746
|
MultiSelectTrigger.displayName = "MultiSelectTrigger";
|
|
3219
3747
|
function MultiSelectContent({
|
|
3220
3748
|
className,
|
|
@@ -3234,7 +3762,7 @@ function MultiSelectContent({
|
|
|
3234
3762
|
"data-state": ctx.open ? "open" : "closed",
|
|
3235
3763
|
"data-side": side,
|
|
3236
3764
|
className: cn(
|
|
3237
|
-
"animate-kui-scale-in absolute z-50 max-h-64 w-full overflow-auto rounded-[var(--kui-radii-md)] border border-border bg-surface p-1 shadow-lg",
|
|
3765
|
+
"animate-kui-scale-in absolute z-50 max-h-64 w-full overflow-auto rounded-[var(--kui-radii-md)] border border-kui-border bg-kui-surface p-1 shadow-lg",
|
|
3238
3766
|
side === "bottom" ? "top-full mt-1" : "bottom-full mb-1",
|
|
3239
3767
|
className
|
|
3240
3768
|
),
|
|
@@ -3289,8 +3817,8 @@ function MultiSelectItem({
|
|
|
3289
3817
|
onMouseEnter: () => !disabled && ctx.setActiveValue(value),
|
|
3290
3818
|
onClick: () => !disabled && ctx.toggleValue(value),
|
|
3291
3819
|
className: cn(
|
|
3292
|
-
"flex cursor-pointer items-center justify-between rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-text transition-colors",
|
|
3293
|
-
active && "bg-brand/15 text-brand",
|
|
3820
|
+
"flex cursor-pointer items-center justify-between rounded-[calc(var(--kui-radii-md)-2px)] px-2.5 py-1.5 text-sm text-kui-text transition-colors",
|
|
3821
|
+
active && "bg-kui-brand/15 text-kui-brand",
|
|
3294
3822
|
disabled && "pointer-events-none cursor-not-allowed opacity-50",
|
|
3295
3823
|
className
|
|
3296
3824
|
),
|
|
@@ -3349,7 +3877,10 @@ function MultiSelect({
|
|
|
3349
3877
|
(v) => commit(value.includes(v) ? value.filter((x) => x !== v) : [...value, v]),
|
|
3350
3878
|
[value, commit]
|
|
3351
3879
|
);
|
|
3352
|
-
const removeValue = react.useCallback(
|
|
3880
|
+
const removeValue = react.useCallback(
|
|
3881
|
+
(v) => commit(value.filter((x) => x !== v)),
|
|
3882
|
+
[value, commit]
|
|
3883
|
+
);
|
|
3353
3884
|
const handleClear = react.useCallback(() => {
|
|
3354
3885
|
commit([]);
|
|
3355
3886
|
}, [commit]);
|
|
@@ -3358,13 +3889,17 @@ function MultiSelect({
|
|
|
3358
3889
|
react.useEffect(() => {
|
|
3359
3890
|
if (!open) return;
|
|
3360
3891
|
function handlePointerDown(e) {
|
|
3361
|
-
if (rootRef.current && !rootRef.current.contains(e.target))
|
|
3892
|
+
if (rootRef.current && !rootRef.current.contains(e.target))
|
|
3893
|
+
setOpen(false);
|
|
3362
3894
|
}
|
|
3363
3895
|
__name(handlePointerDown, "handlePointerDown");
|
|
3364
3896
|
document.addEventListener("mousedown", handlePointerDown);
|
|
3365
3897
|
return () => document.removeEventListener("mousedown", handlePointerDown);
|
|
3366
3898
|
}, [open]);
|
|
3367
|
-
const optionId = react.useCallback(
|
|
3899
|
+
const optionId = react.useCallback(
|
|
3900
|
+
(val) => `${contentId}-option-${val}`,
|
|
3901
|
+
[contentId]
|
|
3902
|
+
);
|
|
3368
3903
|
const ctxValue = react.useMemo(
|
|
3369
3904
|
() => ({
|
|
3370
3905
|
value,
|
|
@@ -3393,17 +3928,326 @@ function MultiSelect({
|
|
|
3393
3928
|
clearable,
|
|
3394
3929
|
onClear: handleClear
|
|
3395
3930
|
}),
|
|
3396
|
-
[
|
|
3931
|
+
[
|
|
3932
|
+
value,
|
|
3933
|
+
toggleValue,
|
|
3934
|
+
removeValue,
|
|
3935
|
+
disabled,
|
|
3936
|
+
variant,
|
|
3937
|
+
size,
|
|
3938
|
+
open,
|
|
3939
|
+
triggerId,
|
|
3940
|
+
contentId,
|
|
3941
|
+
field?.invalid,
|
|
3942
|
+
field?.describedBy,
|
|
3943
|
+
field?.required,
|
|
3944
|
+
required,
|
|
3945
|
+
placeholder,
|
|
3946
|
+
maxVisibleChips,
|
|
3947
|
+
activeValue,
|
|
3948
|
+
registerItem,
|
|
3949
|
+
optionId,
|
|
3950
|
+
error,
|
|
3951
|
+
success,
|
|
3952
|
+
rounded,
|
|
3953
|
+
clearable,
|
|
3954
|
+
handleClear
|
|
3955
|
+
]
|
|
3397
3956
|
);
|
|
3398
3957
|
return /* @__PURE__ */ jsxRuntime.jsx(MultiSelectContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: className ?? "relative w-full", children: [
|
|
3399
3958
|
children,
|
|
3400
|
-
name && value.map((v) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3959
|
+
name && value.map((v) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3960
|
+
"input",
|
|
3961
|
+
{
|
|
3962
|
+
type: "hidden",
|
|
3963
|
+
name: `${name}[]`,
|
|
3964
|
+
value: v,
|
|
3965
|
+
disabled
|
|
3966
|
+
},
|
|
3967
|
+
v
|
|
3968
|
+
))
|
|
3401
3969
|
] }) });
|
|
3402
3970
|
}
|
|
3403
3971
|
__name(MultiSelect, "MultiSelect");
|
|
3404
3972
|
MultiSelect.Trigger = MultiSelectTrigger;
|
|
3405
3973
|
MultiSelect.Content = MultiSelectContent;
|
|
3406
3974
|
MultiSelect.Item = MultiSelectItem;
|
|
3975
|
+
|
|
3976
|
+
// src/utils/responsive.ts
|
|
3977
|
+
function resolveResponsiveValue(value) {
|
|
3978
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
3979
|
+
return {
|
|
3980
|
+
base: value,
|
|
3981
|
+
responsive: {}
|
|
3982
|
+
};
|
|
3983
|
+
}
|
|
3984
|
+
const responsiveValue = value;
|
|
3985
|
+
const { base, ...responsive } = responsiveValue;
|
|
3986
|
+
return {
|
|
3987
|
+
base,
|
|
3988
|
+
responsive: Object.fromEntries(
|
|
3989
|
+
Object.entries(responsive).filter(([, value2]) => value2 !== void 0)
|
|
3990
|
+
)
|
|
3991
|
+
};
|
|
3992
|
+
}
|
|
3993
|
+
__name(resolveResponsiveValue, "resolveResponsiveValue");
|
|
3994
|
+
var Container = react.forwardRef(
|
|
3995
|
+
({
|
|
3996
|
+
maxWidth = "lg",
|
|
3997
|
+
padding,
|
|
3998
|
+
centered = true,
|
|
3999
|
+
as: Tag = "div",
|
|
4000
|
+
className,
|
|
4001
|
+
style,
|
|
4002
|
+
unstyled,
|
|
4003
|
+
children,
|
|
4004
|
+
...rest
|
|
4005
|
+
}, ref) => {
|
|
4006
|
+
const { theme } = kreativCore.useTheme();
|
|
4007
|
+
const recipeClassName = unstyled ? "" : resolveRecipe(theme.recipes.Container, { maxWidth });
|
|
4008
|
+
const responsiveStyles = {};
|
|
4009
|
+
if (padding !== void 0) {
|
|
4010
|
+
const { base, responsive } = resolveResponsiveValue(padding);
|
|
4011
|
+
if (base !== void 0) {
|
|
4012
|
+
responsiveStyles.base = { paddingInline: `var(--kui-spacing-${base})` };
|
|
4013
|
+
}
|
|
4014
|
+
for (const [bp, value] of Object.entries(responsive)) {
|
|
4015
|
+
responsiveStyles[bp] = { paddingInline: `var(--kui-spacing-${value})` };
|
|
4016
|
+
}
|
|
4017
|
+
}
|
|
4018
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
4019
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4020
|
+
/* @__PURE__ */ jsxRuntime.jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
4021
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4022
|
+
Tag,
|
|
4023
|
+
{
|
|
4024
|
+
ref,
|
|
4025
|
+
"data-kui-responsive": attribute,
|
|
4026
|
+
className: cn(recipeClassName, centered && "mx-auto", className),
|
|
4027
|
+
style,
|
|
4028
|
+
...rest,
|
|
4029
|
+
children
|
|
4030
|
+
}
|
|
4031
|
+
)
|
|
4032
|
+
] });
|
|
4033
|
+
}
|
|
4034
|
+
);
|
|
4035
|
+
Container.displayName = "Container";
|
|
4036
|
+
function spaceVar(value) {
|
|
4037
|
+
return `var(--kui-spacing-${value})`;
|
|
4038
|
+
}
|
|
4039
|
+
__name(spaceVar, "spaceVar");
|
|
4040
|
+
var Flex = react.forwardRef(
|
|
4041
|
+
({
|
|
4042
|
+
direction = "row",
|
|
4043
|
+
wrap = "nowrap",
|
|
4044
|
+
align,
|
|
4045
|
+
justify,
|
|
4046
|
+
gap,
|
|
4047
|
+
as: Tag = "div",
|
|
4048
|
+
className,
|
|
4049
|
+
style,
|
|
4050
|
+
unstyled,
|
|
4051
|
+
children,
|
|
4052
|
+
...rest
|
|
4053
|
+
}, ref) => {
|
|
4054
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
4055
|
+
[direction, (v) => ({ flexDirection: v })],
|
|
4056
|
+
[wrap, (v) => ({ flexWrap: v })],
|
|
4057
|
+
[align, (v) => ({ alignItems: v })],
|
|
4058
|
+
[justify, (v) => ({ justifyContent: v })],
|
|
4059
|
+
[gap, (v) => ({ gap: spaceVar(v) })]
|
|
4060
|
+
]);
|
|
4061
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
4062
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4063
|
+
/* @__PURE__ */ jsxRuntime.jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
4064
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4065
|
+
Tag,
|
|
4066
|
+
{
|
|
4067
|
+
ref,
|
|
4068
|
+
"data-kui-responsive": attribute,
|
|
4069
|
+
className: cn(!unstyled && "flex", className),
|
|
4070
|
+
style,
|
|
4071
|
+
...rest,
|
|
4072
|
+
children
|
|
4073
|
+
}
|
|
4074
|
+
)
|
|
4075
|
+
] });
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4078
|
+
Flex.displayName = "Flex";
|
|
4079
|
+
var Stack = react.forwardRef(
|
|
4080
|
+
({ orientation = "vertical", divider, children, ...rest }, ref) => {
|
|
4081
|
+
const direction = orientation === "horizontal" ? "row" : "column";
|
|
4082
|
+
if (!divider) {
|
|
4083
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Flex, { ref, direction, ...rest, children });
|
|
4084
|
+
}
|
|
4085
|
+
const items = react.Children.toArray(children).filter(react.isValidElement);
|
|
4086
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Flex, { ref, direction, ...rest, children: items.map((child, index) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
|
|
4087
|
+
child,
|
|
4088
|
+
index < items.length - 1 && divider
|
|
4089
|
+
] }, child.key ?? index)) });
|
|
4090
|
+
}
|
|
4091
|
+
);
|
|
4092
|
+
Stack.displayName = "Stack";
|
|
4093
|
+
function spaceVar2(value) {
|
|
4094
|
+
return `var(--kui-spacing-${value})`;
|
|
4095
|
+
}
|
|
4096
|
+
__name(spaceVar2, "spaceVar");
|
|
4097
|
+
var Grid = react.forwardRef(
|
|
4098
|
+
({
|
|
4099
|
+
columns,
|
|
4100
|
+
templateColumns,
|
|
4101
|
+
templateRows,
|
|
4102
|
+
templateAreas,
|
|
4103
|
+
gap,
|
|
4104
|
+
columnGap,
|
|
4105
|
+
rowGap,
|
|
4106
|
+
align,
|
|
4107
|
+
justify,
|
|
4108
|
+
as: Tag = "div",
|
|
4109
|
+
className,
|
|
4110
|
+
style,
|
|
4111
|
+
unstyled,
|
|
4112
|
+
children,
|
|
4113
|
+
...rest
|
|
4114
|
+
}, ref) => {
|
|
4115
|
+
const responsiveStyles = (0, hooks_exports.useMergedResponsiveStyles)([
|
|
4116
|
+
[
|
|
4117
|
+
templateColumns ?? columns,
|
|
4118
|
+
(v) => typeof v === "number" ? { gridTemplateColumns: `repeat(${v}, minmax(0, 1fr))` } : { gridTemplateColumns: v }
|
|
4119
|
+
],
|
|
4120
|
+
[templateRows, (v) => ({ gridTemplateRows: v })],
|
|
4121
|
+
[gap, (v) => ({ gap: spaceVar2(v) })],
|
|
4122
|
+
[columnGap, (v) => ({ columnGap: spaceVar2(v) })],
|
|
4123
|
+
[rowGap, (v) => ({ rowGap: spaceVar2(v) })],
|
|
4124
|
+
[align, (v) => ({ alignItems: v })],
|
|
4125
|
+
[justify, (v) => ({ justifyContent: v })]
|
|
4126
|
+
]);
|
|
4127
|
+
const { attribute, style: responsiveCss } = (0, hooks_exports.useResponsiveStyles)(responsiveStyles);
|
|
4128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4129
|
+
/* @__PURE__ */ jsxRuntime.jsx(ResponsiveStyle, { css: responsiveCss }),
|
|
4130
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4131
|
+
Tag,
|
|
4132
|
+
{
|
|
4133
|
+
ref,
|
|
4134
|
+
"data-kui-responsive": attribute,
|
|
4135
|
+
className: cn(!unstyled && "grid", className),
|
|
4136
|
+
style: { ...style, gridTemplateAreas: templateAreas },
|
|
4137
|
+
...rest,
|
|
4138
|
+
children
|
|
4139
|
+
}
|
|
4140
|
+
)
|
|
4141
|
+
] });
|
|
4142
|
+
}
|
|
4143
|
+
);
|
|
4144
|
+
Grid.displayName = "Grid";
|
|
4145
|
+
var cardVariants = {
|
|
4146
|
+
solid: "bg-kui-surface",
|
|
4147
|
+
outline: "border border-kui-border bg-kui-surface",
|
|
4148
|
+
ghost: "bg-transparent",
|
|
4149
|
+
elevated: "bg-kui-surface shadow-md",
|
|
4150
|
+
compact: "bg-kui-surface"
|
|
4151
|
+
};
|
|
4152
|
+
var cardSizes = {
|
|
4153
|
+
sm: "p-3",
|
|
4154
|
+
md: "p-4",
|
|
4155
|
+
lg: "p-6"
|
|
4156
|
+
};
|
|
4157
|
+
function Card({
|
|
4158
|
+
variant = "outline",
|
|
4159
|
+
size = "md",
|
|
4160
|
+
hasImage = false,
|
|
4161
|
+
fullWidth = false,
|
|
4162
|
+
noPadding = false,
|
|
4163
|
+
className,
|
|
4164
|
+
children,
|
|
4165
|
+
...props
|
|
4166
|
+
}) {
|
|
4167
|
+
const basePadding = variant === "compact" ? "p-3" : hasImage ? "p-0" : cardSizes[size];
|
|
4168
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4169
|
+
"div",
|
|
4170
|
+
{
|
|
4171
|
+
className: cn(
|
|
4172
|
+
"overflow-hidden rounded-(--kui-radii-lg)",
|
|
4173
|
+
cardVariants[variant],
|
|
4174
|
+
fullWidth && "w-full",
|
|
4175
|
+
className
|
|
4176
|
+
),
|
|
4177
|
+
...props,
|
|
4178
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(!noPadding && basePadding), children })
|
|
4179
|
+
}
|
|
4180
|
+
);
|
|
4181
|
+
}
|
|
4182
|
+
__name(Card, "Card");
|
|
4183
|
+
function CardHeader({ className, children, ...props }) {
|
|
4184
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4185
|
+
"div",
|
|
4186
|
+
{
|
|
4187
|
+
className: cn(
|
|
4188
|
+
"flex items-center justify-between gap-(--kui-spacing-md)",
|
|
4189
|
+
className
|
|
4190
|
+
),
|
|
4191
|
+
...props,
|
|
4192
|
+
children
|
|
4193
|
+
}
|
|
4194
|
+
);
|
|
4195
|
+
}
|
|
4196
|
+
__name(CardHeader, "CardHeader");
|
|
4197
|
+
function CardBody({ className, children, ...props }) {
|
|
4198
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("min-w-0", className), ...props, children });
|
|
4199
|
+
}
|
|
4200
|
+
__name(CardBody, "CardBody");
|
|
4201
|
+
function CardFooter({ className, children, ...props }) {
|
|
4202
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4203
|
+
"div",
|
|
4204
|
+
{
|
|
4205
|
+
className: cn("flex items-center gap-(--kui-spacing-md)", className),
|
|
4206
|
+
...props,
|
|
4207
|
+
children
|
|
4208
|
+
}
|
|
4209
|
+
);
|
|
4210
|
+
}
|
|
4211
|
+
__name(CardFooter, "CardFooter");
|
|
4212
|
+
Card.Header = CardHeader;
|
|
4213
|
+
Card.Body = CardBody;
|
|
4214
|
+
Card.Footer = CardFooter;
|
|
4215
|
+
|
|
4216
|
+
// src/components/internal/loader/skeletonRegistry.ts
|
|
4217
|
+
var registry = /* @__PURE__ */ new WeakMap();
|
|
4218
|
+
function registerSkeleton(component, definition) {
|
|
4219
|
+
registry.set(component, definition);
|
|
4220
|
+
}
|
|
4221
|
+
__name(registerSkeleton, "registerSkeleton");
|
|
4222
|
+
|
|
4223
|
+
// src/components/Loader/Loader.types.ts
|
|
4224
|
+
var KUI_COMPONENT_METADATA = /* @__PURE__ */ Symbol("kui.component.metadata");
|
|
4225
|
+
function tagKuiComponent(component, metadata) {
|
|
4226
|
+
component[KUI_COMPONENT_METADATA] = metadata;
|
|
4227
|
+
}
|
|
4228
|
+
__name(tagKuiComponent, "tagKuiComponent");
|
|
4229
|
+
|
|
4230
|
+
// src/components/Loader/defineSkeleton.ts
|
|
4231
|
+
function defineSkeleton(resolve, options) {
|
|
4232
|
+
return { resolve, defaults: options?.defaults };
|
|
4233
|
+
}
|
|
4234
|
+
__name(defineSkeleton, "defineSkeleton");
|
|
4235
|
+
|
|
4236
|
+
// src/components/layout/Card/Card.skeleton.tsx
|
|
4237
|
+
tagKuiComponent(Card, {
|
|
4238
|
+
name: "Card",
|
|
4239
|
+
usesSizeScale: true,
|
|
4240
|
+
slots: ["avatar", "text"]
|
|
4241
|
+
});
|
|
4242
|
+
var cardSkeleton = defineSkeleton(
|
|
4243
|
+
(props) => ({
|
|
4244
|
+
avatar: props.hasImage ? { size: "md", shape: "square" } : false,
|
|
4245
|
+
rows: props.variant === "compact" ? 1 : 3,
|
|
4246
|
+
width: props.fullWidth ? "100%" : props.size === "sm" ? 200 : 320
|
|
4247
|
+
}),
|
|
4248
|
+
{ defaults: { rows: 2, avatar: false, width: 280 } }
|
|
4249
|
+
);
|
|
4250
|
+
registerSkeleton(Card, cardSkeleton);
|
|
3407
4251
|
var InputField = react.forwardRef(
|
|
3408
4252
|
({
|
|
3409
4253
|
id,
|
|
@@ -3425,7 +4269,7 @@ var InputField = react.forwardRef(
|
|
|
3425
4269
|
label && /* @__PURE__ */ jsxRuntime.jsxs(FormField.Label, { className: labelClassName, children: [
|
|
3426
4270
|
labelStart,
|
|
3427
4271
|
label,
|
|
3428
|
-
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-muted", children: " (optional)" }),
|
|
4272
|
+
optional && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-kui-text-muted", children: " (optional)" }),
|
|
3429
4273
|
labelEnd
|
|
3430
4274
|
] }),
|
|
3431
4275
|
/* @__PURE__ */ jsxRuntime.jsx(FormField.Control, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3502,7 +4346,7 @@ __name(getTokenValue, "getTokenValue");
|
|
|
3502
4346
|
function resolveReference(reference, tokens, seen = /* @__PURE__ */ new Set()) {
|
|
3503
4347
|
if (seen.has(reference)) {
|
|
3504
4348
|
console.error(
|
|
3505
|
-
`[kreativ-
|
|
4349
|
+
`[kreativ-core] Circular token reference detected: ${reference}`
|
|
3506
4350
|
);
|
|
3507
4351
|
return void 0;
|
|
3508
4352
|
}
|
|
@@ -3511,7 +4355,7 @@ function resolveReference(reference, tokens, seen = /* @__PURE__ */ new Set()) {
|
|
|
3511
4355
|
const value = getTokenValue(reference, tokens);
|
|
3512
4356
|
if (value === void 0) {
|
|
3513
4357
|
console.warn(
|
|
3514
|
-
`[kreativ-
|
|
4358
|
+
`[kreativ-core] Unable to resolve token reference: ${reference}`
|
|
3515
4359
|
);
|
|
3516
4360
|
return void 0;
|
|
3517
4361
|
}
|
|
@@ -3601,20 +4445,20 @@ function resolveTokens(tokens, semanticTokens, mode) {
|
|
|
3601
4445
|
};
|
|
3602
4446
|
}
|
|
3603
4447
|
__name(resolveTokens, "resolveTokens");
|
|
3604
|
-
function tokensToCssVars(tokens, mode, intensity) {
|
|
4448
|
+
function tokensToCssVars(tokens, mode, intensity, prefix = "kui") {
|
|
3605
4449
|
const cssVars = {};
|
|
3606
4450
|
for (const [path, value] of Object.entries(tokens)) {
|
|
3607
4451
|
const parts = path.split(".");
|
|
3608
4452
|
const isSemanticColor = parts.length === 2 && parts[0] === "colors";
|
|
3609
4453
|
const isPrimitiveColor = parts.length >= 3 && parts[0] === "colors";
|
|
3610
|
-
const varName = isSemanticColor ?
|
|
4454
|
+
const varName = isSemanticColor ? `--${prefix}-${toKebabCase(parts[1])}` : `--${prefix}-${parts.map(toKebabCase).join("-")}`;
|
|
3611
4455
|
const outputValue = isSemanticColor || isPrimitiveColor ? colorToRgbChannels(value) : value;
|
|
3612
4456
|
cssVars[varName] = outputValue;
|
|
3613
4457
|
}
|
|
3614
4458
|
return {
|
|
3615
4459
|
...cssVars,
|
|
3616
|
-
|
|
3617
|
-
|
|
4460
|
+
[`--${prefix}-mode`]: mode,
|
|
4461
|
+
[`--${prefix}-intensity`]: String(intensity)
|
|
3618
4462
|
};
|
|
3619
4463
|
}
|
|
3620
4464
|
__name(tokensToCssVars, "tokensToCssVars");
|
|
@@ -3624,178 +4468,213 @@ function defineRecipe(recipe) {
|
|
|
3624
4468
|
return recipe;
|
|
3625
4469
|
}
|
|
3626
4470
|
__name(defineRecipe, "defineRecipe");
|
|
3627
|
-
|
|
3628
|
-
// src/theme/defaults/tokens.ts
|
|
3629
4471
|
var defaultTokens = {
|
|
3630
4472
|
colors: {
|
|
3631
4473
|
blue: {
|
|
3632
|
-
300: defineToken("#5EA6ED"),
|
|
3633
|
-
400: defineToken("#4799EB"),
|
|
3634
|
-
500: defineToken("#1A80E6"),
|
|
3635
|
-
600: defineToken("#1773CF")
|
|
4474
|
+
300: kreativCore.defineToken("#5EA6ED"),
|
|
4475
|
+
400: kreativCore.defineToken("#4799EB"),
|
|
4476
|
+
500: kreativCore.defineToken("#1A80E6"),
|
|
4477
|
+
600: kreativCore.defineToken("#1773CF")
|
|
3636
4478
|
},
|
|
3637
4479
|
red: {
|
|
3638
|
-
300: defineToken("#EB4747"),
|
|
3639
|
-
400: defineToken("#E83030"),
|
|
3640
|
-
500: defineToken("#E61A1A"),
|
|
3641
|
-
600: defineToken("#CF1717")
|
|
4480
|
+
300: kreativCore.defineToken("#EB4747"),
|
|
4481
|
+
400: kreativCore.defineToken("#E83030"),
|
|
4482
|
+
500: kreativCore.defineToken("#E61A1A"),
|
|
4483
|
+
600: kreativCore.defineToken("#CF1717")
|
|
3642
4484
|
},
|
|
3643
4485
|
green: {
|
|
3644
|
-
300: defineToken("#26D997"),
|
|
3645
|
-
400: defineToken("#22C388"),
|
|
3646
|
-
500: defineToken("#16A249"),
|
|
3647
|
-
600: defineToken("#12875C")
|
|
4486
|
+
300: kreativCore.defineToken("#26D997"),
|
|
4487
|
+
400: kreativCore.defineToken("#22C388"),
|
|
4488
|
+
500: kreativCore.defineToken("#16A249"),
|
|
4489
|
+
600: kreativCore.defineToken("#12875C")
|
|
3648
4490
|
},
|
|
3649
4491
|
amber: {
|
|
3650
|
-
300: defineToken("#F7B23B"),
|
|
3651
|
-
400: defineToken("#F6A823"),
|
|
3652
|
-
500: defineToken("#F59F0A"),
|
|
3653
|
-
600: defineToken("#D38909")
|
|
4492
|
+
300: kreativCore.defineToken("#F7B23B"),
|
|
4493
|
+
400: kreativCore.defineToken("#F6A823"),
|
|
4494
|
+
500: kreativCore.defineToken("#F59F0A"),
|
|
4495
|
+
600: kreativCore.defineToken("#D38909")
|
|
3654
4496
|
},
|
|
3655
4497
|
cyan: {
|
|
3656
|
-
300: defineToken("#6CC3EF"),
|
|
3657
|
-
400: defineToken("#47B4EB"),
|
|
3658
|
-
500: defineToken("#1791CF"),
|
|
3659
|
-
600: defineToken("#137BAE")
|
|
4498
|
+
300: kreativCore.defineToken("#6CC3EF"),
|
|
4499
|
+
400: kreativCore.defineToken("#47B4EB"),
|
|
4500
|
+
500: kreativCore.defineToken("#1791CF"),
|
|
4501
|
+
600: kreativCore.defineToken("#137BAE")
|
|
4502
|
+
},
|
|
4503
|
+
indigo: {
|
|
4504
|
+
300: kreativCore.defineToken("#818CF8"),
|
|
4505
|
+
400: kreativCore.defineToken("#6366F1"),
|
|
4506
|
+
500: kreativCore.defineToken("#4F46E5"),
|
|
4507
|
+
600: kreativCore.defineToken("#4338CA")
|
|
4508
|
+
},
|
|
4509
|
+
emerald: {
|
|
4510
|
+
300: kreativCore.defineToken("#6EE7B7"),
|
|
4511
|
+
400: kreativCore.defineToken("#34D399"),
|
|
4512
|
+
500: kreativCore.defineToken("#10B981"),
|
|
4513
|
+
600: kreativCore.defineToken("#059669")
|
|
4514
|
+
},
|
|
4515
|
+
violet: {
|
|
4516
|
+
300: kreativCore.defineToken("#A78BFA"),
|
|
4517
|
+
400: kreativCore.defineToken("#8B5CF6"),
|
|
4518
|
+
500: kreativCore.defineToken("#7C3AED"),
|
|
4519
|
+
600: kreativCore.defineToken("#6D28D9")
|
|
4520
|
+
},
|
|
4521
|
+
rose: {
|
|
4522
|
+
300: kreativCore.defineToken("#FDA4AF"),
|
|
4523
|
+
400: kreativCore.defineToken("#FB7185"),
|
|
4524
|
+
500: kreativCore.defineToken("#F43F5E"),
|
|
4525
|
+
600: kreativCore.defineToken("#E11D48")
|
|
4526
|
+
},
|
|
4527
|
+
orange: {
|
|
4528
|
+
300: kreativCore.defineToken("#FDBA74"),
|
|
4529
|
+
400: kreativCore.defineToken("#FB923C"),
|
|
4530
|
+
500: kreativCore.defineToken("#F97316"),
|
|
4531
|
+
600: kreativCore.defineToken("#EA580C")
|
|
3660
4532
|
},
|
|
3661
4533
|
gray: {
|
|
3662
|
-
50: defineToken("#FAFAFA"),
|
|
3663
|
-
100: defineToken("#EBEBEB"),
|
|
3664
|
-
200: defineToken("#D9D9D9"),
|
|
3665
|
-
300: defineToken("#BDBDBD"),
|
|
3666
|
-
400: defineToken("#999999"),
|
|
3667
|
-
500: defineToken("#666666"),
|
|
3668
|
-
600: defineToken("#4D4D4D"),
|
|
3669
|
-
700: defineToken("#333333"),
|
|
3670
|
-
800: defineToken("#2E2E2E"),
|
|
3671
|
-
900: defineToken("#1F1F1F"),
|
|
3672
|
-
950: defineToken("#141414"),
|
|
3673
|
-
1e3: defineToken("#0A0A0A")
|
|
4534
|
+
50: kreativCore.defineToken("#FAFAFA"),
|
|
4535
|
+
100: kreativCore.defineToken("#EBEBEB"),
|
|
4536
|
+
200: kreativCore.defineToken("#D9D9D9"),
|
|
4537
|
+
300: kreativCore.defineToken("#BDBDBD"),
|
|
4538
|
+
400: kreativCore.defineToken("#999999"),
|
|
4539
|
+
500: kreativCore.defineToken("#666666"),
|
|
4540
|
+
600: kreativCore.defineToken("#4D4D4D"),
|
|
4541
|
+
700: kreativCore.defineToken("#333333"),
|
|
4542
|
+
800: kreativCore.defineToken("#2E2E2E"),
|
|
4543
|
+
900: kreativCore.defineToken("#1F1F1F"),
|
|
4544
|
+
950: kreativCore.defineToken("#141414"),
|
|
4545
|
+
1e3: kreativCore.defineToken("#0A0A0A")
|
|
3674
4546
|
},
|
|
3675
|
-
white: defineToken("#FFFFFF"),
|
|
3676
|
-
black: defineToken("#000000")
|
|
4547
|
+
white: kreativCore.defineToken("#FFFFFF"),
|
|
4548
|
+
black: kreativCore.defineToken("#000000")
|
|
3677
4549
|
},
|
|
3678
4550
|
spacing: {
|
|
3679
|
-
1: defineToken("0.25rem"),
|
|
3680
|
-
2: defineToken("0.5rem"),
|
|
3681
|
-
3: defineToken("0.75rem"),
|
|
3682
|
-
4: defineToken("1rem"),
|
|
3683
|
-
5: defineToken("1.25rem"),
|
|
3684
|
-
6: defineToken("1.5rem"),
|
|
3685
|
-
8: defineToken("2rem"),
|
|
3686
|
-
10: defineToken("2.5rem"),
|
|
3687
|
-
12: defineToken("3rem"),
|
|
3688
|
-
16: defineToken("4rem")
|
|
4551
|
+
1: kreativCore.defineToken("0.25rem"),
|
|
4552
|
+
2: kreativCore.defineToken("0.5rem"),
|
|
4553
|
+
3: kreativCore.defineToken("0.75rem"),
|
|
4554
|
+
4: kreativCore.defineToken("1rem"),
|
|
4555
|
+
5: kreativCore.defineToken("1.25rem"),
|
|
4556
|
+
6: kreativCore.defineToken("1.5rem"),
|
|
4557
|
+
8: kreativCore.defineToken("2rem"),
|
|
4558
|
+
10: kreativCore.defineToken("2.5rem"),
|
|
4559
|
+
12: kreativCore.defineToken("3rem"),
|
|
4560
|
+
16: kreativCore.defineToken("4rem"),
|
|
4561
|
+
xs: kreativCore.defineToken("0.25rem"),
|
|
4562
|
+
sm: kreativCore.defineToken("0.5rem"),
|
|
4563
|
+
md: kreativCore.defineToken("1rem"),
|
|
4564
|
+
lg: kreativCore.defineToken("1.5rem"),
|
|
4565
|
+
xl: kreativCore.defineToken("2rem")
|
|
3689
4566
|
},
|
|
3690
4567
|
radii: {
|
|
3691
|
-
none: defineToken("0"),
|
|
3692
|
-
sm: defineToken("0.25rem"),
|
|
3693
|
-
md: defineToken("0.5rem"),
|
|
3694
|
-
lg: defineToken("0.75rem"),
|
|
3695
|
-
xl: defineToken("1rem"),
|
|
3696
|
-
full: defineToken("9999px")
|
|
4568
|
+
none: kreativCore.defineToken("0"),
|
|
4569
|
+
sm: kreativCore.defineToken("0.25rem"),
|
|
4570
|
+
md: kreativCore.defineToken("0.5rem"),
|
|
4571
|
+
lg: kreativCore.defineToken("0.75rem"),
|
|
4572
|
+
xl: kreativCore.defineToken("1rem"),
|
|
4573
|
+
full: kreativCore.defineToken("9999px")
|
|
3697
4574
|
},
|
|
3698
4575
|
fonts: {
|
|
3699
|
-
body: defineToken("Inter, sans-serif"),
|
|
3700
|
-
heading: defineToken("Inter, sans-serif"),
|
|
3701
|
-
mono: defineToken("ui-monospace, SFMono-Regular, Menlo, monospace")
|
|
4576
|
+
body: kreativCore.defineToken("Inter, sans-serif"),
|
|
4577
|
+
heading: kreativCore.defineToken("Inter, sans-serif"),
|
|
4578
|
+
mono: kreativCore.defineToken("ui-monospace, SFMono-Regular, Menlo, monospace")
|
|
3702
4579
|
},
|
|
3703
4580
|
fontSizes: {
|
|
3704
|
-
xs: defineToken("0.75rem"),
|
|
3705
|
-
sm: defineToken("0.875rem"),
|
|
3706
|
-
md: defineToken("1rem"),
|
|
3707
|
-
lg: defineToken("1.125rem"),
|
|
3708
|
-
xl: defineToken("1.25rem"),
|
|
3709
|
-
"2xl": defineToken("1.5rem"),
|
|
3710
|
-
"3xl": defineToken("1.875rem"),
|
|
3711
|
-
"4xl": defineToken("2.25rem")
|
|
4581
|
+
xs: kreativCore.defineToken("0.75rem"),
|
|
4582
|
+
sm: kreativCore.defineToken("0.875rem"),
|
|
4583
|
+
md: kreativCore.defineToken("1rem"),
|
|
4584
|
+
lg: kreativCore.defineToken("1.125rem"),
|
|
4585
|
+
xl: kreativCore.defineToken("1.25rem"),
|
|
4586
|
+
"2xl": kreativCore.defineToken("1.5rem"),
|
|
4587
|
+
"3xl": kreativCore.defineToken("1.875rem"),
|
|
4588
|
+
"4xl": kreativCore.defineToken("2.25rem")
|
|
3712
4589
|
},
|
|
3713
4590
|
fontWeights: {
|
|
3714
|
-
normal: defineToken("400"),
|
|
3715
|
-
medium: defineToken("500"),
|
|
3716
|
-
semibold: defineToken("600"),
|
|
3717
|
-
bold: defineToken("700")
|
|
4591
|
+
normal: kreativCore.defineToken("400"),
|
|
4592
|
+
medium: kreativCore.defineToken("500"),
|
|
4593
|
+
semibold: kreativCore.defineToken("600"),
|
|
4594
|
+
bold: kreativCore.defineToken("700")
|
|
3718
4595
|
},
|
|
3719
4596
|
lineHeights: {
|
|
3720
|
-
tight: defineToken("1.25"),
|
|
3721
|
-
normal: defineToken("1.5"),
|
|
3722
|
-
relaxed: defineToken("1.75")
|
|
4597
|
+
tight: kreativCore.defineToken("1.25"),
|
|
4598
|
+
normal: kreativCore.defineToken("1.5"),
|
|
4599
|
+
relaxed: kreativCore.defineToken("1.75")
|
|
3723
4600
|
},
|
|
3724
4601
|
letterSpacings: {
|
|
3725
|
-
tighter: defineToken("-0.025em"),
|
|
3726
|
-
tight: defineToken("-0.01em"),
|
|
3727
|
-
normal: defineToken("0"),
|
|
3728
|
-
wide: defineToken("0.025em")
|
|
4602
|
+
tighter: kreativCore.defineToken("-0.025em"),
|
|
4603
|
+
tight: kreativCore.defineToken("-0.01em"),
|
|
4604
|
+
normal: kreativCore.defineToken("0"),
|
|
4605
|
+
wide: kreativCore.defineToken("0.025em")
|
|
3729
4606
|
},
|
|
3730
4607
|
animations: {
|
|
3731
|
-
|
|
4608
|
+
spin: kreativCore.defineToken("kui-spin 0.6s linear infinite"),
|
|
4609
|
+
"fade-in": kreativCore.defineToken("kui-fade-in 0.15s ease-out"),
|
|
4610
|
+
"fade-out": kreativCore.defineToken("kui-fade-out 0.15s ease-in"),
|
|
4611
|
+
"scale-in": kreativCore.defineToken("kui-scale-in 0.15s ease-out"),
|
|
4612
|
+
"scale-out": kreativCore.defineToken("kui-scale-out 0.15s ease-in"),
|
|
4613
|
+
"slide-up": kreativCore.defineToken("kui-slide-up 0.2s ease-out"),
|
|
4614
|
+
"slide-down": kreativCore.defineToken("kui-slide-down 0.2s ease-out"),
|
|
4615
|
+
"slide-left": kreativCore.defineToken("kui-slide-left 0.2s ease-out"),
|
|
4616
|
+
"slide-right": kreativCore.defineToken("kui-slide-right 0.2s ease-out"),
|
|
4617
|
+
"slide-in-next": kreativCore.defineToken("kui-slide-in-next 0.2s ease-out"),
|
|
4618
|
+
"slide-in-prev": kreativCore.defineToken("kui-slide-in-prev 0.2s ease-out"),
|
|
4619
|
+
bounce: kreativCore.defineToken("kui-bounce 0.8s infinite"),
|
|
4620
|
+
pulse: kreativCore.defineToken("kui-pulse 1.5s ease-in-out infinite"),
|
|
4621
|
+
shake: kreativCore.defineToken("kui-shake 0.25s ease-in-out"),
|
|
4622
|
+
shimmer: kreativCore.defineToken("kui-shimmer 1.5s linear infinite"),
|
|
4623
|
+
expand: kreativCore.defineToken("kui-expand 0.2s ease-out"),
|
|
4624
|
+
collapse: kreativCore.defineToken("kui-collapse 0.2s ease-in"),
|
|
4625
|
+
ping: kreativCore.defineToken("kui-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"),
|
|
4626
|
+
"state-error": kreativCore.defineToken("kui-state-error 500ms ease-out 3 500ms"),
|
|
4627
|
+
"state-success": kreativCore.defineToken("kui-state-success 500ms ease-out 2 500ms"),
|
|
4628
|
+
"state-warning": kreativCore.defineToken("kui-state-warning 500ms ease-out 2 500ms")
|
|
4629
|
+
},
|
|
4630
|
+
breakpoints: {
|
|
4631
|
+
sm: kreativCore.defineToken("640px"),
|
|
4632
|
+
md: kreativCore.defineToken("768px"),
|
|
4633
|
+
lg: kreativCore.defineToken("1024px"),
|
|
4634
|
+
xl: kreativCore.defineToken("1280px"),
|
|
4635
|
+
"2xl": kreativCore.defineToken("1536px")
|
|
3732
4636
|
}
|
|
3733
4637
|
};
|
|
3734
|
-
|
|
3735
|
-
// src/theme/defaults/semanticTokens.ts
|
|
3736
4638
|
var defaultSemanticTokens = {
|
|
3737
4639
|
colors: {
|
|
3738
|
-
brand: defineSemanticToken("{colors.blue.500}", "{colors.blue.400}"),
|
|
3739
|
-
brandHover: defineSemanticToken("{colors.blue.600}", "{colors.blue.300}"),
|
|
3740
|
-
brandFg:
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
4640
|
+
brand: kreativCore.defineSemanticToken("{colors.blue.500}", "{colors.blue.400}"),
|
|
4641
|
+
brandHover: kreativCore.defineSemanticToken("{colors.blue.600}", "{colors.blue.300}"),
|
|
4642
|
+
brandFg: kreativCore.defineSemanticToken("{colors.white}"),
|
|
4643
|
+
background: kreativCore.defineSemanticToken("{colors.gray.50}", "{colors.gray.950}"),
|
|
4644
|
+
surface: kreativCore.defineSemanticToken("{colors.white}", "{colors.gray.900}"),
|
|
4645
|
+
surfaceRaised: kreativCore.defineSemanticToken("{colors.gray.50}", "{colors.gray.800}"),
|
|
4646
|
+
surfaceSunken: kreativCore.defineSemanticToken(
|
|
3744
4647
|
"{colors.gray.100}",
|
|
3745
4648
|
"{colors.gray.950}"
|
|
3746
4649
|
),
|
|
3747
|
-
border: defineSemanticToken("{colors.gray.200}", "{colors.gray.600}"),
|
|
3748
|
-
text: defineSemanticToken("{colors.gray.900}", "{colors.gray.50}"),
|
|
3749
|
-
textMuted: defineSemanticToken("{colors.gray.500}", "{colors.gray.400}"),
|
|
3750
|
-
destructive: defineSemanticToken("{colors.red.500}", "{colors.red.400}"),
|
|
3751
|
-
destructiveFg:
|
|
3752
|
-
destructiveHover: defineSemanticToken(
|
|
4650
|
+
border: kreativCore.defineSemanticToken("{colors.gray.200}", "{colors.gray.600}"),
|
|
4651
|
+
text: kreativCore.defineSemanticToken("{colors.gray.900}", "{colors.gray.50}"),
|
|
4652
|
+
textMuted: kreativCore.defineSemanticToken("{colors.gray.500}", "{colors.gray.400}"),
|
|
4653
|
+
destructive: kreativCore.defineSemanticToken("{colors.red.500}", "{colors.red.400}"),
|
|
4654
|
+
destructiveFg: kreativCore.defineSemanticToken("{colors.white}"),
|
|
4655
|
+
destructiveHover: kreativCore.defineSemanticToken(
|
|
3753
4656
|
"{colors.red.600}",
|
|
3754
4657
|
"{colors.red.300}"
|
|
3755
4658
|
),
|
|
3756
|
-
success: defineSemanticToken("{colors.green.500}", "{colors.green.400}"),
|
|
3757
|
-
successFg:
|
|
3758
|
-
successHover: defineSemanticToken(
|
|
4659
|
+
success: kreativCore.defineSemanticToken("{colors.green.500}", "{colors.green.400}"),
|
|
4660
|
+
successFg: kreativCore.defineSemanticToken("{colors.white}"),
|
|
4661
|
+
successHover: kreativCore.defineSemanticToken(
|
|
3759
4662
|
"{colors.green.600}",
|
|
3760
4663
|
"{colors.green.300}"
|
|
3761
4664
|
),
|
|
3762
|
-
warning: defineSemanticToken("{colors.amber.500}", "{colors.amber.400}"),
|
|
3763
|
-
warningFg:
|
|
3764
|
-
warningHover: defineSemanticToken(
|
|
4665
|
+
warning: kreativCore.defineSemanticToken("{colors.amber.500}", "{colors.amber.400}"),
|
|
4666
|
+
warningFg: kreativCore.defineSemanticToken("{colors.black}"),
|
|
4667
|
+
warningHover: kreativCore.defineSemanticToken(
|
|
3765
4668
|
"{colors.amber.600}",
|
|
3766
|
-
"{colors.amber.300}"
|
|
3767
|
-
),
|
|
3768
|
-
info: defineSemanticToken("{colors.cyan.500}", "{colors.cyan.400}"),
|
|
3769
|
-
infoFg:
|
|
3770
|
-
infoHover: defineSemanticToken("{colors.cyan.600}", "{colors.cyan.300}")
|
|
3771
|
-
|
|
3772
|
-
}
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
function defineTypography(typography) {
|
|
3776
|
-
return typography;
|
|
3777
|
-
}
|
|
3778
|
-
__name(defineTypography, "defineTypography");
|
|
3779
|
-
|
|
3780
|
-
// src/theme/typography/extendTypography.ts
|
|
3781
|
-
function extendTypography(override) {
|
|
3782
|
-
if (!override) {
|
|
3783
|
-
return { ...defaultTypography };
|
|
3784
|
-
}
|
|
3785
|
-
const result = { ...defaultTypography };
|
|
3786
|
-
for (const key of Object.keys(override)) {
|
|
3787
|
-
const variant = key;
|
|
3788
|
-
result[variant] = {
|
|
3789
|
-
...defaultTypography[variant],
|
|
3790
|
-
...override[variant]
|
|
3791
|
-
};
|
|
3792
|
-
}
|
|
3793
|
-
return result;
|
|
3794
|
-
}
|
|
3795
|
-
__name(extendTypography, "extendTypography");
|
|
3796
|
-
|
|
3797
|
-
// src/theme/defaults/typography.ts
|
|
3798
|
-
var defaultTypography = defineTypography({
|
|
4669
|
+
"{colors.amber.300}"
|
|
4670
|
+
),
|
|
4671
|
+
info: kreativCore.defineSemanticToken("{colors.cyan.500}", "{colors.cyan.400}"),
|
|
4672
|
+
infoFg: kreativCore.defineSemanticToken("{colors.white}"),
|
|
4673
|
+
infoHover: kreativCore.defineSemanticToken("{colors.cyan.600}", "{colors.cyan.300}"),
|
|
4674
|
+
shadowColor: kreativCore.defineSemanticToken("{colors.gray.200}", "{colors.gray.600}")
|
|
4675
|
+
}
|
|
4676
|
+
};
|
|
4677
|
+
var defaultTypography = kreativCore.defineTypography({
|
|
3799
4678
|
body: {
|
|
3800
4679
|
fontFamily: "{fonts.body}",
|
|
3801
4680
|
fontWeight: "{fontWeights.normal}",
|
|
@@ -3834,53 +4713,133 @@ var defaultTypography = defineTypography({
|
|
|
3834
4713
|
fontSize: "{fontSizes.xs}",
|
|
3835
4714
|
fontWeight: "{fontWeights.normal}",
|
|
3836
4715
|
lineHeight: "{lineHeights.normal}"
|
|
4716
|
+
},
|
|
4717
|
+
sizeXs: {
|
|
4718
|
+
fontFamily: "{fonts.body}",
|
|
4719
|
+
fontSize: "{fontSizes.xs}",
|
|
4720
|
+
fontWeight: "{fontWeights.normal}",
|
|
4721
|
+
lineHeight: "{lineHeights.normal}"
|
|
4722
|
+
},
|
|
4723
|
+
sizeSm: {
|
|
4724
|
+
fontFamily: "{fonts.body}",
|
|
4725
|
+
fontSize: "{fontSizes.sm}",
|
|
4726
|
+
fontWeight: "{fontWeights.normal}",
|
|
4727
|
+
lineHeight: "{lineHeights.normal}"
|
|
4728
|
+
},
|
|
4729
|
+
sizeMd: {
|
|
4730
|
+
fontFamily: "{fonts.body}",
|
|
4731
|
+
fontSize: "{fontSizes.sm}",
|
|
4732
|
+
fontWeight: "{fontWeights.normal}",
|
|
4733
|
+
lineHeight: "{lineHeights.normal}"
|
|
4734
|
+
},
|
|
4735
|
+
sizeLg: {
|
|
4736
|
+
fontFamily: "{fonts.body}",
|
|
4737
|
+
fontSize: "{fontSizes.md}",
|
|
4738
|
+
fontWeight: "{fontWeights.normal}",
|
|
4739
|
+
lineHeight: "{lineHeights.normal}"
|
|
4740
|
+
},
|
|
4741
|
+
sizeXl: {
|
|
4742
|
+
fontFamily: "{fonts.body}",
|
|
4743
|
+
fontSize: "{fontSizes.xl}",
|
|
4744
|
+
fontWeight: "{fontWeights.medium}",
|
|
4745
|
+
lineHeight: "{lineHeights.tight}"
|
|
3837
4746
|
}
|
|
3838
4747
|
});
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
4748
|
+
var defaultSizes = kreativCore.defineSizes({
|
|
4749
|
+
xs: {
|
|
4750
|
+
height: "1.75rem",
|
|
4751
|
+
width: "1.75rem",
|
|
4752
|
+
paddingX: "0.5rem",
|
|
4753
|
+
fontSize: "{typography.sizeXs}",
|
|
4754
|
+
gap: "0.25rem",
|
|
4755
|
+
iconSize: "0.75rem",
|
|
4756
|
+
radius: "0.65rem",
|
|
4757
|
+
separatorSize: "15px"
|
|
4758
|
+
},
|
|
4759
|
+
sm: {
|
|
4760
|
+
height: "2rem",
|
|
4761
|
+
width: "2rem",
|
|
4762
|
+
paddingX: "0.75rem",
|
|
4763
|
+
fontSize: "{typography.sizeSm}",
|
|
4764
|
+
gap: "0.375rem",
|
|
4765
|
+
iconSize: "0.875rem",
|
|
4766
|
+
radius: "0.8rem",
|
|
4767
|
+
separatorSize: "20px"
|
|
4768
|
+
},
|
|
4769
|
+
md: {
|
|
4770
|
+
height: "2.5rem",
|
|
4771
|
+
width: "2.5rem",
|
|
4772
|
+
paddingX: "1rem",
|
|
4773
|
+
fontSize: "{typography.sizeMd}",
|
|
4774
|
+
gap: "0.5rem",
|
|
4775
|
+
iconSize: "1rem",
|
|
4776
|
+
radius: "1rem",
|
|
4777
|
+
separatorSize: "25px"
|
|
4778
|
+
},
|
|
4779
|
+
lg: {
|
|
4780
|
+
height: "3rem",
|
|
4781
|
+
width: "3rem",
|
|
4782
|
+
paddingX: "1.25rem",
|
|
4783
|
+
fontSize: "{typography.sizeLg}",
|
|
4784
|
+
gap: "0.625rem",
|
|
4785
|
+
iconSize: "1.25rem",
|
|
4786
|
+
radius: "1.15rem",
|
|
4787
|
+
separatorSize: "30px"
|
|
4788
|
+
},
|
|
4789
|
+
xl: {
|
|
4790
|
+
height: "3.5rem",
|
|
4791
|
+
width: "3.5rem",
|
|
4792
|
+
paddingX: "1.5rem",
|
|
4793
|
+
fontSize: "{typography.sizeXl}",
|
|
4794
|
+
gap: "0.875rem",
|
|
4795
|
+
iconSize: "1.5rem",
|
|
4796
|
+
radius: "1.3rem",
|
|
4797
|
+
separatorSize: "35px"
|
|
4798
|
+
}
|
|
4799
|
+
});
|
|
4800
|
+
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";
|
|
3842
4801
|
var buttonVariants = {
|
|
3843
|
-
solid: "",
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
link: "bg-transparent p-0 h-auto hover:underline"
|
|
4802
|
+
solid: "ease-[cubic-bezier(0.34,1.56,0.64,1)] active:scale-[0.97]",
|
|
4803
|
+
soft: "ease-[cubic-bezier(0.34,1.56,0.64,1)] active:scale-[0.97]",
|
|
4804
|
+
outline: "border bg-transparent ease-out active:scale-[0.98]",
|
|
4805
|
+
ghost: "bg-transparent ease-out active:scale-[0.98]",
|
|
4806
|
+
link: "bg-transparent p-0 h-auto hover:underline ease-out"
|
|
3848
4807
|
};
|
|
3849
4808
|
var buttonColors = {
|
|
3850
4809
|
brand: {
|
|
3851
|
-
solid: "bg-brand text-brand-fg hover:bg-brand-hover",
|
|
3852
|
-
outline: "border-brand text-brand hover:bg-brand/10",
|
|
3853
|
-
ghost: "text-brand hover:bg-brand/10",
|
|
3854
|
-
soft: "bg-brand/10 text-brand hover:bg-brand/20",
|
|
3855
|
-
link: "text-brand"
|
|
4810
|
+
solid: "bg-kui-brand text-kui-brand-fg hover:bg-kui-brand-hover",
|
|
4811
|
+
outline: "border-kui-brand text-kui-brand hover:bg-kui-brand/10",
|
|
4812
|
+
ghost: "text-kui-brand hover:bg-kui-brand/10",
|
|
4813
|
+
soft: "bg-kui-brand/10 text-kui-brand hover:bg-kui-brand/20",
|
|
4814
|
+
link: "text-kui-brand"
|
|
3856
4815
|
},
|
|
3857
4816
|
destructive: {
|
|
3858
|
-
solid: "bg-destructive text-destructive-fg hover:bg-destructive-hover",
|
|
3859
|
-
outline: "border-destructive text-destructive hover:bg-destructive/10",
|
|
3860
|
-
ghost: "text-destructive hover:bg-destructive/10",
|
|
3861
|
-
soft: "bg-destructive/10 text-destructive hover:bg-destructive/20",
|
|
3862
|
-
link: "text-destructive"
|
|
4817
|
+
solid: "bg-kui-destructive text-kui-destructive-fg hover:bg-kui-destructive-hover",
|
|
4818
|
+
outline: "border-kui-destructive text-kui-destructive hover:bg-kui-destructive/10",
|
|
4819
|
+
ghost: "text-kui-destructive hover:bg-kui-destructive/10",
|
|
4820
|
+
soft: "bg-kui-destructive/10 text-kui-destructive hover:bg-kui-destructive/20",
|
|
4821
|
+
link: "text-kui-destructive"
|
|
3863
4822
|
},
|
|
3864
4823
|
success: {
|
|
3865
|
-
solid: "bg-success text-success-fg hover:bg-success-hover",
|
|
3866
|
-
outline: "border-success text-success hover:bg-success/10",
|
|
3867
|
-
ghost: "text-success hover:bg-success/10",
|
|
3868
|
-
soft: "bg-success/10 text-success hover:bg-success/20",
|
|
3869
|
-
link: "text-success"
|
|
4824
|
+
solid: "bg-kui-success text-kui-success-fg hover:bg-kui-success-hover",
|
|
4825
|
+
outline: "border-kui-success text-kui-success hover:bg-kui-success/10",
|
|
4826
|
+
ghost: "text-kui-success hover:bg-kui-success/10",
|
|
4827
|
+
soft: "bg-kui-success/10 text-kui-success hover:bg-kui-success/20",
|
|
4828
|
+
link: "text-kui-success"
|
|
3870
4829
|
},
|
|
3871
4830
|
warning: {
|
|
3872
|
-
solid: "bg-warning text-warning-fg hover:bg-warning-hover",
|
|
3873
|
-
outline: "border-warning text-warning hover:bg-warning/10",
|
|
3874
|
-
ghost: "text-warning hover:bg-warning/10",
|
|
3875
|
-
soft: "bg-warning/10 text-warning hover:bg-warning/20",
|
|
3876
|
-
link: "text-warning"
|
|
4831
|
+
solid: "bg-kui-warning text-kui-warning-fg hover:bg-kui-warning-hover",
|
|
4832
|
+
outline: "border-kui-warning text-kui-warning hover:bg-kui-warning/10",
|
|
4833
|
+
ghost: "text-kui-warning hover:bg-kui-warning/10",
|
|
4834
|
+
soft: "bg-kui-warning/10 text-kui-warning hover:bg-kui-warning/20",
|
|
4835
|
+
link: "text-kui-warning"
|
|
3877
4836
|
},
|
|
3878
4837
|
info: {
|
|
3879
|
-
solid: "bg-info text-info-fg hover:bg-info-hover",
|
|
3880
|
-
outline: "border-info text-info hover:bg-info/10",
|
|
3881
|
-
ghost: "text-info hover:bg-info/10",
|
|
3882
|
-
soft: "bg-info/10 text-info hover:bg-info/20",
|
|
3883
|
-
link: "text-info"
|
|
4838
|
+
solid: "bg-kui-info text-kui-info-fg hover:bg-kui-info-hover",
|
|
4839
|
+
outline: "border-kui-info text-kui-info hover:bg-kui-info/10",
|
|
4840
|
+
ghost: "text-kui-info hover:bg-kui-info/10",
|
|
4841
|
+
soft: "bg-kui-info/10 text-kui-info hover:bg-kui-info/20",
|
|
4842
|
+
link: "text-kui-info"
|
|
3884
4843
|
},
|
|
3885
4844
|
white: {
|
|
3886
4845
|
solid: "bg-white text-black hover:bg-gray-50",
|
|
@@ -3890,11 +4849,18 @@ var buttonColors = {
|
|
|
3890
4849
|
link: "text-white"
|
|
3891
4850
|
},
|
|
3892
4851
|
neutral: {
|
|
3893
|
-
solid: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
3894
|
-
outline: "border-border text-text hover:bg-surface-raised",
|
|
3895
|
-
ghost: "text-text hover:bg-surface-raised",
|
|
3896
|
-
soft: "bg-surface-raised text-text hover:bg-surface-sunken",
|
|
3897
|
-
link: "text-text"
|
|
4852
|
+
solid: "bg-kui-surface-raised text-kui-text hover:bg-kui-surface-sunken",
|
|
4853
|
+
outline: "border-kui-border text-kui-text hover:bg-kui-surface-raised",
|
|
4854
|
+
ghost: "text-kui-text hover:bg-kui-surface-raised",
|
|
4855
|
+
soft: "bg-kui-surface-raised text-kui-text hover:bg-kui-surface-sunken",
|
|
4856
|
+
link: "text-kui-text"
|
|
4857
|
+
},
|
|
4858
|
+
inherit: {
|
|
4859
|
+
solid: "[background-color:var(--kui-inherit-bg)] [color:var(--kui-inherit-fg)]",
|
|
4860
|
+
outline: "[border-color:var(--kui-inherit-border)] [color:var(--kui-inherit-fg)] bg-transparent",
|
|
4861
|
+
ghost: "[color:var(--kui-inherit-fg)] bg-transparent",
|
|
4862
|
+
soft: "[background-color:var(--kui-inherit-soft-bg)] [color:var(--kui-inherit-fg)]",
|
|
4863
|
+
link: "[color:var(--kui-inherit-fg)] bg-transparent"
|
|
3898
4864
|
}
|
|
3899
4865
|
};
|
|
3900
4866
|
var buildCompoundVariants = /* @__PURE__ */ __name(() => {
|
|
@@ -3909,7 +4875,7 @@ var buildCompoundVariants = /* @__PURE__ */ __name(() => {
|
|
|
3909
4875
|
}
|
|
3910
4876
|
return compounds;
|
|
3911
4877
|
}, "buildCompoundVariants");
|
|
3912
|
-
var buttonRecipe = defineRecipe({
|
|
4878
|
+
var buttonRecipe = kreativCore.defineRecipe({
|
|
3913
4879
|
base: buttonBase,
|
|
3914
4880
|
variants: {
|
|
3915
4881
|
variant: buttonVariants,
|
|
@@ -3923,26 +4889,29 @@ var buttonRecipe = defineRecipe({
|
|
|
3923
4889
|
},
|
|
3924
4890
|
compoundVariants: buildCompoundVariants()
|
|
3925
4891
|
});
|
|
3926
|
-
|
|
3927
|
-
// src/theme/defaults/recipes/formControl.ts
|
|
3928
4892
|
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 focus-within:ring-offset-2 focus-within:ring-offset-surface";
|
|
3929
4893
|
var formControlVariants = {
|
|
3930
|
-
outline: "border border-border bg-transparent text-text",
|
|
3931
|
-
filled: "border border-transparent bg-surface-raised text-text",
|
|
3932
|
-
ghost: "border border-transparent bg-transparent text-text"
|
|
4894
|
+
outline: "border border-kui-border bg-transparent text-kui-text",
|
|
4895
|
+
filled: "border border-transparent bg-kui-surface-raised text-kui-text",
|
|
4896
|
+
ghost: "border border-transparent bg-transparent text-kui-text"
|
|
3933
4897
|
};
|
|
3934
4898
|
var standaloneStates = {
|
|
3935
|
-
none: "hover:border-brand focus-within:ring-2 focus-within:ring-brand/20",
|
|
3936
|
-
error: "border-destructive hover:border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
3937
|
-
success: "border-success hover:border-success focus-within:ring-2 focus-within:ring-success/20",
|
|
3938
|
-
warning: "border-warning hover:border-warning focus-within:ring-2 focus-within:ring-warning/20"
|
|
4899
|
+
none: "hover:border-kui-brand focus-within:ring-2 focus-within:ring-kui-brand/20",
|
|
4900
|
+
error: "border-kui-destructive hover:border-kui-destructive focus-within:ring-2 focus-within:ring-kui-destructive/20",
|
|
4901
|
+
success: "border-kui-success hover:border-kui-success focus-within:ring-2 focus-within:ring-kui-success/20",
|
|
4902
|
+
warning: "border-kui-warning hover:border-kui-warning focus-within:ring-2 focus-within:ring-kui-warning/20"
|
|
3939
4903
|
};
|
|
3940
|
-
var
|
|
4904
|
+
var borderlessControl = "rounded-none border-0! shadow-none! hover:border-0! hover:bg-transparent! focus-within:ring-0! focus-within:ring-offset-0! focus-within-outline-none!";
|
|
4905
|
+
var formControlRecipe = kreativCore.defineRecipe({
|
|
3941
4906
|
base: formControlBase,
|
|
3942
4907
|
variants: {
|
|
3943
4908
|
variant: formControlVariants,
|
|
3944
4909
|
embedded: {
|
|
3945
|
-
true:
|
|
4910
|
+
true: borderlessControl,
|
|
4911
|
+
false: ""
|
|
4912
|
+
},
|
|
4913
|
+
groupItem: {
|
|
4914
|
+
true: borderlessControl,
|
|
3946
4915
|
false: ""
|
|
3947
4916
|
},
|
|
3948
4917
|
state: standaloneStates,
|
|
@@ -3955,7 +4924,11 @@ var formControlRecipe = defineRecipe({
|
|
|
3955
4924
|
false: ""
|
|
3956
4925
|
},
|
|
3957
4926
|
disabled: {
|
|
3958
|
-
true: "cursor-not-allowed opacity-50 border-border hover:border-border focus-within:ring-0",
|
|
4927
|
+
true: "cursor-not-allowed opacity-50 border-kui-border hover:border-kui-border focus-within:ring-0",
|
|
4928
|
+
false: ""
|
|
4929
|
+
},
|
|
4930
|
+
attached: {
|
|
4931
|
+
true: "rounded-r-none",
|
|
3959
4932
|
false: ""
|
|
3960
4933
|
},
|
|
3961
4934
|
hasAdornment: {
|
|
@@ -3965,19 +4938,59 @@ var formControlRecipe = defineRecipe({
|
|
|
3965
4938
|
},
|
|
3966
4939
|
compoundVariants: [
|
|
3967
4940
|
{
|
|
3968
|
-
conditions: {
|
|
4941
|
+
conditions: {
|
|
4942
|
+
embedded: true,
|
|
4943
|
+
state: "none"
|
|
4944
|
+
},
|
|
4945
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
4946
|
+
},
|
|
4947
|
+
{
|
|
4948
|
+
conditions: {
|
|
4949
|
+
embedded: true,
|
|
4950
|
+
state: "error"
|
|
4951
|
+
},
|
|
4952
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
4953
|
+
},
|
|
4954
|
+
{
|
|
4955
|
+
conditions: {
|
|
4956
|
+
embedded: true,
|
|
4957
|
+
state: "success"
|
|
4958
|
+
},
|
|
4959
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
4960
|
+
},
|
|
4961
|
+
{
|
|
4962
|
+
conditions: {
|
|
4963
|
+
embedded: true,
|
|
4964
|
+
state: "warning"
|
|
4965
|
+
},
|
|
4966
|
+
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
4967
|
+
},
|
|
4968
|
+
{
|
|
4969
|
+
conditions: {
|
|
4970
|
+
groupItem: true,
|
|
4971
|
+
state: "none"
|
|
4972
|
+
},
|
|
3969
4973
|
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3970
4974
|
},
|
|
3971
4975
|
{
|
|
3972
|
-
conditions: {
|
|
4976
|
+
conditions: {
|
|
4977
|
+
groupItem: true,
|
|
4978
|
+
state: "error"
|
|
4979
|
+
},
|
|
3973
4980
|
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3974
4981
|
},
|
|
3975
4982
|
{
|
|
3976
|
-
conditions: {
|
|
4983
|
+
conditions: {
|
|
4984
|
+
groupItem: true,
|
|
4985
|
+
state: "success"
|
|
4986
|
+
},
|
|
3977
4987
|
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3978
4988
|
},
|
|
3979
4989
|
{
|
|
3980
|
-
conditions: {
|
|
4990
|
+
conditions: {
|
|
4991
|
+
groupItem: true,
|
|
4992
|
+
state: "warning"
|
|
4993
|
+
},
|
|
3981
4994
|
className: "border-0! shadow-none! focus-within:ring-0! hover:border-0!"
|
|
3982
4995
|
},
|
|
3983
4996
|
{
|
|
@@ -3985,21 +4998,21 @@ var formControlRecipe = defineRecipe({
|
|
|
3985
4998
|
disabled: true,
|
|
3986
4999
|
state: "error"
|
|
3987
5000
|
},
|
|
3988
|
-
className: "border-border hover:border-border focus-within:ring-0"
|
|
5001
|
+
className: "border-kui-border hover:border-kui-border focus-within:ring-0"
|
|
3989
5002
|
},
|
|
3990
5003
|
{
|
|
3991
5004
|
conditions: {
|
|
3992
5005
|
disabled: true,
|
|
3993
5006
|
state: "success"
|
|
3994
5007
|
},
|
|
3995
|
-
className: "border-border hover:border-border focus-within:ring-0"
|
|
5008
|
+
className: "border-kui-border hover:border-kui-border focus-within:ring-0"
|
|
3996
5009
|
},
|
|
3997
5010
|
{
|
|
3998
5011
|
conditions: {
|
|
3999
5012
|
disabled: true,
|
|
4000
5013
|
state: "warning"
|
|
4001
5014
|
},
|
|
4002
|
-
className: "border-border hover:border-border focus-within:ring-0"
|
|
5015
|
+
className: "border-kui-border hover:border-kui-border focus-within:ring-0"
|
|
4003
5016
|
},
|
|
4004
5017
|
{
|
|
4005
5018
|
conditions: {
|
|
@@ -4007,22 +5020,29 @@ var formControlRecipe = defineRecipe({
|
|
|
4007
5020
|
disabled: true
|
|
4008
5021
|
},
|
|
4009
5022
|
className: "border-0! hover:border-0! focus-within:ring-0! cursor-default"
|
|
5023
|
+
},
|
|
5024
|
+
{
|
|
5025
|
+
conditions: {
|
|
5026
|
+
groupItem: true,
|
|
5027
|
+
disabled: true
|
|
5028
|
+
},
|
|
5029
|
+
className: "border-0! hover:border-0! focus-within:ring-0! cursor-default"
|
|
4010
5030
|
}
|
|
4011
5031
|
],
|
|
4012
5032
|
defaultVariants: {
|
|
4013
5033
|
variant: "outline",
|
|
4014
5034
|
state: "none",
|
|
4015
5035
|
embedded: false,
|
|
5036
|
+
groupItem: false,
|
|
4016
5037
|
rounded: false,
|
|
4017
5038
|
fullWidth: true,
|
|
4018
5039
|
disabled: false,
|
|
4019
|
-
hasAdornment: false
|
|
5040
|
+
hasAdornment: false,
|
|
5041
|
+
attached: false
|
|
4020
5042
|
}
|
|
4021
5043
|
});
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
var inputBase2 = "flex min-w-0 flex-1 font-sans bg-transparent border-0 outline-none transition-colors duration-[var(--kui-duration-fast)] placeholder:text-text-muted disabled:cursor-not-allowed";
|
|
4025
|
-
var inputRecipe = defineRecipe({
|
|
5044
|
+
var inputBase2 = "flex min-w-0 flex-1 font-sans bg-transparent border-0 outline-none transition-colors duration-[var(--kui-duration-fast)] placeholder:text-kui-text-muted disabled:cursor-not-allowed";
|
|
5045
|
+
var inputRecipe = kreativCore.defineRecipe({
|
|
4026
5046
|
base: inputBase2,
|
|
4027
5047
|
variants: {
|
|
4028
5048
|
variant: {
|
|
@@ -4035,10 +5055,8 @@ var inputRecipe = defineRecipe({
|
|
|
4035
5055
|
variant: "outline"
|
|
4036
5056
|
}
|
|
4037
5057
|
});
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
var textareaRecipe = defineRecipe({
|
|
4041
|
-
base: "flex w-full min-w-0 bg-transparent outline-none border-0 text-text placeholder:text-text-muted transition-colors duration-[var(--kui-duration-fast)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 kui-scrollbar",
|
|
5058
|
+
var textareaRecipe = kreativCore.defineRecipe({
|
|
5059
|
+
base: "flex w-full min-w-0 bg-transparent outline-none border-0 text-kui-text placeholder:text-kui-text-muted transition-colors duration-[var(--kui-duration-fast)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 kui-scrollbar",
|
|
4042
5060
|
variants: {
|
|
4043
5061
|
variant: {
|
|
4044
5062
|
outline: "",
|
|
@@ -4062,24 +5080,22 @@ var textareaRecipe = defineRecipe({
|
|
|
4062
5080
|
autoResize: false
|
|
4063
5081
|
}
|
|
4064
5082
|
});
|
|
4065
|
-
|
|
4066
|
-
// src/theme/defaults/recipes/markdownEditor.ts
|
|
4067
|
-
var markdownEditorRecipe = defineRecipe({
|
|
5083
|
+
var markdownEditorRecipe = kreativCore.defineRecipe({
|
|
4068
5084
|
base: "group relative w-full overflow-hidden rounded-[var(--kui-radii-md)] transition-[border-color,box-shadow] duration-[var(--kui-duration-fast)]",
|
|
4069
5085
|
variants: {
|
|
4070
5086
|
variant: {
|
|
4071
|
-
outline: "border border-border bg-transparent",
|
|
4072
|
-
filled: "border border-transparent bg-surface-raised",
|
|
5087
|
+
outline: "border border-kui-border bg-transparent",
|
|
5088
|
+
filled: "border border-transparent bg-kui-surface-raised",
|
|
4073
5089
|
ghost: "border border-transparent bg-transparent"
|
|
4074
5090
|
},
|
|
4075
5091
|
state: {
|
|
4076
|
-
none: "hover:border-brand focus-within:ring-2 focus-within:ring-brand/20",
|
|
4077
|
-
error: "border-destructive focus-within:ring-2 focus-within:ring-destructive/20",
|
|
4078
|
-
success: "border-success focus-within:ring-2 focus-within:ring-success/20",
|
|
4079
|
-
warning: "border-warning focus-within:ring-2 focus-within:ring-warning/20"
|
|
5092
|
+
none: "hover:border-kui-brand focus-within:ring-2 focus-within:ring-kui-brand/20",
|
|
5093
|
+
error: "border-kui-destructive focus-within:ring-2 focus-within:ring-kui-destructive/20",
|
|
5094
|
+
success: "border-kui-success focus-within:ring-2 focus-within:ring-kui-success/20",
|
|
5095
|
+
warning: "border-kui-warning focus-within:ring-2 focus-within:ring-kui-warning/20"
|
|
4080
5096
|
},
|
|
4081
5097
|
disabled: {
|
|
4082
|
-
true: "cursor-not-allowed opacity-50 border-border hover:border-border focus-within:ring-0",
|
|
5098
|
+
true: "cursor-not-allowed opacity-50 border-kui-border hover:border-kui-border focus-within:ring-0",
|
|
4083
5099
|
false: ""
|
|
4084
5100
|
},
|
|
4085
5101
|
fullWidth: {
|
|
@@ -4093,61 +5109,17 @@ var markdownEditorRecipe = defineRecipe({
|
|
|
4093
5109
|
fullWidth: true
|
|
4094
5110
|
}
|
|
4095
5111
|
});
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
function defineSizes(sizes) {
|
|
4099
|
-
return sizes;
|
|
4100
|
-
}
|
|
4101
|
-
__name(defineSizes, "defineSizes");
|
|
4102
|
-
|
|
4103
|
-
// src/theme/defaults/sizes.ts
|
|
4104
|
-
var defaultSizes = defineSizes({
|
|
4105
|
-
xs: {
|
|
4106
|
-
height: "1.75rem",
|
|
4107
|
-
paddingX: "0.5rem",
|
|
4108
|
-
fontSize: "0.75rem",
|
|
4109
|
-
gap: "0.25rem",
|
|
4110
|
-
iconSize: "0.875rem",
|
|
4111
|
-
radius: "0.65rem"
|
|
4112
|
-
},
|
|
4113
|
-
sm: {
|
|
4114
|
-
height: "2rem",
|
|
4115
|
-
paddingX: "0.75rem",
|
|
4116
|
-
fontSize: "0.8125rem",
|
|
4117
|
-
gap: "0.375rem",
|
|
4118
|
-
iconSize: "1rem",
|
|
4119
|
-
radius: "0.8rem"
|
|
4120
|
-
},
|
|
4121
|
-
md: {
|
|
4122
|
-
height: "2.5rem",
|
|
4123
|
-
paddingX: "1rem",
|
|
4124
|
-
fontSize: "0.875rem",
|
|
4125
|
-
gap: "0.5rem",
|
|
4126
|
-
iconSize: "1.125rem",
|
|
4127
|
-
radius: "1rem"
|
|
4128
|
-
},
|
|
4129
|
-
lg: {
|
|
4130
|
-
height: "3.5rem",
|
|
4131
|
-
paddingX: "1.5rem",
|
|
4132
|
-
fontSize: "1rem",
|
|
4133
|
-
gap: "0.625rem",
|
|
4134
|
-
iconSize: "1.25rem",
|
|
4135
|
-
radius: "1.15rem"
|
|
4136
|
-
}
|
|
4137
|
-
});
|
|
4138
|
-
|
|
4139
|
-
// src/theme/defaults/recipes/checkbox.ts
|
|
4140
|
-
var checkboxRecipe = defineRecipe({
|
|
4141
|
-
base: "relative inline-flex shrink-0 items-center justify-center border transition-colors duration-[var(--kui-duration-fast)] peer-focus-visible:ring-2 peer-focus-visible:ring-brand peer-focus-visible:ring-offset-1",
|
|
5112
|
+
var checkboxRecipe = kreativCore.defineRecipe({
|
|
5113
|
+
base: "relative inline-flex shrink-0 items-center justify-center border transition-colors duration-[var(--kui-duration-fast)] peer-focus-visible:ring-2 peer-focus-visible:ring-kui-brand peer-focus-visible:ring-offset-1",
|
|
4142
5114
|
variants: {
|
|
4143
5115
|
state: {
|
|
4144
|
-
none: "border-border",
|
|
4145
|
-
error: "border-destructive",
|
|
4146
|
-
success: "border-success",
|
|
4147
|
-
warning: "border-warning"
|
|
5116
|
+
none: "border-kui-border",
|
|
5117
|
+
error: "border-kui-destructive",
|
|
5118
|
+
success: "border-kui-success",
|
|
5119
|
+
warning: "border-kui-warning"
|
|
4148
5120
|
},
|
|
4149
5121
|
checked: {
|
|
4150
|
-
true: "border-brand bg-brand text-brand-fg",
|
|
5122
|
+
true: "border-kui-brand bg-kui-brand text-kui-brand-fg",
|
|
4151
5123
|
false: "bg-transparent"
|
|
4152
5124
|
},
|
|
4153
5125
|
disabled: {
|
|
@@ -4165,21 +5137,21 @@ var checkboxRecipe = defineRecipe({
|
|
|
4165
5137
|
checked: false,
|
|
4166
5138
|
state: "error"
|
|
4167
5139
|
},
|
|
4168
|
-
className: "border-destructive"
|
|
5140
|
+
className: "border-kui-destructive"
|
|
4169
5141
|
},
|
|
4170
5142
|
{
|
|
4171
5143
|
conditions: {
|
|
4172
5144
|
checked: false,
|
|
4173
5145
|
state: "success"
|
|
4174
5146
|
},
|
|
4175
|
-
className: "border-success"
|
|
5147
|
+
className: "border-kui-success"
|
|
4176
5148
|
},
|
|
4177
5149
|
{
|
|
4178
5150
|
conditions: {
|
|
4179
5151
|
checked: false,
|
|
4180
5152
|
state: "warning"
|
|
4181
5153
|
},
|
|
4182
|
-
className: "border-warning"
|
|
5154
|
+
className: "border-kui-warning"
|
|
4183
5155
|
}
|
|
4184
5156
|
],
|
|
4185
5157
|
defaultVariants: {
|
|
@@ -4189,101 +5161,275 @@ var checkboxRecipe = defineRecipe({
|
|
|
4189
5161
|
rounded: false
|
|
4190
5162
|
}
|
|
4191
5163
|
});
|
|
4192
|
-
|
|
4193
|
-
|
|
5164
|
+
var buttonGroupRecipe = kreativCore.defineRecipe({
|
|
5165
|
+
base: ["inline-flex items-center relative isolate", "kui-button-group"].join(
|
|
5166
|
+
" "
|
|
5167
|
+
),
|
|
5168
|
+
variants: {
|
|
5169
|
+
orientation: {
|
|
5170
|
+
horizontal: "flex-row",
|
|
5171
|
+
vertical: "flex-col items-stretch"
|
|
5172
|
+
},
|
|
5173
|
+
attached: {
|
|
5174
|
+
true: "gap-0",
|
|
5175
|
+
false: ""
|
|
5176
|
+
},
|
|
5177
|
+
spacing: {
|
|
5178
|
+
none: "gap-0",
|
|
5179
|
+
sm: "gap-1",
|
|
5180
|
+
md: "gap-2",
|
|
5181
|
+
lg: "gap-3"
|
|
5182
|
+
}
|
|
5183
|
+
},
|
|
5184
|
+
defaultVariants: {
|
|
5185
|
+
orientation: "horizontal",
|
|
5186
|
+
attached: false,
|
|
5187
|
+
spacing: "md"
|
|
5188
|
+
},
|
|
5189
|
+
compoundVariants: [
|
|
5190
|
+
{
|
|
5191
|
+
conditions: {
|
|
5192
|
+
orientation: "horizontal",
|
|
5193
|
+
attached: true
|
|
5194
|
+
},
|
|
5195
|
+
className: [
|
|
5196
|
+
"[&>[data-kui-button-group-item]]:rounded-none",
|
|
5197
|
+
"[&>[data-kui-button-group-item]:first-child]:rounded-l-md",
|
|
5198
|
+
"[&>[data-kui-button-group-item]:last-child]:rounded-r-md",
|
|
5199
|
+
"[&>[data-kui-button-group-item]+[data-kui-button-group-item]]:-ml-px",
|
|
5200
|
+
"[&>[data-kui-button-group-separator]]:h-[var(--kui-button-group-separator-size)]",
|
|
5201
|
+
"[&>[data-kui-button-group-separator]]:w-px",
|
|
5202
|
+
"[&>[data-kui-button-group-separator]]:mx-1",
|
|
5203
|
+
"[&>[data-kui-button-group-separator]]:shrink-0"
|
|
5204
|
+
].join(" ")
|
|
5205
|
+
},
|
|
5206
|
+
{
|
|
5207
|
+
conditions: {
|
|
5208
|
+
orientation: "vertical"
|
|
5209
|
+
},
|
|
5210
|
+
className: [
|
|
5211
|
+
"[&>[data-kui-button-group-item]]:w-full",
|
|
5212
|
+
"[&>[data-kui-button-group-separator]]:h-px",
|
|
5213
|
+
"[&>[data-kui-button-group-separator]]:w-[var(--kui-button-group-separator-size)]",
|
|
5214
|
+
"[&>[data-kui-button-group-separator]]:shrink-0"
|
|
5215
|
+
].join(" ")
|
|
5216
|
+
},
|
|
5217
|
+
{
|
|
5218
|
+
conditions: {
|
|
5219
|
+
orientation: "vertical",
|
|
5220
|
+
attached: true
|
|
5221
|
+
},
|
|
5222
|
+
className: [
|
|
5223
|
+
"[&>[data-kui-button-group-item]]:rounded-none",
|
|
5224
|
+
"[&>[data-kui-button-group-item]:first-child]:rounded-t-md",
|
|
5225
|
+
"[&>[data-kui-button-group-item]:last-child]:rounded-b-md",
|
|
5226
|
+
"[&>[data-kui-button-group-item]+[data-kui-button-group-item]]:-mt-px"
|
|
5227
|
+
].join(" ")
|
|
5228
|
+
}
|
|
5229
|
+
]
|
|
5230
|
+
});
|
|
5231
|
+
var switchRecipe = kreativCore.defineRecipe({
|
|
5232
|
+
base: [
|
|
5233
|
+
"relative inline-flex shrink-0 items-center",
|
|
5234
|
+
"rounded-full",
|
|
5235
|
+
"transition-[background-color,border-color,box-shadow]",
|
|
5236
|
+
"duration-[var(--kui-duration-fast)]",
|
|
5237
|
+
"peer-focus-visible:ring-2",
|
|
5238
|
+
"peer-focus-visible:ring-kui-brand",
|
|
5239
|
+
"peer-focus-visible:ring-offset-1",
|
|
5240
|
+
"peer-focus-visible:ring-offset-surface"
|
|
5241
|
+
].join(" "),
|
|
5242
|
+
variants: {
|
|
5243
|
+
checked: {
|
|
5244
|
+
true: "bg-kui-brand",
|
|
5245
|
+
false: "bg-kui-border"
|
|
5246
|
+
},
|
|
5247
|
+
state: {
|
|
5248
|
+
none: "",
|
|
5249
|
+
error: "bg-kui-destructive",
|
|
5250
|
+
success: "bg-kui-success",
|
|
5251
|
+
warning: "bg-kui-warning"
|
|
5252
|
+
},
|
|
5253
|
+
disabled: {
|
|
5254
|
+
true: "cursor-not-allowed opacity-50",
|
|
5255
|
+
false: ""
|
|
5256
|
+
}
|
|
5257
|
+
},
|
|
5258
|
+
defaultVariants: {
|
|
5259
|
+
checked: false,
|
|
5260
|
+
state: "none",
|
|
5261
|
+
disabled: false
|
|
5262
|
+
}
|
|
5263
|
+
});
|
|
5264
|
+
var containerReccipe = kreativCore.defineRecipe({
|
|
5265
|
+
base: "w-full",
|
|
5266
|
+
variants: {
|
|
5267
|
+
maxWidth: {
|
|
5268
|
+
xs: "max-w-screen-xs",
|
|
5269
|
+
sm: "max-w-screen-sm",
|
|
5270
|
+
md: "max-w-screen-md",
|
|
5271
|
+
lg: "max-w-screen-lg",
|
|
5272
|
+
xl: "max-w-screen-xl",
|
|
5273
|
+
full: "max-w-full"
|
|
5274
|
+
}
|
|
5275
|
+
},
|
|
5276
|
+
defaultVariants: {
|
|
5277
|
+
maxWidth: "lg"
|
|
5278
|
+
}
|
|
5279
|
+
});
|
|
5280
|
+
var linkRecipe = kreativCore.defineRecipe({
|
|
5281
|
+
base: "kui-link",
|
|
5282
|
+
variants: {
|
|
5283
|
+
variant: {
|
|
5284
|
+
solid: "text-kui-brand hover:text-kui-brand-hover",
|
|
5285
|
+
outline: "text-kui-text-secondary hover:text-kui-brand",
|
|
5286
|
+
ghost: "text-kui-text-secondary hover:text-kui-text",
|
|
5287
|
+
soft: "text-kui-brand hover:text-kui-brand-hover"
|
|
5288
|
+
},
|
|
5289
|
+
underline: {
|
|
5290
|
+
always: "underline",
|
|
5291
|
+
hover: "no-underline hover:underline",
|
|
5292
|
+
none: "no-underline"
|
|
5293
|
+
},
|
|
5294
|
+
disabled: {
|
|
5295
|
+
true: "pointer-events-none opacity-50 cursor-not-allowed",
|
|
5296
|
+
false: ""
|
|
5297
|
+
}
|
|
5298
|
+
},
|
|
5299
|
+
defaultVariants: {
|
|
5300
|
+
variant: "solid",
|
|
5301
|
+
underline: "hover",
|
|
5302
|
+
disabled: false
|
|
5303
|
+
}
|
|
5304
|
+
});
|
|
4194
5305
|
var defaultRecipes = {
|
|
4195
5306
|
Button: buttonRecipe,
|
|
4196
5307
|
FormControl: formControlRecipe,
|
|
4197
5308
|
Input: inputRecipe,
|
|
4198
5309
|
Textarea: textareaRecipe,
|
|
4199
5310
|
MarkdownEditor: markdownEditorRecipe,
|
|
4200
|
-
Checkbox: checkboxRecipe
|
|
5311
|
+
Checkbox: checkboxRecipe,
|
|
5312
|
+
ButtonGroup: buttonGroupRecipe,
|
|
5313
|
+
Switch: switchRecipe,
|
|
5314
|
+
Container: containerReccipe,
|
|
5315
|
+
Link: linkRecipe
|
|
4201
5316
|
};
|
|
4202
|
-
var defaultTheme = {
|
|
5317
|
+
var defaultTheme = kreativCore.defineTheme({
|
|
4203
5318
|
tokens: defaultTokens,
|
|
4204
5319
|
semanticTokens: defaultSemanticTokens,
|
|
4205
5320
|
typography: defaultTypography,
|
|
4206
5321
|
recipes: defaultRecipes,
|
|
4207
5322
|
intensity: 50,
|
|
4208
5323
|
sizes: defaultSizes
|
|
4209
|
-
};
|
|
5324
|
+
});
|
|
4210
5325
|
|
|
4211
5326
|
// src/theme/recipes/extendRecipe.ts
|
|
5327
|
+
var defaultRecipes2 = defaultRecipes;
|
|
5328
|
+
function extendRecipe(name, override) {
|
|
5329
|
+
const base = defaultRecipes2[name];
|
|
5330
|
+
if (!override) {
|
|
5331
|
+
return base;
|
|
5332
|
+
}
|
|
5333
|
+
return {
|
|
5334
|
+
...base,
|
|
5335
|
+
...override,
|
|
5336
|
+
...override?.compoundVariants ? { compoundVariants: override.compoundVariants } : {},
|
|
5337
|
+
...base?.variants || override?.variants ? {
|
|
5338
|
+
variants: {
|
|
5339
|
+
...base?.variants,
|
|
5340
|
+
...override?.variants
|
|
5341
|
+
}
|
|
5342
|
+
} : {}
|
|
5343
|
+
};
|
|
5344
|
+
}
|
|
5345
|
+
__name(extendRecipe, "extendRecipe");
|
|
4212
5346
|
function extendRecipes(override) {
|
|
4213
5347
|
if (!override) {
|
|
4214
|
-
return
|
|
5348
|
+
return defaultRecipes2;
|
|
4215
5349
|
}
|
|
4216
|
-
const result = { ...
|
|
4217
|
-
for (const
|
|
4218
|
-
|
|
4219
|
-
const base = defaultRecipes[key];
|
|
4220
|
-
result[key] = {
|
|
4221
|
-
...base,
|
|
4222
|
-
...recipeOverride,
|
|
4223
|
-
...base?.compoundVariants || recipeOverride?.compoundVariants ? {
|
|
4224
|
-
compoundVariants: [
|
|
4225
|
-
...base?.compoundVariants ?? [],
|
|
4226
|
-
...recipeOverride?.compoundVariants ?? []
|
|
4227
|
-
]
|
|
4228
|
-
} : {},
|
|
4229
|
-
...base?.variants || recipeOverride?.variants ? {
|
|
4230
|
-
variants: {
|
|
4231
|
-
...base?.variants,
|
|
4232
|
-
...recipeOverride?.variants
|
|
4233
|
-
}
|
|
4234
|
-
} : {}
|
|
4235
|
-
};
|
|
5350
|
+
const result = { ...defaultRecipes2 };
|
|
5351
|
+
for (const name of Object.keys(override)) {
|
|
5352
|
+
result[name] = extendRecipe(name, override[name]);
|
|
4236
5353
|
}
|
|
4237
5354
|
return result;
|
|
4238
5355
|
}
|
|
4239
5356
|
__name(extendRecipes, "extendRecipes");
|
|
4240
5357
|
|
|
5358
|
+
// src/theme/recipes/helpers.ts
|
|
5359
|
+
function getRecipeNames() {
|
|
5360
|
+
return Object.keys(defaultRecipes);
|
|
5361
|
+
}
|
|
5362
|
+
__name(getRecipeNames, "getRecipeNames");
|
|
5363
|
+
|
|
5364
|
+
// src/theme/typography/defineTypography.ts
|
|
5365
|
+
function defineTypography2(typography) {
|
|
5366
|
+
return typography;
|
|
5367
|
+
}
|
|
5368
|
+
__name(defineTypography2, "defineTypography");
|
|
5369
|
+
|
|
5370
|
+
// src/theme/typography/extendTypography.ts
|
|
5371
|
+
function extendTypography(override) {
|
|
5372
|
+
if (!override) {
|
|
5373
|
+
return { ...defaultTypography };
|
|
5374
|
+
}
|
|
5375
|
+
const result = { ...defaultTypography };
|
|
5376
|
+
for (const key of Object.keys(override)) {
|
|
5377
|
+
const variant = key;
|
|
5378
|
+
result[variant] = {
|
|
5379
|
+
...defaultTypography[variant],
|
|
5380
|
+
...override[variant]
|
|
5381
|
+
};
|
|
5382
|
+
}
|
|
5383
|
+
return result;
|
|
5384
|
+
}
|
|
5385
|
+
__name(extendTypography, "extendTypography");
|
|
5386
|
+
|
|
4241
5387
|
// src/theme/token/defineToken.ts
|
|
4242
|
-
function
|
|
5388
|
+
function defineToken2(value) {
|
|
4243
5389
|
return {
|
|
4244
5390
|
value
|
|
4245
5391
|
};
|
|
4246
5392
|
}
|
|
4247
|
-
__name(
|
|
4248
|
-
function
|
|
4249
|
-
return
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
// src/utils/deepMerge.ts
|
|
4254
|
-
function isPlainObject(value) {
|
|
4255
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
5393
|
+
__name(defineToken2, "defineToken");
|
|
5394
|
+
function defineTokens(tokens) {
|
|
5395
|
+
return Object.fromEntries(
|
|
5396
|
+
Object.entries(tokens).map(([key, value]) => [key, defineToken2(value)])
|
|
5397
|
+
);
|
|
4256
5398
|
}
|
|
4257
|
-
__name(
|
|
4258
|
-
function
|
|
4259
|
-
if (
|
|
4260
|
-
return
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
5399
|
+
__name(defineTokens, "defineTokens");
|
|
5400
|
+
function defineSemanticToken2(lightOrValue, dark) {
|
|
5401
|
+
if (dark === void 0) {
|
|
5402
|
+
return {
|
|
5403
|
+
value: {
|
|
5404
|
+
sameForBothModes: true,
|
|
5405
|
+
value: lightOrValue
|
|
5406
|
+
}
|
|
5407
|
+
};
|
|
4264
5408
|
}
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
if (isPlainObject(existing) && isPlainObject(value)) {
|
|
4271
|
-
result[key] = deepMerge(existing, value);
|
|
4272
|
-
} else {
|
|
4273
|
-
result[key] = value;
|
|
5409
|
+
return {
|
|
5410
|
+
value: {
|
|
5411
|
+
sameForBothModes: false,
|
|
5412
|
+
light: lightOrValue,
|
|
5413
|
+
dark
|
|
4274
5414
|
}
|
|
4275
|
-
}
|
|
4276
|
-
return result;
|
|
5415
|
+
};
|
|
4277
5416
|
}
|
|
4278
|
-
__name(
|
|
4279
|
-
|
|
4280
|
-
|
|
5417
|
+
__name(defineSemanticToken2, "defineSemanticToken");
|
|
5418
|
+
function defineSemanticTokens(tokens) {
|
|
5419
|
+
return Object.fromEntries(
|
|
5420
|
+
Object.entries(tokens).map(([key, entry]) => [
|
|
5421
|
+
key,
|
|
5422
|
+
entry !== null && typeof entry === "object" && "light" in entry && "dark" in entry ? defineSemanticToken2(entry.light, entry.dark) : defineSemanticToken2(entry)
|
|
5423
|
+
])
|
|
5424
|
+
);
|
|
5425
|
+
}
|
|
5426
|
+
__name(defineSemanticTokens, "defineSemanticTokens");
|
|
4281
5427
|
function extendTokens(override) {
|
|
4282
|
-
return deepMerge(defaultTokens, override);
|
|
5428
|
+
return kreativCore.deepMerge(defaultTokens, override);
|
|
4283
5429
|
}
|
|
4284
5430
|
__name(extendTokens, "extendTokens");
|
|
4285
5431
|
function extendSemanticTokens(override) {
|
|
4286
|
-
return deepMerge(defaultSemanticTokens, override);
|
|
5432
|
+
return kreativCore.deepMerge(defaultSemanticTokens, override);
|
|
4287
5433
|
}
|
|
4288
5434
|
__name(extendSemanticTokens, "extendSemanticTokens");
|
|
4289
5435
|
|
|
@@ -4313,24 +5459,28 @@ function extendTheme(override) {
|
|
|
4313
5459
|
return {
|
|
4314
5460
|
...defaultTheme,
|
|
4315
5461
|
...override,
|
|
5462
|
+
tokens: extendTokens(override.tokens),
|
|
5463
|
+
semanticTokens: extendSemanticTokens(override.semanticTokens),
|
|
4316
5464
|
sizes: extendSizes(override.sizes),
|
|
4317
5465
|
typography: extendTypography(override.typography),
|
|
4318
5466
|
recipes: extendRecipes(override.recipes)
|
|
4319
5467
|
};
|
|
4320
5468
|
}
|
|
4321
5469
|
__name(extendTheme, "extendTheme");
|
|
5470
|
+
|
|
5471
|
+
// src/theme/defineTheme.ts
|
|
5472
|
+
function defineTheme2(theme) {
|
|
5473
|
+
return theme;
|
|
5474
|
+
}
|
|
5475
|
+
__name(defineTheme2, "defineTheme");
|
|
4322
5476
|
function useSystemPrefersDark() {
|
|
4323
5477
|
const [prefersDark, setPrefersDark] = react.useState(false);
|
|
4324
5478
|
react.useEffect(() => {
|
|
4325
|
-
const
|
|
4326
|
-
setPrefersDark(
|
|
4327
|
-
const
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
mediaQuery.addEventListener("change", handleChange);
|
|
4331
|
-
return () => {
|
|
4332
|
-
mediaQuery.removeEventListener("change", handleChange);
|
|
4333
|
-
};
|
|
5479
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
5480
|
+
setPrefersDark(mq.matches);
|
|
5481
|
+
const handler = /* @__PURE__ */ __name((e) => setPrefersDark(e.matches), "handler");
|
|
5482
|
+
mq.addEventListener("change", handler);
|
|
5483
|
+
return () => mq.removeEventListener("change", handler);
|
|
4334
5484
|
}, []);
|
|
4335
5485
|
return prefersDark;
|
|
4336
5486
|
}
|
|
@@ -4340,9 +5490,12 @@ function UIProvider({
|
|
|
4340
5490
|
theme: themeOverride,
|
|
4341
5491
|
defaultMode = "system",
|
|
4342
5492
|
as = "div",
|
|
4343
|
-
fallbackSize = "md"
|
|
5493
|
+
fallbackSize = "md",
|
|
5494
|
+
themeTransition = true,
|
|
5495
|
+
themeTransitionDuration = 300
|
|
4344
5496
|
}) {
|
|
4345
5497
|
const [mode, setMode] = react.useState(defaultMode);
|
|
5498
|
+
const [transitioning, setTransitioning] = react.useState(false);
|
|
4346
5499
|
const systemPrefersDark = useSystemPrefersDark();
|
|
4347
5500
|
const resolvedMode = mode === "system" ? systemPrefersDark ? "dark" : "light" : mode;
|
|
4348
5501
|
const theme = react.useMemo(() => extendTheme(themeOverride), [themeOverride]);
|
|
@@ -4357,10 +5510,19 @@ function UIProvider({
|
|
|
4357
5510
|
react.useEffect(() => {
|
|
4358
5511
|
if (isDev() && !theme.sizes[fallbackSize]) {
|
|
4359
5512
|
console.error(
|
|
4360
|
-
`[kreativ-ui] fallbackSize="${fallbackSize}" is not a registered size in theme.sizes
|
|
5513
|
+
`[kreativ-ui] fallbackSize="${fallbackSize}" is not a registered size in theme.sizes.`
|
|
4361
5514
|
);
|
|
4362
5515
|
}
|
|
4363
5516
|
}, [theme.sizes, fallbackSize]);
|
|
5517
|
+
react.useEffect(() => {
|
|
5518
|
+
if (!themeTransition) return;
|
|
5519
|
+
setTransitioning(true);
|
|
5520
|
+
const timeout = setTimeout(
|
|
5521
|
+
() => setTransitioning(false),
|
|
5522
|
+
themeTransitionDuration
|
|
5523
|
+
);
|
|
5524
|
+
return () => clearTimeout(timeout);
|
|
5525
|
+
}, [resolvedMode, themeTransition, themeTransitionDuration]);
|
|
4364
5526
|
const contextValue = react.useMemo(
|
|
4365
5527
|
() => ({
|
|
4366
5528
|
theme,
|
|
@@ -4373,29 +5535,55 @@ function UIProvider({
|
|
|
4373
5535
|
[theme, mode, resolvedMode, fallbackSize, resolvedTokens]
|
|
4374
5536
|
);
|
|
4375
5537
|
const Tag = as;
|
|
4376
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5538
|
+
return /* @__PURE__ */ jsxRuntime.jsx(kreativCore.ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4377
5539
|
Tag,
|
|
4378
5540
|
{
|
|
4379
5541
|
"data-kreativ-theme": resolvedMode,
|
|
5542
|
+
"data-kui-transitioning": transitioning ? "true" : void 0,
|
|
4380
5543
|
className: resolvedMode === "dark" ? "dark" : void 0,
|
|
4381
|
-
style:
|
|
5544
|
+
style: {
|
|
5545
|
+
...cssVars,
|
|
5546
|
+
["--kui-theme-transition-duration"]: `${themeTransitionDuration}ms`
|
|
5547
|
+
},
|
|
4382
5548
|
children
|
|
4383
5549
|
}
|
|
4384
5550
|
) });
|
|
4385
5551
|
}
|
|
4386
5552
|
__name(UIProvider, "UIProvider");
|
|
4387
5553
|
|
|
5554
|
+
// src/index.ts
|
|
5555
|
+
__reExport(index_exports, hooks_exports);
|
|
5556
|
+
|
|
5557
|
+
// src/types/index.ts
|
|
5558
|
+
var types_exports = {};
|
|
5559
|
+
__reExport(types_exports, types_star__namespace);
|
|
5560
|
+
|
|
5561
|
+
// src/index.ts
|
|
5562
|
+
__reExport(index_exports, types_exports);
|
|
5563
|
+
|
|
5564
|
+
Object.defineProperty(exports, "ThemeContext", {
|
|
5565
|
+
enumerable: true,
|
|
5566
|
+
get: function () { return kreativCore.ThemeContext; }
|
|
5567
|
+
});
|
|
5568
|
+
exports.Adornment = Adornment;
|
|
4388
5569
|
exports.Button = Button;
|
|
5570
|
+
exports.ButtonGroup = ButtonGroup;
|
|
5571
|
+
exports.ButtonGroupContext = ButtonGroupContext;
|
|
5572
|
+
exports.ButtonGroupItemContext = ButtonGroupItemContext;
|
|
5573
|
+
exports.Card = Card;
|
|
4389
5574
|
exports.Checkbox = Checkbox;
|
|
4390
5575
|
exports.Combobox = Combobox;
|
|
4391
5576
|
exports.ComboboxContent = ComboboxContent;
|
|
4392
5577
|
exports.ComboboxInput = ComboboxInput;
|
|
4393
5578
|
exports.ComboboxItem = ComboboxItem;
|
|
5579
|
+
exports.Container = Container;
|
|
5580
|
+
exports.Flex = Flex;
|
|
4394
5581
|
exports.FormField = FormField;
|
|
4395
5582
|
exports.FormFieldControl = FormFieldControl;
|
|
4396
5583
|
exports.FormFieldDescription = FormFieldDescription;
|
|
4397
5584
|
exports.FormFieldLabel = FormFieldLabel;
|
|
4398
5585
|
exports.FormFieldMessage = FormFieldMessage;
|
|
5586
|
+
exports.Grid = Grid;
|
|
4399
5587
|
exports.Input = Input;
|
|
4400
5588
|
exports.InputField = InputField;
|
|
4401
5589
|
exports.MarkdownEditor = MarkdownEditor;
|
|
@@ -4411,29 +5599,36 @@ exports.SelectGroup = SelectGroup;
|
|
|
4411
5599
|
exports.SelectItem = SelectItem;
|
|
4412
5600
|
exports.SelectTrigger = SelectTrigger;
|
|
4413
5601
|
exports.SelectValue = SelectValue;
|
|
5602
|
+
exports.Stack = Stack;
|
|
4414
5603
|
exports.Switch = Switch;
|
|
4415
5604
|
exports.Textarea = Textarea;
|
|
4416
|
-
exports.ThemeContext = ThemeContext;
|
|
4417
5605
|
exports.ThemeToggler = ThemeToggler;
|
|
4418
5606
|
exports.UIProvider = UIProvider;
|
|
5607
|
+
exports.cardSkeleton = cardSkeleton;
|
|
4419
5608
|
exports.cn = cn;
|
|
4420
5609
|
exports.defineRecipe = defineRecipe;
|
|
4421
|
-
exports.defineSemanticToken =
|
|
4422
|
-
exports.
|
|
4423
|
-
exports.
|
|
5610
|
+
exports.defineSemanticToken = defineSemanticToken2;
|
|
5611
|
+
exports.defineSemanticTokens = defineSemanticTokens;
|
|
5612
|
+
exports.defineTheme = defineTheme2;
|
|
5613
|
+
exports.defineToken = defineToken2;
|
|
5614
|
+
exports.defineTokens = defineTokens;
|
|
5615
|
+
exports.defineTypography = defineTypography2;
|
|
5616
|
+
exports.extendRecipe = extendRecipe;
|
|
4424
5617
|
exports.extendRecipes = extendRecipes;
|
|
4425
5618
|
exports.extendSemanticTokens = extendSemanticTokens;
|
|
4426
5619
|
exports.extendTheme = extendTheme;
|
|
4427
5620
|
exports.extendTokens = extendTokens;
|
|
4428
5621
|
exports.extendTypography = extendTypography;
|
|
5622
|
+
exports.getRecipeNames = getRecipeNames;
|
|
4429
5623
|
exports.hexToRgbString = hexToRgbString;
|
|
4430
5624
|
exports.rgbToHex = rgbToHex;
|
|
4431
|
-
exports.
|
|
5625
|
+
exports.useButtonGroupContext = useButtonGroupContext;
|
|
5626
|
+
exports.useButtonGroupItemContext = useButtonGroupItemContext;
|
|
4432
5627
|
exports.useClearableField = useClearableField;
|
|
4433
5628
|
exports.useFloatingSide = useFloatingSide;
|
|
4434
|
-
exports.
|
|
5629
|
+
exports.useKeyboardShortcuts = useKeyboardShortcuts;
|
|
5630
|
+
exports.useOptionalButtonGroupContext = useOptionalButtonGroupContext;
|
|
5631
|
+
exports.useOptionalButtonGroupItemContext = useOptionalButtonGroupItemContext;
|
|
4435
5632
|
exports.useStatusTransition = useStatusTransition;
|
|
4436
|
-
exports.useTheme = useTheme;
|
|
4437
|
-
exports.useTypography = useTypography;
|
|
4438
5633
|
//# sourceMappingURL=index.cjs.map
|
|
4439
5634
|
//# sourceMappingURL=index.cjs.map
|