@mario_hahn/jumpy-ui 0.8.1 → 0.9.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 +68 -1
- package/dist/{chunk-B7QIDGY7.js → chunk-3QWVEQL3.js} +4 -0
- package/dist/index.js +658 -350
- package/dist/theme.js +1 -1
- package/index.d.ts +16 -1
- package/package.json +6 -3
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
textStyleValue,
|
|
29
29
|
themeToCSSVariables,
|
|
30
30
|
useJumpyTheme
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3QWVEQL3.js";
|
|
32
32
|
import {
|
|
33
33
|
cn
|
|
34
34
|
} from "./chunk-3DBKYKP2.js";
|
|
@@ -37,9 +37,291 @@ import {
|
|
|
37
37
|
} from "./chunk-XDTVYUWG.js";
|
|
38
38
|
|
|
39
39
|
// index.js
|
|
40
|
-
import { autoUpdate, flip, FloatingFocusManager, FloatingOverlay, FloatingPortal, offset, size, useFloating } from "@floating-ui/react";
|
|
41
|
-
import { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
42
|
-
|
|
40
|
+
import { autoUpdate, flip, FloatingFocusManager, FloatingOverlay, FloatingPortal, offset, shift, size, useFloating } from "@floating-ui/react";
|
|
41
|
+
import { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useEffect as useEffect2, useId, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
42
|
+
|
|
43
|
+
// token-input.js
|
|
44
|
+
import { useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
45
|
+
import { $addUpdateTag, $createParagraphNode, $createTextNode, $getNodeByKey, $getRoot, $getSelection, $isElementNode, $isNodeSelection, $isRangeSelection, $isTextNode, $setSelection, CLEAR_HISTORY_COMMAND, COMMAND_PRIORITY_HIGH, COPY_COMMAND, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DecoratorNode, HISTORY_PUSH_TAG, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_ENTER_COMMAND, PASTE_COMMAND } from "lexical";
|
|
46
|
+
import { $generateJSONFromSelectedNodes } from "@lexical/clipboard";
|
|
47
|
+
import { LexicalComposer } from "@lexical/react/LexicalComposer";
|
|
48
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
49
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
50
|
+
import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
|
|
51
|
+
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
52
|
+
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
53
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
54
|
+
var clipboardType = "application/x-jumpy-token-input";
|
|
55
|
+
function normalizeTokenInputValue(value) {
|
|
56
|
+
const result = [];
|
|
57
|
+
const ids = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const part of value) {
|
|
59
|
+
if (part.type === "text") {
|
|
60
|
+
const text = part.text.replace(/[\r\n]+/g, " ");
|
|
61
|
+
if (!text) continue;
|
|
62
|
+
const previous = result[result.length - 1];
|
|
63
|
+
if (previous?.type === "text") previous.text += text;
|
|
64
|
+
else result.push({ type: "text", text });
|
|
65
|
+
} else if (part.type === "token") {
|
|
66
|
+
if (typeof part.id !== "string" || !part.id || ids.has(part.id) || typeof part.value !== "string" || typeof part.label !== "string" || !part.label) throw new Error("JumpTokenInput tokens require unique ids, string values and non-empty labels");
|
|
67
|
+
ids.add(part.id);
|
|
68
|
+
result.push({ type: "token", id: part.id, value: part.value, label: part.label });
|
|
69
|
+
} else throw new Error("Unknown JumpTokenInput value part");
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
function tokenInputText(value) {
|
|
74
|
+
return value.map((part) => part.type === "text" ? part.text : part.label).join("");
|
|
75
|
+
}
|
|
76
|
+
var JumpyTokenNode = class _JumpyTokenNode extends DecoratorNode {
|
|
77
|
+
static getType() {
|
|
78
|
+
return "jumpy-token";
|
|
79
|
+
}
|
|
80
|
+
static clone(node) {
|
|
81
|
+
return new _JumpyTokenNode(node.__token, node.__key);
|
|
82
|
+
}
|
|
83
|
+
static importJSON(json) {
|
|
84
|
+
return new _JumpyTokenNode(json.token);
|
|
85
|
+
}
|
|
86
|
+
constructor(token, key) {
|
|
87
|
+
super(key);
|
|
88
|
+
this.__token = { ...token };
|
|
89
|
+
}
|
|
90
|
+
exportJSON() {
|
|
91
|
+
return { ...super.exportJSON(), type: "jumpy-token", version: 1, token: { ...this.__token } };
|
|
92
|
+
}
|
|
93
|
+
getTextContent() {
|
|
94
|
+
return this.__token.label;
|
|
95
|
+
}
|
|
96
|
+
isInline() {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
isKeyboardSelectable() {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
createDOM() {
|
|
103
|
+
const element = document.createElement("span");
|
|
104
|
+
element.contentEditable = "false";
|
|
105
|
+
element.dataset.jumpyTokenId = this.__token.id;
|
|
106
|
+
element.style.display = "inline-block";
|
|
107
|
+
return element;
|
|
108
|
+
}
|
|
109
|
+
updateDOM() {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
decorate(editor) {
|
|
113
|
+
return /* @__PURE__ */ jsx(TokenChip, { editor, nodeKey: this.__key, token: this.__token });
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
function TokenChip({ editor, nodeKey, token }) {
|
|
117
|
+
const theme = useJumpyTheme();
|
|
118
|
+
const [editable, setEditable] = useState(editor.isEditable());
|
|
119
|
+
useEffect(() => editor.registerEditableListener(setEditable), [editor]);
|
|
120
|
+
return /* @__PURE__ */ jsxs("span", { "data-jumpy-slot": "input-token", style: { display: "inline-flex", alignItems: "center", verticalAlign: "baseline", borderRadius: theme.radius.small, border: `${theme.borderWidth.small}px solid var(--jumpy-color-feedback-info-border)`, paddingInline: theme.spacing.small3XS, gap: theme.spacing.small3XS, background: "var(--jumpy-color-feedback-info-surface)", color: "var(--jumpy-color-text-primary)", fontSize: theme.fontFamily.bodySmall.fontSize, lineHeight: "inherit", whiteSpace: "nowrap" }, children: [
|
|
121
|
+
/* @__PURE__ */ jsx("span", { children: token.label }),
|
|
122
|
+
editable && /* @__PURE__ */ jsx("button", { type: "button", tabIndex: -1, "aria-label": `Remove ${token.label}`, onMouseDown: (event) => event.preventDefault(), onClick: (event) => {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
if (!editor.isEditable()) return;
|
|
126
|
+
editor.update(() => {
|
|
127
|
+
const node = $getNodeByKey(nodeKey);
|
|
128
|
+
if (node) {
|
|
129
|
+
node.selectPrevious();
|
|
130
|
+
node.remove();
|
|
131
|
+
}
|
|
132
|
+
}, { tag: HISTORY_PUSH_TAG });
|
|
133
|
+
editor.focus();
|
|
134
|
+
}, style: { display: "inline-flex", alignItems: "center", appearance: "none", border: 0, padding: 0, background: "transparent", color: "inherit", font: "inherit", cursor: "pointer" }, children: /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", focusable: "false", width: theme.fontFamily.bodySmall.fontSize, height: theme.fontFamily.bodySmall.fontSize, viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8", stroke: "currentColor", strokeWidth: "1.5" }) }) })
|
|
135
|
+
] });
|
|
136
|
+
}
|
|
137
|
+
function $readValue() {
|
|
138
|
+
const parts = [];
|
|
139
|
+
function visit(node) {
|
|
140
|
+
if (node instanceof JumpyTokenNode) parts.push({ ...node.__token });
|
|
141
|
+
else if ($isTextNode(node)) parts.push({ type: "text", text: node.getTextContent() });
|
|
142
|
+
else if ($isElementNode(node)) node.getChildren().forEach(visit);
|
|
143
|
+
}
|
|
144
|
+
visit($getRoot());
|
|
145
|
+
return normalizeTokenInputValue(parts);
|
|
146
|
+
}
|
|
147
|
+
function $nodes(parts) {
|
|
148
|
+
return parts.map((part) => part.type === "token" ? new JumpyTokenNode(part) : $createTextNode(part.text));
|
|
149
|
+
}
|
|
150
|
+
function $replaceValue(parts) {
|
|
151
|
+
$getRoot().clear().append($createParagraphNode().append(...$nodes(parts)));
|
|
152
|
+
}
|
|
153
|
+
function $adjacentToken(backward) {
|
|
154
|
+
const selection = $getSelection();
|
|
155
|
+
if (!$isRangeSelection(selection) || !selection.isCollapsed()) return null;
|
|
156
|
+
const { offset: offset2, type } = selection.anchor;
|
|
157
|
+
const node = selection.anchor.getNode();
|
|
158
|
+
if (type === "element" && $isElementNode(node)) return node.getChildAtIndex(offset2 - (backward ? 1 : 0));
|
|
159
|
+
if ($isTextNode(node) && (backward ? offset2 === 0 : offset2 === node.getTextContentSize())) return backward ? node.getPreviousSibling() : node.getNextSibling();
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function EditorBehavior({ model, editable, editorRef, onValueChange, onChange }) {
|
|
163
|
+
const [editor] = useLexicalComposerContext();
|
|
164
|
+
const savedSelection = useRef(null);
|
|
165
|
+
const callbacks = useRef({ onValueChange, onChange });
|
|
166
|
+
callbacks.current = { onValueChange, onChange };
|
|
167
|
+
useLayoutEffect(() => {
|
|
168
|
+
editor.setEditable(editable);
|
|
169
|
+
}, [editor, editable]);
|
|
170
|
+
useLayoutEffect(() => {
|
|
171
|
+
const current = editor.getEditorState().read($readValue);
|
|
172
|
+
if (JSON.stringify(current) !== JSON.stringify(model)) {
|
|
173
|
+
savedSelection.current = null;
|
|
174
|
+
editor.update(() => {
|
|
175
|
+
$replaceValue(model);
|
|
176
|
+
$setSelection(null);
|
|
177
|
+
}, { tag: "jumpy-external-value" });
|
|
178
|
+
editor.dispatchCommand(CLEAR_HISTORY_COMMAND, void 0);
|
|
179
|
+
}
|
|
180
|
+
}, [editor, model]);
|
|
181
|
+
function insert(parts) {
|
|
182
|
+
if (!editor.isEditable()) return;
|
|
183
|
+
editor.update(() => {
|
|
184
|
+
const selection = savedSelection.current?.clone() || $getSelection();
|
|
185
|
+
if (selection) $setSelection(selection);
|
|
186
|
+
else $getRoot().selectEnd();
|
|
187
|
+
$getSelection()?.insertNodes($nodes(parts));
|
|
188
|
+
}, { tag: HISTORY_PUSH_TAG });
|
|
189
|
+
editor.focus();
|
|
190
|
+
}
|
|
191
|
+
useImperativeHandle(editorRef, () => ({
|
|
192
|
+
focus: () => editor.focus(),
|
|
193
|
+
insertText: (text) => insert(normalizeTokenInputValue([{ type: "text", text }])),
|
|
194
|
+
insertToken: (token) => {
|
|
195
|
+
const part = { ...token, type: "token", id: token.id || crypto.randomUUID() };
|
|
196
|
+
const current = editor.getEditorState().read($readValue);
|
|
197
|
+
normalizeTokenInputValue([...current, part]);
|
|
198
|
+
insert([part]);
|
|
199
|
+
},
|
|
200
|
+
removeToken: (id) => {
|
|
201
|
+
if (!editor.isEditable()) return;
|
|
202
|
+
editor.update(() => {
|
|
203
|
+
const paragraph = $getRoot().getFirstChild();
|
|
204
|
+
if ($isElementNode(paragraph)) for (const node of paragraph.getChildren()) {
|
|
205
|
+
if (node instanceof JumpyTokenNode && node.__token.id === id) {
|
|
206
|
+
node.selectPrevious();
|
|
207
|
+
node.remove();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, { tag: HISTORY_PUSH_TAG });
|
|
211
|
+
}
|
|
212
|
+
}));
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
let previous = JSON.stringify(editor.getEditorState().read($readValue));
|
|
215
|
+
const unregisterUpdate = editor.registerUpdateListener(({ editorState, tags }) => {
|
|
216
|
+
editorState.read(() => {
|
|
217
|
+
const selection = $getSelection();
|
|
218
|
+
if (selection) savedSelection.current = selection.clone();
|
|
219
|
+
const next = $readValue();
|
|
220
|
+
const json = JSON.stringify(next);
|
|
221
|
+
if (json === previous) return;
|
|
222
|
+
previous = json;
|
|
223
|
+
if (tags.has("jumpy-external-value")) return;
|
|
224
|
+
callbacks.current.onChange?.({ target: { value: tokenInputText(next) }, currentTarget: { value: tokenInputText(next) } });
|
|
225
|
+
callbacks.current.onValueChange(next);
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
const deleteToken = (event, backward) => {
|
|
229
|
+
if (!editor.isEditable() || editor.isComposing()) return false;
|
|
230
|
+
const selection = $getSelection();
|
|
231
|
+
if ($isNodeSelection(selection)) {
|
|
232
|
+
$addUpdateTag(HISTORY_PUSH_TAG);
|
|
233
|
+
event?.preventDefault();
|
|
234
|
+
for (const node2 of selection.getNodes()) {
|
|
235
|
+
node2.selectPrevious();
|
|
236
|
+
node2.remove();
|
|
237
|
+
}
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
const node = $adjacentToken(backward);
|
|
241
|
+
if (!(node instanceof JumpyTokenNode)) return false;
|
|
242
|
+
$addUpdateTag(HISTORY_PUSH_TAG);
|
|
243
|
+
event?.preventDefault();
|
|
244
|
+
node.selectPrevious();
|
|
245
|
+
node.remove();
|
|
246
|
+
return true;
|
|
247
|
+
};
|
|
248
|
+
const copy = (event, cut) => {
|
|
249
|
+
if (!event?.clipboardData || cut && !editor.isEditable()) return false;
|
|
250
|
+
const selection = $getSelection();
|
|
251
|
+
if (!selection || $isRangeSelection(selection) && selection.isCollapsed()) return false;
|
|
252
|
+
const { nodes } = $generateJSONFromSelectedNodes(editor, selection);
|
|
253
|
+
const parts = [];
|
|
254
|
+
const visit = (node) => {
|
|
255
|
+
if (node.type === "jumpy-token") parts.push(node.token);
|
|
256
|
+
else if (node.type === "text") parts.push({ type: "text", text: node.text });
|
|
257
|
+
else node.children?.forEach(visit);
|
|
258
|
+
};
|
|
259
|
+
nodes.forEach(visit);
|
|
260
|
+
event.preventDefault();
|
|
261
|
+
event.clipboardData.setData("text/plain", selection.getTextContent());
|
|
262
|
+
event.clipboardData.setData(clipboardType, JSON.stringify(parts));
|
|
263
|
+
if (cut) {
|
|
264
|
+
$addUpdateTag(HISTORY_PUSH_TAG);
|
|
265
|
+
if ($isNodeSelection(selection)) for (const node of selection.getNodes()) node.remove();
|
|
266
|
+
else if ($isRangeSelection(selection)) selection.removeText();
|
|
267
|
+
}
|
|
268
|
+
return true;
|
|
269
|
+
};
|
|
270
|
+
const commands = [
|
|
271
|
+
editor.registerCommand(DELETE_CHARACTER_COMMAND, (backward) => deleteToken(null, backward), COMMAND_PRIORITY_HIGH),
|
|
272
|
+
editor.registerCommand(KEY_BACKSPACE_COMMAND, (event) => deleteToken(event, true), COMMAND_PRIORITY_HIGH),
|
|
273
|
+
editor.registerCommand(KEY_DELETE_COMMAND, (event) => deleteToken(event, false), COMMAND_PRIORITY_HIGH),
|
|
274
|
+
editor.registerCommand(KEY_ENTER_COMMAND, (event) => {
|
|
275
|
+
if (editor.isComposing()) return false;
|
|
276
|
+
event?.preventDefault();
|
|
277
|
+
return true;
|
|
278
|
+
}, COMMAND_PRIORITY_HIGH),
|
|
279
|
+
editor.registerCommand(COPY_COMMAND, (event) => copy(event, false), COMMAND_PRIORITY_HIGH),
|
|
280
|
+
editor.registerCommand(CUT_COMMAND, (event) => copy(event, true), COMMAND_PRIORITY_HIGH),
|
|
281
|
+
editor.registerCommand(PASTE_COMMAND, (event) => {
|
|
282
|
+
if (!event?.clipboardData || !editor.isEditable()) return false;
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
$addUpdateTag(HISTORY_PUSH_TAG);
|
|
285
|
+
let parts;
|
|
286
|
+
try {
|
|
287
|
+
parts = normalizeTokenInputValue(JSON.parse(event.clipboardData.getData(clipboardType)).map((part) => part.type === "token" ? { ...part, id: crypto.randomUUID() } : part));
|
|
288
|
+
} catch {
|
|
289
|
+
parts = normalizeTokenInputValue([{ type: "text", text: event.clipboardData.getData("text/plain") }]);
|
|
290
|
+
}
|
|
291
|
+
$getSelection()?.insertNodes($nodes(parts));
|
|
292
|
+
return true;
|
|
293
|
+
}, COMMAND_PRIORITY_HIGH)
|
|
294
|
+
];
|
|
295
|
+
return () => {
|
|
296
|
+
unregisterUpdate();
|
|
297
|
+
commands.forEach((unregister) => unregister());
|
|
298
|
+
};
|
|
299
|
+
}, [editor]);
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
function TokenEditor({ model, editorRef, onValueChange, onChange, fieldContext, value: _value, placeholder, disabled, readOnly, style, ...props }) {
|
|
303
|
+
const theme = useJumpyTheme();
|
|
304
|
+
const initialConfig = useMemo(() => ({ namespace: "JumpyTokenInput", nodes: [JumpyTokenNode], editable: !disabled && !readOnly, onError: (error) => {
|
|
305
|
+
throw error;
|
|
306
|
+
}, editorState: () => $replaceValue(model) }), []);
|
|
307
|
+
const offset2 = fieldContext?.hasLabel ? spacingValue(theme, JumpySpacing.large) : 0;
|
|
308
|
+
return /* @__PURE__ */ jsx(LexicalComposer, { initialConfig, children: /* @__PURE__ */ jsxs("div", { style: { position: "relative", width: "100%", minWidth: 0, marginTop: offset2 }, children: [
|
|
309
|
+
/* @__PURE__ */ jsx(
|
|
310
|
+
PlainTextPlugin,
|
|
311
|
+
{
|
|
312
|
+
contentEditable: /* @__PURE__ */ jsx(ContentEditable, { ...props, "data-jumpy-component": "token-input", role: "textbox", "aria-multiline": false, "aria-readonly": readOnly || void 0, "aria-disabled": disabled || void 0, tabIndex: disabled ? -1 : 0, style: { width: "100%", minHeight: theme.fontFamily.bodyMedium.fontSize * theme.fontFamily.bodyMedium.lineHeight, padding: 0, outline: 0, overflowX: "auto", whiteSpace: "pre", color: "var(--jumpy-cmp-base-input-value-color)", fontFamily: theme.fontFamily.familyBase, fontSize: theme.fontFamily.bodyMedium.fontSize, lineHeight: theme.fontFamily.bodyMedium.lineHeight, ...style } }),
|
|
313
|
+
placeholder: null,
|
|
314
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
model.length === 0 && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", style: { position: "absolute", top: 0, left: 0, pointerEvents: "none", color: "var(--jumpy-cmp-base-input-placeholder-color)", fontSize: theme.fontFamily.bodyMedium.fontSize, lineHeight: theme.fontFamily.bodyMedium.lineHeight }, children: placeholder }),
|
|
318
|
+
/* @__PURE__ */ jsx(HistoryPlugin, {}),
|
|
319
|
+
/* @__PURE__ */ jsx(EditorBehavior, { model, editable: !disabled && !readOnly, editorRef, onValueChange, onChange })
|
|
320
|
+
] }) });
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// index.js
|
|
324
|
+
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
43
325
|
var JumpyFieldContext = createContext(null);
|
|
44
326
|
var JumpyTableContext = createContext(null);
|
|
45
327
|
var JumpyExpandableContext = createContext(null);
|
|
@@ -62,22 +344,22 @@ var KeyboardKeys = {
|
|
|
62
344
|
};
|
|
63
345
|
function ChevronDownIcon(props) {
|
|
64
346
|
const theme = useJumpyTheme();
|
|
65
|
-
return /* @__PURE__ */
|
|
347
|
+
return /* @__PURE__ */ jsx2("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, style: { display: "block", fontSize: sizeValue(theme, JumpySize.small), ...props.style || {} }, children: /* @__PURE__ */ jsx2("path", { fillRule: "evenodd", d: "M7.41 8.295 6 9.705l6 6 6-6-1.41-1.41-4.59 4.58z", clipRule: "evenodd", fill: "currentColor" }) });
|
|
66
348
|
}
|
|
67
349
|
function ChevronUpIcon(props) {
|
|
68
350
|
const theme = useJumpyTheme();
|
|
69
|
-
return /* @__PURE__ */
|
|
351
|
+
return /* @__PURE__ */ jsx2("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, style: { display: "block", fontSize: sizeValue(theme, JumpySize.small), ...props.style || {} }, children: /* @__PURE__ */ jsx2("path", { fillRule: "evenodd", d: "m16.59 15.705 1.41-1.41-6-6-6 6 1.41 1.41 4.59-4.58z", clipRule: "evenodd", fill: "currentColor" }) });
|
|
70
352
|
}
|
|
71
353
|
function CircleConfirmIcon(props) {
|
|
72
|
-
return /* @__PURE__ */
|
|
354
|
+
return /* @__PURE__ */ jsx2("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: /* @__PURE__ */ jsx2("path", { fill: "currentColor", d: "M10 1.667a8.333 8.333 0 1 0 0 16.666 8.333 8.333 0 0 0 0-16.666Zm3.775 6.441-4.167 4.167a.833.833 0 0 1-1.178 0l-2.083-2.083a.833.833 0 1 1 1.178-1.179l1.494 1.494 3.577-3.577a.833.833 0 0 1 1.179 1.178Z" }) });
|
|
73
355
|
}
|
|
74
356
|
function CircleErrorIcon(props) {
|
|
75
|
-
return /* @__PURE__ */
|
|
357
|
+
return /* @__PURE__ */ jsx2("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, children: /* @__PURE__ */ jsx2("path", { fill: "currentColor", d: "M10 1.667a8.333 8.333 0 1 0 0 16.666A8.333 8.333 0 0 0 10 1.667Zm0 4.166c.46 0 .833.373.833.834v3.75a.833.833 0 0 1-1.666 0v-3.75c0-.46.373-.834.833-.834Zm0 8.75a1.042 1.042 0 1 1 0-2.083 1.042 1.042 0 0 1 0 2.083Z" }) });
|
|
76
358
|
}
|
|
77
359
|
function CircleClearIcon(props) {
|
|
78
|
-
return /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
360
|
+
return /* @__PURE__ */ jsxs2("svg", { "data-jumpy-stroke-icon": "true", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", focusable: "false", ...props, style: { display: "block", fill: "none", ...props.style || {} }, children: [
|
|
361
|
+
/* @__PURE__ */ jsx2("path", { d: "M10 17.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Z", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
362
|
+
/* @__PURE__ */ jsx2("path", { d: "m7.5 7.5 5 5M12.5 7.5l-5 5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
81
363
|
] });
|
|
82
364
|
}
|
|
83
365
|
function supportsDisabledAttribute(tag) {
|
|
@@ -260,22 +542,22 @@ function JumpSeverityIcon({ status = "other", icon, style }) {
|
|
|
260
542
|
};
|
|
261
543
|
switch (status) {
|
|
262
544
|
case "positive":
|
|
263
|
-
return /* @__PURE__ */
|
|
545
|
+
return /* @__PURE__ */ jsx2("svg", { ...common, children: /* @__PURE__ */ jsx2("path", { d: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm4.3 7.8-5 5a1 1 0 0 1-1.4 0l-2.2-2.2a1 1 0 1 1 1.4-1.4l1.5 1.5 4.3-4.3a1 1 0 1 1 1.4 1.4Z" }) });
|
|
264
546
|
case "warning":
|
|
265
|
-
return /* @__PURE__ */
|
|
547
|
+
return /* @__PURE__ */ jsx2("svg", { ...common, children: /* @__PURE__ */ jsx2("path", { d: "M11.1 3.5a1 1 0 0 1 1.8 0l8.2 15A1 1 0 0 1 20.2 20H3.8a1 1 0 0 1-.9-1.5l8.2-15ZM12 8a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V9a1 1 0 0 0-1-1Zm0 9.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z" }) });
|
|
266
548
|
case "alarm":
|
|
267
|
-
return /* @__PURE__ */
|
|
549
|
+
return /* @__PURE__ */ jsx2("svg", { ...common, children: /* @__PURE__ */ jsx2("path", { d: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm1 13a1 1 0 1 1-2 0V7a1 1 0 1 1 2 0v8Zm-1 4a1.25 1.25 0 1 1 0-2.5 1.25 1.25 0 0 1 0 2.5Z" }) });
|
|
268
550
|
case "info":
|
|
269
|
-
return /* @__PURE__ */
|
|
551
|
+
return /* @__PURE__ */ jsx2("svg", { ...common, children: /* @__PURE__ */ jsx2("path", { d: "M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm1 15a1 1 0 1 1-2 0v-6a1 1 0 1 1 2 0v6Zm-1-8.5A1.25 1.25 0 1 1 12 6a1.25 1.25 0 0 1 0 2.5Z" }) });
|
|
270
552
|
default:
|
|
271
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ jsx2("svg", { ...common, children: /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "9" }) });
|
|
272
554
|
}
|
|
273
555
|
}
|
|
274
556
|
function renderBannerSlot(slot, fallbackTag = "span", className, style) {
|
|
275
557
|
if (!slot) return null;
|
|
276
558
|
if (typeof slot === "string" || typeof slot === "number") {
|
|
277
559
|
const Tag = fallbackTag;
|
|
278
|
-
return /* @__PURE__ */
|
|
560
|
+
return /* @__PURE__ */ jsx2(Tag, { className, style, children: slot });
|
|
279
561
|
}
|
|
280
562
|
if (isValidElement(slot)) {
|
|
281
563
|
return cloneElement(slot, {
|
|
@@ -478,7 +760,7 @@ function getFieldShellStyles(theme, disabled, status = "regular", focused = fals
|
|
|
478
760
|
};
|
|
479
761
|
}
|
|
480
762
|
function renderStandaloneField(theme, disabled, className, style, inputElement, status = "regular", readOnly = false) {
|
|
481
|
-
return /* @__PURE__ */
|
|
763
|
+
return /* @__PURE__ */ jsx2(
|
|
482
764
|
"div",
|
|
483
765
|
{
|
|
484
766
|
"data-jumpy-component": "field-control",
|
|
@@ -496,18 +778,18 @@ function renderStandaloneField(theme, disabled, className, style, inputElement,
|
|
|
496
778
|
}
|
|
497
779
|
function JumpBackground({ snow = true }) {
|
|
498
780
|
const theme = useJumpyTheme();
|
|
499
|
-
return /* @__PURE__ */
|
|
500
|
-
/* @__PURE__ */
|
|
501
|
-
/* @__PURE__ */
|
|
502
|
-
/* @__PURE__ */
|
|
503
|
-
snow && /* @__PURE__ */
|
|
781
|
+
return /* @__PURE__ */ jsxs2("div", { className: "pointer-events-none fixed inset-0 z-0 overflow-hidden", style: { pointerEvents: "none" }, children: [
|
|
782
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute left-1/2 top-[-18rem] h-[34rem] w-[34rem] -translate-x-1/2 rounded-full blur-[120px]", style: { backgroundColor: theme.color.infoSurface } }),
|
|
783
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute bottom-24 right-[-10rem] h-[28rem] w-[28rem] rounded-full blur-[110px]", style: { backgroundColor: theme.color.borderSubtle } }),
|
|
784
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute inset-0 bg-[radial-gradient(rgba(26,28,31,0.16)_1px,transparent_1px)] bg-[size:22px_22px]", style: { opacity: theme.opacity.subtle } }),
|
|
785
|
+
snow && /* @__PURE__ */ jsx2("div", { className: "snowfall", "aria-hidden": "true" })
|
|
504
786
|
] });
|
|
505
787
|
}
|
|
506
788
|
function JumpBadge({ as, size: size2 = "medium", status = "regular", hidden = false, children, className = "", ...props }) {
|
|
507
789
|
const theme = useJumpyTheme();
|
|
508
790
|
const visible = !hidden;
|
|
509
791
|
const Root = as || "div";
|
|
510
|
-
return /* @__PURE__ */
|
|
792
|
+
return /* @__PURE__ */ jsx2(
|
|
511
793
|
Root,
|
|
512
794
|
{
|
|
513
795
|
...props,
|
|
@@ -530,15 +812,15 @@ function JumpBadge({ as, size: size2 = "medium", status = "regular", hidden = fa
|
|
|
530
812
|
transition: `width ${animationDurationValue(theme, JumpyAnimationDuration.medium)}s ${theme.animation.timeEasingDrift}, opacity ${animationDurationValue(theme, JumpyAnimationDuration.smallXS)}s ${visible ? theme.animation.timeEasingImpulse : theme.animation.timeEasingRelease}, scale ${animationDurationValue(theme, JumpyAnimationDuration.smallXS)}s ${visible ? theme.animation.timeEasingImpulse : theme.animation.timeEasingRelease}`,
|
|
531
813
|
...props.style || {}
|
|
532
814
|
},
|
|
533
|
-
children: size2 === "xSmall" ? null : /* @__PURE__ */
|
|
815
|
+
children: size2 === "xSmall" ? null : /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "badge-content", style: { display: "inline-block", lineHeight: "inherit", transform: "translateY(1px)", fontVariantNumeric: "tabular-nums" }, children })
|
|
534
816
|
}
|
|
535
817
|
);
|
|
536
818
|
}
|
|
537
819
|
function BrandMark({ compact = false, label = "Jumpy UI" }) {
|
|
538
820
|
const theme = useJumpyTheme();
|
|
539
|
-
return /* @__PURE__ */
|
|
540
|
-
/* @__PURE__ */
|
|
541
|
-
/* @__PURE__ */
|
|
821
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("flex items-center gap-3", !compact && "justify-center"), children: [
|
|
822
|
+
/* @__PURE__ */ jsx2("div", { className: "grid h-10 w-10 place-items-center rounded-xl text-xl font-black", style: { backgroundColor: theme.color.surfaceCard, color: theme.color.surfacePrimary, borderRadius: theme.radius.medium }, children: "J" }),
|
|
823
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-lg font-extrabold tracking-tight", style: { color: theme.color.textPrimary, fontFamily: theme.typography.fontFamily }, children: label })
|
|
542
824
|
] });
|
|
543
825
|
}
|
|
544
826
|
function JumpCard({ as, children, className = "", variant = "filled", interactive = false, selected = false, disabled = false, dragged = false, innerClasses = {}, ...props }) {
|
|
@@ -551,7 +833,7 @@ function JumpCard({ as, children, className = "", variant = "filled", interactiv
|
|
|
551
833
|
backgroundColor: `var(--jumpy-card-${activity}-dragged-surface)`
|
|
552
834
|
} : {};
|
|
553
835
|
const hasPaddingUtility = /(?:^|\s)(?:[a-z]+:)*p(?:[trblxy])?-/.test(className);
|
|
554
|
-
return /* @__PURE__ */
|
|
836
|
+
return /* @__PURE__ */ jsxs2(
|
|
555
837
|
Component,
|
|
556
838
|
{
|
|
557
839
|
...props,
|
|
@@ -585,7 +867,7 @@ function JumpCard({ as, children, className = "", variant = "filled", interactiv
|
|
|
585
867
|
...props.style || {}
|
|
586
868
|
},
|
|
587
869
|
children: [
|
|
588
|
-
interactive && selected ? /* @__PURE__ */
|
|
870
|
+
interactive && selected ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "checkmark", className: innerClasses.checkmark?.className, style: { position: "absolute", right: "var(--jumpy-cmp-card-checkmark-right)", top: "var(--jumpy-cmp-card-checkmark-top)", display: "flex", color: "var(--jumpy-card-default-icon)", ...innerClasses.checkmark?.style || {} }, children: /* @__PURE__ */ jsx2(CircleConfirmIcon, { "data-jumpy-slot": "checkmark-icon", className: innerClasses.checkmarkIcon?.className, style: { width: sizeValue(theme, JumpySize.small), height: sizeValue(theme, JumpySize.small), ...innerClasses.checkmarkIcon?.style || {} } }) }) : null,
|
|
589
871
|
children
|
|
590
872
|
]
|
|
591
873
|
}
|
|
@@ -595,7 +877,7 @@ function JumpGrid({ as, columns = { small: 8, medium: 12, large: 12, xLarge: 12
|
|
|
595
877
|
const Component = as || "div";
|
|
596
878
|
const resolvedColumns = responsiveValue(columns, { small: 8, medium: 12, large: 12, xLarge: 12 });
|
|
597
879
|
const resolvedSpacing = responsiveGridSpacing(spacing);
|
|
598
|
-
return /* @__PURE__ */
|
|
880
|
+
return /* @__PURE__ */ jsx2(
|
|
599
881
|
Component,
|
|
600
882
|
{
|
|
601
883
|
...props,
|
|
@@ -623,7 +905,7 @@ function JumpGrid({ as, columns = { small: 8, medium: 12, large: 12, xLarge: 12
|
|
|
623
905
|
function JumpGridItem({ as, span = 1, horizontalPlacement = "stretch", verticalPlacement = "stretch", children, className = "", ...props }) {
|
|
624
906
|
const Component = as || "div";
|
|
625
907
|
const resolvedSpan = responsiveValue(span, { small: 1, medium: 1, large: 1, xLarge: 1 });
|
|
626
|
-
return /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ jsx2(
|
|
627
909
|
Component,
|
|
628
910
|
{
|
|
629
911
|
...props,
|
|
@@ -644,7 +926,7 @@ function JumpGridItem({ as, span = 1, horizontalPlacement = "stretch", verticalP
|
|
|
644
926
|
}
|
|
645
927
|
function JumpList({ as, children, className = "", ...props }) {
|
|
646
928
|
const Component = as || "div";
|
|
647
|
-
return /* @__PURE__ */
|
|
929
|
+
return /* @__PURE__ */ jsx2(
|
|
648
930
|
Component,
|
|
649
931
|
{
|
|
650
932
|
...props,
|
|
@@ -674,7 +956,7 @@ function JumpListItem({ as, children, className = "", selected = false, disabled
|
|
|
674
956
|
const resolvedDescription = slots.description ?? description;
|
|
675
957
|
const resolvedSelector = slots.selector;
|
|
676
958
|
const resolvedNestedList = slots.nestedList;
|
|
677
|
-
const [internalNestedCollapsed, setInternalNestedCollapsed] =
|
|
959
|
+
const [internalNestedCollapsed, setInternalNestedCollapsed] = useState2(defaultNestedCollapsed);
|
|
678
960
|
const isNestedCollapsed = nestedCollapsed ?? internalNestedCollapsed;
|
|
679
961
|
const hasNestedList = Boolean(resolvedNestedList);
|
|
680
962
|
const isDisabled = disabled || readOnly;
|
|
@@ -698,7 +980,7 @@ function JumpListItem({ as, children, className = "", selected = false, disabled
|
|
|
698
980
|
}
|
|
699
981
|
props.onKeyDown?.(event);
|
|
700
982
|
};
|
|
701
|
-
return /* @__PURE__ */
|
|
983
|
+
return /* @__PURE__ */ jsxs2(
|
|
702
984
|
Component,
|
|
703
985
|
{
|
|
704
986
|
...props,
|
|
@@ -746,18 +1028,18 @@ function JumpListItem({ as, children, className = "", selected = false, disabled
|
|
|
746
1028
|
...props.style || {}
|
|
747
1029
|
},
|
|
748
1030
|
children: [
|
|
749
|
-
resolvedSelector ? /* @__PURE__ */
|
|
750
|
-
resolvedLeading ? /* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
/* @__PURE__ */
|
|
753
|
-
resolvedDescription ? /* @__PURE__ */
|
|
1031
|
+
resolvedSelector ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "selector", "aria-hidden": props.role === "option" || props.role === "treeitem" ? "true" : void 0, className: innerClasses.selector?.className, style: { display: "inline-flex", pointerEvents: "none", color: "var(--jumpy-list-item-icon-color, var(--jumpy-list-item-default-icon))", ...innerClasses.selector?.style || {} }, children: resolvedSelector }) : null,
|
|
1032
|
+
resolvedLeading ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "leading", "aria-hidden": "true", className: innerClasses.leading?.className, style: { display: "inline-flex", width: iconSize, height: iconSize, color: "var(--jumpy-list-item-icon-color, var(--jumpy-list-item-default-icon))", ...innerClasses.leading?.style || {} }, children: resolvedLeading }) : null,
|
|
1033
|
+
/* @__PURE__ */ jsxs2("span", { style: { display: "grid", minWidth: 0 }, children: [
|
|
1034
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "label", "data-truncate": truncateTexts ? "true" : void 0, "data-text": typeof children === "string" ? children : void 0, className: innerClasses.label?.className, style: { minWidth: 0, maxWidth: "100%", overflowWrap: "anywhere", wordBreak: "break-word", fontWeight: bodyMedium.fontWeight, ...innerClasses.label?.style || {} }, children }),
|
|
1035
|
+
resolvedDescription ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "description", className: innerClasses.description?.className, style: { color: selected ? theme.listItem.active.default.subtext : theme.listItem.inactive.default.subtext, fontSize: bodySmall.fontSize, lineHeight: bodySmall.lineHeight, ...innerClasses.description?.style || {} }, children: resolvedDescription }) : null
|
|
754
1036
|
] }),
|
|
755
|
-
resolvedMetadata ? /* @__PURE__ */
|
|
756
|
-
resolvedTrailing || hasNestedList ? /* @__PURE__ */
|
|
1037
|
+
resolvedMetadata ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "metadata", className: innerClasses.metadata?.className, style: { color: selected ? theme.listItem.active.default.subtext : theme.listItem.inactive.default.subtext, whiteSpace: "nowrap", fontSize: bodySmall.fontSize, lineHeight: bodySmall.lineHeight, ...innerClasses.metadata?.style || {} }, children: resolvedMetadata }) : null,
|
|
1038
|
+
resolvedTrailing || hasNestedList ? /* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "trailing", "aria-hidden": "true", className: innerClasses.trailing?.className, style: { display: "inline-flex", color: "var(--jumpy-list-item-icon-color, var(--jumpy-list-item-default-icon))", ...innerClasses.trailing?.style || {} }, children: [
|
|
757
1039
|
resolvedTrailing,
|
|
758
|
-
hasNestedList ? /* @__PURE__ */
|
|
1040
|
+
hasNestedList ? /* @__PURE__ */ jsx2(JumpIconButton, { as: "span", variant: "secondary", alternateHover: true, tabIndex: -1, "aria-hidden": "true", children: isNestedCollapsed ? /* @__PURE__ */ jsx2(ChevronDownIcon, {}) : /* @__PURE__ */ jsx2(ChevronUpIcon, {}) }) : null
|
|
759
1041
|
] }) : null,
|
|
760
|
-
hasNestedList ? /* @__PURE__ */
|
|
1042
|
+
hasNestedList ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "nested-list", "aria-hidden": isNestedCollapsed ? "true" : void 0, style: { gridColumn: "1 / -1", display: isNestedCollapsed ? "none" : "block" }, children: resolvedNestedList }) : null
|
|
761
1043
|
]
|
|
762
1044
|
}
|
|
763
1045
|
);
|
|
@@ -765,12 +1047,12 @@ function JumpListItem({ as, children, className = "", selected = false, disabled
|
|
|
765
1047
|
function JumpSideMenu({ as, children, className = "", collapsed = false, selected, disabled = false, disableKeyboardNavigation = false, renderMode, getItemProps, onChange, onKeyDown, onTransitionEnd, ...props }) {
|
|
766
1048
|
const Component = as || "ul";
|
|
767
1049
|
const theme = useJumpyTheme();
|
|
768
|
-
const elementRef =
|
|
769
|
-
const itemRefs =
|
|
770
|
-
const previousCollapsed =
|
|
771
|
-
const releaseTimer =
|
|
772
|
-
const [isResizing, setIsResizing] =
|
|
773
|
-
|
|
1050
|
+
const elementRef = useRef2(null);
|
|
1051
|
+
const itemRefs = useRef2([]);
|
|
1052
|
+
const previousCollapsed = useRef2(collapsed);
|
|
1053
|
+
const releaseTimer = useRef2(void 0);
|
|
1054
|
+
const [isResizing, setIsResizing] = useState2(false);
|
|
1055
|
+
useLayoutEffect2(() => {
|
|
774
1056
|
if (previousCollapsed.current === collapsed) return void 0;
|
|
775
1057
|
previousCollapsed.current = collapsed;
|
|
776
1058
|
const element = elementRef.current;
|
|
@@ -782,7 +1064,7 @@ function JumpSideMenu({ as, children, className = "", collapsed = false, selecte
|
|
|
782
1064
|
releaseTimer.current = window.setTimeout(() => setIsResizing(false), transitionMs + 100);
|
|
783
1065
|
return void 0;
|
|
784
1066
|
}, [collapsed]);
|
|
785
|
-
|
|
1067
|
+
useEffect2(() => () => window.clearTimeout(releaseTimer.current), []);
|
|
786
1068
|
const selectItem = (value) => {
|
|
787
1069
|
if (disabled || value === void 0) return;
|
|
788
1070
|
onChange?.([value]);
|
|
@@ -812,7 +1094,7 @@ function JumpSideMenu({ as, children, className = "", collapsed = false, selecte
|
|
|
812
1094
|
setIsResizing(false);
|
|
813
1095
|
}
|
|
814
1096
|
};
|
|
815
|
-
return /* @__PURE__ */
|
|
1097
|
+
return /* @__PURE__ */ jsx2(JumpySideMenuContext.Provider, { value: { collapsed, disabled, selected, onSelect: selectItem, containerExpanded: isResizing || !collapsed, renderMode, getItemProps, disableKeyboardNavigation, itemRefs }, children: /* @__PURE__ */ jsx2(
|
|
816
1098
|
Component,
|
|
817
1099
|
{
|
|
818
1100
|
...props,
|
|
@@ -844,8 +1126,8 @@ function JumpSideMenu({ as, children, className = "", collapsed = false, selecte
|
|
|
844
1126
|
function JumpSideMenuItem({ as, children, value, selected = false, disabled = false, className = "", icon, badge, collapsed, slots, metadata, description, nestedMenu, nestedCollapsed, defaultNestedCollapsed = false, onNestedCollapsedChange, renderMode, focusedView, truncateTexts = false, tooltipProps, innerClasses = {}, wrapperProps = {}, expanderIconProps = {}, onClick, onKeyDown, ...props }) {
|
|
845
1127
|
const theme = useJumpyTheme();
|
|
846
1128
|
const sideMenu = useContext(JumpySideMenuContext);
|
|
847
|
-
const itemRef =
|
|
848
|
-
const wrapperItemRef =
|
|
1129
|
+
const itemRef = useRef2(null);
|
|
1130
|
+
const wrapperItemRef = useRef2(null);
|
|
849
1131
|
const isCollapsed = sideMenu ? !sideMenu.containerExpanded : collapsed ?? false;
|
|
850
1132
|
const resolvedRenderMode = sideMenu?.renderMode ?? renderMode ?? "navigation";
|
|
851
1133
|
const selectedValues = sideMenu?.selected;
|
|
@@ -856,7 +1138,7 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
856
1138
|
const resolvedTabIndex = focusedView ? 0 : sideMenu && !sideMenu.disableKeyboardNavigation && Array.isArray(selectedValues) ? isSelected ? 0 : -1 : props.tabIndex;
|
|
857
1139
|
const hasNested = Boolean(resolvedNestedMenu);
|
|
858
1140
|
const hasSelectedChildren = hasSelectedNestedItem(resolvedNestedMenu, selectedValues);
|
|
859
|
-
const [internalNestedCollapsed, setInternalNestedCollapsed] =
|
|
1141
|
+
const [internalNestedCollapsed, setInternalNestedCollapsed] = useState2(defaultNestedCollapsed);
|
|
860
1142
|
const isNestedCollapsed = nestedCollapsed ?? internalNestedCollapsed;
|
|
861
1143
|
const iconNode = typeof icon === "function" ? icon({ selected: isSelected }) : icon;
|
|
862
1144
|
const badgeNode = typeof badge === "function" ? badge({ selected: isSelected, collapsed: isCollapsed }) : badge;
|
|
@@ -881,7 +1163,7 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
881
1163
|
const itemInteractionProps = sideMenu?.getItemProps?.({ onClick: handleItemClick, onKeyDown: handleItemKeyDown }) ?? {};
|
|
882
1164
|
const { onClick: interactionOnClick, onKeyDown: interactionOnKeyDown, ...restItemInteractionProps } = itemInteractionProps;
|
|
883
1165
|
const { wrapperProps: splitWrapperProps, linkProps } = resolvedRenderMode === "navigation" ? splitNavigationItemProps(props) : { wrapperProps: {}, linkProps: props };
|
|
884
|
-
|
|
1166
|
+
useEffect2(() => {
|
|
885
1167
|
if (!sideMenu?.itemRefs) return void 0;
|
|
886
1168
|
const registryItem = isCollapsed && resolvedRenderMode === "navigation" ? wrapperItemRef : itemRef;
|
|
887
1169
|
sideMenu.itemRefs.current.push(registryItem);
|
|
@@ -892,11 +1174,11 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
892
1174
|
const withTooltip = (node) => {
|
|
893
1175
|
if (!tooltipProps?.content) return node;
|
|
894
1176
|
const { content, ...restTooltipProps } = tooltipProps;
|
|
895
|
-
return /* @__PURE__ */
|
|
1177
|
+
return /* @__PURE__ */ jsx2(JumpTooltip, { ...restTooltipProps, content, children: node });
|
|
896
1178
|
};
|
|
897
|
-
const trailingNode = hasNested ? /* @__PURE__ */
|
|
1179
|
+
const trailingNode = hasNested ? /* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "expander", "aria-hidden": "true", className: innerClasses.expander?.className, style: { display: "inline-flex", alignItems: "center", gap: spacingValue(theme, JumpySpacing.small), ...innerClasses.expander?.style || {} }, children: [
|
|
898
1180
|
badgeNode,
|
|
899
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx2("span", { ...expanderIconProps, "data-jumpy-slot": "expander-icon", className: cn(innerClasses.expanderIcon?.className, expanderIconProps.className), style: { display: "inline-flex", transform: isNestedCollapsed ? "rotate(0deg)" : "rotate(180deg)", transition: `transform ${animationDurationValue(theme, JumpyAnimationDuration.smallXS)}s ${theme.animation.timeEasingDrift}`, ...innerClasses.expanderIcon?.style || {}, ...expanderIconProps.style || {} }, children: /* @__PURE__ */ jsx2(ChevronDownIcon, {}) })
|
|
900
1182
|
] }) : badgeNode;
|
|
901
1183
|
if (isCollapsed) {
|
|
902
1184
|
const Component = as || (resolvedRenderMode === "navigation" ? "a" : "button");
|
|
@@ -920,9 +1202,9 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
920
1202
|
}
|
|
921
1203
|
}
|
|
922
1204
|
} : {};
|
|
923
|
-
return /* @__PURE__ */
|
|
1205
|
+
return /* @__PURE__ */ jsxs2("li", { ...splitWrapperProps, ...wrapperProps, ...collapsedWrapperInteractiveProps, "data-jumpy-component": "side-menu-item-wrapper", "aria-expanded": hasNested ? !isNestedCollapsed : void 0, className: cn(innerClasses.selector?.className, splitWrapperProps.className, wrapperProps.className), style: { display: "block", margin: 0, padding: 0, ...splitWrapperProps.style || {}, ...innerClasses.selector?.style || {}, ...wrapperProps.style || {} }, children: [
|
|
924
1206
|
withTooltip(
|
|
925
|
-
/* @__PURE__ */
|
|
1207
|
+
/* @__PURE__ */ jsxs2(
|
|
926
1208
|
Component,
|
|
927
1209
|
{
|
|
928
1210
|
...linkProps,
|
|
@@ -962,19 +1244,19 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
962
1244
|
...linkProps.style || {}
|
|
963
1245
|
},
|
|
964
1246
|
children: [
|
|
965
|
-
/* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "side-menu-decorator", className: innerClasses.decoratorContainer?.className, style: { position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", padding: `${spacingValue(theme, JumpySpacing.smallXS)}px ${spacingValue(theme, JumpySpacing.large2XL)}px ${spacingValue(theme, JumpySpacing.small3XS)}px`, color: tokens.icon, ...innerClasses.decoratorContainer?.style || {} }, children: [
|
|
966
1248
|
iconNode,
|
|
967
|
-
badgeNode ? /* @__PURE__ */
|
|
1249
|
+
badgeNode ? /* @__PURE__ */ jsx2("span", { style: { position: "absolute", top: 0, right: spacingValue(theme, JumpySpacing.large), display: "inline-flex" }, children: badgeNode }) : null
|
|
968
1250
|
] }),
|
|
969
|
-
children ? /* @__PURE__ */
|
|
1251
|
+
children ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "label", "data-text": typeof children === "string" ? children : void 0, className: innerClasses.label?.className, style: { boxSizing: "border-box", paddingInline: spacingValue(theme, JumpySpacing.large), overflowWrap: "anywhere", textAlign: "center", fontFamily: theme.fontFamily.familyBase, fontSize: labelStyle.fontSize, lineHeight: labelStyle.lineHeight, fontWeight: labelStyle.fontWeight, ...truncateTexts ? { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", maxWidth: "100%" } : {}, ...innerClasses.label?.style || {} }, children }) : null
|
|
970
1252
|
]
|
|
971
1253
|
}
|
|
972
1254
|
)
|
|
973
1255
|
),
|
|
974
|
-
hasNested && !isNestedCollapsed ? /* @__PURE__ */
|
|
1256
|
+
hasNested && !isNestedCollapsed ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "nested-menu", children: resolvedNestedMenu }) : null
|
|
975
1257
|
] });
|
|
976
1258
|
}
|
|
977
|
-
const expandedItem = /* @__PURE__ */
|
|
1259
|
+
const expandedItem = /* @__PURE__ */ jsx2(
|
|
978
1260
|
JumpListItem,
|
|
979
1261
|
{
|
|
980
1262
|
...linkProps,
|
|
@@ -1012,17 +1294,17 @@ function JumpSideMenuItem({ as, children, value, selected = false, disabled = fa
|
|
|
1012
1294
|
children
|
|
1013
1295
|
}
|
|
1014
1296
|
);
|
|
1015
|
-
const expandedNestedMenu = hasNested && !isNestedCollapsed ? /* @__PURE__ */
|
|
1297
|
+
const expandedNestedMenu = hasNested && !isNestedCollapsed ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "nested-menu", children: resolvedNestedMenu }) : null;
|
|
1016
1298
|
if (resolvedRenderMode === "navigation") {
|
|
1017
1299
|
return withTooltip(
|
|
1018
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsxs2("li", { ...splitWrapperProps, ...wrapperProps, "data-jumpy-component": "side-menu-item-wrapper", "aria-expanded": hasNested ? !isNestedCollapsed : void 0, className: cn(splitWrapperProps.className, wrapperProps.className), style: { display: "block", margin: 0, padding: 0, ...splitWrapperProps.style || {}, ...wrapperProps.style || {} }, children: [
|
|
1019
1301
|
withTooltip(expandedItem),
|
|
1020
1302
|
expandedNestedMenu
|
|
1021
1303
|
] })
|
|
1022
1304
|
);
|
|
1023
1305
|
}
|
|
1024
1306
|
return withTooltip(
|
|
1025
|
-
/* @__PURE__ */
|
|
1307
|
+
/* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1026
1308
|
expandedItem,
|
|
1027
1309
|
expandedNestedMenu
|
|
1028
1310
|
] })
|
|
@@ -1032,7 +1314,7 @@ function JumpTypography({ as, variant = "bodyMedium", color = "primary", classNa
|
|
|
1032
1314
|
const theme = useJumpyTheme();
|
|
1033
1315
|
const Component = as || "p";
|
|
1034
1316
|
const colorValue = color === "secondary" ? theme.color.textSecondary : color === "primary" ? theme.color.textPrimary : color;
|
|
1035
|
-
return /* @__PURE__ */
|
|
1317
|
+
return /* @__PURE__ */ jsx2(
|
|
1036
1318
|
Component,
|
|
1037
1319
|
{
|
|
1038
1320
|
...props,
|
|
@@ -1052,9 +1334,9 @@ function JumpHyperlink({ as, variant = "inline", disabled = false, className = "
|
|
|
1052
1334
|
const theme = useJumpyTheme();
|
|
1053
1335
|
const Component = as || "a";
|
|
1054
1336
|
if (variant !== "inline") {
|
|
1055
|
-
return /* @__PURE__ */
|
|
1337
|
+
return /* @__PURE__ */ jsx2(JumpLinkButton, { ...props, href: props.href || "#", variant: "borderless", className, children });
|
|
1056
1338
|
}
|
|
1057
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ jsx2(
|
|
1058
1340
|
Component,
|
|
1059
1341
|
{
|
|
1060
1342
|
...props,
|
|
@@ -1081,7 +1363,7 @@ function JumpDivider({ as, direction = "horizontal", captionPosition = "center",
|
|
|
1081
1363
|
const theme = useJumpyTheme();
|
|
1082
1364
|
const Component = as || "div";
|
|
1083
1365
|
const isVertical = direction === "vertical";
|
|
1084
|
-
return /* @__PURE__ */
|
|
1366
|
+
return /* @__PURE__ */ jsx2(
|
|
1085
1367
|
Component,
|
|
1086
1368
|
{
|
|
1087
1369
|
...props,
|
|
@@ -1103,7 +1385,7 @@ function JumpDivider({ as, direction = "horizontal", captionPosition = "center",
|
|
|
1103
1385
|
color: theme.color.textSecondary,
|
|
1104
1386
|
...props.style || {}
|
|
1105
1387
|
},
|
|
1106
|
-
children: children ? /* @__PURE__ */
|
|
1388
|
+
children: children ? /* @__PURE__ */ jsx2("span", { style: { backgroundColor: theme.color.surfaceCard, padding: `0 ${spacingValue(theme, JumpySpacing.smallXS)}px`, transform: isVertical ? "rotate(-90deg)" : void 0 }, children }) : null
|
|
1107
1389
|
}
|
|
1108
1390
|
);
|
|
1109
1391
|
}
|
|
@@ -1113,7 +1395,7 @@ function JumpAvatar({ as, size: size2 = "medium", disableInteraction = false, di
|
|
|
1113
1395
|
const isButton = Component === "button";
|
|
1114
1396
|
const sizes = { small: JumpySize.large, medium: JumpySize.large2XL, large: JumpySize.large4XL };
|
|
1115
1397
|
const avatarSize = sizeValue(theme, sizes[size2] || JumpySize.large2XL);
|
|
1116
|
-
return /* @__PURE__ */
|
|
1398
|
+
return /* @__PURE__ */ jsx2(
|
|
1117
1399
|
Component,
|
|
1118
1400
|
{
|
|
1119
1401
|
...props,
|
|
@@ -1154,7 +1436,7 @@ function JumpBanner({ as, status: statusProp = "other", variant = "default", dir
|
|
|
1154
1436
|
const contentContainerVertical = direction === "vertical";
|
|
1155
1437
|
const contentTitle = textStyleValue(theme, JumpyTextStyle.titleMediumEmphasized);
|
|
1156
1438
|
const contentDescription = textStyleValue(theme, JumpyTextStyle.bodyMedium);
|
|
1157
|
-
return /* @__PURE__ */
|
|
1439
|
+
return /* @__PURE__ */ jsxs2(
|
|
1158
1440
|
Component,
|
|
1159
1441
|
{
|
|
1160
1442
|
...props,
|
|
@@ -1172,7 +1454,7 @@ function JumpBanner({ as, status: statusProp = "other", variant = "default", dir
|
|
|
1172
1454
|
...props.style || {}
|
|
1173
1455
|
},
|
|
1174
1456
|
children: [
|
|
1175
|
-
!hideStatus ? /* @__PURE__ */
|
|
1457
|
+
!hideStatus ? /* @__PURE__ */ jsx2(
|
|
1176
1458
|
"span",
|
|
1177
1459
|
{
|
|
1178
1460
|
"data-jumpy-slot": "banner-status",
|
|
@@ -1181,10 +1463,10 @@ function JumpBanner({ as, status: statusProp = "other", variant = "default", dir
|
|
|
1181
1463
|
style: {
|
|
1182
1464
|
...innerClasses.status?.style || {}
|
|
1183
1465
|
},
|
|
1184
|
-
children: /* @__PURE__ */
|
|
1466
|
+
children: /* @__PURE__ */ jsx2(JumpSeverityIcon, { status, icon: bannerIcon })
|
|
1185
1467
|
}
|
|
1186
1468
|
) : null,
|
|
1187
|
-
/* @__PURE__ */
|
|
1469
|
+
/* @__PURE__ */ jsxs2(
|
|
1188
1470
|
"div",
|
|
1189
1471
|
{
|
|
1190
1472
|
"data-jumpy-slot": "banner-content-container",
|
|
@@ -1194,7 +1476,7 @@ function JumpBanner({ as, status: statusProp = "other", variant = "default", dir
|
|
|
1194
1476
|
...innerClasses.contentContainer?.style || {}
|
|
1195
1477
|
},
|
|
1196
1478
|
children: [
|
|
1197
|
-
/* @__PURE__ */
|
|
1479
|
+
/* @__PURE__ */ jsxs2(
|
|
1198
1480
|
"div",
|
|
1199
1481
|
{
|
|
1200
1482
|
"data-jumpy-slot": "banner-content",
|
|
@@ -1226,7 +1508,7 @@ function JumpBanner({ as, status: statusProp = "other", variant = "default", dir
|
|
|
1226
1508
|
]
|
|
1227
1509
|
}
|
|
1228
1510
|
),
|
|
1229
|
-
contentContainerVertical && bannerActions ? /* @__PURE__ */
|
|
1511
|
+
contentContainerVertical && bannerActions ? /* @__PURE__ */ jsx2(
|
|
1230
1512
|
"div",
|
|
1231
1513
|
{
|
|
1232
1514
|
"data-jumpy-slot": "banner-actions-container",
|
|
@@ -1251,7 +1533,7 @@ function JumpSkeletonLoader({ as, variant = "text", lines = 1, width, height, di
|
|
|
1251
1533
|
const defaultHeight = variant === "text" ? theme.fontFamily.bodyMedium.fontSize * theme.fontFamily.bodyMedium.lineHeight : variant === "icon" || variant === "avatar" ? sizeValue(theme, JumpySize.large) : sizeValue(theme, JumpySize.large2XL);
|
|
1252
1534
|
const radius = variant === "avatar" ? radiusValue(theme, JumpyRadius.full) : radiusValue(theme, JumpyRadius.small);
|
|
1253
1535
|
const items = Array.from({ length: variant === "text" ? lines : 1 });
|
|
1254
|
-
return /* @__PURE__ */
|
|
1536
|
+
return /* @__PURE__ */ jsx2("div", { "data-jumpy-component": "skeleton-loader-group", className: cn(className), style: { display: "grid", gap: spacingValue(theme, JumpySpacing.smallXS), width: width || "100%", ...props.style || {} }, children: items.map((_, index) => /* @__PURE__ */ jsx2(
|
|
1255
1537
|
Component,
|
|
1256
1538
|
{
|
|
1257
1539
|
"aria-hidden": "true",
|
|
@@ -1270,35 +1552,35 @@ function JumpSkeletonLoader({ as, variant = "text", lines = 1, width, height, di
|
|
|
1270
1552
|
var JumpSearchField = forwardRef(function JumpSearchField2({ label = "Search", placeholder = "Search", className = "", ...props }, ref) {
|
|
1271
1553
|
const ariaLabelledBy = props["aria-labelledby"];
|
|
1272
1554
|
const ariaLabel = ariaLabelledBy ? void 0 : props["aria-label"] || label || placeholder;
|
|
1273
|
-
return /* @__PURE__ */
|
|
1555
|
+
return /* @__PURE__ */ jsx2(JumpBaseInput, { className: cn("jumpy-search-field", className), leading: /* @__PURE__ */ jsx2("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("path", { d: "M16.071 14.5q1.509-1.95 1.508-4.5c0-4.1-3.418-7.5-7.54-7.5C5.919 2.5 2.5 5.9 2.5 10s3.418 7.5 7.54 7.5c1.709 0 3.317-.6 4.524-1.5l5.529 5.5 1.407-1.4zm-6.031 1c-3.016 0-5.53-2.5-5.53-5.5s2.515-5.5 5.53-5.5S15.569 7 15.569 10s-2.513 5.5-5.53 5.5z" }) }), children: /* @__PURE__ */ jsx2(JumpInput, { ...props, ref, type: "search", placeholder, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }) });
|
|
1274
1556
|
});
|
|
1275
1557
|
function JumpTooltip({ content, children, className = "", ...props }) {
|
|
1276
1558
|
const theme = useJumpyTheme();
|
|
1277
|
-
const [visible, setVisible] =
|
|
1278
|
-
return /* @__PURE__ */
|
|
1559
|
+
const [visible, setVisible] = useState2(false);
|
|
1560
|
+
return /* @__PURE__ */ jsxs2("span", { ...props, "data-jumpy-component": "tooltip", className: cn(className), style: { position: "relative", display: "inline-flex", ...props.style || {} }, onMouseEnter: () => setVisible(true), onMouseLeave: () => setVisible(false), onFocus: () => setVisible(true), onBlur: () => setVisible(false), children: [
|
|
1279
1561
|
children,
|
|
1280
|
-
visible ? /* @__PURE__ */
|
|
1562
|
+
visible ? /* @__PURE__ */ jsx2("span", { role: "tooltip", style: { position: "absolute", left: "50%", bottom: `calc(100% + ${spacingValue(theme, JumpySpacing.smallXS)}px)`, transform: "translateX(-50%)", zIndex: 30, width: "max-content", maxWidth: 240, borderRadius: radiusValue(theme, JumpyRadius.small), backgroundColor: theme.color.textPrimary, color: theme.color.surfaceCard, padding: `${spacingValue(theme, JumpySpacing.small3XS)}px ${spacingValue(theme, JumpySpacing.smallXS)}px`, boxShadow: theme.shadow.positiveSmall, fontSize: theme.fontFamily.bodySmall.fontSize, lineHeight: theme.fontFamily.bodySmall.lineHeight }, children: content }) : null
|
|
1281
1563
|
] });
|
|
1282
1564
|
}
|
|
1283
1565
|
function JumpPopover({ open, defaultOpen = false, onOpenChange, trigger, children, className = "", ...props }) {
|
|
1284
1566
|
const theme = useJumpyTheme();
|
|
1285
|
-
const [internalOpen, setInternalOpen] =
|
|
1567
|
+
const [internalOpen, setInternalOpen] = useState2(defaultOpen);
|
|
1286
1568
|
const visible = open ?? internalOpen;
|
|
1287
1569
|
const setVisible = (next) => {
|
|
1288
1570
|
setInternalOpen(next);
|
|
1289
1571
|
onOpenChange?.(next);
|
|
1290
1572
|
};
|
|
1291
|
-
return /* @__PURE__ */
|
|
1292
|
-
/* @__PURE__ */
|
|
1293
|
-
visible ? /* @__PURE__ */
|
|
1573
|
+
return /* @__PURE__ */ jsxs2("span", { "data-jumpy-component": "popover-root", className: cn(className), style: { position: "relative", display: "inline-flex", ...props.style || {} }, children: [
|
|
1574
|
+
/* @__PURE__ */ jsx2("span", { onClick: () => setVisible(!visible), children: trigger }),
|
|
1575
|
+
visible ? /* @__PURE__ */ jsx2("div", { role: "dialog", "data-jumpy-component": "popover", style: { position: "absolute", top: `calc(100% + ${spacingValue(theme, JumpySpacing.smallXS)}px)`, left: 0, zIndex: 30, minWidth: 220, borderRadius: radiusValue(theme, JumpyRadius.large), border: `${borderWidthValue(theme, JumpyBorderWidth.small)}px solid ${theme.color.borderSubtle}`, backgroundColor: theme.color.surfaceCard, color: theme.color.textPrimary, boxShadow: theme.shadow.positiveMedium, padding: spacingValue(theme, JumpySpacing.large) }, children }) : null
|
|
1294
1576
|
] });
|
|
1295
1577
|
}
|
|
1296
1578
|
function JumpMenu({ trigger, open, defaultOpen = false, onOpenChange, header, footer, children, className = "", placement = "bottom-start", closeOnSelect = true, ...props }) {
|
|
1297
1579
|
const theme = useJumpyTheme();
|
|
1298
|
-
const [internalOpen, setInternalOpen] =
|
|
1580
|
+
const [internalOpen, setInternalOpen] = useState2(defaultOpen);
|
|
1299
1581
|
const isOpen = open ?? internalOpen;
|
|
1300
|
-
const menuRef =
|
|
1301
|
-
const insideEventRef =
|
|
1582
|
+
const menuRef = useRef2(null);
|
|
1583
|
+
const insideEventRef = useRef2(null);
|
|
1302
1584
|
const menuOffset = spacingValue(theme, JumpySpacing.small3XS);
|
|
1303
1585
|
const menuPadding = spacingValue(theme, JumpySpacing.medium);
|
|
1304
1586
|
const menuMinWidth = sizeValue(theme, JumpySize.large8XL);
|
|
@@ -1375,7 +1657,7 @@ function JumpMenu({ trigger, open, defaultOpen = false, onOpenChange, header, fo
|
|
|
1375
1657
|
}
|
|
1376
1658
|
props.onKeyDown?.(event);
|
|
1377
1659
|
}
|
|
1378
|
-
|
|
1660
|
+
useEffect2(() => {
|
|
1379
1661
|
if (!isOpen) return void 0;
|
|
1380
1662
|
function dismissOutside(event) {
|
|
1381
1663
|
if (insideEventRef.current !== event) setOpen(false);
|
|
@@ -1398,9 +1680,9 @@ function JumpMenu({ trigger, open, defaultOpen = false, onOpenChange, header, fo
|
|
|
1398
1680
|
setOpen(false);
|
|
1399
1681
|
refs.domReference.current?.focus?.();
|
|
1400
1682
|
}
|
|
1401
|
-
return /* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1403
|
-
isOpen ? /* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ jsxs2("span", { "data-jumpy-component": "menu-root", className: cn(className), onPointerDown: markInteractionInside, onFocus: markInteractionInside, style: { display: "inline-flex", ...props.style || {} }, children: [
|
|
1684
|
+
/* @__PURE__ */ jsx2("span", { ref: refs.setReference, "aria-haspopup": "menu", "aria-expanded": isOpen, tabIndex: 0, onClick: () => setOpen(!isOpen), onKeyDown: handleTriggerKeyDown, children: trigger }),
|
|
1685
|
+
isOpen ? /* @__PURE__ */ jsx2(JumpyPortal, { children: /* @__PURE__ */ jsxs2(
|
|
1404
1686
|
"div",
|
|
1405
1687
|
{
|
|
1406
1688
|
...props,
|
|
@@ -1420,9 +1702,9 @@ function JumpMenu({ trigger, open, defaultOpen = false, onOpenChange, header, fo
|
|
|
1420
1702
|
...props.style || {}
|
|
1421
1703
|
},
|
|
1422
1704
|
children: [
|
|
1423
|
-
header ? /* @__PURE__ */
|
|
1705
|
+
header ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "menu-header", children: header }) : null,
|
|
1424
1706
|
children,
|
|
1425
|
-
footer ? /* @__PURE__ */
|
|
1707
|
+
footer ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "menu-footer", children: footer }) : null
|
|
1426
1708
|
]
|
|
1427
1709
|
}
|
|
1428
1710
|
) }) : null
|
|
@@ -1433,12 +1715,12 @@ function JumpMenuItem({ as, children, selected = false, disabled = false, readOn
|
|
|
1433
1715
|
const resolvedSlots = {
|
|
1434
1716
|
...slots,
|
|
1435
1717
|
leading: slots.leading ?? leading,
|
|
1436
|
-
trailing: nestedMenu ? /* @__PURE__ */
|
|
1718
|
+
trailing: nestedMenu ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", children: "\u203A" }) : slots.trailing ?? trailing,
|
|
1437
1719
|
metadata: slots.metadata ?? metadata,
|
|
1438
1720
|
description: slots.description ?? description
|
|
1439
1721
|
};
|
|
1440
|
-
return /* @__PURE__ */
|
|
1441
|
-
/* @__PURE__ */
|
|
1722
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1723
|
+
/* @__PURE__ */ jsx2(
|
|
1442
1724
|
JumpListItem,
|
|
1443
1725
|
{
|
|
1444
1726
|
...props,
|
|
@@ -1474,7 +1756,7 @@ function JumpToggleButton({ as, selected, value, disabled = false, onChange, lea
|
|
|
1474
1756
|
onChange?.(!isSelected);
|
|
1475
1757
|
props.onClick?.(event);
|
|
1476
1758
|
}
|
|
1477
|
-
return /* @__PURE__ */
|
|
1759
|
+
return /* @__PURE__ */ jsxs2(
|
|
1478
1760
|
Component,
|
|
1479
1761
|
{
|
|
1480
1762
|
...props,
|
|
@@ -1512,8 +1794,8 @@ function JumpToggleButton({ as, selected, value, disabled = false, onChange, lea
|
|
|
1512
1794
|
...props.style || {}
|
|
1513
1795
|
},
|
|
1514
1796
|
children: [
|
|
1515
|
-
leading ? /* @__PURE__ */
|
|
1516
|
-
children ? /* @__PURE__ */
|
|
1797
|
+
leading ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", style: { display: "inline-flex", color: "var(--jumpy-cmp-toggle-button-icon-fill)" }, children: typeof leading === "function" ? leading({ selected: isSelected }) : leading }) : null,
|
|
1798
|
+
children ? /* @__PURE__ */ jsx2("span", { style: { display: "inline-flex", alignItems: "center", justifyContent: "center", margin: `0 ${spacingValue(theme, JumpySpacing.small3XS)}px`, whiteSpace: "nowrap" }, children }) : null
|
|
1517
1799
|
]
|
|
1518
1800
|
}
|
|
1519
1801
|
);
|
|
@@ -1521,14 +1803,14 @@ function JumpToggleButton({ as, selected, value, disabled = false, onChange, lea
|
|
|
1521
1803
|
function JumpToggleButtonGroup({ as, selected, defaultSelected = [], onChange, exclusive = false, disabled = false, children, className = "", ...props }) {
|
|
1522
1804
|
const theme = useJumpyTheme();
|
|
1523
1805
|
const Component = as || "div";
|
|
1524
|
-
const [internalSelected, setInternalSelected] =
|
|
1806
|
+
const [internalSelected, setInternalSelected] = useState2(defaultSelected);
|
|
1525
1807
|
const currentSelected = selected ?? internalSelected;
|
|
1526
1808
|
function handleToggle(toggledValue) {
|
|
1527
1809
|
const nextSelected = currentSelected.includes(toggledValue) ? currentSelected.filter((item) => item !== toggledValue) : exclusive ? [toggledValue] : [...currentSelected, toggledValue];
|
|
1528
1810
|
setInternalSelected(nextSelected);
|
|
1529
1811
|
onChange?.(nextSelected);
|
|
1530
1812
|
}
|
|
1531
|
-
return /* @__PURE__ */
|
|
1813
|
+
return /* @__PURE__ */ jsx2(JumpyToggleButtonGroupContext.Provider, { value: { value: currentSelected, onChange: handleToggle, exclusive, disabled }, children: /* @__PURE__ */ jsx2(
|
|
1532
1814
|
Component,
|
|
1533
1815
|
{
|
|
1534
1816
|
...props,
|
|
@@ -1543,9 +1825,9 @@ function JumpToggleButtonGroup({ as, selected, defaultSelected = [], onChange, e
|
|
|
1543
1825
|
function JumpPinInput({ length = 6, value, defaultValue = "", onChange, onComplete, name, mask = false, type = "numeric", error = false, disabled = false, helperText, ariaLabels = {}, className = "", innerClasses = {}, ...props }) {
|
|
1544
1826
|
const theme = useJumpyTheme();
|
|
1545
1827
|
const normalizedLength = clampNumber(length, 4, 8);
|
|
1546
|
-
const [internalValue, setInternalValue] =
|
|
1828
|
+
const [internalValue, setInternalValue] = useState2(defaultValue);
|
|
1547
1829
|
const currentValue = String(value ?? internalValue).slice(0, normalizedLength);
|
|
1548
|
-
const refs =
|
|
1830
|
+
const refs = useRef2([]);
|
|
1549
1831
|
const pattern = type === "alphanumeric" ? /^[a-z0-9]$/i : /^\d$/;
|
|
1550
1832
|
const helperId = helperText ? `${name || props.id || "jumpy-pin-input"}-helper` : void 0;
|
|
1551
1833
|
function commit(nextValue, focusIndex) {
|
|
@@ -1562,11 +1844,11 @@ function JumpPinInput({ length = 6, value, defaultValue = "", onChange, onComple
|
|
|
1562
1844
|
}
|
|
1563
1845
|
const supportingColor = disabled ? theme.color["jumpy-input-regular-disabled-supporting"] : error ? theme.color["jumpy-input-alarm-default-supporting"] : theme.color["jumpy-input-regular-default-supporting"];
|
|
1564
1846
|
const textStyle = textStyleValue(theme, JumpyTextStyle.bodyLarge);
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
name ? /* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1847
|
+
return /* @__PURE__ */ jsxs2("fieldset", { ...props, disabled, "data-jumpy-component": "pin-input", className: cn(className), style: { display: "inline-flex", flexDirection: "column", alignItems: "flex-start", border: 0, margin: 0, padding: 0, ...props.style || {} }, children: [
|
|
1848
|
+
name ? /* @__PURE__ */ jsx2("input", { type: "hidden", name, value: currentValue }) : null,
|
|
1849
|
+
/* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "pin-input-cells", className: cn(innerClasses.cells?.className), style: { display: "flex", gap: spacingValue(theme, JumpySpacing.small2XS), cursor: disabled ? "not-allowed" : "text", ...innerClasses.cells?.style || {} }, onClick: (event) => {
|
|
1568
1850
|
if (event.target === event.currentTarget) refs.current[Math.min(currentValue.length, normalizedLength - 1)]?.focus();
|
|
1569
|
-
}, children: Array.from({ length: normalizedLength }, (_, index) => /* @__PURE__ */
|
|
1851
|
+
}, children: Array.from({ length: normalizedLength }, (_, index) => /* @__PURE__ */ jsx2(
|
|
1570
1852
|
"input",
|
|
1571
1853
|
{
|
|
1572
1854
|
ref: (node) => {
|
|
@@ -1610,12 +1892,12 @@ function JumpPinInput({ length = 6, value, defaultValue = "", onChange, onComple
|
|
|
1610
1892
|
},
|
|
1611
1893
|
index
|
|
1612
1894
|
)) }),
|
|
1613
|
-
helperText ? /* @__PURE__ */
|
|
1895
|
+
helperText ? /* @__PURE__ */ jsx2("div", { id: helperId, "data-jumpy-slot": "pin-input-helper", className: cn(innerClasses.supportingText?.className), style: { paddingTop: spacingValue(theme, JumpySpacing.small3XS), color: supportingColor, fontFamily: theme.fontFamily.familyBase, fontSize: textStyleValue(theme, JumpyTextStyle.labelSmall).fontSize, ...innerClasses.supportingText?.style || {} }, children: helperText }) : null
|
|
1614
1896
|
] });
|
|
1615
1897
|
}
|
|
1616
1898
|
function JumpPageControl({ totalPages = 1, currentPage, defaultPage = 0, maxVisibleDots = 7, disabled = false, disabledPages = [], disableInteraction = false, onPageChange, pageAriaLabels = [], className = "", ...props }) {
|
|
1617
1899
|
const theme = useJumpyTheme();
|
|
1618
|
-
const [internalPage, setInternalPage] =
|
|
1900
|
+
const [internalPage, setInternalPage] = useState2(defaultPage);
|
|
1619
1901
|
const selectedPage = clampNumber(currentPage ?? internalPage, 0, Math.max(totalPages - 1, 0));
|
|
1620
1902
|
const visibleCount = clampNumber(maxVisibleDots, 3, Math.max(totalPages, 3));
|
|
1621
1903
|
const half = Math.floor(visibleCount / 2);
|
|
@@ -1632,9 +1914,9 @@ function JumpPageControl({ totalPages = 1, currentPage, defaultPage = 0, maxVisi
|
|
|
1632
1914
|
const selected = page === selectedPage;
|
|
1633
1915
|
const pageDisabled = disabledPages.includes(page);
|
|
1634
1916
|
const dotSize = truncation ? sizeValue(theme, JumpySize.small5XS) : sizeValue(theme, JumpySize.small4XS);
|
|
1635
|
-
return /* @__PURE__ */
|
|
1917
|
+
return /* @__PURE__ */ jsx2("button", { type: "button", disabled: disabled || pageDisabled || truncation || disableInteraction, "aria-label": truncation ? "More pages" : pageAriaLabels[page] || `Page ${page + 1}`, "aria-current": selected ? "page" : void 0, "data-jumpy-component": "page-control-dot", "data-selected": selected ? "true" : "false", "data-truncation": truncation ? "true" : "false", onClick: () => selectPage(page, pageDisabled), style: { display: "inline-flex", alignItems: "center", justifyContent: "center", flexShrink: 0, width: truncation ? sizeValue(theme, JumpySize.small3XS) : sizeValue(theme, JumpySize.small), height: truncation ? sizeValue(theme, JumpySize.small3XS) : sizeValue(theme, JumpySize.small), border: `${borderWidthValue(theme, JumpyBorderWidth.medium)}px solid transparent`, borderRadius: radiusValue(theme, JumpyRadius.small), background: "transparent", cursor: disabled || pageDisabled || truncation || disableInteraction ? "default" : "pointer", opacity: disabled || pageDisabled ? opacityValue(theme, JumpyOpacity.strong) : opacityValue(theme, JumpyOpacity.solid) }, children: /* @__PURE__ */ jsx2("span", { style: { display: "block", width: dotSize, height: dotSize, boxSizing: "border-box", borderRadius: selected || truncation ? radiusValue(theme, JumpyRadius.full) : radiusValue(theme, JumpyRadius.small), border: truncation ? 0 : `${borderWidthValue(theme, JumpyBorderWidth.medium)}px solid ${selected ? theme.listItem.active.default.icon : theme.color.borderStrong}`, backgroundColor: selected ? theme.listItem.active.default.icon : truncation ? theme.color.borderStrong : "transparent" } }) }, truncation ? `truncate-${page}` : page);
|
|
1636
1918
|
}
|
|
1637
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ jsxs2("div", { ...props, "data-jumpy-component": "page-control", className: cn(className), style: { position: "relative", overflow: "clip", width: "100%", height: sizeValue(theme, JumpySize.small), display: "flex", justifyContent: "center", alignItems: "center", boxSizing: "border-box", ...props.style || {} }, children: [
|
|
1638
1920
|
showLeft ? renderDot(start - 1, true) : null,
|
|
1639
1921
|
pages.map((page) => renderDot(page)),
|
|
1640
1922
|
showRight ? renderDot(start + visibleCount, true) : null
|
|
@@ -1651,7 +1933,7 @@ function useJumpSnackbar() {
|
|
|
1651
1933
|
}
|
|
1652
1934
|
function JumpSnackbarProvider({ children, position = "bottom-center", maxSnackbars = 3, offset: offset2 = {}, className = "", ...props }) {
|
|
1653
1935
|
const theme = useJumpyTheme();
|
|
1654
|
-
const [snackbars, setSnackbars] =
|
|
1936
|
+
const [snackbars, setSnackbars] = useState2([]);
|
|
1655
1937
|
const top = position.startsWith("top");
|
|
1656
1938
|
const align = position.endsWith("start") ? "flex-start" : position.endsWith("end") ? "flex-end" : "center";
|
|
1657
1939
|
const horizontalOffset = offset2.left ?? offset2.right ?? spacingValue(theme, JumpySpacing.large);
|
|
@@ -1669,35 +1951,35 @@ function JumpSnackbarProvider({ children, position = "bottom-center", maxSnackba
|
|
|
1669
1951
|
return id;
|
|
1670
1952
|
}
|
|
1671
1953
|
const contextValue = { addSnackbar, removeSnackbar, clearAll: () => setSnackbars([]), snackbars };
|
|
1672
|
-
return /* @__PURE__ */
|
|
1954
|
+
return /* @__PURE__ */ jsxs2(JumpySnackbarContext.Provider, { value: contextValue, children: [
|
|
1673
1955
|
children,
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
/* @__PURE__ */
|
|
1956
|
+
/* @__PURE__ */ jsx2("output", { "aria-live": "assertive", "aria-atomic": "true", style: { position: "absolute", width: 1, height: 1, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", border: 0 }, children: snackbars[0] ? textFromNode(snackbars[0].content?.title || snackbars[0].content?.description || snackbars[0].content) : "" }),
|
|
1957
|
+
/* @__PURE__ */ jsx2("div", { ...props, "data-jumpy-component": "snackbar-provider", className: cn(className), style: { position: "fixed", zIndex: 1100, left: position.endsWith("start") ? horizontalOffset : position.endsWith("end") ? "auto" : "50%", right: position.endsWith("end") ? horizontalOffset : "auto", top: top ? verticalOffset : "auto", bottom: top ? "auto" : verticalOffset, transform: position.endsWith("center") ? "translateX(-50%)" : void 0, display: "flex", flexDirection: "column", alignItems: align, gap: spacingValue(theme, JumpySpacing.smallXS), width: "min(487px, calc(100vw - 32px))", maxWidth: "50vw", pointerEvents: "none", ...props.style || {} }, children: snackbars.map((snackbar) => snackbar.isData ? /* @__PURE__ */ jsx2(JumpBanner, { floating: true, status: snackbar.content.status || "info", title: snackbar.content.title, actions: snackbar.content.slots?.actions, style: { width: "100%", pointerEvents: "auto", boxShadow: theme.shadow.positiveLarge }, children: snackbar.content.description }, snackbar.id) : /* @__PURE__ */ jsx2("div", { "data-jumpy-component": "snackbar", style: { width: "100%", pointerEvents: "auto", borderRadius: radiusValue(theme, JumpyRadius.small), boxShadow: theme.shadow.positiveLarge }, children: snackbar.content }, snackbar.id)) })
|
|
1676
1958
|
] });
|
|
1677
1959
|
}
|
|
1678
1960
|
function JumpTable({ children, showHorizontalBorders = false, disabled = false, stickyHeader = false, density = "regular", containerProps, innerClasses = {}, className = "", ...props }) {
|
|
1679
1961
|
const { className: containerClassName, style: containerStyle, ...restContainerProps } = containerProps || {};
|
|
1680
1962
|
const contextValue = { showHorizontalBorders, disabled };
|
|
1681
|
-
return /* @__PURE__ */
|
|
1963
|
+
return /* @__PURE__ */ jsx2(JumpyTableContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "table-wrapper", className: innerClasses.wrapper?.className, style: innerClasses.wrapper?.style, children: /* @__PURE__ */ jsx2("div", { ...restContainerProps, "data-jumpy-slot": "table-container", "data-sticky-header": stickyHeader ? "true" : "false", className: cn(containerClassName), style: containerStyle, children: /* @__PURE__ */ jsx2("table", { ...props, "data-jumpy-component": "table", "data-horizontal-borders": showHorizontalBorders ? "true" : "false", "data-density": density === "condensed" ? "condensed" : void 0, "data-disabled": disabled ? "true" : void 0, role: props.role || "grid", className: cn(className), children }) }) }) });
|
|
1682
1964
|
}
|
|
1683
1965
|
function JumpTableHead({ as, children, className = "", ...props }) {
|
|
1684
1966
|
const Component = as || "thead";
|
|
1685
|
-
return /* @__PURE__ */
|
|
1967
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, "data-jumpy-component": "table-head", role: props.role || "rowgroup", className: cn(className), children });
|
|
1686
1968
|
}
|
|
1687
1969
|
function JumpTableBody({ as, children, className = "", ...props }) {
|
|
1688
1970
|
const Component = as || "tbody";
|
|
1689
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, "data-jumpy-component": "table-body", role: props.role || "rowgroup", className: cn(className), children });
|
|
1690
1972
|
}
|
|
1691
1973
|
function JumpTableFooter({ as, children, className = "", ...props }) {
|
|
1692
1974
|
const Component = as || "tfoot";
|
|
1693
|
-
return /* @__PURE__ */
|
|
1975
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, "data-jumpy-component": "table-footer", role: props.role || "rowgroup", className: cn(className), children });
|
|
1694
1976
|
}
|
|
1695
1977
|
function JumpTableRow({ as, children, selected = false, disabled = false, disableHover = false, verticalAlign = "middle", dragging = false, className = "", onClick, ...props }) {
|
|
1696
1978
|
const Component = as || "tr";
|
|
1697
1979
|
const tableContext = useContext(JumpyTableContext);
|
|
1698
1980
|
const isDisabled = disabled || tableContext?.disabled;
|
|
1699
1981
|
const isInteractive = !disableHover && !isDisabled && Boolean(onClick);
|
|
1700
|
-
return /* @__PURE__ */
|
|
1982
|
+
return /* @__PURE__ */ jsx2(
|
|
1701
1983
|
Component,
|
|
1702
1984
|
{
|
|
1703
1985
|
...props,
|
|
@@ -1744,7 +2026,7 @@ function JumpTableCell({ as, children, selected = false, disabled = false, align
|
|
|
1744
2026
|
const isDisabled = disabled || tableContext?.disabled;
|
|
1745
2027
|
const resolvedHorizontalBorder = showHorizontalBorder ?? tableContext?.showHorizontalBorders ?? false;
|
|
1746
2028
|
const isInteractive = !isDisabled && Boolean(onClick);
|
|
1747
|
-
return /* @__PURE__ */
|
|
2029
|
+
return /* @__PURE__ */ jsxs2(
|
|
1748
2030
|
Component,
|
|
1749
2031
|
{
|
|
1750
2032
|
...props,
|
|
@@ -1765,14 +2047,14 @@ function JumpTableCell({ as, children, selected = false, disabled = false, align
|
|
|
1765
2047
|
className: cn(className),
|
|
1766
2048
|
onClick: isDisabled ? void 0 : onClick,
|
|
1767
2049
|
children: [
|
|
1768
|
-
/* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
cellLeading ? /* @__PURE__ */
|
|
1771
|
-
/* @__PURE__ */
|
|
1772
|
-
/* @__PURE__ */
|
|
1773
|
-
cellDescription ? /* @__PURE__ */
|
|
2050
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": "true", "data-jumpy-slot": "table-cell-surface" }),
|
|
2051
|
+
/* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "table-cell-inner", "data-align": resolvedAlign, className: innerClasses.inner?.className, style: innerClasses.inner?.style, children: [
|
|
2052
|
+
cellLeading ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-leading", className: innerClasses.leading?.className, style: innerClasses.leading?.style, children: cellLeading }) : null,
|
|
2053
|
+
/* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "table-cell-content", className: innerClasses.content?.className, style: innerClasses.content?.style, children: [
|
|
2054
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-text", className: innerClasses.text?.className, style: tableCellTextStyle(theme, false, innerClasses.text?.style), children }),
|
|
2055
|
+
cellDescription ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-description", className: innerClasses.description?.className, style: tableCellTextStyle(theme, false, innerClasses.description?.style), children: cellDescription }) : null
|
|
1774
2056
|
] }),
|
|
1775
|
-
cellTrailing ? /* @__PURE__ */
|
|
2057
|
+
cellTrailing ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-trailing", className: innerClasses.trailing?.className, style: innerClasses.trailing?.style, children: cellTrailing }) : null
|
|
1776
2058
|
] })
|
|
1777
2059
|
]
|
|
1778
2060
|
}
|
|
@@ -1860,7 +2142,7 @@ function JumpTableHeaderCell({ as, children, selected = false, disabled = false,
|
|
|
1860
2142
|
const resolvedHorizontalBorder = showHorizontalBorder ?? tableContext?.showHorizontalBorders ?? false;
|
|
1861
2143
|
const participatesInSort = sortable || sortOrder !== "default" && sortOrder !== "none";
|
|
1862
2144
|
const ariaSort = participatesInSort ? ariaSortOrder(sortOrder) : void 0;
|
|
1863
|
-
return /* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ jsxs2(
|
|
1864
2146
|
Component,
|
|
1865
2147
|
{
|
|
1866
2148
|
...props,
|
|
@@ -1879,12 +2161,12 @@ function JumpTableHeaderCell({ as, children, selected = false, disabled = false,
|
|
|
1879
2161
|
"aria-sort": ariaSort,
|
|
1880
2162
|
className: cn(className),
|
|
1881
2163
|
children: [
|
|
1882
|
-
/* @__PURE__ */
|
|
1883
|
-
/* @__PURE__ */
|
|
1884
|
-
cellLeading ? /* @__PURE__ */
|
|
1885
|
-
/* @__PURE__ */
|
|
1886
|
-
cellTrailing || sortable ? /* @__PURE__ */
|
|
1887
|
-
sortable ? /* @__PURE__ */
|
|
2164
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": "true", "data-jumpy-slot": "table-cell-surface" }),
|
|
2165
|
+
/* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "table-cell-inner", "data-align": resolvedAlign, className: innerClasses.inner?.className, style: innerClasses.inner?.style, children: [
|
|
2166
|
+
cellLeading ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-leading", className: innerClasses.leading?.className, style: innerClasses.leading?.style, children: cellLeading }) : null,
|
|
2167
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-content", className: innerClasses.label?.className, style: innerClasses.label?.style, children: /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "table-cell-text", className: innerClasses.labelText?.className, style: tableCellTextStyle(theme, true, innerClasses.labelText?.style), children }) }),
|
|
2168
|
+
cellTrailing || sortable ? /* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "table-cell-trailing", className: innerClasses.trailing?.className, style: innerClasses.trailing?.style, children: [
|
|
2169
|
+
sortable ? /* @__PURE__ */ jsx2(JumpIconButton, { variant: "secondary", disabled: isDisabled, "aria-label": typeof ariaLabels?.sort === "function" ? ariaLabels.sort(sortOrder) : ariaLabels?.sort || getSortActionLabel(sortOrder, typeof children === "string" ? children : void 0), onClick: () => onSortChange?.(getNextSortOrder(sortOrder)), children: sortSymbol(sortOrder) }) : null,
|
|
1888
2170
|
cellTrailing
|
|
1889
2171
|
] }) : null
|
|
1890
2172
|
] })
|
|
@@ -1893,7 +2175,7 @@ function JumpTableHeaderCell({ as, children, selected = false, disabled = false,
|
|
|
1893
2175
|
);
|
|
1894
2176
|
}
|
|
1895
2177
|
function ChevronIcon({ expanded }) {
|
|
1896
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", width: "24", height: "24", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx2("path", { d: expanded ? "M7.4 15.4 12 10.8l4.6 4.6 1.4-1.4-6-6-6 6 1.4 1.4Z" : "M7.4 8.6 12 13.2l4.6-4.6 1.4 1.4-6 6-6-6 1.4-1.4Z" }) });
|
|
1897
2179
|
}
|
|
1898
2180
|
function JumpExpandable({ as, variant = "filled", disabled = false, expanded, defaultExpanded = false, onChange, slots, innerClasses = {}, className = "", children, ...props }) {
|
|
1899
2181
|
const Component = as || "div";
|
|
@@ -1901,7 +2183,7 @@ function JumpExpandable({ as, variant = "filled", disabled = false, expanded, de
|
|
|
1901
2183
|
const panelId = useId();
|
|
1902
2184
|
const isDisabled = disabled || context?.disabled;
|
|
1903
2185
|
const isControlled = expanded !== void 0 || context?.expanded !== void 0;
|
|
1904
|
-
const [uncontrolledExpanded, setUncontrolledExpanded] =
|
|
2186
|
+
const [uncontrolledExpanded, setUncontrolledExpanded] = useState2(defaultExpanded);
|
|
1905
2187
|
const isExpanded = isControlled ? Boolean(expanded ?? context?.expanded) : uncontrolledExpanded;
|
|
1906
2188
|
const label = slots?.label;
|
|
1907
2189
|
const description = slots?.description;
|
|
@@ -1914,7 +2196,7 @@ function JumpExpandable({ as, variant = "filled", disabled = false, expanded, de
|
|
|
1914
2196
|
if (!isControlled) setUncontrolledExpanded(nextExpanded);
|
|
1915
2197
|
onChange?.(nextExpanded);
|
|
1916
2198
|
}
|
|
1917
|
-
const header = /* @__PURE__ */
|
|
2199
|
+
const header = /* @__PURE__ */ jsxs2(
|
|
1918
2200
|
"button",
|
|
1919
2201
|
{
|
|
1920
2202
|
ref: context?.buttonRef,
|
|
@@ -1927,23 +2209,23 @@ function JumpExpandable({ as, variant = "filled", disabled = false, expanded, de
|
|
|
1927
2209
|
"aria-controls": panelId,
|
|
1928
2210
|
"aria-expanded": isExpanded,
|
|
1929
2211
|
children: [
|
|
1930
|
-
/* @__PURE__ */
|
|
2212
|
+
/* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "expandable-slots-container", children: [
|
|
1931
2213
|
leading,
|
|
1932
|
-
label || description ? /* @__PURE__ */
|
|
1933
|
-
label ? /* @__PURE__ */
|
|
1934
|
-
description ? /* @__PURE__ */
|
|
2214
|
+
label || description ? /* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "expandable-header-content", className: innerClasses.headerContent?.className, style: innerClasses.headerContent?.style, children: [
|
|
2215
|
+
label ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "expandable-label", className: innerClasses.label?.className, style: innerClasses.label?.style, children: label }) : null,
|
|
2216
|
+
description ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "expandable-description", className: innerClasses.description?.className, style: innerClasses.description?.style, children: description }) : null
|
|
1935
2217
|
] }) : null
|
|
1936
2218
|
] }),
|
|
1937
|
-
/* @__PURE__ */
|
|
2219
|
+
/* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "expandable-slots-container", children: [
|
|
1938
2220
|
trailing,
|
|
1939
|
-
!isDisabled ? /* @__PURE__ */
|
|
2221
|
+
!isDisabled ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "expandable-icon", className: innerClasses.icon?.className, style: innerClasses.icon?.style, children: /* @__PURE__ */ jsx2(ChevronIcon, { expanded: isExpanded }) }) : null
|
|
1940
2222
|
] })
|
|
1941
2223
|
]
|
|
1942
2224
|
}
|
|
1943
2225
|
);
|
|
1944
|
-
return /* @__PURE__ */
|
|
1945
|
-
context?.headingLevel ? /* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
2226
|
+
return /* @__PURE__ */ jsxs2(Component, { ...props, "data-jumpy-component": "expandable", "data-variant": variant, className: cn(className), children: [
|
|
2227
|
+
context?.headingLevel ? /* @__PURE__ */ jsx2(context.headingLevel, { "data-jumpy-slot": "expandable-header-wrapper", children: header }) : header,
|
|
2228
|
+
/* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "expandable-content-wrapper", "data-expanded": isExpanded ? "true" : "false", children: /* @__PURE__ */ jsx2("div", { id: panelId, "data-jumpy-slot": "expandable-panel", className: innerClasses.panel?.className, style: innerClasses.panel?.style, children }) })
|
|
1947
2229
|
] });
|
|
1948
2230
|
}
|
|
1949
2231
|
function headingTag(level) {
|
|
@@ -1956,9 +2238,9 @@ function focusExpandableButton(buttonRefs, index) {
|
|
|
1956
2238
|
}
|
|
1957
2239
|
function JumpExpandableGroup({ as, multiple = false, disabled = false, headingLevel, onChange, innerClasses = {}, className = "", children, ...props }) {
|
|
1958
2240
|
const Component = as || "div";
|
|
1959
|
-
const buttonRefs =
|
|
2241
|
+
const buttonRefs = useRef2([]);
|
|
1960
2242
|
const childArray = Children.toArray(children);
|
|
1961
|
-
const [expandedIndices, setExpandedIndices] =
|
|
2243
|
+
const [expandedIndices, setExpandedIndices] = useState2(() => {
|
|
1962
2244
|
const initial = /* @__PURE__ */ new Set();
|
|
1963
2245
|
childArray.forEach((child, index) => {
|
|
1964
2246
|
if (isValidElement(child) && (child.props.expanded || child.props.defaultExpanded)) initial.add(index);
|
|
@@ -1999,7 +2281,7 @@ function JumpExpandableGroup({ as, multiple = false, disabled = false, headingLe
|
|
|
1999
2281
|
}
|
|
2000
2282
|
props.onKeyDown?.(event);
|
|
2001
2283
|
}
|
|
2002
|
-
return /* @__PURE__ */
|
|
2284
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, "data-jumpy-component": "expandable-group", "aria-disabled": disabled || void 0, className: cn(className), onKeyDown: handleKeyDown, children: childArray.map((child, index) => {
|
|
2003
2285
|
const contextValue = {
|
|
2004
2286
|
headingLevel: headingTag(headingLevel),
|
|
2005
2287
|
disabled,
|
|
@@ -2009,9 +2291,9 @@ function JumpExpandableGroup({ as, multiple = false, disabled = false, headingLe
|
|
|
2009
2291
|
buttonRefs.current[index] = element;
|
|
2010
2292
|
}
|
|
2011
2293
|
};
|
|
2012
|
-
return /* @__PURE__ */
|
|
2294
|
+
return /* @__PURE__ */ jsxs2(JumpyExpandableContext.Provider, { value: contextValue, children: [
|
|
2013
2295
|
child,
|
|
2014
|
-
index < childArray.length - 1 ? /* @__PURE__ */
|
|
2296
|
+
index < childArray.length - 1 ? /* @__PURE__ */ jsx2(JumpDivider, { direction: "horizontal", "data-jumpy-slot": "expandable-group-divider", className: innerClasses.divider?.className, style: innerClasses.divider?.style }) : null
|
|
2015
2297
|
] }, child.key || index);
|
|
2016
2298
|
}) });
|
|
2017
2299
|
}
|
|
@@ -2019,15 +2301,15 @@ var JUMPY_POPUP_Z_INDEX = 1200;
|
|
|
2019
2301
|
function JumpyPortal({ children }) {
|
|
2020
2302
|
const theme = useJumpyTheme();
|
|
2021
2303
|
const scope = useContext(JumpyThemeScopeContext);
|
|
2022
|
-
return /* @__PURE__ */
|
|
2304
|
+
return /* @__PURE__ */ jsx2(FloatingPortal, { children: /* @__PURE__ */ jsx2("div", { "data-jumpy-theme": "true", "data-jumpy-scope": scope || void 0, "data-jumpy-portal": "true", style: { ...!scope ? themeToCSSVariables(theme) : {}, fontFamily: theme.fontFamily.familyBase }, children }) });
|
|
2023
2305
|
}
|
|
2024
2306
|
function JumpyModalLayer({ children, onVisibleChange, style, onPointerDown, ...props }) {
|
|
2025
2307
|
const theme = useJumpyTheme();
|
|
2026
2308
|
const { refs, context } = useFloating({ open: true, onOpenChange: onVisibleChange });
|
|
2027
|
-
return /* @__PURE__ */
|
|
2309
|
+
return /* @__PURE__ */ jsx2(JumpyPortal, { children: /* @__PURE__ */ jsx2(FloatingOverlay, { ...props, lockScroll: true, onPointerDown: (event) => {
|
|
2028
2310
|
onPointerDown?.(event);
|
|
2029
2311
|
if (event.target === event.currentTarget) event.preventDefault();
|
|
2030
|
-
}, style, children: /* @__PURE__ */
|
|
2312
|
+
}, style, children: /* @__PURE__ */ jsx2(FloatingFocusManager, { context, outsideElementsInert: true, restoreFocus: true, children: cloneElement(children, {
|
|
2031
2313
|
ref: refs.setFloating,
|
|
2032
2314
|
tabIndex: -1,
|
|
2033
2315
|
onKeyDown(event) {
|
|
@@ -2045,37 +2327,37 @@ function JumpSheet({ visible = false, onVisibleChange, position = "right", title
|
|
|
2045
2327
|
const theme = useJumpyTheme();
|
|
2046
2328
|
const vertical = position === "left" || position === "right";
|
|
2047
2329
|
if (!visible) return null;
|
|
2048
|
-
return /* @__PURE__ */
|
|
2330
|
+
return /* @__PURE__ */ jsx2(JumpyModalLayer, { onVisibleChange, "data-jumpy-component": "sheet-overlay", role: "presentation", onClick: (event) => {
|
|
2049
2331
|
if (event.target === event.currentTarget) onVisibleChange?.(false);
|
|
2050
|
-
}, style: { position: "fixed", inset: 0, zIndex: 50, backgroundColor: theme.color.surfaceOverlay }, children: /* @__PURE__ */
|
|
2332
|
+
}, style: { position: "fixed", inset: 0, zIndex: 50, backgroundColor: theme.color.surfaceOverlay }, children: /* @__PURE__ */ jsxs2("aside", { ...props, "data-jumpy-component": "sheet", className: cn(className), role: "dialog", "aria-modal": "true", "aria-label": title || props["aria-label"], tabIndex: -1, onClick: (event) => {
|
|
2051
2333
|
event.stopPropagation();
|
|
2052
2334
|
props.onClick?.(event);
|
|
2053
2335
|
}, style: { position: "fixed", top: position === "bottom" ? "auto" : 0, bottom: position === "top" ? "auto" : 0, left: position === "right" ? "auto" : 0, right: position === "left" ? "auto" : 0, width: vertical ? "min(420px, 100vw)" : "100vw", height: vertical ? "100dvh" : "min(420px, 100dvh)", backgroundColor: theme.color.surfaceCard, color: theme.color.textPrimary, boxShadow: theme.shadow.positiveMedium, display: "flex", flexDirection: "column", ...props.style || {} }, children: [
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
title ? /* @__PURE__ */
|
|
2056
|
-
subtitle ? /* @__PURE__ */
|
|
2336
|
+
/* @__PURE__ */ jsxs2("div", { style: { padding: spacingValue(theme, JumpySpacing.large), borderBottom: `${borderWidthValue(theme, JumpyBorderWidth.small)}px solid ${theme.color.borderSubtle}` }, children: [
|
|
2337
|
+
title ? /* @__PURE__ */ jsx2(JumpTypography, { variant: "titleMediumEmphasized", children: title }) : null,
|
|
2338
|
+
subtitle ? /* @__PURE__ */ jsx2(JumpTypography, { variant: "bodySmall", color: "secondary", children: subtitle }) : null
|
|
2057
2339
|
] }),
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
footer ? /* @__PURE__ */
|
|
2340
|
+
/* @__PURE__ */ jsx2("div", { style: { padding: spacingValue(theme, JumpySpacing.large), flex: 1, overflow: "auto" }, children }),
|
|
2341
|
+
footer ? /* @__PURE__ */ jsx2("div", { style: { padding: spacingValue(theme, JumpySpacing.large), borderTop: `${borderWidthValue(theme, JumpyBorderWidth.small)}px solid ${theme.color.borderSubtle}` }, children: footer }) : null
|
|
2060
2342
|
] }) });
|
|
2061
2343
|
}
|
|
2062
2344
|
function JumpSectionHeader({ as, variant = "regular", description, className = "", children, ...props }) {
|
|
2063
2345
|
const theme = useJumpyTheme();
|
|
2064
2346
|
const Component = as || "li";
|
|
2065
|
-
return /* @__PURE__ */
|
|
2066
|
-
/* @__PURE__ */
|
|
2067
|
-
variant === "prominent" && description ? /* @__PURE__ */
|
|
2347
|
+
return /* @__PURE__ */ jsxs2(Component, { ...props, "data-jumpy-component": "section-header", className: cn(className), style: { display: "grid", gap: variant === "prominent" ? spacingValue(theme, JumpySpacing.small3XS) : 0, padding: `${spacingValue(theme, JumpySpacing.smallXS)}px ${spacingValue(theme, JumpySpacing.large)}px`, color: theme.color.textSecondary, ...props.style || {} }, children: [
|
|
2348
|
+
/* @__PURE__ */ jsx2(JumpTypography, { variant: variant === "prominent" ? "bodyMediumEmphasized" : "labelSmallEmphasized", color: "secondary", children }),
|
|
2349
|
+
variant === "prominent" && description ? /* @__PURE__ */ jsx2(JumpTypography, { variant: "bodySmall", color: "secondary", children: description }) : null
|
|
2068
2350
|
] });
|
|
2069
2351
|
}
|
|
2070
2352
|
function JumpSectionFooter({ as, className = "", children, ...props }) {
|
|
2071
2353
|
const theme = useJumpyTheme();
|
|
2072
2354
|
const Component = as || "li";
|
|
2073
|
-
return /* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ jsx2(Component, { ...props, "data-jumpy-component": "section-footer", className: cn(className), style: { padding: `${spacingValue(theme, JumpySpacing.smallXS)}px ${spacingValue(theme, JumpySpacing.large)}px`, color: theme.color.textSecondary, ...props.style || {} }, children: /* @__PURE__ */ jsx2(JumpTypography, { variant: "bodySmall", color: "secondary", children }) });
|
|
2074
2356
|
}
|
|
2075
2357
|
function JumpTag({ size: size2 = "small", status = "regular", disabled = false, className = "", children, ...props }) {
|
|
2076
2358
|
const theme = useJumpyTheme();
|
|
2077
2359
|
const labelStyle = textStyleValue(theme, size2 === "medium" ? JumpyTextStyle.labelMediumEmphasized : JumpyTextStyle.labelSmallEmphasized);
|
|
2078
|
-
return /* @__PURE__ */
|
|
2360
|
+
return /* @__PURE__ */ jsx2(
|
|
2079
2361
|
"span",
|
|
2080
2362
|
{
|
|
2081
2363
|
...props,
|
|
@@ -2109,7 +2391,7 @@ function JumpTag({ size: size2 = "small", status = "regular", disabled = false,
|
|
|
2109
2391
|
function JumpChip({ selected = false, disabled = false, className = "", children, ...props }) {
|
|
2110
2392
|
const theme = useJumpyTheme();
|
|
2111
2393
|
const bodyMediumEmphasized = textStyleValue(theme, JumpyTextStyle.bodyMediumEmphasized);
|
|
2112
|
-
return /* @__PURE__ */
|
|
2394
|
+
return /* @__PURE__ */ jsx2(
|
|
2113
2395
|
"button",
|
|
2114
2396
|
{
|
|
2115
2397
|
...props,
|
|
@@ -2146,8 +2428,8 @@ function JumpChip({ selected = false, disabled = false, className = "", children
|
|
|
2146
2428
|
function JumpCheckbox({ label, children, checked, defaultChecked = false, indeterminate = false, onCheckedChange, onIndeterminateChange, labelPlacement = "end", innerClasses = {}, className = "", disabled = false, readOnly = false, style, ...props }) {
|
|
2147
2429
|
const theme = useJumpyTheme();
|
|
2148
2430
|
const labelLarge = textStyleValue(theme, JumpyTextStyle.labelLarge);
|
|
2149
|
-
const inputRef =
|
|
2150
|
-
const [uncontrolledChecked, setUncontrolledChecked] =
|
|
2431
|
+
const inputRef = useRef2(null);
|
|
2432
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState2(defaultChecked);
|
|
2151
2433
|
const isControlled = checked !== void 0;
|
|
2152
2434
|
const isChecked = Boolean(isControlled ? checked : uncontrolledChecked);
|
|
2153
2435
|
const isReadonly = readOnly && !disabled;
|
|
@@ -2158,7 +2440,7 @@ function JumpCheckbox({ label, children, checked, defaultChecked = false, indete
|
|
|
2158
2440
|
const inactiveDisabled = theme.selectors.inactive.disabled;
|
|
2159
2441
|
const inactiveReadOnly = theme.selectors.inactive.readOnly;
|
|
2160
2442
|
const labelContent = children ?? label;
|
|
2161
|
-
|
|
2443
|
+
useEffect2(() => {
|
|
2162
2444
|
if (inputRef.current) inputRef.current.indeterminate = indeterminate;
|
|
2163
2445
|
}, [indeterminate]);
|
|
2164
2446
|
const stateTokens = isChecked || indeterminate ? disabled ? activeDisabled : isReadonly ? activeReadOnly : activeDefault : disabled ? inactiveDisabled : isReadonly ? inactiveReadOnly : inactiveDefault;
|
|
@@ -2172,7 +2454,7 @@ function JumpCheckbox({ label, children, checked, defaultChecked = false, indete
|
|
|
2172
2454
|
onCheckedChange?.(event.target.checked);
|
|
2173
2455
|
props.onChange?.(event);
|
|
2174
2456
|
}
|
|
2175
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ jsxs2(
|
|
2176
2458
|
"label",
|
|
2177
2459
|
{
|
|
2178
2460
|
"data-jumpy-component": "checkbox",
|
|
@@ -2206,8 +2488,8 @@ function JumpCheckbox({ label, children, checked, defaultChecked = false, indete
|
|
|
2206
2488
|
...style || {}
|
|
2207
2489
|
},
|
|
2208
2490
|
children: [
|
|
2209
|
-
/* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2491
|
+
/* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "checkbox-container", className: innerClasses.container?.className, style: innerClasses.container?.style, children: [
|
|
2492
|
+
/* @__PURE__ */ jsx2(
|
|
2211
2493
|
"input",
|
|
2212
2494
|
{
|
|
2213
2495
|
...props,
|
|
@@ -2226,9 +2508,9 @@ function JumpCheckbox({ label, children, checked, defaultChecked = false, indete
|
|
|
2226
2508
|
onChange: handleChange
|
|
2227
2509
|
}
|
|
2228
2510
|
),
|
|
2229
|
-
isChecked || indeterminate ? /* @__PURE__ */
|
|
2511
|
+
isChecked || indeterminate ? /* @__PURE__ */ jsx2("svg", { "data-jumpy-slot": "checkbox-icon", className: innerClasses.icons?.className, style: innerClasses.icons?.style, viewBox: "0 0 24 24", "aria-hidden": "true", focusable: "false", children: indeterminate ? /* @__PURE__ */ jsx2("path", { d: "M6 11h12v2H6z" }) : /* @__PURE__ */ jsx2("path", { d: "M9.4 16.6 4.8 12l1.4-1.4 3.2 3.2 8.4-8.4L19.2 6.8z" }) }) : null
|
|
2230
2512
|
] }),
|
|
2231
|
-
labelContent ? /* @__PURE__ */
|
|
2513
|
+
labelContent ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "checkbox-label", children: labelContent }) : null
|
|
2232
2514
|
]
|
|
2233
2515
|
}
|
|
2234
2516
|
);
|
|
@@ -2236,14 +2518,14 @@ function JumpCheckbox({ label, children, checked, defaultChecked = false, indete
|
|
|
2236
2518
|
function JumpSwitch({ label, children, checked, defaultChecked = false, onCheckedChange, labelPlacement = "end", innerClasses = {}, className = "", disabled = false, readOnly = false, style, ...props }) {
|
|
2237
2519
|
const theme = useJumpyTheme();
|
|
2238
2520
|
const bodyMedium = textStyleValue(theme, JumpyTextStyle.bodyMedium);
|
|
2239
|
-
const [uncontrolledChecked, setUncontrolledChecked] =
|
|
2521
|
+
const [uncontrolledChecked, setUncontrolledChecked] = useState2(Boolean(defaultChecked));
|
|
2240
2522
|
const isControlled = checked !== void 0;
|
|
2241
2523
|
const isChecked = Boolean(isControlled ? checked : uncontrolledChecked);
|
|
2242
2524
|
const isReadonly = readOnly && !disabled;
|
|
2243
2525
|
const selectorState = disabled ? "disabled" : isReadonly ? "readOnly" : "default";
|
|
2244
2526
|
const selectorTokens = isChecked ? theme.selectors.active[selectorState] : theme.selectors.inactive[selectorState];
|
|
2245
2527
|
const labelContent = children ?? label;
|
|
2246
|
-
return /* @__PURE__ */
|
|
2528
|
+
return /* @__PURE__ */ jsxs2(
|
|
2247
2529
|
"label",
|
|
2248
2530
|
{
|
|
2249
2531
|
"data-jumpy-component": "switch",
|
|
@@ -2275,8 +2557,8 @@ function JumpSwitch({ label, children, checked, defaultChecked = false, onChecke
|
|
|
2275
2557
|
...style || {}
|
|
2276
2558
|
},
|
|
2277
2559
|
children: [
|
|
2278
|
-
/* @__PURE__ */
|
|
2279
|
-
/* @__PURE__ */
|
|
2560
|
+
/* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "switch-container", className: innerClasses.container?.className, style: innerClasses.container?.style, children: [
|
|
2561
|
+
/* @__PURE__ */ jsx2(
|
|
2280
2562
|
"input",
|
|
2281
2563
|
{
|
|
2282
2564
|
...props,
|
|
@@ -2297,9 +2579,9 @@ function JumpSwitch({ label, children, checked, defaultChecked = false, onChecke
|
|
|
2297
2579
|
}
|
|
2298
2580
|
}
|
|
2299
2581
|
),
|
|
2300
|
-
/* @__PURE__ */
|
|
2582
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "switch-track", className: innerClasses.track?.className, style: innerClasses.track?.style, children: /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "switch-thumb", className: innerClasses.thumb?.className, style: innerClasses.thumb?.style, children: /* @__PURE__ */ jsx2("svg", { "data-jumpy-slot": "switch-icon", className: innerClasses.icon?.className, style: innerClasses.icon?.style, viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx2("path", { d: "M6 10.25 8.6 12.85 14 7.45", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }) })
|
|
2301
2583
|
] }),
|
|
2302
|
-
labelContent ? /* @__PURE__ */
|
|
2584
|
+
labelContent ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "switch-label", children: labelContent }) : null
|
|
2303
2585
|
]
|
|
2304
2586
|
}
|
|
2305
2587
|
);
|
|
@@ -2310,10 +2592,10 @@ function JumpRadioGroup({ name, value, defaultValue, onValueChange, options, cla
|
|
|
2310
2592
|
const isReadonly = readOnly && !disabled;
|
|
2311
2593
|
const generatedName = useId();
|
|
2312
2594
|
const validName = name || generatedName;
|
|
2313
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
2595
|
+
const [uncontrolledValue, setUncontrolledValue] = useState2(defaultValue ?? "");
|
|
2314
2596
|
const isControlled = value !== void 0;
|
|
2315
2597
|
const selectedValue = isControlled ? value : uncontrolledValue;
|
|
2316
|
-
return /* @__PURE__ */
|
|
2598
|
+
return /* @__PURE__ */ jsx2("div", { ...props, role: "radiogroup", "aria-readonly": isReadonly || void 0, "aria-orientation": direction === "horizontal" ? "horizontal" : "vertical", "data-jumpy-component": "radio-group", "data-direction": direction, className: cn(className), style: { display: "flex", flexDirection: direction === "horizontal" ? "row" : "column", gap: spacingValue(theme, JumpySpacing.medium), ...props.style || {} }, onChange: (event) => {
|
|
2317
2599
|
if (isReadonly || event.defaultPrevented) return;
|
|
2318
2600
|
const target = event.target;
|
|
2319
2601
|
if (target?.type === "radio" && target.name === validName) {
|
|
@@ -2326,7 +2608,7 @@ function JumpRadioGroup({ name, value, defaultValue, onValueChange, options, cla
|
|
|
2326
2608
|
const optionSelected = selectedValue === option.value;
|
|
2327
2609
|
const selectorState = optionDisabled ? "disabled" : isReadonly ? "readOnly" : "default";
|
|
2328
2610
|
const selectorTokens = optionSelected ? theme.selectors.active[selectorState] : theme.selectors.inactive[selectorState];
|
|
2329
|
-
return /* @__PURE__ */
|
|
2611
|
+
return /* @__PURE__ */ jsxs2(
|
|
2330
2612
|
"label",
|
|
2331
2613
|
{
|
|
2332
2614
|
"data-jumpy-component": "radio",
|
|
@@ -2350,9 +2632,9 @@ function JumpRadioGroup({ name, value, defaultValue, onValueChange, options, cla
|
|
|
2350
2632
|
letterSpacing: labelLarge.letterSpacing
|
|
2351
2633
|
},
|
|
2352
2634
|
children: [
|
|
2353
|
-
/* @__PURE__ */
|
|
2635
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "radio-container", className: innerClasses.container?.className, style: innerClasses.container?.style, children: /* @__PURE__ */ jsx2("input", { type: "radio", name: validName, value: option.value, checked: optionSelected, disabled: optionDisabled, "aria-readonly": isReadonly || void 0, readOnly: isReadonly || void 0, "data-jumpy-slot": "radio-input", className: innerClasses.input?.className, style: innerClasses.input?.style, onChange: () => {
|
|
2354
2636
|
} }) }),
|
|
2355
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "radio-label", className: innerClasses.label?.className, style: innerClasses.label?.style, children: option.label })
|
|
2356
2638
|
]
|
|
2357
2639
|
},
|
|
2358
2640
|
option.value
|
|
@@ -2424,14 +2706,14 @@ function coerceDateOutput(date, sample) {
|
|
|
2424
2706
|
}
|
|
2425
2707
|
function PickerTrailingIcon({ type, open }) {
|
|
2426
2708
|
if (type === "time") {
|
|
2427
|
-
return /* @__PURE__ */
|
|
2428
|
-
/* @__PURE__ */
|
|
2429
|
-
/* @__PURE__ */
|
|
2709
|
+
return /* @__PURE__ */ jsxs2("svg", { "data-jumpy-stroke-icon": "true", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", style: { display: "block", fill: "none" }, children: [
|
|
2710
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12Z", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
2711
|
+
/* @__PURE__ */ jsx2("path", { d: "M8 4.75V8l2.25 1.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
2430
2712
|
] });
|
|
2431
2713
|
}
|
|
2432
|
-
return /* @__PURE__ */
|
|
2433
|
-
/* @__PURE__ */
|
|
2434
|
-
open ? /* @__PURE__ */
|
|
2714
|
+
return /* @__PURE__ */ jsxs2("svg", { width: "16", height: "16", viewBox: "0 0 16 16", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", style: { display: "block" }, children: [
|
|
2715
|
+
/* @__PURE__ */ jsx2("path", { d: "M4.25 2.5v2M11.75 2.5v2M3.25 6.25h9.5M3.75 3.75h8.5c.69 0 1.25.56 1.25 1.25v7.25c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25Z", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
2716
|
+
open ? /* @__PURE__ */ jsx2("path", { d: "M6 10.5 7.25 11.75 10.25 8.75", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) : null
|
|
2435
2717
|
] });
|
|
2436
2718
|
}
|
|
2437
2719
|
function getMonthDays(viewDate) {
|
|
@@ -2452,18 +2734,18 @@ function dateIsUnavailable(date, { minDate, maxDate, disabledDates = [], isDateD
|
|
|
2452
2734
|
}
|
|
2453
2735
|
function JumpDatePicker({ label = "Date", hint, value, defaultValue = null, onChange, open, onOpenChange, format = "MM/dd/yyyy", minDate, maxDate, disabledDates = [], isDateDisabled, labels = {}, disabled = false, readOnly = false, className = "", status = "regular", error = false, hideClearIcon = false, onClear, ...props }) {
|
|
2454
2736
|
const theme = useJumpyTheme();
|
|
2455
|
-
const [internalValue, setInternalValue] =
|
|
2456
|
-
const [internalOpen, setInternalOpen] =
|
|
2737
|
+
const [internalValue, setInternalValue] = useState2(defaultValue);
|
|
2738
|
+
const [internalOpen, setInternalOpen] = useState2(false);
|
|
2457
2739
|
const isControlled = value !== void 0;
|
|
2458
2740
|
const selectedDate = toDateValue(isControlled ? value : internalValue);
|
|
2459
2741
|
const selectedTime = selectedDate?.getTime() ?? null;
|
|
2460
|
-
const [viewDate, setViewDate] =
|
|
2742
|
+
const [viewDate, setViewDate] = useState2(selectedDate || /* @__PURE__ */ new Date());
|
|
2461
2743
|
const isOpen = open ?? internalOpen;
|
|
2462
2744
|
const resolvedFormat = Array.isArray(format) ? format[0] : format;
|
|
2463
2745
|
const inputValue = formatDateValue(selectedDate, resolvedFormat);
|
|
2464
|
-
const [draft, setDraft] =
|
|
2465
|
-
const typedValue =
|
|
2466
|
-
|
|
2746
|
+
const [draft, setDraft] = useState2(inputValue);
|
|
2747
|
+
const typedValue = useRef2(void 0);
|
|
2748
|
+
useEffect2(() => {
|
|
2467
2749
|
if (typedValue.current !== selectedTime) setDraft(inputValue);
|
|
2468
2750
|
typedValue.current = void 0;
|
|
2469
2751
|
if (selectedTime !== null) setViewDate(new Date(selectedTime));
|
|
@@ -2491,9 +2773,9 @@ function JumpDatePicker({ label = "Date", hint, value, defaultValue = null, onCh
|
|
|
2491
2773
|
onChange?.(next);
|
|
2492
2774
|
setOpen(false);
|
|
2493
2775
|
}
|
|
2494
|
-
const trailing = readOnly ? void 0 : /* @__PURE__ */
|
|
2495
|
-
return /* @__PURE__ */
|
|
2496
|
-
/* @__PURE__ */
|
|
2776
|
+
const trailing = readOnly ? void 0 : /* @__PURE__ */ jsx2(PickerTrailingIcon, { type: "date", open: isOpen });
|
|
2777
|
+
return /* @__PURE__ */ jsxs2("div", { ref: refs.setReference, "data-jumpy-component": "date-picker", style: { position: "relative", width: "100%", maxWidth: "100%" }, children: [
|
|
2778
|
+
/* @__PURE__ */ jsx2(JumpField, { label, hint, status, error, hideClearIcon, onClear, className, trailing, children: /* @__PURE__ */ jsx2(
|
|
2497
2779
|
JumpInput,
|
|
2498
2780
|
{
|
|
2499
2781
|
...props,
|
|
@@ -2539,24 +2821,24 @@ function JumpDatePicker({ label = "Date", hint, value, defaultValue = null, onCh
|
|
|
2539
2821
|
}
|
|
2540
2822
|
}
|
|
2541
2823
|
) }),
|
|
2542
|
-
isOpen && !disabled && !readOnly ? /* @__PURE__ */
|
|
2543
|
-
/* @__PURE__ */
|
|
2544
|
-
/* @__PURE__ */
|
|
2545
|
-
/* @__PURE__ */
|
|
2546
|
-
/* @__PURE__ */
|
|
2824
|
+
isOpen && !disabled && !readOnly ? /* @__PURE__ */ jsx2(JumpyPortal, { children: /* @__PURE__ */ jsxs2("div", { ref: refs.setFloating, role: "dialog", "aria-label": label, style: { ...floatingStyles, zIndex: JUMPY_POPUP_Z_INDEX, width: sizeValue(theme, JumpySize.large8XL) * 2.5, maxWidth: "calc(100vw - 32px)", overflow: "visible", borderRadius: radiusValue(theme, JumpyRadius.smallXS), backgroundColor: "var(--jumpy-card-inactive-default-surface, var(--jumpy-color-surface-card))", color: "var(--jumpy-card-inactive-default-text, var(--jumpy-color-text-primary))", boxShadow: theme.shadow.positiveMedium, padding: `${spacingValue(theme, JumpySpacing.small3XS)}px 0` }, children: [
|
|
2825
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: spacingValue(theme, JumpySpacing.medium), padding: spacingValue(theme, JumpySpacing.small3XS) }, children: [
|
|
2826
|
+
/* @__PURE__ */ jsx2(JumpIconButton, { variant: "borderless", "aria-label": "Previous", onClick: () => setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1)), children: "\u2039" }),
|
|
2827
|
+
/* @__PURE__ */ jsx2("strong", { style: { fontFamily: theme.fontFamily.familyBase, color: "inherit" }, children: viewDate.toLocaleDateString(void 0, { month: "long", year: "numeric" }) }),
|
|
2828
|
+
/* @__PURE__ */ jsx2(JumpIconButton, { variant: "borderless", "aria-label": "Next", onClick: () => setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1)), children: "\u203A" })
|
|
2547
2829
|
] }),
|
|
2548
|
-
/* @__PURE__ */
|
|
2549
|
-
weekdays.map((weekday) => /* @__PURE__ */
|
|
2830
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, 1fr)", gap: spacingValue(theme, JumpySpacing.small3XS), padding: `0 ${spacingValue(theme, JumpySpacing.small3XS)}px` }, children: [
|
|
2831
|
+
weekdays.map((weekday) => /* @__PURE__ */ jsx2("span", { style: { color: theme.color.textSecondary, textAlign: "center", fontSize: textStyleValue(theme, JumpyTextStyle.labelSmall).fontSize, fontWeight: theme.fontFamily.labelSmall.fontWeight }, children: weekday }, weekday)),
|
|
2550
2832
|
dayCells.map((date) => {
|
|
2551
2833
|
const outside = date.getMonth() !== viewDate.getMonth();
|
|
2552
2834
|
const selected = sameDay(date, selectedDate);
|
|
2553
2835
|
const unavailable = dateIsUnavailable(date, { minDate, maxDate, disabledDates, isDateDisabled });
|
|
2554
|
-
return /* @__PURE__ */
|
|
2836
|
+
return /* @__PURE__ */ jsx2("button", { type: "button", disabled: unavailable, onClick: () => commit(date), style: { minHeight: sizeValue(theme, JumpySize.large), border: 0, borderRadius: radiusValue(theme, JumpyRadius.small), backgroundColor: selected ? "var(--jumpy-interactive-active-regular-default-surface, var(--jumpy-color-surface-primary))" : "transparent", color: selected ? "var(--jumpy-interactive-active-regular-default-text, var(--jumpy-color-text-on-primary))" : outside ? "var(--jumpy-card-inactive-default-subtext, var(--jumpy-color-text-secondary))" : "var(--jumpy-card-inactive-default-text, var(--jumpy-color-text-primary))", opacity: unavailable ? opacityValue(theme, JumpyOpacity.medium) : outside ? opacityValue(theme, JumpyOpacity.strong) : opacityValue(theme, JumpyOpacity.solid), cursor: unavailable ? "not-allowed" : "pointer", fontFamily: theme.fontFamily.familyBase }, children: date.getDate() }, date.toISOString());
|
|
2555
2837
|
})
|
|
2556
2838
|
] }),
|
|
2557
|
-
/* @__PURE__ */
|
|
2558
|
-
/* @__PURE__ */
|
|
2559
|
-
/* @__PURE__ */
|
|
2839
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "flex-end", gap: spacingValue(theme, JumpySpacing.smallXS), padding: spacingValue(theme, JumpySpacing.large) }, children: [
|
|
2840
|
+
/* @__PURE__ */ jsx2(JumpButton, { variant: "tertiary", onClick: () => setOpen(false), children: labels.cancelButton || "Cancel" }),
|
|
2841
|
+
/* @__PURE__ */ jsx2(JumpButton, { variant: "borderless", onClick: () => commit(/* @__PURE__ */ new Date()), children: "Today" })
|
|
2560
2842
|
] })
|
|
2561
2843
|
] }) }) : null
|
|
2562
2844
|
] });
|
|
@@ -2564,15 +2846,15 @@ function JumpDatePicker({ label = "Date", hint, value, defaultValue = null, onCh
|
|
|
2564
2846
|
function JumpTimePicker({ label = "Time", hint, value, defaultValue = null, onChange, open, onOpenChange, format, twentyFourHours = true, labels = {}, disabled = false, readOnly = false, className = "", status = "regular", error = false, hideClearIcon = false, onClear, ...props }) {
|
|
2565
2847
|
const theme = useJumpyTheme();
|
|
2566
2848
|
const resolvedFormat = format || (twentyFourHours ? "HH:mm" : "hh:mm aa");
|
|
2567
|
-
const [internalValue, setInternalValue] =
|
|
2568
|
-
const [internalOpen, setInternalOpen] =
|
|
2849
|
+
const [internalValue, setInternalValue] = useState2(defaultValue);
|
|
2850
|
+
const [internalOpen, setInternalOpen] = useState2(false);
|
|
2569
2851
|
const isControlled = value !== void 0;
|
|
2570
2852
|
const selectedDate = toDateValue(isControlled ? value : internalValue);
|
|
2571
2853
|
const selectedTime = selectedDate?.getTime() ?? null;
|
|
2572
2854
|
const inputValue = formatTimeValue(selectedDate, resolvedFormat);
|
|
2573
|
-
const [draft, setDraft] =
|
|
2574
|
-
const typedValue =
|
|
2575
|
-
|
|
2855
|
+
const [draft, setDraft] = useState2(inputValue);
|
|
2856
|
+
const typedValue = useRef2(void 0);
|
|
2857
|
+
useEffect2(() => {
|
|
2576
2858
|
if (typedValue.current !== selectedTime) setDraft(inputValue);
|
|
2577
2859
|
typedValue.current = void 0;
|
|
2578
2860
|
}, [selectedTime, inputValue, resolvedFormat]);
|
|
@@ -2613,9 +2895,9 @@ function JumpTimePicker({ label = "Time", hint, value, defaultValue = null, onCh
|
|
|
2613
2895
|
setDraft(isControlled ? inputValue : formatTimeValue(next, resolvedFormat));
|
|
2614
2896
|
onChange?.(output);
|
|
2615
2897
|
}
|
|
2616
|
-
const trailing = readOnly ? void 0 : /* @__PURE__ */
|
|
2617
|
-
return /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2898
|
+
const trailing = readOnly ? void 0 : /* @__PURE__ */ jsx2(PickerTrailingIcon, { type: "time", open: isOpen });
|
|
2899
|
+
return /* @__PURE__ */ jsxs2("div", { ref: refs.setReference, "data-jumpy-component": "time-picker", style: { position: "relative", width: "100%", maxWidth: "100%" }, children: [
|
|
2900
|
+
/* @__PURE__ */ jsx2(JumpField, { label, hint, status, error, hideClearIcon, onClear, className, trailing, children: /* @__PURE__ */ jsx2(
|
|
2619
2901
|
JumpInput,
|
|
2620
2902
|
{
|
|
2621
2903
|
...props,
|
|
@@ -2661,17 +2943,17 @@ function JumpTimePicker({ label = "Time", hint, value, defaultValue = null, onCh
|
|
|
2661
2943
|
}
|
|
2662
2944
|
}
|
|
2663
2945
|
) }),
|
|
2664
|
-
isOpen && !disabled && !readOnly ? /* @__PURE__ */
|
|
2665
|
-
/* @__PURE__ */
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
/* @__PURE__ */
|
|
2668
|
-
/* @__PURE__ */
|
|
2669
|
-
/* @__PURE__ */
|
|
2670
|
-
!twentyFourHours ? /* @__PURE__ */
|
|
2946
|
+
isOpen && !disabled && !readOnly ? /* @__PURE__ */ jsx2(JumpyPortal, { children: /* @__PURE__ */ jsxs2("div", { ref: refs.setFloating, role: "dialog", "aria-label": label, style: { ...floatingStyles, zIndex: JUMPY_POPUP_Z_INDEX, overflow: "visible", borderRadius: radiusValue(theme, JumpyRadius.smallXS), backgroundColor: `var(--jumpy-non-interactive-background-alternative, var(--jumpy-color-non-interactive-background-alternative, ${theme.color.surfaceCard}))`, color: "var(--jumpy-card-inactive-default-text, var(--jumpy-color-text-primary))", boxShadow: theme.shadow.positiveMedium, padding: `${spacingValue(theme, JumpySpacing.small3XS)}px 0`, minWidth: 260 }, children: [
|
|
2947
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", position: "relative", justifyContent: "center", alignItems: "center", gap: spacingValue(theme, JumpySpacing.small), padding: `${spacingValue(theme, JumpySpacing.zero)}px ${spacingValue(theme, JumpySpacing.zero)}px`, overflow: "hidden" }, children: [
|
|
2948
|
+
/* @__PURE__ */ jsx2("div", { "aria-hidden": "true", style: { position: "absolute", left: 0, right: 0, top: "50%", height: sizeValue(theme, JumpySize.medium), transform: "translateY(-50%)", backgroundColor: "var(--jumpy-interactive-active-regular-default-surface)", pointerEvents: "none" } }),
|
|
2949
|
+
/* @__PURE__ */ jsx2(TimeColumn, { label: "Hour", values: hours, selected: String(displayHour).padStart(2, "0"), onSelect: (next) => commit("hour", next), theme }),
|
|
2950
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": "true", style: { zIndex: 1, display: "flex", alignItems: "center", justifyContent: "center", width: sizeValue(theme, JumpySize.smallXS), height: sizeValue(theme, JumpySize.large), padding: `${spacingValue(theme, JumpySpacing.small3XS)}px 0`, color: "var(--jumpy-interactive-active-regular-default-text)", fontFamily: theme.fontFamily.familyBase, fontSize: textStyleValue(theme, JumpyTextStyle.bodyLargeEmphasized).fontSize, fontWeight: textStyleValue(theme, JumpyTextStyle.bodyLargeEmphasized).fontWeight }, children: ":" }),
|
|
2951
|
+
/* @__PURE__ */ jsx2(TimeColumn, { label: "Minute", values: minutes, selected: String(currentMinute).padStart(2, "0"), onSelect: (next) => commit("minute", next), theme }),
|
|
2952
|
+
!twentyFourHours ? /* @__PURE__ */ jsx2(TimeColumn, { label: "Period", values: ["AM", "PM"], selected: currentPeriod, onSelect: (next) => commit("period", next), theme }) : null
|
|
2671
2953
|
] }),
|
|
2672
|
-
/* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
/* @__PURE__ */
|
|
2954
|
+
/* @__PURE__ */ jsxs2("div", { style: { display: "flex", justifyContent: "space-between", gap: spacingValue(theme, JumpySpacing.smallXS), padding: spacingValue(theme, JumpySpacing.large) }, children: [
|
|
2955
|
+
/* @__PURE__ */ jsx2(JumpButton, { variant: "tertiary", onClick: () => setOpen(false), children: labels.cancelButton || "Cancel" }),
|
|
2956
|
+
/* @__PURE__ */ jsx2(JumpButton, { onClick: () => setOpen(false), children: labels.applyButton || "Apply" })
|
|
2675
2957
|
] })
|
|
2676
2958
|
] }) }) : null
|
|
2677
2959
|
] });
|
|
@@ -2684,24 +2966,25 @@ function TimeColumn({ label, values, selected, onSelect, theme }) {
|
|
|
2684
2966
|
});
|
|
2685
2967
|
const bodyMedium = textStyleValue(theme, JumpyTextStyle.bodyMedium);
|
|
2686
2968
|
const bodyLargeEmphasized = textStyleValue(theme, JumpyTextStyle.bodyLargeEmphasized);
|
|
2687
|
-
return /* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ jsx2("div", { "aria-label": label, style: { position: "relative", zIndex: 1, display: "flex", flexDirection: "column", overflow: "hidden", padding: `0 ${spacingValue(theme, JumpySpacing.small3XS)}px`, margin: `0 ${-spacingValue(theme, JumpySpacing.small3XS)}px`, height: (sizeValue(theme, JumpySize.large) + spacingValue(theme, JumpySpacing.small3XS) * 2) * 5 }, children: /* @__PURE__ */ jsx2("div", { style: { display: "flex", flexDirection: "column" }, children: visibleValues.map((value) => {
|
|
2688
2970
|
const active = value === selected;
|
|
2689
|
-
return /* @__PURE__ */
|
|
2971
|
+
return /* @__PURE__ */ jsx2("button", { type: "button", "data-jumpy-component": "time-picker-wheel-button", onClick: () => onSelect(value), "data-selected": active ? "true" : "false", style: { border: 0, width: sizeValue(theme, JumpySize.large), height: sizeValue(theme, JumpySize.large), flex: `0 0 ${sizeValue(theme, JumpySize.large)}px`, backgroundColor: "transparent", color: active ? "var(--jumpy-interactive-active-regular-default-text, var(--jumpy-color-text-on-primary))" : "var(--jumpy-interactive-inactive-regular-default-text, var(--jumpy-color-text-primary))", padding: `${spacingValue(theme, JumpySpacing.small3XS)}px 0`, cursor: "pointer", fontFamily: theme.fontFamily.familyBase, fontSize: active ? bodyLargeEmphasized.fontSize : bodyMedium.fontSize, lineHeight: active ? bodyLargeEmphasized.lineHeight : bodyMedium.lineHeight, fontWeight: active ? bodyLargeEmphasized.fontWeight : bodyMedium.fontWeight }, children: value }, `${label}-${value}`);
|
|
2690
2972
|
}) }) });
|
|
2691
2973
|
}
|
|
2692
2974
|
function flattenDropdownItems(items) {
|
|
2693
2975
|
return items.flatMap((item) => [item, ...flattenDropdownItems(item.children || [])]);
|
|
2694
2976
|
}
|
|
2695
|
-
function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, onOpenChange, items = [], placeholder, disabled = false, readOnly = false, multiple = false, searchable = false, renderTrigger, renderItem, inputRef, className = "", status = "regular", error = false, hideClearIcon = false, onClear, ...props }) {
|
|
2977
|
+
function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, onOpenChange, items = [], placeholder, popupMinWidth = 0, disabled = false, readOnly = false, multiple = false, searchable = false, renderTrigger, renderItem, inputRef, className = "", status = "regular", error = false, hideClearIcon = false, onClear, ...props }) {
|
|
2696
2978
|
const theme = useJumpyTheme();
|
|
2697
2979
|
const fieldContext = useContext(JumpyFieldContext);
|
|
2698
2980
|
const generatedId = useId();
|
|
2699
2981
|
const triggerId = props.id || `jumpy-dropdown-${generatedId}`;
|
|
2700
|
-
const [internalValue, setInternalValue] =
|
|
2701
|
-
const [internalOpen, setInternalOpen] =
|
|
2702
|
-
const [searchValue, setSearchValue] =
|
|
2703
|
-
const [focusedIndex, setFocusedIndex] =
|
|
2704
|
-
const dropdownRef =
|
|
2982
|
+
const [internalValue, setInternalValue] = useState2(defaultValue);
|
|
2983
|
+
const [internalOpen, setInternalOpen] = useState2(false);
|
|
2984
|
+
const [searchValue, setSearchValue] = useState2("");
|
|
2985
|
+
const [focusedIndex, setFocusedIndex] = useState2(-1);
|
|
2986
|
+
const dropdownRef = useRef2(null);
|
|
2987
|
+
const triggerRef = useRef2(null);
|
|
2705
2988
|
const selectedValues = value ?? internalValue;
|
|
2706
2989
|
const isOpen = open ?? internalOpen;
|
|
2707
2990
|
const flattenedItems = flattenDropdownItems(items);
|
|
@@ -2722,11 +3005,12 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2722
3005
|
middleware: [
|
|
2723
3006
|
offset(dropdownOffset),
|
|
2724
3007
|
flip({ padding: dropdownPadding }),
|
|
3008
|
+
shift({ padding: dropdownPadding }),
|
|
2725
3009
|
size({
|
|
2726
3010
|
padding: dropdownPadding,
|
|
2727
|
-
apply({ rects, availableHeight, elements }) {
|
|
3011
|
+
apply({ rects, availableWidth, availableHeight, elements }) {
|
|
2728
3012
|
Object.assign(elements.floating.style, {
|
|
2729
|
-
width: `${rects.reference.width}px`,
|
|
3013
|
+
width: `${Math.max(0, Math.min(Math.max(rects.reference.width, popupMinWidth), availableWidth))}px`,
|
|
2730
3014
|
maxHeight: `${Math.max(dropdownMinHeight, Math.min(dropdownMaxHeight, availableHeight))}px`
|
|
2731
3015
|
});
|
|
2732
3016
|
}
|
|
@@ -2756,10 +3040,10 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2756
3040
|
onChange?.(nextValues);
|
|
2757
3041
|
if (!multiple) {
|
|
2758
3042
|
setOpen(false);
|
|
2759
|
-
|
|
3043
|
+
triggerRef.current?.focus();
|
|
2760
3044
|
}
|
|
2761
3045
|
}
|
|
2762
|
-
|
|
3046
|
+
useEffect2(() => {
|
|
2763
3047
|
if (!isOpen) return void 0;
|
|
2764
3048
|
function dismissOutside(event) {
|
|
2765
3049
|
if (!dropdownRef.current?.contains(event.target) && !refs.floating.current?.contains(event.target)) setOpen(false);
|
|
@@ -2785,18 +3069,21 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2785
3069
|
const nextEnabledIndex = direction === "start" ? 0 : direction === "end" ? enabledVisibleItems.length - 1 : (currentEnabledIndex + direction + enabledVisibleItems.length) % enabledVisibleItems.length;
|
|
2786
3070
|
setFocusedIndex(visibleItems.findIndex((item) => item.value === enabledVisibleItems[nextEnabledIndex].value));
|
|
2787
3071
|
}
|
|
2788
|
-
const triggerInput = /* @__PURE__ */
|
|
3072
|
+
const triggerInput = /* @__PURE__ */ jsx2(
|
|
2789
3073
|
JumpInput,
|
|
2790
3074
|
{
|
|
2791
3075
|
...props,
|
|
2792
3076
|
ref: (node) => {
|
|
2793
|
-
|
|
3077
|
+
triggerRef.current = node;
|
|
3078
|
+
refs.setReference(node?.closest('[data-jumpy-component="field-control"]') || node);
|
|
2794
3079
|
if (typeof inputRef === "function") inputRef(node);
|
|
2795
3080
|
else if (inputRef) inputRef.current = node;
|
|
2796
3081
|
},
|
|
2797
3082
|
id: triggerId,
|
|
2798
3083
|
style: triggerInputStyle,
|
|
2799
3084
|
"data-jumpy-dropdown-trigger": "true",
|
|
3085
|
+
onChange: () => {
|
|
3086
|
+
},
|
|
2800
3087
|
"data-has-value": Boolean(displayText),
|
|
2801
3088
|
role: "combobox",
|
|
2802
3089
|
"aria-expanded": isOpen,
|
|
@@ -2836,16 +3123,16 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2836
3123
|
onPaste: (event) => event.preventDefault()
|
|
2837
3124
|
}
|
|
2838
3125
|
);
|
|
2839
|
-
const trailing = readOnly ? void 0 : /* @__PURE__ */
|
|
2840
|
-
const trigger = renderTrigger ? renderTrigger(selectedValues, isOpen) : fieldContext && !label && !hint ? /* @__PURE__ */
|
|
3126
|
+
const trailing = readOnly ? void 0 : /* @__PURE__ */ jsx2("svg", { width: "1em", height: "1em", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", style: { display: "block", fontSize: sizeValue(theme, JumpySize.small) }, children: /* @__PURE__ */ jsx2("path", { fillRule: "evenodd", d: isOpen ? "m16.59 15.705 1.41-1.41-6-6-6 6 1.41 1.41 4.59-4.58z" : "M7.41 8.295 6 9.705l6 6 6-6-1.41-1.41-4.59 4.58z", clipRule: "evenodd", fill: "currentColor" }) });
|
|
3127
|
+
const trigger = renderTrigger ? renderTrigger(selectedValues, isOpen) : fieldContext && !label && !hint ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
2841
3128
|
triggerInput,
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
] }) : /* @__PURE__ */
|
|
3129
|
+
/* @__PURE__ */ jsx2("span", { "aria-hidden": "true", style: { pointerEvents: "none", position: "absolute", right: spacingValue(theme, JumpySpacing.medium), top: "50%", transform: "translateY(-50%)", color: theme.color.textSecondary, display: "inline-flex", alignItems: "center", justifyContent: "center", lineHeight: 1 }, children: trailing })
|
|
3130
|
+
] }) : /* @__PURE__ */ jsx2(JumpField, { label, hint, status, error, hideClearIcon, onClear: () => {
|
|
2844
3131
|
commit([]);
|
|
2845
3132
|
setSearchValue("");
|
|
2846
3133
|
onClear?.();
|
|
2847
3134
|
}, className, trailing, children: triggerInput });
|
|
2848
|
-
const listbox = isOpen && !disabled ? /* @__PURE__ */
|
|
3135
|
+
const listbox = isOpen && !disabled ? /* @__PURE__ */ jsx2(JumpyPortal, { children: /* @__PURE__ */ jsxs2(
|
|
2849
3136
|
"div",
|
|
2850
3137
|
{
|
|
2851
3138
|
ref: refs.setFloating,
|
|
@@ -2864,11 +3151,11 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2864
3151
|
padding: `${spacingValue(theme, JumpySpacing.small3XS)}px 0`
|
|
2865
3152
|
},
|
|
2866
3153
|
children: [
|
|
2867
|
-
searchable ? /* @__PURE__ */
|
|
3154
|
+
searchable ? /* @__PURE__ */ jsx2("div", { style: { margin: `${spacingValue(theme, JumpySpacing.small3XS)}px ${spacingValue(theme, JumpySpacing.smallXS)}px` }, children: /* @__PURE__ */ jsx2(JumpSearchField, { label: "Search", placeholder: "Search", value: searchValue, onChange: (event) => {
|
|
2868
3155
|
setSearchValue(event.target.value);
|
|
2869
3156
|
setFocusedIndex(-1);
|
|
2870
3157
|
} }) }) : null,
|
|
2871
|
-
visibleItems.length === 0 ? /* @__PURE__ */
|
|
3158
|
+
visibleItems.length === 0 ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "dropdown-empty-state", style: { padding: `${spacingValue(theme, JumpySpacing.medium)}px ${spacingValue(theme, JumpySpacing.large)}px`, color: "var(--jumpy-interactive-inactive-regular-default-text)", fontFamily: theme.fontFamily.familyBase, fontSize: textStyleValue(theme, JumpyTextStyle.bodyMedium).fontSize }, children: "No options available" }) : null,
|
|
2872
3159
|
visibleItems.map((item, index) => {
|
|
2873
3160
|
const selected = selectedValues.includes(item.value);
|
|
2874
3161
|
const listItemProps = {
|
|
@@ -2882,17 +3169,17 @@ function JumpDropdown({ label, hint, value, defaultValue = [], onChange, open, o
|
|
|
2882
3169
|
selectItem(item);
|
|
2883
3170
|
}
|
|
2884
3171
|
};
|
|
2885
|
-
return renderItem ? renderItem(item, selected, listItemProps) : /* @__PURE__ */
|
|
3172
|
+
return renderItem ? renderItem(item, selected, listItemProps) : /* @__PURE__ */ jsx2(JumpListItem, { selected, ...listItemProps, children: item.label }, String(item.value));
|
|
2886
3173
|
})
|
|
2887
3174
|
]
|
|
2888
3175
|
}
|
|
2889
3176
|
) }) : null;
|
|
2890
|
-
return /* @__PURE__ */
|
|
3177
|
+
return /* @__PURE__ */ jsxs2("div", { ref: dropdownRef, "data-jumpy-component": "dropdown", onKeyDown: (event) => {
|
|
2891
3178
|
if (event.key === KeyboardKeys.ESCAPE && isOpen && !event.defaultPrevented) {
|
|
2892
3179
|
event.preventDefault();
|
|
2893
3180
|
event.stopPropagation();
|
|
2894
3181
|
setOpen(false);
|
|
2895
|
-
|
|
3182
|
+
triggerRef.current?.focus();
|
|
2896
3183
|
}
|
|
2897
3184
|
}, style: { position: "relative", width: "100%" }, children: [
|
|
2898
3185
|
trigger,
|
|
@@ -2916,9 +3203,9 @@ function JumpSpinner({ size: size2 = "medium", mode = "indeterminate", value = 0
|
|
|
2916
3203
|
const clampedValue = Math.min(Math.max(value, 0), 100);
|
|
2917
3204
|
const dash = mode === "determinate" ? clampedValue / 100 * circumference : circumference * 0.72;
|
|
2918
3205
|
const gap = circumference - dash;
|
|
2919
|
-
return /* @__PURE__ */
|
|
2920
|
-
showTrack ? /* @__PURE__ */
|
|
2921
|
-
/* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsxs2("svg", { ...props, "data-jumpy-component": "spinner", className: cn(className), width: diameter, height: diameter, viewBox: `0 0 ${diameter} ${diameter}`, role: "progressbar", "aria-valuemin": mode === "determinate" ? 0 : void 0, "aria-valuemax": mode === "determinate" ? 100 : void 0, "aria-valuenow": mode === "determinate" ? clampedValue : void 0, "aria-label": props["aria-label"] || (mode === "determinate" ? `Loading progress: ${clampedValue}%` : "Loading in progress"), style: { color: inverse ? theme.color.textOnPrimary : theme.color.surfacePrimary, ...props.style || {} }, children: [
|
|
3207
|
+
showTrack ? /* @__PURE__ */ jsx2("circle", { cx: center, cy: center, r: radius, fill: "none", stroke: theme.color.borderSubtle, strokeWidth }) : null,
|
|
3208
|
+
/* @__PURE__ */ jsx2("circle", { cx: center, cy: center, r: radius, fill: "none", stroke: "currentColor", strokeWidth, strokeLinecap: "round", strokeDasharray: `${dash} ${gap}`, transform: `rotate(-90 ${center} ${center})`, children: mode === "indeterminate" ? /* @__PURE__ */ jsx2("animateTransform", { attributeName: "transform", type: "rotate", from: `0 ${center} ${center}`, to: `360 ${center} ${center}`, dur: "1s", repeatCount: "indefinite" }) : null })
|
|
2922
3209
|
] });
|
|
2923
3210
|
}
|
|
2924
3211
|
function JumpDialog({ as, visible = false, onVisibleChange, title, description, footer, children, className = "", disableBackdropClick = false, disableContentScroll = false, fullScreen = false, overlayProps, slots, innerClasses = {}, ...props }) {
|
|
@@ -2935,7 +3222,7 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
2935
3222
|
const descriptionStyle = textStyleValue(theme, JumpyTextStyle.bodyMedium);
|
|
2936
3223
|
const { className: overlayClassName, style: overlayStyle, onClick: overlayOnClick, ...restOverlayProps } = overlayProps || {};
|
|
2937
3224
|
if (!visible) return null;
|
|
2938
|
-
return /* @__PURE__ */
|
|
3225
|
+
return /* @__PURE__ */ jsx2(
|
|
2939
3226
|
JumpyModalLayer,
|
|
2940
3227
|
{
|
|
2941
3228
|
...restOverlayProps,
|
|
@@ -2949,7 +3236,7 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
2949
3236
|
if (event.target === event.currentTarget && !event.defaultPrevented && !disableBackdropClick) onVisibleChange?.(false);
|
|
2950
3237
|
},
|
|
2951
3238
|
style: overlayStyle,
|
|
2952
|
-
children: /* @__PURE__ */
|
|
3239
|
+
children: /* @__PURE__ */ jsxs2(
|
|
2953
3240
|
Component,
|
|
2954
3241
|
{
|
|
2955
3242
|
...props,
|
|
@@ -2971,10 +3258,10 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
2971
3258
|
...props.style || {}
|
|
2972
3259
|
},
|
|
2973
3260
|
children: [
|
|
2974
|
-
dialogIllustration ? /* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
2976
|
-
dialogIcon ? /* @__PURE__ */
|
|
2977
|
-
dialogTitle ? /* @__PURE__ */
|
|
3261
|
+
dialogIllustration ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "dialog-illustration", className: innerClasses.illustration?.className, style: innerClasses.illustration?.style, children: dialogIllustration }) : null,
|
|
3262
|
+
/* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "dialog-body", className: innerClasses.body?.className, style: innerClasses.body?.style, children: [
|
|
3263
|
+
dialogIcon ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "dialog-icon", className: innerClasses.icon?.className, style: innerClasses.icon?.style, children: dialogIcon }) : null,
|
|
3264
|
+
dialogTitle ? /* @__PURE__ */ jsx2(
|
|
2978
3265
|
"div",
|
|
2979
3266
|
{
|
|
2980
3267
|
id: labelId,
|
|
@@ -2992,8 +3279,8 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
2992
3279
|
children: dialogTitle
|
|
2993
3280
|
}
|
|
2994
3281
|
) : null,
|
|
2995
|
-
/* @__PURE__ */
|
|
2996
|
-
dialogDescription ? /* @__PURE__ */
|
|
3282
|
+
/* @__PURE__ */ jsxs2("div", { "data-jumpy-slot": "dialog-scrollable-content", className: innerClasses.scrollableContent?.className, style: innerClasses.scrollableContent?.style, children: [
|
|
3283
|
+
dialogDescription ? /* @__PURE__ */ jsx2(
|
|
2997
3284
|
"div",
|
|
2998
3285
|
{
|
|
2999
3286
|
id: descriptionId,
|
|
@@ -3014,7 +3301,7 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
3014
3301
|
children
|
|
3015
3302
|
] })
|
|
3016
3303
|
] }),
|
|
3017
|
-
dialogFooter ? /* @__PURE__ */
|
|
3304
|
+
dialogFooter ? /* @__PURE__ */ jsx2("div", { "data-jumpy-slot": "dialog-footer", className: innerClasses.footer?.className, style: innerClasses.footer?.style, children: dialogFooter }) : null
|
|
3018
3305
|
]
|
|
3019
3306
|
}
|
|
3020
3307
|
)
|
|
@@ -3023,24 +3310,24 @@ function JumpDialog({ as, visible = false, onVisibleChange, title, description,
|
|
|
3023
3310
|
}
|
|
3024
3311
|
function JumpLoader({ label = "Jumpy UI wird geladen", fullScreen = false, className = "", decorativeBackground = false }) {
|
|
3025
3312
|
const theme = useJumpyTheme();
|
|
3026
|
-
const content = /* @__PURE__ */
|
|
3027
|
-
/* @__PURE__ */
|
|
3028
|
-
/* @__PURE__ */
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3313
|
+
const content = /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col items-center text-center", className), role: "status", "aria-live": "polite", children: [
|
|
3314
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative flex items-center justify-center", style: { height: theme.sizing.loaderSize, width: theme.sizing.loaderSize }, children: [
|
|
3315
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute inset-0", style: { borderRadius: theme.radius.large2XL, backgroundColor: theme.color.infoSurface } }),
|
|
3316
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute inset-2", style: { borderRadius: theme.radius.largeXL, border: `1px solid ${theme.color.infoBorder}`, backgroundColor: theme.color.surfaceCard, boxShadow: theme.shadow.loader } }),
|
|
3317
|
+
/* @__PURE__ */ jsx2("span", { className: "relative grid place-items-center", style: { color: theme.color.surfacePrimary }, children: /* @__PURE__ */ jsx2(JumpSpinner, { size: "large", "aria-label": label }) })
|
|
3031
3318
|
] }),
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
3034
|
-
/* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3036
|
-
/* @__PURE__ */
|
|
3319
|
+
/* @__PURE__ */ jsx2("p", { className: "mt-5 text-[11px] font-bold uppercase tracking-[0.18em]", style: { color: theme.color.surfacePrimary }, children: label }),
|
|
3320
|
+
/* @__PURE__ */ jsxs2("div", { className: "mt-3 flex items-center gap-1.5", "aria-hidden": "true", children: [
|
|
3321
|
+
/* @__PURE__ */ jsx2("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full [animation-delay:-0.2s]", style: { backgroundColor: theme.color.surfacePrimary } }),
|
|
3322
|
+
/* @__PURE__ */ jsx2("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full [animation-delay:-0.1s]", style: { backgroundColor: theme.color.successBorder } }),
|
|
3323
|
+
/* @__PURE__ */ jsx2("span", { className: "h-1.5 w-1.5 animate-bounce rounded-full", style: { backgroundColor: theme.color.infoBorder } })
|
|
3037
3324
|
] }),
|
|
3038
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsx2("span", { className: "sr-only", children: "Laden" })
|
|
3039
3326
|
] });
|
|
3040
3327
|
if (!fullScreen) return content;
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
decorativeBackground && /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3328
|
+
return /* @__PURE__ */ jsxs2("div", { className: "relative flex min-h-screen items-center justify-center overflow-hidden p-6", style: { backgroundColor: theme.color.surfaceCanvas, color: theme.color.textPrimary }, children: [
|
|
3329
|
+
decorativeBackground && /* @__PURE__ */ jsx2(JumpBackground, { snow: false }),
|
|
3330
|
+
/* @__PURE__ */ jsx2(JumpCard, { className: cn("px-10 py-9", decorativeBackground && "relative z-10"), children: content })
|
|
3044
3331
|
] });
|
|
3045
3332
|
}
|
|
3046
3333
|
function JumpButton({ as, size: size2, variant = "primary", status = "regular", className = "", isLoading = false, disabled, elevated = false, slots, leadingIcon, trailingIcon, children, ...props }) {
|
|
@@ -3051,7 +3338,7 @@ function JumpButton({ as, size: size2, variant = "primary", status = "regular",
|
|
|
3051
3338
|
const compact = height < sizeValue(theme, JumpySize.large);
|
|
3052
3339
|
const textStyle = textStyleValue(theme, compact ? JumpyTextStyle.bodySmallEmphasized : JumpyTextStyle.bodyMediumEmphasized);
|
|
3053
3340
|
const iconSize = sizeValue(theme, compact ? JumpySize.small3XS : JumpySize.small2XS);
|
|
3054
|
-
const [pressed, setPressed] =
|
|
3341
|
+
const [pressed, setPressed] = useState2(false);
|
|
3055
3342
|
const leading = slots?.leading ?? leadingIcon;
|
|
3056
3343
|
const trailing = slots?.trailing ?? trailingIcon;
|
|
3057
3344
|
const Component = as || "button";
|
|
@@ -3068,12 +3355,12 @@ function JumpButton({ as, size: size2, variant = "primary", status = "regular",
|
|
|
3068
3355
|
spacing.paddingLeft = spacing.paddingRight = spacingValue(theme, variant === "borderless" ? JumpySpacing.zero : JumpySpacing.medium);
|
|
3069
3356
|
}
|
|
3070
3357
|
}
|
|
3071
|
-
const content = /* @__PURE__ */
|
|
3072
|
-
leading ? /* @__PURE__ */
|
|
3073
|
-
/* @__PURE__ */
|
|
3074
|
-
trailing ? /* @__PURE__ */
|
|
3358
|
+
const content = /* @__PURE__ */ jsxs2("span", { style: { display: "inline-flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: spacing.gap, whiteSpace: "nowrap" }, children: [
|
|
3359
|
+
leading ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "inline-flex shrink-0 items-center justify-center", style: { width: iconSize, height: iconSize, lineHeight: 0, fontSize: iconSize }, children: leading }) : null,
|
|
3360
|
+
/* @__PURE__ */ jsx2("span", { children }),
|
|
3361
|
+
trailing ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "inline-flex shrink-0 items-center justify-center", style: { width: iconSize, height: iconSize, lineHeight: 0, fontSize: iconSize }, children: trailing }) : null
|
|
3075
3362
|
] });
|
|
3076
|
-
return /* @__PURE__ */
|
|
3363
|
+
return /* @__PURE__ */ jsx2(
|
|
3077
3364
|
Component,
|
|
3078
3365
|
{
|
|
3079
3366
|
...props,
|
|
@@ -3131,11 +3418,11 @@ function JumpButton({ as, size: size2, variant = "primary", status = "regular",
|
|
|
3131
3418
|
...elevated && !isDisabled ? { "--jumpy-action-default-shadow": shadowValue(theme, JumpyShadowStyle.positiveMedium) } : {},
|
|
3132
3419
|
...props.style || {}
|
|
3133
3420
|
},
|
|
3134
|
-
children: /* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */
|
|
3136
|
-
isLoading ? /* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3421
|
+
children: /* @__PURE__ */ jsxs2("span", { style: { position: "relative", display: "inline-flex", alignItems: "center", justifyContent: "center", whiteSpace: "nowrap" }, children: [
|
|
3422
|
+
/* @__PURE__ */ jsx2("span", { style: { display: "inline-flex", whiteSpace: "nowrap", opacity: isLoading ? 0 : 1 }, children: content }),
|
|
3423
|
+
isLoading ? /* @__PURE__ */ jsxs2("span", { className: "absolute inset-0 inline-flex items-center justify-center gap-2 whitespace-nowrap", children: [
|
|
3424
|
+
/* @__PURE__ */ jsx2("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent", "aria-hidden": "true" }),
|
|
3425
|
+
/* @__PURE__ */ jsx2("span", { className: "opacity-90", children: "Loading" })
|
|
3139
3426
|
] }) : null
|
|
3140
3427
|
] })
|
|
3141
3428
|
}
|
|
@@ -3146,12 +3433,12 @@ function JumpIconButton({ as, variant = "primary", status = "regular", alternate
|
|
|
3146
3433
|
const actionVariant = variant === "primary" ? "secondary" : variant === "secondary" ? "tertiary" : variant;
|
|
3147
3434
|
const variantStyles = getButtonVariantStyles(theme, actionVariant, status);
|
|
3148
3435
|
const actionTokenPrefix = `--jumpy-actions-${actionVariant}-${status}`;
|
|
3149
|
-
const [pressed, setPressed] =
|
|
3436
|
+
const [pressed, setPressed] = useState2(false);
|
|
3150
3437
|
const Component = as || "button";
|
|
3151
3438
|
const isButton = Component === "button";
|
|
3152
3439
|
const supportsDisabled = typeof Component === "string" && supportsDisabledAttribute(Component);
|
|
3153
3440
|
const hasBorder = variant === "primary";
|
|
3154
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ jsx2(
|
|
3155
3442
|
Component,
|
|
3156
3443
|
{
|
|
3157
3444
|
...props,
|
|
@@ -3210,7 +3497,7 @@ function JumpIconButton({ as, variant = "primary", status = "regular", alternate
|
|
|
3210
3497
|
} : {},
|
|
3211
3498
|
...props.style || {}
|
|
3212
3499
|
},
|
|
3213
|
-
children: /* @__PURE__ */
|
|
3500
|
+
children: /* @__PURE__ */ jsx2("span", { style: { display: "grid", placeItems: "center", width: sizeValue(theme, JumpySize.small), height: sizeValue(theme, JumpySize.small), lineHeight: 0, fontSize: sizeValue(theme, JumpySize.small) }, "aria-hidden": "true", children })
|
|
3214
3501
|
}
|
|
3215
3502
|
);
|
|
3216
3503
|
}
|
|
@@ -3219,10 +3506,10 @@ function JumpLinkButton({ href, variant = "borderless", status = "regular", clas
|
|
|
3219
3506
|
const variantStyles = getButtonVariantStyles(theme, variant, status);
|
|
3220
3507
|
const bodyMediumEmphasized = textStyleValue(theme, JumpyTextStyle.bodyMediumEmphasized);
|
|
3221
3508
|
const iconSize = sizeValue(theme, JumpySize.small2XS);
|
|
3222
|
-
const [pressed, setPressed] =
|
|
3509
|
+
const [pressed, setPressed] = useState2(false);
|
|
3223
3510
|
const spacing = getButtonSpacing(theme, variant, Boolean(leadingIcon), Boolean(trailingIcon));
|
|
3224
3511
|
const hasBorder = variant === "secondary" || variant === "tertiary";
|
|
3225
|
-
return /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsx2(
|
|
3226
3513
|
"a",
|
|
3227
3514
|
{
|
|
3228
3515
|
href,
|
|
@@ -3271,10 +3558,10 @@ function JumpLinkButton({ href, variant = "borderless", status = "regular", clas
|
|
|
3271
3558
|
...variantStyles,
|
|
3272
3559
|
...props.style || {}
|
|
3273
3560
|
},
|
|
3274
|
-
children: /* @__PURE__ */
|
|
3275
|
-
leadingIcon ? /* @__PURE__ */
|
|
3276
|
-
/* @__PURE__ */
|
|
3277
|
-
trailingIcon ? /* @__PURE__ */
|
|
3561
|
+
children: /* @__PURE__ */ jsxs2("span", { style: { display: "inline-flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: spacing.gap, whiteSpace: "nowrap" }, children: [
|
|
3562
|
+
leadingIcon ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "inline-flex shrink-0 items-center justify-center", style: { width: iconSize, height: iconSize, lineHeight: 0, fontSize: iconSize }, children: leadingIcon }) : null,
|
|
3563
|
+
/* @__PURE__ */ jsx2("span", { children }),
|
|
3564
|
+
trailingIcon ? /* @__PURE__ */ jsx2("span", { "aria-hidden": "true", className: "inline-flex shrink-0 items-center justify-center", style: { width: iconSize, height: iconSize, lineHeight: 0, fontSize: iconSize }, children: trailingIcon }) : null
|
|
3278
3565
|
] })
|
|
3279
3566
|
}
|
|
3280
3567
|
);
|
|
@@ -3284,7 +3571,7 @@ var JumpInput = forwardRef(function JumpInput2({ className = "", ...props }, ref
|
|
|
3284
3571
|
const fieldContext = useContext(JumpyFieldContext);
|
|
3285
3572
|
const inputOffset = fieldContext?.hasLabel ? spacingValue(theme, JumpySpacing.large) : spacingValue(theme, JumpySpacing.zero);
|
|
3286
3573
|
const inputMinHeight = fieldContext ? void 0 : sizeValue(theme, JumpySize.largeXL) - spacingValue(theme, JumpySpacing.small3XS) * 2;
|
|
3287
|
-
const inputElement = /* @__PURE__ */
|
|
3574
|
+
const inputElement = /* @__PURE__ */ jsx2(
|
|
3288
3575
|
"input",
|
|
3289
3576
|
{
|
|
3290
3577
|
...props,
|
|
@@ -3304,11 +3591,31 @@ var JumpInput = forwardRef(function JumpInput2({ className = "", ...props }, ref
|
|
|
3304
3591
|
}
|
|
3305
3592
|
return renderStandaloneField(theme, props.disabled, "", null, inputElement, props.status || "regular", props.readOnly);
|
|
3306
3593
|
});
|
|
3594
|
+
function TokenEditorField(props) {
|
|
3595
|
+
const fieldContext = useContext(JumpyFieldContext);
|
|
3596
|
+
return /* @__PURE__ */ jsx2(TokenEditor, { ...props, fieldContext });
|
|
3597
|
+
}
|
|
3598
|
+
function JumpTokenInput({ ref, value, defaultValue = [], onChange, onTokenInsert, onTokenRemove, label, hint, status = "regular", error = false, disabled = false, readOnly = false, className = "", ...props }) {
|
|
3599
|
+
const [internalValue, setInternalValue] = useState2(() => normalizeTokenInputValue(defaultValue));
|
|
3600
|
+
const [, refresh] = useState2(0);
|
|
3601
|
+
const model = normalizeTokenInputValue(value === void 0 ? internalValue : value);
|
|
3602
|
+
const change = (next) => {
|
|
3603
|
+
if (disabled || readOnly) return;
|
|
3604
|
+
if (value === void 0) setInternalValue(next);
|
|
3605
|
+
else refresh((revision) => revision + 1);
|
|
3606
|
+
onChange?.(next);
|
|
3607
|
+
const previousTokens = model.filter((part) => part.type === "token");
|
|
3608
|
+
const nextTokens = next.filter((part) => part.type === "token");
|
|
3609
|
+
for (const token of nextTokens) if (!previousTokens.some((previous) => previous.id === token.id)) onTokenInsert?.(token);
|
|
3610
|
+
for (const token of previousTokens) if (!nextTokens.some((current) => current.id === token.id)) onTokenRemove?.(token);
|
|
3611
|
+
};
|
|
3612
|
+
return /* @__PURE__ */ jsx2(JumpField, { label, hint, status, error, hideClearIcon: true, className, children: /* @__PURE__ */ jsx2(TokenEditorField, { ...props, editorRef: ref, model, value: tokenInputText(model), "data-has-value": model.length > 0, disabled, readOnly, onValueChange: change }) });
|
|
3613
|
+
}
|
|
3307
3614
|
function JumpTextarea({ className = "", ...props }) {
|
|
3308
3615
|
const theme = useJumpyTheme();
|
|
3309
3616
|
const fieldContext = useContext(JumpyFieldContext);
|
|
3310
3617
|
const inputOffset = fieldContext?.hasLabel ? spacingValue(theme, JumpySpacing.large) : spacingValue(theme, JumpySpacing.zero);
|
|
3311
|
-
const textareaElement = /* @__PURE__ */
|
|
3618
|
+
const textareaElement = /* @__PURE__ */ jsx2(
|
|
3312
3619
|
"textarea",
|
|
3313
3620
|
{
|
|
3314
3621
|
...props,
|
|
@@ -3337,18 +3644,18 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3337
3644
|
const child = Children.only(children);
|
|
3338
3645
|
const childValue = isValidElement(child) ? child.props.value ?? child.props.defaultValue ?? "" : "";
|
|
3339
3646
|
const childHasValue = isValidElement(child) && (child.props["data-has-value"] === true || child.props["data-has-value"] === "true");
|
|
3340
|
-
const [focused, setFocused] =
|
|
3341
|
-
const [hasValue, setHasValue] =
|
|
3342
|
-
const [inputValue, setInputValue] =
|
|
3647
|
+
const [focused, setFocused] = useState2(false);
|
|
3648
|
+
const [hasValue, setHasValue] = useState2(childHasValue || Boolean(String(childValue).length));
|
|
3649
|
+
const [inputValue, setInputValue] = useState2(String(childValue ?? ""));
|
|
3343
3650
|
const bodySmall = textStyleValue(theme, JumpyTextStyle.bodySmall);
|
|
3344
3651
|
const bodyMedium = textStyleValue(theme, JumpyTextStyle.bodyMedium);
|
|
3345
3652
|
const labelSmall = textStyleValue(theme, JumpyTextStyle.labelSmall);
|
|
3346
|
-
|
|
3653
|
+
useEffect2(() => {
|
|
3347
3654
|
setHasValue(childHasValue || Boolean(String(childValue).length));
|
|
3348
3655
|
setInputValue(String(childValue ?? ""));
|
|
3349
3656
|
}, [childHasValue, childValue]);
|
|
3350
3657
|
if (!isValidElement(child)) {
|
|
3351
|
-
return /* @__PURE__ */
|
|
3658
|
+
return /* @__PURE__ */ jsx2("div", { className: cn("block w-full", className), children });
|
|
3352
3659
|
}
|
|
3353
3660
|
const originalOnFocus = child.props.onFocus;
|
|
3354
3661
|
const originalOnBlur = child.props.onBlur;
|
|
@@ -3414,8 +3721,8 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3414
3721
|
if (!disabled) document.getElementById(child.props.id || fieldId)?.focus();
|
|
3415
3722
|
}
|
|
3416
3723
|
};
|
|
3417
|
-
return /* @__PURE__ */
|
|
3418
|
-
/* @__PURE__ */
|
|
3724
|
+
return /* @__PURE__ */ jsxs2("div", { "data-jumpy-component": "base-input-root", className: cn("inline-flex w-full max-w-full flex-col", className), style: { color: "var(--jumpy-cmp-base-input-helper-color)" }, children: [
|
|
3725
|
+
/* @__PURE__ */ jsx2(
|
|
3419
3726
|
Container,
|
|
3420
3727
|
{
|
|
3421
3728
|
...containerProps,
|
|
@@ -3424,7 +3731,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3424
3731
|
"data-readonly": readOnly ? "true" : "false",
|
|
3425
3732
|
"data-status": status,
|
|
3426
3733
|
style: { color: "var(--jumpy-cmp-base-input-helper-color)" },
|
|
3427
|
-
children: /* @__PURE__ */
|
|
3734
|
+
children: /* @__PURE__ */ jsxs2(
|
|
3428
3735
|
"div",
|
|
3429
3736
|
{
|
|
3430
3737
|
"data-jumpy-component": "field-control",
|
|
@@ -3447,7 +3754,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3447
3754
|
minHeight: isTextarea ? sizeValue(theme, JumpySize.large2XL) : sizeValue(theme, JumpySize.largeXL)
|
|
3448
3755
|
},
|
|
3449
3756
|
children: [
|
|
3450
|
-
leading ? /* @__PURE__ */
|
|
3757
|
+
leading ? /* @__PURE__ */ jsx2(
|
|
3451
3758
|
"span",
|
|
3452
3759
|
{
|
|
3453
3760
|
"aria-hidden": "true",
|
|
@@ -3461,7 +3768,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3461
3768
|
children: leading
|
|
3462
3769
|
}
|
|
3463
3770
|
) : null,
|
|
3464
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ jsxs2(
|
|
3465
3772
|
"div",
|
|
3466
3773
|
{
|
|
3467
3774
|
style: {
|
|
@@ -3474,7 +3781,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3474
3781
|
overflow: "hidden"
|
|
3475
3782
|
},
|
|
3476
3783
|
children: [
|
|
3477
|
-
label && /* @__PURE__ */
|
|
3784
|
+
label && /* @__PURE__ */ jsx2(
|
|
3478
3785
|
"span",
|
|
3479
3786
|
{
|
|
3480
3787
|
id: labelId,
|
|
@@ -3501,8 +3808,8 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3501
3808
|
children: label
|
|
3502
3809
|
}
|
|
3503
3810
|
),
|
|
3504
|
-
/* @__PURE__ */
|
|
3505
|
-
content ? /* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ jsx2(JumpyFieldContext.Provider, { value: { fieldId, hasLabel: Boolean(label), floating }, children: enhancedChild }),
|
|
3812
|
+
content ? /* @__PURE__ */ jsx2(
|
|
3506
3813
|
"div",
|
|
3507
3814
|
{
|
|
3508
3815
|
"data-jumpy-slot": "content",
|
|
@@ -3524,7 +3831,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3524
3831
|
]
|
|
3525
3832
|
}
|
|
3526
3833
|
),
|
|
3527
|
-
showTrailing ? /* @__PURE__ */
|
|
3834
|
+
showTrailing ? /* @__PURE__ */ jsxs2(
|
|
3528
3835
|
"span",
|
|
3529
3836
|
{
|
|
3530
3837
|
"data-jumpy-slot": "trailing-container",
|
|
@@ -3541,7 +3848,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3541
3848
|
transition: `color ${animationDurationValue(theme, JumpyAnimationDuration.smallXS)}s ${focused && !readOnly ? theme.animation.timeEasingImpulse : theme.animation.timeEasingRelease}`
|
|
3542
3849
|
},
|
|
3543
3850
|
children: [
|
|
3544
|
-
showClearButton ? /* @__PURE__ */
|
|
3851
|
+
showClearButton ? /* @__PURE__ */ jsx2(
|
|
3545
3852
|
JumpIconButton,
|
|
3546
3853
|
{
|
|
3547
3854
|
variant: "secondary",
|
|
@@ -3566,12 +3873,12 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3566
3873
|
padding: spacingValue(theme, JumpySpacing.small2XS),
|
|
3567
3874
|
borderRadius: radiusValue(theme, JumpyRadius.small)
|
|
3568
3875
|
},
|
|
3569
|
-
children: /* @__PURE__ */
|
|
3876
|
+
children: /* @__PURE__ */ jsx2(CircleClearIcon, {})
|
|
3570
3877
|
}
|
|
3571
3878
|
) : null,
|
|
3572
|
-
showErrorIcon || trailing ? /* @__PURE__ */
|
|
3573
|
-
showErrorIcon ? /* @__PURE__ */
|
|
3574
|
-
trailing ? /* @__PURE__ */
|
|
3879
|
+
showErrorIcon || trailing ? /* @__PURE__ */ jsxs2("span", { "data-jumpy-slot": "trailing", "aria-hidden": "true", style: { display: "inline-flex", alignItems: "center", justifyContent: "center", gap: spacingValue(theme, JumpySpacing.smallXS), paddingRight: spacingValue(theme, JumpySpacing.medium), color: "var(--jumpy-cmp-base-input-trailing-color)", fontSize: bodyMedium.fontSize, lineHeight: bodyMedium.lineHeight }, children: [
|
|
3880
|
+
showErrorIcon ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "trailing-error", style: { display: "inline-flex", alignItems: "center", color: "var(--jumpy-cmp-base-input-trailing-error-fill, var(--jumpy-cmp-base-input-icon-fill))", lineHeight: 1 }, children: /* @__PURE__ */ jsx2(CircleErrorIcon, { style: { width: sizeValue(theme, JumpySize.small2XS), height: sizeValue(theme, JumpySize.small2XS) } }) }) : null,
|
|
3881
|
+
trailing ? /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "trailing-text", style: { display: "inline-flex", alignItems: "center", maxWidth: `calc(30 * ${spacingValue(theme, JumpySpacing.smallXS)}px)`, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: 1 }, children: trailing }) : null
|
|
3575
3882
|
] }) : null
|
|
3576
3883
|
]
|
|
3577
3884
|
}
|
|
@@ -3581,7 +3888,7 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3581
3888
|
)
|
|
3582
3889
|
}
|
|
3583
3890
|
),
|
|
3584
|
-
(hasHelperText || hasCounter) && /* @__PURE__ */
|
|
3891
|
+
(hasHelperText || hasCounter) && /* @__PURE__ */ jsxs2(
|
|
3585
3892
|
"div",
|
|
3586
3893
|
{
|
|
3587
3894
|
className: "flex justify-end",
|
|
@@ -3596,8 +3903,8 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3596
3903
|
transition: `color ${animationDurationValue(theme, JumpyAnimationDuration.smallXS)}s ${focused && !readOnly ? theme.animation.timeEasingImpulse : theme.animation.timeEasingRelease}`
|
|
3597
3904
|
},
|
|
3598
3905
|
children: [
|
|
3599
|
-
hasHelperText ? /* @__PURE__ */
|
|
3600
|
-
hasCounter ? /* @__PURE__ */
|
|
3906
|
+
hasHelperText ? /* @__PURE__ */ jsx2("span", { id: helperId, style: { flex: 1 }, children: helperText }) : null,
|
|
3907
|
+
hasCounter ? /* @__PURE__ */ jsxs2("span", { id: counterId, style: { flex: 0, whiteSpace: "nowrap" }, children: [
|
|
3601
3908
|
inputValue.length,
|
|
3602
3909
|
"/",
|
|
3603
3910
|
maxLength
|
|
@@ -3608,11 +3915,11 @@ function JumpBaseInput({ label, hint, children, className = "", error = false, h
|
|
|
3608
3915
|
] });
|
|
3609
3916
|
}
|
|
3610
3917
|
function JumpField(props) {
|
|
3611
|
-
return /* @__PURE__ */
|
|
3918
|
+
return /* @__PURE__ */ jsx2(JumpBaseInput, { ...props });
|
|
3612
3919
|
}
|
|
3613
3920
|
function JumpChoice({ selected = false, title, description, className = "", ...props }) {
|
|
3614
3921
|
const theme = useJumpyTheme();
|
|
3615
|
-
return /* @__PURE__ */
|
|
3922
|
+
return /* @__PURE__ */ jsxs2(
|
|
3616
3923
|
"button",
|
|
3617
3924
|
{
|
|
3618
3925
|
type: "button",
|
|
@@ -3627,8 +3934,8 @@ function JumpChoice({ selected = false, title, description, className = "", ...p
|
|
|
3627
3934
|
opacity: props.disabled ? theme.opacity.disabled : 1
|
|
3628
3935
|
},
|
|
3629
3936
|
children: [
|
|
3630
|
-
/* @__PURE__ */
|
|
3631
|
-
description && /* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ jsx2("span", { className: "block text-sm font-bold", children: title }),
|
|
3938
|
+
description && /* @__PURE__ */ jsx2("span", { className: "mt-1 block text-xs leading-5", style: { color: theme.color.textSecondary }, children: description })
|
|
3632
3939
|
]
|
|
3633
3940
|
}
|
|
3634
3941
|
);
|
|
@@ -3636,16 +3943,16 @@ function JumpChoice({ selected = false, title, description, className = "", ...p
|
|
|
3636
3943
|
function JumpNotice({ tone = "info", title, children, className = "" }) {
|
|
3637
3944
|
const theme = useJumpyTheme();
|
|
3638
3945
|
const toneStyles = getNoticeToneStyles(theme, tone);
|
|
3639
|
-
return /* @__PURE__ */
|
|
3640
|
-
title && /* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3946
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("p-4", className), style: { borderRadius: theme.sizing.choiceRadius, border: `1px solid ${toneStyles.borderColor}`, backgroundColor: toneStyles.backgroundColor, color: toneStyles.color }, children: [
|
|
3947
|
+
title && /* @__PURE__ */ jsx2("p", { className: "text-sm font-bold", children: title }),
|
|
3948
|
+
/* @__PURE__ */ jsx2("div", { className: cn("text-xs leading-5", title && "mt-1"), children })
|
|
3642
3949
|
] });
|
|
3643
3950
|
}
|
|
3644
3951
|
function JumpTabs({ items, value, onChange, className = "" }) {
|
|
3645
|
-
const scrollRef =
|
|
3646
|
-
const indicatorRef =
|
|
3647
|
-
const tabRefs =
|
|
3648
|
-
const placeIndicatorRef =
|
|
3952
|
+
const scrollRef = useRef2(null);
|
|
3953
|
+
const indicatorRef = useRef2(null);
|
|
3954
|
+
const tabRefs = useRef2(/* @__PURE__ */ new Map());
|
|
3955
|
+
const placeIndicatorRef = useRef2(null);
|
|
3649
3956
|
placeIndicatorRef.current = (animate) => {
|
|
3650
3957
|
const selectedTab = tabRefs.current.get(value);
|
|
3651
3958
|
const scrollContainer = scrollRef.current;
|
|
@@ -3669,12 +3976,12 @@ function JumpTabs({ items, value, onChange, className = "" }) {
|
|
|
3669
3976
|
indicator.style.transition = "";
|
|
3670
3977
|
}
|
|
3671
3978
|
};
|
|
3672
|
-
const indicatorPlacedRef =
|
|
3673
|
-
|
|
3979
|
+
const indicatorPlacedRef = useRef2(false);
|
|
3980
|
+
useLayoutEffect2(() => {
|
|
3674
3981
|
placeIndicatorRef.current(indicatorPlacedRef.current);
|
|
3675
3982
|
indicatorPlacedRef.current = true;
|
|
3676
3983
|
}, [items, value]);
|
|
3677
|
-
|
|
3984
|
+
useEffect2(() => {
|
|
3678
3985
|
const scrollContainer = scrollRef.current;
|
|
3679
3986
|
if (!scrollContainer || typeof ResizeObserver === "undefined") return void 0;
|
|
3680
3987
|
const sizes = /* @__PURE__ */ new WeakMap();
|
|
@@ -3691,10 +3998,10 @@ function JumpTabs({ items, value, onChange, className = "" }) {
|
|
|
3691
3998
|
tabRefs.current.forEach((tab) => observer.observe(tab));
|
|
3692
3999
|
return () => observer.disconnect();
|
|
3693
4000
|
}, [items]);
|
|
3694
|
-
return /* @__PURE__ */
|
|
4001
|
+
return /* @__PURE__ */ jsx2("div", { className, "data-jumpy-component": "tabs", children: /* @__PURE__ */ jsxs2("div", { ref: scrollRef, "data-jumpy-slot": "tabs-scroll-container", role: "tablist", "aria-orientation": "horizontal", tabIndex: -1, children: [
|
|
3695
4002
|
items.map((item) => {
|
|
3696
4003
|
const active = item.key === value;
|
|
3697
|
-
return /* @__PURE__ */
|
|
4004
|
+
return /* @__PURE__ */ jsx2(
|
|
3698
4005
|
"button",
|
|
3699
4006
|
{
|
|
3700
4007
|
ref: (node) => {
|
|
@@ -3709,12 +4016,12 @@ function JumpTabs({ items, value, onChange, className = "" }) {
|
|
|
3709
4016
|
event.currentTarget.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
3710
4017
|
},
|
|
3711
4018
|
"data-jumpy-component": "tab",
|
|
3712
|
-
children: /* @__PURE__ */
|
|
4019
|
+
children: /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "tab-content", children: /* @__PURE__ */ jsx2("span", { "data-jumpy-slot": "tab-label", "data-text": item.label, children: item.label }) })
|
|
3713
4020
|
},
|
|
3714
4021
|
item.key
|
|
3715
4022
|
);
|
|
3716
4023
|
}),
|
|
3717
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ jsx2(
|
|
3718
4025
|
"div",
|
|
3719
4026
|
{
|
|
3720
4027
|
ref: indicatorRef,
|
|
@@ -3725,7 +4032,7 @@ function JumpTabs({ items, value, onChange, className = "" }) {
|
|
|
3725
4032
|
] }) });
|
|
3726
4033
|
}
|
|
3727
4034
|
function JumpModal({ children }) {
|
|
3728
|
-
return /* @__PURE__ */
|
|
4035
|
+
return /* @__PURE__ */ jsx2(JumpDialog, { visible: true, children });
|
|
3729
4036
|
}
|
|
3730
4037
|
export {
|
|
3731
4038
|
BrandMark,
|
|
@@ -3786,6 +4093,7 @@ export {
|
|
|
3786
4093
|
JumpTimePicker,
|
|
3787
4094
|
JumpToggleButton,
|
|
3788
4095
|
JumpToggleButtonGroup,
|
|
4096
|
+
JumpTokenInput,
|
|
3789
4097
|
JumpTooltip,
|
|
3790
4098
|
JumpTypography,
|
|
3791
4099
|
JumpyAnimation,
|