@octaviaflow/core 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/MonacoEditor/MonacoDiffEditor.d.ts +1 -1
- package/dist/components/MonacoEditor/MonacoDiffEditor.d.ts.map +1 -1
- package/dist/components/MonacoEditor/MonacoEditor.d.ts +1 -1
- package/dist/components/MonacoEditor/MonacoEditor.d.ts.map +1 -1
- package/dist/index.cjs +274 -264
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -8723,8 +8723,7 @@ function LinkButton({
|
|
|
8723
8723
|
}
|
|
8724
8724
|
|
|
8725
8725
|
// src/components/MonacoEditor/MonacoEditor.tsx
|
|
8726
|
-
var import_react40 = require("
|
|
8727
|
-
var import_react41 = require("react");
|
|
8726
|
+
var import_react40 = require("react");
|
|
8728
8727
|
|
|
8729
8728
|
// src/components/MonacoEditor/octaviaflowTheme.ts
|
|
8730
8729
|
var OCTAVIAFLOW_LIGHT = {
|
|
@@ -8817,6 +8816,9 @@ var OCTAVIAFLOW_THEME_ID = "octaviaflow-light";
|
|
|
8817
8816
|
|
|
8818
8817
|
// src/components/MonacoEditor/MonacoEditor.tsx
|
|
8819
8818
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
8819
|
+
var Editor = (0, import_react40.lazy)(
|
|
8820
|
+
() => import("@monaco-editor/react").then((mod) => ({ default: mod.Editor }))
|
|
8821
|
+
);
|
|
8820
8822
|
var MARKER_SEVERITY = {
|
|
8821
8823
|
hint: 1,
|
|
8822
8824
|
info: 2,
|
|
@@ -8849,27 +8851,27 @@ function MonacoEditor({
|
|
|
8849
8851
|
ariaLabel = "Code editor",
|
|
8850
8852
|
theme
|
|
8851
8853
|
}) {
|
|
8852
|
-
const editorRef = (0,
|
|
8853
|
-
const monacoRef = (0,
|
|
8854
|
-
const [wordWrap, setWordWrap] = (0,
|
|
8855
|
-
const [minimap, setMinimap] = (0,
|
|
8856
|
-
const [copied, setCopied] = (0,
|
|
8857
|
-
const [cursor, setCursor] = (0,
|
|
8858
|
-
const [selection, setSelection] = (0,
|
|
8859
|
-
const [lineCount, setLineCount] = (0,
|
|
8860
|
-
(0,
|
|
8854
|
+
const editorRef = (0, import_react40.useRef)(null);
|
|
8855
|
+
const monacoRef = (0, import_react40.useRef)(null);
|
|
8856
|
+
const [wordWrap, setWordWrap] = (0, import_react40.useState)(wordWrapProp ?? false);
|
|
8857
|
+
const [minimap, setMinimap] = (0, import_react40.useState)(minimapProp ?? false);
|
|
8858
|
+
const [copied, setCopied] = (0, import_react40.useState)(false);
|
|
8859
|
+
const [cursor, setCursor] = (0, import_react40.useState)({ line: 1, column: 1 });
|
|
8860
|
+
const [selection, setSelection] = (0, import_react40.useState)({ chars: 0, lines: 0 });
|
|
8861
|
+
const [lineCount, setLineCount] = (0, import_react40.useState)(value.split("\n").length);
|
|
8862
|
+
(0, import_react40.useEffect)(() => {
|
|
8861
8863
|
if (wordWrapProp !== void 0) setWordWrap(wordWrapProp);
|
|
8862
8864
|
}, [wordWrapProp]);
|
|
8863
|
-
(0,
|
|
8865
|
+
(0, import_react40.useEffect)(() => {
|
|
8864
8866
|
if (minimapProp !== void 0) setMinimap(minimapProp);
|
|
8865
8867
|
}, [minimapProp]);
|
|
8866
|
-
(0,
|
|
8868
|
+
(0, import_react40.useEffect)(() => {
|
|
8867
8869
|
editorRef.current?.updateOptions({
|
|
8868
8870
|
wordWrap: wordWrap ? "on" : "off",
|
|
8869
8871
|
minimap: { enabled: minimap }
|
|
8870
8872
|
});
|
|
8871
8873
|
}, [wordWrap, minimap]);
|
|
8872
|
-
(0,
|
|
8874
|
+
(0, import_react40.useEffect)(() => {
|
|
8873
8875
|
const editor = editorRef.current;
|
|
8874
8876
|
const monaco = monacoRef.current;
|
|
8875
8877
|
if (!editor || !monaco || !markers) return;
|
|
@@ -8889,7 +8891,7 @@ function MonacoEditor({
|
|
|
8889
8891
|
}))
|
|
8890
8892
|
);
|
|
8891
8893
|
}, [markers]);
|
|
8892
|
-
const handleMount = (0,
|
|
8894
|
+
const handleMount = (0, import_react40.useCallback)(
|
|
8893
8895
|
(editor, monaco) => {
|
|
8894
8896
|
editorRef.current = editor;
|
|
8895
8897
|
monacoRef.current = monaco;
|
|
@@ -9072,8 +9074,11 @@ function MonacoEditor({
|
|
|
9072
9074
|
)
|
|
9073
9075
|
] })
|
|
9074
9076
|
] }),
|
|
9075
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9076
|
-
|
|
9077
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react40.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
9078
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("circle", { cx: "7", cy: "7", r: "5", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "4 18", strokeLinecap: "round" }) }) }),
|
|
9079
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: "Loading editor\u2026" })
|
|
9080
|
+
] }), children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
9081
|
+
Editor,
|
|
9077
9082
|
{
|
|
9078
9083
|
value,
|
|
9079
9084
|
onChange: (v) => onChange?.(v ?? ""),
|
|
@@ -9088,7 +9093,7 @@ function MonacoEditor({
|
|
|
9088
9093
|
] }),
|
|
9089
9094
|
"aria-label": ariaLabel
|
|
9090
9095
|
}
|
|
9091
|
-
) }),
|
|
9096
|
+
) }) }),
|
|
9092
9097
|
!hideFooter && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className: "ods-monaco__footer", children: [
|
|
9093
9098
|
/* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("span", { className: "ods-monaco__pos", children: [
|
|
9094
9099
|
"Ln ",
|
|
@@ -9121,9 +9126,11 @@ function MonacoEditor({
|
|
|
9121
9126
|
}
|
|
9122
9127
|
|
|
9123
9128
|
// src/components/MonacoEditor/MonacoDiffEditor.tsx
|
|
9124
|
-
var
|
|
9125
|
-
var import_react43 = require("react");
|
|
9129
|
+
var import_react41 = require("react");
|
|
9126
9130
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
9131
|
+
var DiffEditor = (0, import_react41.lazy)(
|
|
9132
|
+
() => import("@monaco-editor/react").then((mod) => ({ default: mod.DiffEditor }))
|
|
9133
|
+
);
|
|
9127
9134
|
function MonacoDiffEditor({
|
|
9128
9135
|
original,
|
|
9129
9136
|
modified,
|
|
@@ -9144,8 +9151,8 @@ function MonacoDiffEditor({
|
|
|
9144
9151
|
theme,
|
|
9145
9152
|
hideToolbar = false
|
|
9146
9153
|
}) {
|
|
9147
|
-
const editorRef = (0,
|
|
9148
|
-
const [sideBySide, setSideBySide] = (0,
|
|
9154
|
+
const editorRef = (0, import_react41.useRef)(null);
|
|
9155
|
+
const [sideBySide, setSideBySide] = (0, import_react41.useState)(renderSideBySide);
|
|
9149
9156
|
const handleMount = (diffEditor, monaco) => {
|
|
9150
9157
|
editorRef.current = diffEditor;
|
|
9151
9158
|
monaco.editor.defineTheme(OCTAVIAFLOW_THEME_ID, OCTAVIAFLOW_LIGHT);
|
|
@@ -9228,8 +9235,11 @@ function MonacoDiffEditor({
|
|
|
9228
9235
|
}
|
|
9229
9236
|
) })
|
|
9230
9237
|
] }),
|
|
9231
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9232
|
-
|
|
9238
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "ods-monaco__body", style: { minHeight }, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react41.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "ods-monaco__loading", children: [
|
|
9239
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "ods-monaco__loading-spin", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("circle", { cx: "7", cy: "7", r: "5", stroke: "currentColor", strokeWidth: "1.4", strokeDasharray: "4 18", strokeLinecap: "round" }) }) }),
|
|
9240
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Loading diff\u2026" })
|
|
9241
|
+
] }), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
9242
|
+
DiffEditor,
|
|
9233
9243
|
{
|
|
9234
9244
|
original,
|
|
9235
9245
|
modified,
|
|
@@ -9243,7 +9253,7 @@ function MonacoDiffEditor({
|
|
|
9243
9253
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { children: "Loading diff\u2026" })
|
|
9244
9254
|
] })
|
|
9245
9255
|
}
|
|
9246
|
-
) })
|
|
9256
|
+
) }) })
|
|
9247
9257
|
]
|
|
9248
9258
|
}
|
|
9249
9259
|
);
|
|
@@ -9251,7 +9261,7 @@ function MonacoDiffEditor({
|
|
|
9251
9261
|
|
|
9252
9262
|
// src/components/MultiSelect/MultiSelect.tsx
|
|
9253
9263
|
var import_framer_motion10 = require("framer-motion");
|
|
9254
|
-
var
|
|
9264
|
+
var import_react42 = require("react");
|
|
9255
9265
|
var import_react_dom4 = require("react-dom");
|
|
9256
9266
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
9257
9267
|
var RESERVED_TAIL_PX = 64;
|
|
@@ -9273,25 +9283,25 @@ function MultiSelect({
|
|
|
9273
9283
|
maxTags,
|
|
9274
9284
|
className
|
|
9275
9285
|
}) {
|
|
9276
|
-
const [internalValue, setInternalValue] = (0,
|
|
9286
|
+
const [internalValue, setInternalValue] = (0, import_react42.useState)(defaultValue ?? []);
|
|
9277
9287
|
const selectedValues = controlledValue ?? internalValue;
|
|
9278
|
-
const [open, setOpen] = (0,
|
|
9279
|
-
const [query, setQuery] = (0,
|
|
9280
|
-
const [activeIdx, setActiveIdx] = (0,
|
|
9281
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
9282
|
-
const wrapRef = (0,
|
|
9283
|
-
const tagsRowRef = (0,
|
|
9284
|
-
const searchRef = (0,
|
|
9285
|
-
const dropdownRef = (0,
|
|
9286
|
-
const chipRefs = (0,
|
|
9287
|
-
const commit = (0,
|
|
9288
|
+
const [open, setOpen] = (0, import_react42.useState)(false);
|
|
9289
|
+
const [query, setQuery] = (0, import_react42.useState)("");
|
|
9290
|
+
const [activeIdx, setActiveIdx] = (0, import_react42.useState)(0);
|
|
9291
|
+
const [dropdownPos, setDropdownPos] = (0, import_react42.useState)({ top: 0, left: 0, width: 0 });
|
|
9292
|
+
const wrapRef = (0, import_react42.useRef)(null);
|
|
9293
|
+
const tagsRowRef = (0, import_react42.useRef)(null);
|
|
9294
|
+
const searchRef = (0, import_react42.useRef)(null);
|
|
9295
|
+
const dropdownRef = (0, import_react42.useRef)(null);
|
|
9296
|
+
const chipRefs = (0, import_react42.useRef)([]);
|
|
9297
|
+
const commit = (0, import_react42.useCallback)(
|
|
9288
9298
|
(next) => {
|
|
9289
9299
|
if (controlledValue === void 0) setInternalValue(next);
|
|
9290
9300
|
onChange?.(next);
|
|
9291
9301
|
},
|
|
9292
9302
|
[controlledValue, onChange]
|
|
9293
9303
|
);
|
|
9294
|
-
const availableOptions = (0,
|
|
9304
|
+
const availableOptions = (0, import_react42.useMemo)(() => {
|
|
9295
9305
|
const selected = new Set(selectedValues);
|
|
9296
9306
|
const unselected = options.filter((o) => !selected.has(o.value));
|
|
9297
9307
|
if (!query.trim()) return unselected;
|
|
@@ -9303,12 +9313,12 @@ function MultiSelect({
|
|
|
9303
9313
|
const showSearch = searchable ?? options.length > 6;
|
|
9304
9314
|
const getLabel = (v) => options.find((o) => o.value === v)?.label ?? v;
|
|
9305
9315
|
const getIcon = (v) => options.find((o) => o.value === v)?.icon;
|
|
9306
|
-
const updatePosition = (0,
|
|
9316
|
+
const updatePosition = (0, import_react42.useCallback)(() => {
|
|
9307
9317
|
if (!wrapRef.current) return;
|
|
9308
9318
|
const rect = wrapRef.current.getBoundingClientRect();
|
|
9309
9319
|
setDropdownPos({ top: rect.bottom + 4, left: rect.left, width: rect.width });
|
|
9310
9320
|
}, []);
|
|
9311
|
-
(0,
|
|
9321
|
+
(0, import_react42.useEffect)(() => {
|
|
9312
9322
|
if (!open) return;
|
|
9313
9323
|
updatePosition();
|
|
9314
9324
|
window.addEventListener("scroll", updatePosition, true);
|
|
@@ -9318,7 +9328,7 @@ function MultiSelect({
|
|
|
9318
9328
|
window.removeEventListener("resize", updatePosition);
|
|
9319
9329
|
};
|
|
9320
9330
|
}, [open, updatePosition]);
|
|
9321
|
-
(0,
|
|
9331
|
+
(0, import_react42.useEffect)(() => {
|
|
9322
9332
|
if (!open) return;
|
|
9323
9333
|
const onDoc = (e) => {
|
|
9324
9334
|
const t = e.target;
|
|
@@ -9330,15 +9340,15 @@ function MultiSelect({
|
|
|
9330
9340
|
document.addEventListener("mousedown", onDoc);
|
|
9331
9341
|
return () => document.removeEventListener("mousedown", onDoc);
|
|
9332
9342
|
}, [open]);
|
|
9333
|
-
(0,
|
|
9343
|
+
(0, import_react42.useEffect)(() => {
|
|
9334
9344
|
if (open && showSearch) {
|
|
9335
9345
|
requestAnimationFrame(() => searchRef.current?.focus());
|
|
9336
9346
|
}
|
|
9337
9347
|
}, [open, showSearch]);
|
|
9338
|
-
(0,
|
|
9339
|
-
const [fitCount, setFitCount] = (0,
|
|
9340
|
-
const [tick, setTick] = (0,
|
|
9341
|
-
(0,
|
|
9348
|
+
(0, import_react42.useEffect)(() => setActiveIdx(0), [query, open]);
|
|
9349
|
+
const [fitCount, setFitCount] = (0, import_react42.useState)(selectedValues.length);
|
|
9350
|
+
const [tick, setTick] = (0, import_react42.useState)(0);
|
|
9351
|
+
(0, import_react42.useLayoutEffect)(() => {
|
|
9342
9352
|
if (maxVisibleTags !== void 0) {
|
|
9343
9353
|
setFitCount(Math.min(selectedValues.length, maxVisibleTags));
|
|
9344
9354
|
return;
|
|
@@ -9364,7 +9374,7 @@ function MultiSelect({
|
|
|
9364
9374
|
if (count < selectedValues.length && count > 0) count = Math.max(1, count - 1);
|
|
9365
9375
|
setFitCount(count);
|
|
9366
9376
|
}, [tick, selectedValues, maxVisibleTags]);
|
|
9367
|
-
(0,
|
|
9377
|
+
(0, import_react42.useEffect)(() => {
|
|
9368
9378
|
if (typeof ResizeObserver === "undefined") return;
|
|
9369
9379
|
const row = tagsRowRef.current;
|
|
9370
9380
|
if (!row) return;
|
|
@@ -9372,7 +9382,7 @@ function MultiSelect({
|
|
|
9372
9382
|
ro.observe(row);
|
|
9373
9383
|
return () => ro.disconnect();
|
|
9374
9384
|
}, []);
|
|
9375
|
-
const addValue = (0,
|
|
9385
|
+
const addValue = (0, import_react42.useCallback)(
|
|
9376
9386
|
(val) => {
|
|
9377
9387
|
if (maxTags && selectedValues.length >= maxTags) return;
|
|
9378
9388
|
commit([...selectedValues, val]);
|
|
@@ -9382,17 +9392,17 @@ function MultiSelect({
|
|
|
9382
9392
|
},
|
|
9383
9393
|
[selectedValues, maxTags, commit]
|
|
9384
9394
|
);
|
|
9385
|
-
const removeValue = (0,
|
|
9395
|
+
const removeValue = (0, import_react42.useCallback)(
|
|
9386
9396
|
(val) => {
|
|
9387
9397
|
commit(selectedValues.filter((v) => v !== val));
|
|
9388
9398
|
},
|
|
9389
9399
|
[selectedValues, commit]
|
|
9390
9400
|
);
|
|
9391
|
-
const clearAll = (0,
|
|
9401
|
+
const clearAll = (0, import_react42.useCallback)(() => {
|
|
9392
9402
|
commit([]);
|
|
9393
9403
|
setQuery("");
|
|
9394
9404
|
}, [commit]);
|
|
9395
|
-
const handleSearchKey = (0,
|
|
9405
|
+
const handleSearchKey = (0, import_react42.useCallback)(
|
|
9396
9406
|
(e) => {
|
|
9397
9407
|
if (e.key === "Escape") {
|
|
9398
9408
|
setOpen(false);
|
|
@@ -9621,7 +9631,7 @@ function MultiSelect({
|
|
|
9621
9631
|
}
|
|
9622
9632
|
|
|
9623
9633
|
// src/components/NumberInput/NumberInput.tsx
|
|
9624
|
-
var
|
|
9634
|
+
var import_react43 = require("react");
|
|
9625
9635
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
9626
9636
|
function NumberInput({
|
|
9627
9637
|
label,
|
|
@@ -9640,7 +9650,7 @@ function NumberInput({
|
|
|
9640
9650
|
className,
|
|
9641
9651
|
...props
|
|
9642
9652
|
}) {
|
|
9643
|
-
const clamp = (0,
|
|
9653
|
+
const clamp = (0, import_react43.useCallback)(
|
|
9644
9654
|
(v) => {
|
|
9645
9655
|
if (typeof min === "number") v = Math.max(min, v);
|
|
9646
9656
|
if (typeof max === "number") v = Math.min(max, v);
|
|
@@ -9714,7 +9724,7 @@ function NumberInput({
|
|
|
9714
9724
|
}
|
|
9715
9725
|
|
|
9716
9726
|
// src/components/OTPInput/OTPInput.tsx
|
|
9717
|
-
var
|
|
9727
|
+
var import_react44 = require("react");
|
|
9718
9728
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
9719
9729
|
function OTPInput({
|
|
9720
9730
|
label,
|
|
@@ -9729,9 +9739,9 @@ function OTPInput({
|
|
|
9729
9739
|
autoFocus = false,
|
|
9730
9740
|
className
|
|
9731
9741
|
}) {
|
|
9732
|
-
const refs = (0,
|
|
9742
|
+
const refs = (0, import_react44.useRef)([]);
|
|
9733
9743
|
const pattern = type === "numeric" ? /[^0-9]/g : /[^a-zA-Z0-9]/g;
|
|
9734
|
-
const setCharAt = (0,
|
|
9744
|
+
const setCharAt = (0, import_react44.useCallback)(
|
|
9735
9745
|
(idx, ch) => {
|
|
9736
9746
|
const cleaned = ch.replace(pattern, "").slice(0, 1);
|
|
9737
9747
|
const chars = value.split("");
|
|
@@ -9840,7 +9850,7 @@ function PageHeader({
|
|
|
9840
9850
|
}
|
|
9841
9851
|
|
|
9842
9852
|
// src/components/PasswordInput/PasswordInput.tsx
|
|
9843
|
-
var
|
|
9853
|
+
var import_react45 = require("react");
|
|
9844
9854
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
9845
9855
|
var strengthLabels = ["Very weak", "Weak", "Fair", "Strong", "Very strong"];
|
|
9846
9856
|
function PasswordInput({
|
|
@@ -9857,7 +9867,7 @@ function PasswordInput({
|
|
|
9857
9867
|
className,
|
|
9858
9868
|
...rest
|
|
9859
9869
|
}) {
|
|
9860
|
-
const [shown, setShown] = (0,
|
|
9870
|
+
const [shown, setShown] = (0, import_react45.useState)(false);
|
|
9861
9871
|
const handle = (e) => onChange?.(e.target.value);
|
|
9862
9872
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
9863
9873
|
"div",
|
|
@@ -9936,7 +9946,7 @@ function PasswordInput({
|
|
|
9936
9946
|
}
|
|
9937
9947
|
|
|
9938
9948
|
// src/components/PhoneInput/PhoneInput.tsx
|
|
9939
|
-
var
|
|
9949
|
+
var import_react46 = require("react");
|
|
9940
9950
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
9941
9951
|
var DEFAULT_COUNTRIES = [
|
|
9942
9952
|
{ code: "US", name: "United States", dialCode: "+1", flag: "\u{1F1FA}\u{1F1F8}" },
|
|
@@ -9962,7 +9972,7 @@ function PhoneInput({
|
|
|
9962
9972
|
helperText,
|
|
9963
9973
|
className
|
|
9964
9974
|
}) {
|
|
9965
|
-
const [open, setOpen] = (0,
|
|
9975
|
+
const [open, setOpen] = (0, import_react46.useState)(false);
|
|
9966
9976
|
const country = countries.find((c) => c.code === countryCode) ?? countries[0];
|
|
9967
9977
|
const onInput = (e) => onChange?.(e.target.value);
|
|
9968
9978
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
@@ -10044,7 +10054,7 @@ function PhoneInput({
|
|
|
10044
10054
|
}
|
|
10045
10055
|
|
|
10046
10056
|
// src/components/Popover/Popover.tsx
|
|
10047
|
-
var
|
|
10057
|
+
var import_react47 = require("react");
|
|
10048
10058
|
var import_react_dom5 = require("react-dom");
|
|
10049
10059
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
10050
10060
|
function computePosition2(rect, popRect, placement, offset) {
|
|
@@ -10075,31 +10085,31 @@ function Popover({
|
|
|
10075
10085
|
children,
|
|
10076
10086
|
className
|
|
10077
10087
|
}) {
|
|
10078
|
-
const [openState, setOpenState] = (0,
|
|
10088
|
+
const [openState, setOpenState] = (0, import_react47.useState)(defaultOpen);
|
|
10079
10089
|
const open = openProp ?? openState;
|
|
10080
|
-
const setOpen = (0,
|
|
10090
|
+
const setOpen = (0, import_react47.useCallback)(
|
|
10081
10091
|
(v) => {
|
|
10082
10092
|
if (openProp === void 0) setOpenState(v);
|
|
10083
10093
|
onOpenChange?.(v);
|
|
10084
10094
|
},
|
|
10085
10095
|
[openProp, onOpenChange]
|
|
10086
10096
|
);
|
|
10087
|
-
const triggerRef = (0,
|
|
10088
|
-
const popRef = (0,
|
|
10089
|
-
const [coords, setCoords] = (0,
|
|
10090
|
-
const reposition = (0,
|
|
10097
|
+
const triggerRef = (0, import_react47.useRef)(null);
|
|
10098
|
+
const popRef = (0, import_react47.useRef)(null);
|
|
10099
|
+
const [coords, setCoords] = (0, import_react47.useState)(null);
|
|
10100
|
+
const reposition = (0, import_react47.useCallback)(() => {
|
|
10091
10101
|
if (!triggerRef.current || !popRef.current) return;
|
|
10092
10102
|
const trigRect = triggerRef.current.getBoundingClientRect();
|
|
10093
10103
|
const popRect = popRef.current.getBoundingClientRect();
|
|
10094
10104
|
setCoords(computePosition2(trigRect, popRect, placement, offset));
|
|
10095
10105
|
}, [placement, offset]);
|
|
10096
|
-
(0,
|
|
10106
|
+
(0, import_react47.useLayoutEffect)(() => {
|
|
10097
10107
|
if (!open) return;
|
|
10098
10108
|
reposition();
|
|
10099
10109
|
const id = requestAnimationFrame(reposition);
|
|
10100
10110
|
return () => cancelAnimationFrame(id);
|
|
10101
10111
|
}, [open, reposition, content]);
|
|
10102
|
-
(0,
|
|
10112
|
+
(0, import_react47.useEffect)(() => {
|
|
10103
10113
|
if (!open) return;
|
|
10104
10114
|
const onScroll = () => reposition();
|
|
10105
10115
|
window.addEventListener("scroll", onScroll, true);
|
|
@@ -10109,7 +10119,7 @@ function Popover({
|
|
|
10109
10119
|
window.removeEventListener("resize", onScroll);
|
|
10110
10120
|
};
|
|
10111
10121
|
}, [open, reposition]);
|
|
10112
|
-
(0,
|
|
10122
|
+
(0, import_react47.useEffect)(() => {
|
|
10113
10123
|
if (!open || !closeOnClickOutside) return;
|
|
10114
10124
|
const onDoc = (e) => {
|
|
10115
10125
|
const t = e.target;
|
|
@@ -10120,7 +10130,7 @@ function Popover({
|
|
|
10120
10130
|
document.addEventListener("mousedown", onDoc);
|
|
10121
10131
|
return () => document.removeEventListener("mousedown", onDoc);
|
|
10122
10132
|
}, [open, closeOnClickOutside, setOpen]);
|
|
10123
|
-
(0,
|
|
10133
|
+
(0, import_react47.useEffect)(() => {
|
|
10124
10134
|
if (!open || !closeOnEsc) return;
|
|
10125
10135
|
const onKey = (e) => {
|
|
10126
10136
|
if (e.key === "Escape") setOpen(false);
|
|
@@ -10319,7 +10329,7 @@ function ProgressRing({
|
|
|
10319
10329
|
}
|
|
10320
10330
|
|
|
10321
10331
|
// src/components/PromptInput/PromptInput.tsx
|
|
10322
|
-
var
|
|
10332
|
+
var import_react48 = require("react");
|
|
10323
10333
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
10324
10334
|
var ATTACH_GLYPH = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
10325
10335
|
"path",
|
|
@@ -10370,22 +10380,22 @@ function PromptInput({
|
|
|
10370
10380
|
className,
|
|
10371
10381
|
ariaLabel = "Prompt"
|
|
10372
10382
|
}) {
|
|
10373
|
-
const taRef = (0,
|
|
10374
|
-
const [internal, setInternal] = (0,
|
|
10383
|
+
const taRef = (0, import_react48.useRef)(null);
|
|
10384
|
+
const [internal, setInternal] = (0, import_react48.useState)(defaultValue);
|
|
10375
10385
|
const v = value ?? internal;
|
|
10376
10386
|
const isControlled = value !== void 0;
|
|
10377
|
-
const [suggestionsOpen, setSuggestionsOpen] = (0,
|
|
10378
|
-
const [suggestionIndex, setSuggestionIndex] = (0,
|
|
10379
|
-
const [isDragOver, setIsDragOver] = (0,
|
|
10380
|
-
const [historyIdx, setHistoryIdx] = (0,
|
|
10381
|
-
const setValue = (0,
|
|
10387
|
+
const [suggestionsOpen, setSuggestionsOpen] = (0, import_react48.useState)(false);
|
|
10388
|
+
const [suggestionIndex, setSuggestionIndex] = (0, import_react48.useState)(0);
|
|
10389
|
+
const [isDragOver, setIsDragOver] = (0, import_react48.useState)(false);
|
|
10390
|
+
const [historyIdx, setHistoryIdx] = (0, import_react48.useState)(null);
|
|
10391
|
+
const setValue = (0, import_react48.useCallback)(
|
|
10382
10392
|
(next) => {
|
|
10383
10393
|
if (!isControlled) setInternal(next);
|
|
10384
10394
|
onChange?.(next);
|
|
10385
10395
|
},
|
|
10386
10396
|
[isControlled, onChange]
|
|
10387
10397
|
);
|
|
10388
|
-
(0,
|
|
10398
|
+
(0, import_react48.useEffect)(() => {
|
|
10389
10399
|
const el = taRef.current;
|
|
10390
10400
|
if (!el) return;
|
|
10391
10401
|
const computed = window.getComputedStyle(el);
|
|
@@ -10712,16 +10722,16 @@ function Quote({
|
|
|
10712
10722
|
}
|
|
10713
10723
|
|
|
10714
10724
|
// src/components/Radio/Radio.tsx
|
|
10715
|
-
var
|
|
10725
|
+
var import_react50 = require("react");
|
|
10716
10726
|
var import_react_aria9 = require("react-aria");
|
|
10717
10727
|
|
|
10718
10728
|
// src/components/Radio/RadioGroup.tsx
|
|
10719
|
-
var
|
|
10729
|
+
var import_react49 = require("react");
|
|
10720
10730
|
var import_react_aria8 = require("react-aria");
|
|
10721
10731
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
10722
|
-
var RadioGroupContext = (0,
|
|
10732
|
+
var RadioGroupContext = (0, import_react49.createContext)(null);
|
|
10723
10733
|
function useRadioGroupContext() {
|
|
10724
|
-
const context = (0,
|
|
10734
|
+
const context = (0, import_react49.useContext)(RadioGroupContext);
|
|
10725
10735
|
if (!context) {
|
|
10726
10736
|
throw new Error("Radio must be used within a RadioGroup");
|
|
10727
10737
|
}
|
|
@@ -10746,7 +10756,7 @@ function RadioGroup({
|
|
|
10746
10756
|
orientation
|
|
10747
10757
|
};
|
|
10748
10758
|
const state = $384704861d32dbed$export$bca9d026f8e704eb(ariaProps);
|
|
10749
|
-
const ref = (0,
|
|
10759
|
+
const ref = (0, import_react49.useRef)(null);
|
|
10750
10760
|
const { radioGroupProps, labelProps } = (0, import_react_aria8.useRadioGroup)(ariaProps, state);
|
|
10751
10761
|
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
10752
10762
|
"div",
|
|
@@ -10771,7 +10781,7 @@ function RadioGroup({
|
|
|
10771
10781
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
10772
10782
|
function Radio({ value, label, disabled = false, className }) {
|
|
10773
10783
|
const state = useRadioGroupContext();
|
|
10774
|
-
const ref = (0,
|
|
10784
|
+
const ref = (0, import_react50.useRef)(null);
|
|
10775
10785
|
const { inputProps } = (0, import_react_aria9.useRadio)(
|
|
10776
10786
|
{
|
|
10777
10787
|
value,
|
|
@@ -10889,7 +10899,7 @@ function RangeSlider({
|
|
|
10889
10899
|
}
|
|
10890
10900
|
|
|
10891
10901
|
// src/components/Rating/Rating.tsx
|
|
10892
|
-
var
|
|
10902
|
+
var import_react51 = require("react");
|
|
10893
10903
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
10894
10904
|
function StarIcon({ fill }) {
|
|
10895
10905
|
const pathId = `r-${Math.random().toString(36).slice(2)}`;
|
|
@@ -10942,7 +10952,7 @@ function Rating({
|
|
|
10942
10952
|
icon = "star",
|
|
10943
10953
|
className
|
|
10944
10954
|
}) {
|
|
10945
|
-
const [hover, setHover] = (0,
|
|
10955
|
+
const [hover, setHover] = (0, import_react51.useState)(null);
|
|
10946
10956
|
const display = hover ?? value;
|
|
10947
10957
|
const interactive = !readOnly && !disabled;
|
|
10948
10958
|
const Icon = icon === "heart" ? HeartIcon : StarIcon;
|
|
@@ -11005,7 +11015,7 @@ function Rating({
|
|
|
11005
11015
|
}
|
|
11006
11016
|
|
|
11007
11017
|
// src/components/Resizable/Resizable.tsx
|
|
11008
|
-
var
|
|
11018
|
+
var import_react52 = require("react");
|
|
11009
11019
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
11010
11020
|
function Resizable({
|
|
11011
11021
|
direction = "horizontal",
|
|
@@ -11020,8 +11030,8 @@ function Resizable({
|
|
|
11020
11030
|
className,
|
|
11021
11031
|
ariaLabel = "Resize panels"
|
|
11022
11032
|
}) {
|
|
11023
|
-
const wrapRef = (0,
|
|
11024
|
-
const [internalSplit, setInternalSplit] = (0,
|
|
11033
|
+
const wrapRef = (0, import_react52.useRef)(null);
|
|
11034
|
+
const [internalSplit, setInternalSplit] = (0, import_react52.useState)(() => {
|
|
11025
11035
|
if (typeof window === "undefined" || !storageKey) return null;
|
|
11026
11036
|
const stored = window.localStorage.getItem(storageKey);
|
|
11027
11037
|
if (stored != null) {
|
|
@@ -11030,20 +11040,20 @@ function Resizable({
|
|
|
11030
11040
|
}
|
|
11031
11041
|
return null;
|
|
11032
11042
|
});
|
|
11033
|
-
const draggingRef = (0,
|
|
11034
|
-
const [isDragging, setDragging] = (0,
|
|
11035
|
-
const computeFromDefault = (0,
|
|
11043
|
+
const draggingRef = (0, import_react52.useRef)(false);
|
|
11044
|
+
const [isDragging, setDragging] = (0, import_react52.useState)(false);
|
|
11045
|
+
const computeFromDefault = (0, import_react52.useCallback)(() => {
|
|
11036
11046
|
const el = wrapRef.current;
|
|
11037
11047
|
if (!el) return 240;
|
|
11038
11048
|
const total = direction === "horizontal" ? el.offsetWidth : el.offsetHeight;
|
|
11039
11049
|
return defaultSplit > 0 && defaultSplit < 1 ? total * defaultSplit : defaultSplit;
|
|
11040
11050
|
}, [direction, defaultSplit]);
|
|
11041
|
-
const [split, setSplit] = (0,
|
|
11051
|
+
const [split, setSplit] = (0, import_react52.useState)(() => {
|
|
11042
11052
|
if (splitProp != null) return splitProp;
|
|
11043
11053
|
if (internalSplit != null) return internalSplit;
|
|
11044
11054
|
return defaultSplit > 0 && defaultSplit < 1 ? 0 : defaultSplit;
|
|
11045
11055
|
});
|
|
11046
|
-
(0,
|
|
11056
|
+
(0, import_react52.useEffect)(() => {
|
|
11047
11057
|
if (splitProp != null) {
|
|
11048
11058
|
setSplit(splitProp);
|
|
11049
11059
|
return;
|
|
@@ -11058,7 +11068,7 @@ function Resizable({
|
|
|
11058
11068
|
setSplit(defaultSplit);
|
|
11059
11069
|
}
|
|
11060
11070
|
}, [splitProp, internalSplit, defaultSplit, computeFromDefault]);
|
|
11061
|
-
const persist = (0,
|
|
11071
|
+
const persist = (0, import_react52.useCallback)(
|
|
11062
11072
|
(next) => {
|
|
11063
11073
|
onSplitChange?.(next);
|
|
11064
11074
|
if (splitProp == null) setInternalSplit(next);
|
|
@@ -11076,7 +11086,7 @@ function Resizable({
|
|
|
11076
11086
|
draggingRef.current = true;
|
|
11077
11087
|
setDragging(true);
|
|
11078
11088
|
};
|
|
11079
|
-
(0,
|
|
11089
|
+
(0, import_react52.useEffect)(() => {
|
|
11080
11090
|
const onMove = (e) => {
|
|
11081
11091
|
if (!draggingRef.current) return;
|
|
11082
11092
|
const el = wrapRef.current;
|
|
@@ -11172,18 +11182,18 @@ function ResizablePanel({
|
|
|
11172
11182
|
children,
|
|
11173
11183
|
className
|
|
11174
11184
|
}) {
|
|
11175
|
-
const [internal, setInternal] = (0,
|
|
11185
|
+
const [internal, setInternal] = (0, import_react52.useState)(sizeProp ?? defaultSize);
|
|
11176
11186
|
const size = sizeProp ?? internal;
|
|
11177
|
-
const draggingRef = (0,
|
|
11178
|
-
const [isDragging, setDragging] = (0,
|
|
11179
|
-
const startRef = (0,
|
|
11187
|
+
const draggingRef = (0, import_react52.useRef)(false);
|
|
11188
|
+
const [isDragging, setDragging] = (0, import_react52.useState)(false);
|
|
11189
|
+
const startRef = (0, import_react52.useRef)({ x: 0, size });
|
|
11180
11190
|
const onMouseDown = (e) => {
|
|
11181
11191
|
e.preventDefault();
|
|
11182
11192
|
draggingRef.current = true;
|
|
11183
11193
|
setDragging(true);
|
|
11184
11194
|
startRef.current = { x: e.clientX, size };
|
|
11185
11195
|
};
|
|
11186
|
-
(0,
|
|
11196
|
+
(0, import_react52.useEffect)(() => {
|
|
11187
11197
|
const onMove = (e) => {
|
|
11188
11198
|
if (!draggingRef.current) return;
|
|
11189
11199
|
const dx = e.clientX - startRef.current.x;
|
|
@@ -11246,18 +11256,18 @@ function Ribbon({
|
|
|
11246
11256
|
|
|
11247
11257
|
// src/components/Select/Select.tsx
|
|
11248
11258
|
var import_framer_motion11 = require("framer-motion");
|
|
11249
|
-
var
|
|
11259
|
+
var import_react53 = require("react");
|
|
11250
11260
|
var import_react_aria10 = require("react-aria");
|
|
11251
11261
|
var import_react_dom6 = require("react-dom");
|
|
11252
11262
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
11253
11263
|
function ListBox(props) {
|
|
11254
|
-
const ref = (0,
|
|
11264
|
+
const ref = (0, import_react53.useRef)(null);
|
|
11255
11265
|
const { listBoxRef = ref, state } = props;
|
|
11256
11266
|
const { listBoxProps } = (0, import_react_aria10.useListBox)(props, state, listBoxRef);
|
|
11257
11267
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { ...listBoxProps, ref: listBoxRef, className: "ods-select__options", children: [...state.collection].map((item) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Option, { item, state }, item.key)) });
|
|
11258
11268
|
}
|
|
11259
11269
|
function Option({ item, state }) {
|
|
11260
|
-
const ref = (0,
|
|
11270
|
+
const ref = (0, import_react53.useRef)(null);
|
|
11261
11271
|
const { optionProps, isSelected, isFocused, isDisabled } = (0, import_react_aria10.useOption)(
|
|
11262
11272
|
{ key: item.key },
|
|
11263
11273
|
state,
|
|
@@ -11334,19 +11344,19 @@ function Select({
|
|
|
11334
11344
|
className,
|
|
11335
11345
|
name
|
|
11336
11346
|
}) {
|
|
11337
|
-
const triggerRef = (0,
|
|
11338
|
-
const listBoxRef = (0,
|
|
11339
|
-
const searchRef = (0,
|
|
11340
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
11341
|
-
const [dropdownPos, setDropdownPos] = (0,
|
|
11342
|
-
const filteredOptions = (0,
|
|
11347
|
+
const triggerRef = (0, import_react53.useRef)(null);
|
|
11348
|
+
const listBoxRef = (0, import_react53.useRef)(null);
|
|
11349
|
+
const searchRef = (0, import_react53.useRef)(null);
|
|
11350
|
+
const [searchQuery, setSearchQuery] = (0, import_react53.useState)("");
|
|
11351
|
+
const [dropdownPos, setDropdownPos] = (0, import_react53.useState)({ top: 0, left: 0, width: 0 });
|
|
11352
|
+
const filteredOptions = (0, import_react53.useMemo)(() => {
|
|
11343
11353
|
if (!searchable || !searchQuery) return options;
|
|
11344
11354
|
const q = searchQuery.toLowerCase();
|
|
11345
11355
|
return options.filter(
|
|
11346
11356
|
(o) => o.label.toLowerCase().includes(q) || o.description?.toLowerCase().includes(q)
|
|
11347
11357
|
);
|
|
11348
11358
|
}, [options, searchQuery, searchable]);
|
|
11349
|
-
const ariaProps = (0,
|
|
11359
|
+
const ariaProps = (0, import_react53.useMemo)(() => {
|
|
11350
11360
|
const items = filteredOptions.map((o) => ({
|
|
11351
11361
|
key: o.value,
|
|
11352
11362
|
label: o.label,
|
|
@@ -11374,7 +11384,7 @@ function Select({
|
|
|
11374
11384
|
const state = $29256f53a2edafe9$export$5159ec8b34d4ec12(ariaProps);
|
|
11375
11385
|
const { triggerProps, menuProps } = (0, import_react_aria10.useSelect)(ariaProps, state, triggerRef);
|
|
11376
11386
|
const { buttonProps } = (0, import_react_aria10.useButton)(triggerProps, triggerRef);
|
|
11377
|
-
const updatePosition = (0,
|
|
11387
|
+
const updatePosition = (0, import_react53.useCallback)(() => {
|
|
11378
11388
|
if (!triggerRef.current) return;
|
|
11379
11389
|
const rect = triggerRef.current.getBoundingClientRect();
|
|
11380
11390
|
setDropdownPos({
|
|
@@ -11383,7 +11393,7 @@ function Select({
|
|
|
11383
11393
|
width: rect.width
|
|
11384
11394
|
});
|
|
11385
11395
|
}, []);
|
|
11386
|
-
(0,
|
|
11396
|
+
(0, import_react53.useEffect)(() => {
|
|
11387
11397
|
if (state.isOpen) {
|
|
11388
11398
|
updatePosition();
|
|
11389
11399
|
window.addEventListener("scroll", updatePosition, true);
|
|
@@ -11394,7 +11404,7 @@ function Select({
|
|
|
11394
11404
|
};
|
|
11395
11405
|
}
|
|
11396
11406
|
}, [state.isOpen, updatePosition]);
|
|
11397
|
-
(0,
|
|
11407
|
+
(0, import_react53.useEffect)(() => {
|
|
11398
11408
|
if (state.isOpen && searchable && searchRef.current) {
|
|
11399
11409
|
requestAnimationFrame(() => searchRef.current?.focus());
|
|
11400
11410
|
}
|
|
@@ -11501,7 +11511,7 @@ function SettingsRow({
|
|
|
11501
11511
|
|
|
11502
11512
|
// src/components/Sheet/Sheet.tsx
|
|
11503
11513
|
var import_framer_motion12 = require("framer-motion");
|
|
11504
|
-
var
|
|
11514
|
+
var import_react54 = require("react");
|
|
11505
11515
|
var import_react_dom7 = require("react-dom");
|
|
11506
11516
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
11507
11517
|
var slideVariants = {
|
|
@@ -11536,7 +11546,7 @@ function Sheet({
|
|
|
11536
11546
|
dragHandle = true,
|
|
11537
11547
|
className
|
|
11538
11548
|
}) {
|
|
11539
|
-
(0,
|
|
11549
|
+
(0, import_react54.useEffect)(() => {
|
|
11540
11550
|
if (!open || !closeOnEsc) return;
|
|
11541
11551
|
const onKey = (e) => {
|
|
11542
11552
|
if (e.key === "Escape") onClose();
|
|
@@ -11588,7 +11598,7 @@ function Sheet({
|
|
|
11588
11598
|
}
|
|
11589
11599
|
|
|
11590
11600
|
// src/components/Sidebar/Sidebar.tsx
|
|
11591
|
-
var
|
|
11601
|
+
var import_react55 = require("react");
|
|
11592
11602
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
11593
11603
|
function Sidebar({
|
|
11594
11604
|
variant = "expanded",
|
|
@@ -11610,7 +11620,7 @@ function Sidebar({
|
|
|
11610
11620
|
className
|
|
11611
11621
|
}) {
|
|
11612
11622
|
const allSections = sections ?? (items ? [{ items }] : []);
|
|
11613
|
-
const [internalPinned, setInternalPinned] = (0,
|
|
11623
|
+
const [internalPinned, setInternalPinned] = (0, import_react55.useState)(() => {
|
|
11614
11624
|
if (typeof window === "undefined") return defaultPinned;
|
|
11615
11625
|
try {
|
|
11616
11626
|
const stored = window.localStorage.getItem(pinStorageKey);
|
|
@@ -11620,7 +11630,7 @@ function Sidebar({
|
|
|
11620
11630
|
return defaultPinned;
|
|
11621
11631
|
});
|
|
11622
11632
|
const pinned = pinnedProp ?? internalPinned;
|
|
11623
|
-
const setPinned = (0,
|
|
11633
|
+
const setPinned = (0, import_react55.useCallback)(
|
|
11624
11634
|
(p) => {
|
|
11625
11635
|
if (pinnedProp === void 0) setInternalPinned(p);
|
|
11626
11636
|
try {
|
|
@@ -11631,9 +11641,9 @@ function Sidebar({
|
|
|
11631
11641
|
},
|
|
11632
11642
|
[pinnedProp, pinStorageKey, onPinnedChange]
|
|
11633
11643
|
);
|
|
11634
|
-
const [hoverOpen, setHoverOpen] = (0,
|
|
11635
|
-
const openTimer = (0,
|
|
11636
|
-
const closeTimer = (0,
|
|
11644
|
+
const [hoverOpen, setHoverOpen] = (0, import_react55.useState)(false);
|
|
11645
|
+
const openTimer = (0, import_react55.useRef)(null);
|
|
11646
|
+
const closeTimer = (0, import_react55.useRef)(null);
|
|
11637
11647
|
const clearTimers = () => {
|
|
11638
11648
|
if (openTimer.current) {
|
|
11639
11649
|
clearTimeout(openTimer.current);
|
|
@@ -11644,7 +11654,7 @@ function Sidebar({
|
|
|
11644
11654
|
closeTimer.current = null;
|
|
11645
11655
|
}
|
|
11646
11656
|
};
|
|
11647
|
-
(0,
|
|
11657
|
+
(0, import_react55.useEffect)(() => () => clearTimers(), []);
|
|
11648
11658
|
const handleEnter = () => {
|
|
11649
11659
|
clearTimers();
|
|
11650
11660
|
openTimer.current = setTimeout(() => setHoverOpen(true), hoverOpenDelay);
|
|
@@ -11778,15 +11788,15 @@ function RailItem({
|
|
|
11778
11788
|
tooltipDelay,
|
|
11779
11789
|
suppressTooltip
|
|
11780
11790
|
}) {
|
|
11781
|
-
const [tipOpen, setTipOpen] = (0,
|
|
11782
|
-
const timerRef = (0,
|
|
11791
|
+
const [tipOpen, setTipOpen] = (0, import_react55.useState)(false);
|
|
11792
|
+
const timerRef = (0, import_react55.useRef)(null);
|
|
11783
11793
|
const clear = () => {
|
|
11784
11794
|
if (timerRef.current) {
|
|
11785
11795
|
clearTimeout(timerRef.current);
|
|
11786
11796
|
timerRef.current = null;
|
|
11787
11797
|
}
|
|
11788
11798
|
};
|
|
11789
|
-
(0,
|
|
11799
|
+
(0, import_react55.useEffect)(() => () => clear(), []);
|
|
11790
11800
|
const show = () => {
|
|
11791
11801
|
if (suppressTooltip) return;
|
|
11792
11802
|
clear();
|
|
@@ -11907,7 +11917,7 @@ function ExpandedLayout({
|
|
|
11907
11917
|
}
|
|
11908
11918
|
function ExpandedItem({ item, level }) {
|
|
11909
11919
|
const hasChildren = !!(item.children && item.children.length > 0);
|
|
11910
|
-
const [open, setOpen] = (0,
|
|
11920
|
+
const [open, setOpen] = (0, import_react55.useState)(
|
|
11911
11921
|
item.defaultExpanded ?? (hasChildren && hasActiveDescendant(item))
|
|
11912
11922
|
);
|
|
11913
11923
|
if (hasChildren) {
|
|
@@ -12034,7 +12044,7 @@ function Skeleton({ variant = "text", width, height, lines = 1, className }) {
|
|
|
12034
12044
|
|
|
12035
12045
|
// src/components/SlideoutPanel/SlideoutPanel.tsx
|
|
12036
12046
|
var import_framer_motion13 = require("framer-motion");
|
|
12037
|
-
var
|
|
12047
|
+
var import_react56 = require("react");
|
|
12038
12048
|
var import_react_aria11 = require("react-aria");
|
|
12039
12049
|
var import_react_dom8 = require("react-dom");
|
|
12040
12050
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
@@ -12060,8 +12070,8 @@ function SlideoutContent({
|
|
|
12060
12070
|
footer,
|
|
12061
12071
|
className
|
|
12062
12072
|
}) {
|
|
12063
|
-
const overlayRef = (0,
|
|
12064
|
-
const panelRef = (0,
|
|
12073
|
+
const overlayRef = (0, import_react56.useRef)(null);
|
|
12074
|
+
const panelRef = (0, import_react56.useRef)(null);
|
|
12065
12075
|
const { overlayProps } = (0, import_react_aria11.useOverlay)(
|
|
12066
12076
|
{
|
|
12067
12077
|
isOpen: open,
|
|
@@ -12286,7 +12296,7 @@ function SocialButton({
|
|
|
12286
12296
|
}
|
|
12287
12297
|
|
|
12288
12298
|
// src/components/Sortable/Sortable.tsx
|
|
12289
|
-
var
|
|
12299
|
+
var import_react57 = require("react");
|
|
12290
12300
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
12291
12301
|
var DT_TYPE = "application/x-ods-sortable";
|
|
12292
12302
|
function Sortable({
|
|
@@ -12299,15 +12309,15 @@ function Sortable({
|
|
|
12299
12309
|
autoScrollEdge = 48,
|
|
12300
12310
|
className
|
|
12301
12311
|
}) {
|
|
12302
|
-
const containerRef = (0,
|
|
12303
|
-
const itemRefs = (0,
|
|
12304
|
-
const originalOrderRef = (0,
|
|
12305
|
-
const scrollTimerRef = (0,
|
|
12306
|
-
const [draggingId, setDraggingId] = (0,
|
|
12307
|
-
const [dropPos, setDropPos] = (0,
|
|
12308
|
-
const [kbActiveId, setKbActiveId] = (0,
|
|
12312
|
+
const containerRef = (0, import_react57.useRef)(null);
|
|
12313
|
+
const itemRefs = (0, import_react57.useRef)(/* @__PURE__ */ new Map());
|
|
12314
|
+
const originalOrderRef = (0, import_react57.useRef)(null);
|
|
12315
|
+
const scrollTimerRef = (0, import_react57.useRef)(null);
|
|
12316
|
+
const [draggingId, setDraggingId] = (0, import_react57.useState)(null);
|
|
12317
|
+
const [dropPos, setDropPos] = (0, import_react57.useState)(null);
|
|
12318
|
+
const [kbActiveId, setKbActiveId] = (0, import_react57.useState)(null);
|
|
12309
12319
|
const isVertical = direction === "vertical";
|
|
12310
|
-
const onDragStart = (0,
|
|
12320
|
+
const onDragStart = (0, import_react57.useCallback)(
|
|
12311
12321
|
(id) => (e) => {
|
|
12312
12322
|
if (disabled) return;
|
|
12313
12323
|
e.dataTransfer.effectAllowed = "move";
|
|
@@ -12318,7 +12328,7 @@ function Sortable({
|
|
|
12318
12328
|
},
|
|
12319
12329
|
[disabled, items]
|
|
12320
12330
|
);
|
|
12321
|
-
const cancelDrag = (0,
|
|
12331
|
+
const cancelDrag = (0, import_react57.useCallback)(() => {
|
|
12322
12332
|
setDraggingId(null);
|
|
12323
12333
|
setDropPos(null);
|
|
12324
12334
|
originalOrderRef.current = null;
|
|
@@ -12327,7 +12337,7 @@ function Sortable({
|
|
|
12327
12337
|
scrollTimerRef.current = null;
|
|
12328
12338
|
}
|
|
12329
12339
|
}, []);
|
|
12330
|
-
const onDragEnd = (0,
|
|
12340
|
+
const onDragEnd = (0, import_react57.useCallback)(() => {
|
|
12331
12341
|
cancelDrag();
|
|
12332
12342
|
}, [cancelDrag]);
|
|
12333
12343
|
const onItemDragOver = (id) => (e) => {
|
|
@@ -12352,7 +12362,7 @@ function Sortable({
|
|
|
12352
12362
|
if (sourceId === target.id) return;
|
|
12353
12363
|
commitMove(sourceId, target.id, target.edge);
|
|
12354
12364
|
};
|
|
12355
|
-
const commitMove = (0,
|
|
12365
|
+
const commitMove = (0, import_react57.useCallback)(
|
|
12356
12366
|
(sourceId, targetId, edge) => {
|
|
12357
12367
|
const from = items.findIndex((i) => i.id === sourceId);
|
|
12358
12368
|
let to = items.findIndex((i) => i.id === targetId);
|
|
@@ -12366,7 +12376,7 @@ function Sortable({
|
|
|
12366
12376
|
},
|
|
12367
12377
|
[items, onChange]
|
|
12368
12378
|
);
|
|
12369
|
-
(0,
|
|
12379
|
+
(0, import_react57.useEffect)(() => {
|
|
12370
12380
|
if (!autoScroll || !draggingId) return;
|
|
12371
12381
|
const container = containerRef.current;
|
|
12372
12382
|
if (!container) return;
|
|
@@ -12416,7 +12426,7 @@ function Sortable({
|
|
|
12416
12426
|
}
|
|
12417
12427
|
};
|
|
12418
12428
|
}, [autoScroll, autoScrollEdge, draggingId, isVertical]);
|
|
12419
|
-
(0,
|
|
12429
|
+
(0, import_react57.useEffect)(() => {
|
|
12420
12430
|
if (!draggingId) return;
|
|
12421
12431
|
const onKey = (e) => {
|
|
12422
12432
|
if (e.key === "Escape") cancelDrag();
|
|
@@ -12695,7 +12705,7 @@ function Stat({
|
|
|
12695
12705
|
}
|
|
12696
12706
|
|
|
12697
12707
|
// src/components/Switch/Switch.tsx
|
|
12698
|
-
var
|
|
12708
|
+
var import_react58 = require("react");
|
|
12699
12709
|
var import_react_aria12 = require("react-aria");
|
|
12700
12710
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
12701
12711
|
function Switch({
|
|
@@ -12708,7 +12718,7 @@ function Switch({
|
|
|
12708
12718
|
className,
|
|
12709
12719
|
...props
|
|
12710
12720
|
}) {
|
|
12711
|
-
const ref = (0,
|
|
12721
|
+
const ref = (0, import_react58.useRef)(null);
|
|
12712
12722
|
const state = $fd3c5e01e837dc20$export$8042c6c013fd5226({
|
|
12713
12723
|
isSelected: checked,
|
|
12714
12724
|
defaultSelected: defaultChecked,
|
|
@@ -12744,7 +12754,7 @@ function Switch({
|
|
|
12744
12754
|
}
|
|
12745
12755
|
|
|
12746
12756
|
// src/components/Table/Table.tsx
|
|
12747
|
-
var
|
|
12757
|
+
var import_react59 = require("react");
|
|
12748
12758
|
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
12749
12759
|
function Table({
|
|
12750
12760
|
columns,
|
|
@@ -12762,7 +12772,7 @@ function Table({
|
|
|
12762
12772
|
className
|
|
12763
12773
|
}) {
|
|
12764
12774
|
const _expandedRows = /* @__PURE__ */ new Set();
|
|
12765
|
-
const handleSort = (0,
|
|
12775
|
+
const handleSort = (0, import_react59.useCallback)(
|
|
12766
12776
|
(key) => {
|
|
12767
12777
|
if (!onSort) return;
|
|
12768
12778
|
const col = columns.find((c) => c.key === key);
|
|
@@ -12772,7 +12782,7 @@ function Table({
|
|
|
12772
12782
|
},
|
|
12773
12783
|
[columns, onSort, sortKey, sortDirection]
|
|
12774
12784
|
);
|
|
12775
|
-
const handleSelectAll = (0,
|
|
12785
|
+
const handleSelectAll = (0, import_react59.useCallback)(() => {
|
|
12776
12786
|
if (!onSelectionChange) return;
|
|
12777
12787
|
const allSelected = selectedRows?.size === data.length;
|
|
12778
12788
|
if (allSelected) {
|
|
@@ -12781,7 +12791,7 @@ function Table({
|
|
|
12781
12791
|
onSelectionChange(new Set(data.map((_, i) => i)));
|
|
12782
12792
|
}
|
|
12783
12793
|
}, [data, onSelectionChange, selectedRows]);
|
|
12784
|
-
const handleSelectRow = (0,
|
|
12794
|
+
const handleSelectRow = (0, import_react59.useCallback)(
|
|
12785
12795
|
(index) => {
|
|
12786
12796
|
if (!onSelectionChange || !selectedRows) return;
|
|
12787
12797
|
const next = new Set(selectedRows);
|
|
@@ -12867,7 +12877,7 @@ function TableRow({
|
|
|
12867
12877
|
totalCols
|
|
12868
12878
|
}) {
|
|
12869
12879
|
const isSelected = selectedRows?.has(rowIndex) ?? false;
|
|
12870
|
-
const [expanded, setExpanded] = (0,
|
|
12880
|
+
const [expanded, setExpanded] = (0, import_react59.useState)(false);
|
|
12871
12881
|
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
12872
12882
|
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
|
|
12873
12883
|
"tr",
|
|
@@ -12904,11 +12914,11 @@ function TableRow({
|
|
|
12904
12914
|
|
|
12905
12915
|
// src/components/Tabs/Tabs.tsx
|
|
12906
12916
|
var import_framer_motion14 = require("framer-motion");
|
|
12907
|
-
var
|
|
12917
|
+
var import_react60 = require("react");
|
|
12908
12918
|
var import_react_aria13 = require("react-aria");
|
|
12909
12919
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
12910
12920
|
function TabButton({ item, state }) {
|
|
12911
|
-
const ref = (0,
|
|
12921
|
+
const ref = (0, import_react60.useRef)(null);
|
|
12912
12922
|
const { tabProps } = (0, import_react_aria13.useTab)({ key: item.key }, state, ref);
|
|
12913
12923
|
const isSelected = state.selectedKey === item.key;
|
|
12914
12924
|
const isDisabled = state.disabledKeys.has(item.key);
|
|
@@ -12938,7 +12948,7 @@ function TabButton({ item, state }) {
|
|
|
12938
12948
|
);
|
|
12939
12949
|
}
|
|
12940
12950
|
function TabPanelContent({ state, panelContent, ...props }) {
|
|
12941
|
-
const ref = (0,
|
|
12951
|
+
const ref = (0, import_react60.useRef)(null);
|
|
12942
12952
|
const { tabPanelProps } = (0, import_react_aria13.useTabPanel)(props, state, ref);
|
|
12943
12953
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { ...tabPanelProps, ref, className: "ods-tabs__panel", children: panelContent });
|
|
12944
12954
|
}
|
|
@@ -12950,14 +12960,14 @@ function Tabs({
|
|
|
12950
12960
|
orientation = "horizontal",
|
|
12951
12961
|
className
|
|
12952
12962
|
}) {
|
|
12953
|
-
const [internalValue, setInternalValue] = (0,
|
|
12963
|
+
const [internalValue, setInternalValue] = (0, import_react60.useState)(defaultValue || items[0]?.value);
|
|
12954
12964
|
const selectedKey = value ?? internalValue;
|
|
12955
12965
|
const handleSelectionChange = (key) => {
|
|
12956
12966
|
const keyStr = String(key);
|
|
12957
12967
|
if (!value) setInternalValue(keyStr);
|
|
12958
12968
|
onChange?.(keyStr);
|
|
12959
12969
|
};
|
|
12960
|
-
const panelContentMap = (0,
|
|
12970
|
+
const panelContentMap = (0, import_react60.useMemo)(() => {
|
|
12961
12971
|
const map = /* @__PURE__ */ new Map();
|
|
12962
12972
|
items.forEach((item) => {
|
|
12963
12973
|
map.set(item.value, item.children);
|
|
@@ -12974,7 +12984,7 @@ function Tabs({
|
|
|
12974
12984
|
disabledKeys: items.filter((i) => i.disabled).map((i) => i.value)
|
|
12975
12985
|
};
|
|
12976
12986
|
const state = $caeb030f09a278a1$export$4ba071daf4e486(stateProps);
|
|
12977
|
-
const ref = (0,
|
|
12987
|
+
const ref = (0, import_react60.useRef)(null);
|
|
12978
12988
|
const { tabListProps } = (0, import_react_aria13.useTabList)({ ...stateProps, orientation }, state, ref);
|
|
12979
12989
|
const currentPanelContent = panelContentMap.get(String(selectedKey));
|
|
12980
12990
|
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: cn("ods-tabs", `ods-tabs--${orientation}`, className), children: [
|
|
@@ -12984,7 +12994,7 @@ function Tabs({
|
|
|
12984
12994
|
}
|
|
12985
12995
|
|
|
12986
12996
|
// src/components/TagsInput/TagsInput.tsx
|
|
12987
|
-
var
|
|
12997
|
+
var import_react61 = require("react");
|
|
12988
12998
|
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
12989
12999
|
function TagsInput({
|
|
12990
13000
|
label,
|
|
@@ -13000,7 +13010,7 @@ function TagsInput({
|
|
|
13000
13010
|
separators = ["Enter", ","],
|
|
13001
13011
|
className
|
|
13002
13012
|
}) {
|
|
13003
|
-
const [draft, setDraft] = (0,
|
|
13013
|
+
const [draft, setDraft] = (0, import_react61.useState)("");
|
|
13004
13014
|
const addTag = (raw) => {
|
|
13005
13015
|
const tag = raw.trim();
|
|
13006
13016
|
if (!tag) return;
|
|
@@ -13128,7 +13138,7 @@ function TestimonialCard({
|
|
|
13128
13138
|
}
|
|
13129
13139
|
|
|
13130
13140
|
// src/components/Textarea/Textarea.tsx
|
|
13131
|
-
var
|
|
13141
|
+
var import_react62 = require("react");
|
|
13132
13142
|
var import_react_aria14 = require("react-aria");
|
|
13133
13143
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
13134
13144
|
function Textarea({
|
|
@@ -13146,9 +13156,9 @@ function Textarea({
|
|
|
13146
13156
|
onChange,
|
|
13147
13157
|
...props
|
|
13148
13158
|
}) {
|
|
13149
|
-
const ref = (0,
|
|
13150
|
-
const errorId = (0,
|
|
13151
|
-
const [charCount, setCharCount] = (0,
|
|
13159
|
+
const ref = (0, import_react62.useRef)(null);
|
|
13160
|
+
const errorId = (0, import_react62.useId)();
|
|
13161
|
+
const [charCount, setCharCount] = (0, import_react62.useState)(() => String(value ?? defaultValue ?? "").length);
|
|
13152
13162
|
const { labelProps, inputProps } = (0, import_react_aria14.useTextField)(
|
|
13153
13163
|
{
|
|
13154
13164
|
label: label || props["aria-label"] || "textarea",
|
|
@@ -13234,7 +13244,7 @@ function Timeline({ items, size = "md", className }) {
|
|
|
13234
13244
|
}
|
|
13235
13245
|
|
|
13236
13246
|
// src/components/TimePicker/TimePicker.tsx
|
|
13237
|
-
var
|
|
13247
|
+
var import_react63 = require("react");
|
|
13238
13248
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
13239
13249
|
var pad = (n) => n.toString().padStart(2, "0");
|
|
13240
13250
|
function format(v, use24h, showSeconds) {
|
|
@@ -13262,15 +13272,15 @@ function TimePicker({
|
|
|
13262
13272
|
helperText,
|
|
13263
13273
|
className
|
|
13264
13274
|
}) {
|
|
13265
|
-
const [open, setOpen] = (0,
|
|
13266
|
-
const [activeSeg, setActiveSeg] = (0,
|
|
13267
|
-
const draftRef = (0,
|
|
13268
|
-
const wrapRef = (0,
|
|
13269
|
-
const hoursRef = (0,
|
|
13270
|
-
const minutesRef = (0,
|
|
13271
|
-
const secondsRef = (0,
|
|
13275
|
+
const [open, setOpen] = (0, import_react63.useState)(false);
|
|
13276
|
+
const [activeSeg, setActiveSeg] = (0, import_react63.useState)(null);
|
|
13277
|
+
const draftRef = (0, import_react63.useRef)("");
|
|
13278
|
+
const wrapRef = (0, import_react63.useRef)(null);
|
|
13279
|
+
const hoursRef = (0, import_react63.useRef)(null);
|
|
13280
|
+
const minutesRef = (0, import_react63.useRef)(null);
|
|
13281
|
+
const secondsRef = (0, import_react63.useRef)(null);
|
|
13272
13282
|
const refOf = (s) => s === "hours" ? hoursRef : s === "minutes" ? minutesRef : secondsRef;
|
|
13273
|
-
(0,
|
|
13283
|
+
(0, import_react63.useEffect)(() => {
|
|
13274
13284
|
if (!open) return;
|
|
13275
13285
|
const onDoc = (e) => {
|
|
13276
13286
|
if (!wrapRef.current?.contains(e.target)) {
|
|
@@ -13281,7 +13291,7 @@ function TimePicker({
|
|
|
13281
13291
|
document.addEventListener("mousedown", onDoc);
|
|
13282
13292
|
return () => document.removeEventListener("mousedown", onDoc);
|
|
13283
13293
|
}, [open]);
|
|
13284
|
-
const commit = (0,
|
|
13294
|
+
const commit = (0, import_react63.useCallback)(
|
|
13285
13295
|
(seg, n) => {
|
|
13286
13296
|
const next = { ...value, [seg]: clampSeg(seg, n, use24h) };
|
|
13287
13297
|
if (showSeconds && next.seconds === void 0) next.seconds = 0;
|
|
@@ -13476,7 +13486,7 @@ function TimePicker({
|
|
|
13476
13486
|
)
|
|
13477
13487
|
] })
|
|
13478
13488
|
] }),
|
|
13479
|
-
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ods-timepicker__body", children: segOrder().map((seg, i, arr) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
13489
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "ods-timepicker__body", children: segOrder().map((seg, i, arr) => /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_react63.Fragment, { children: [
|
|
13480
13490
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "ods-timepicker__col", children: [
|
|
13481
13491
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "ods-timepicker__col-lbl", children: seg === "hours" ? "HOUR" : seg === "minutes" ? "MIN" : "SEC" }),
|
|
13482
13492
|
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
@@ -13531,7 +13541,7 @@ function TimePicker({
|
|
|
13531
13541
|
}
|
|
13532
13542
|
|
|
13533
13543
|
// src/components/TimezonePicker/TimezonePicker.tsx
|
|
13534
|
-
var
|
|
13544
|
+
var import_react64 = require("react");
|
|
13535
13545
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
13536
13546
|
var DEFAULT_TZS = [
|
|
13537
13547
|
{ iana: "America/Los_Angeles", label: "Pacific Time", offset: "UTC\u22128" },
|
|
@@ -13559,19 +13569,19 @@ function TimezonePicker({
|
|
|
13559
13569
|
placeholder = "Select timezone",
|
|
13560
13570
|
className
|
|
13561
13571
|
}) {
|
|
13562
|
-
const [open, setOpen] = (0,
|
|
13563
|
-
const [query, setQuery] = (0,
|
|
13564
|
-
const wrapRef = (0,
|
|
13565
|
-
const inputRef = (0,
|
|
13572
|
+
const [open, setOpen] = (0, import_react64.useState)(false);
|
|
13573
|
+
const [query, setQuery] = (0, import_react64.useState)("");
|
|
13574
|
+
const wrapRef = (0, import_react64.useRef)(null);
|
|
13575
|
+
const inputRef = (0, import_react64.useRef)(null);
|
|
13566
13576
|
const selected = options.find((o) => o.iana === value);
|
|
13567
|
-
const filtered = (0,
|
|
13577
|
+
const filtered = (0, import_react64.useMemo)(() => {
|
|
13568
13578
|
if (!query.trim()) return options;
|
|
13569
13579
|
const q = query.trim().toLowerCase();
|
|
13570
13580
|
return options.filter(
|
|
13571
13581
|
(o) => o.iana.toLowerCase().includes(q) || o.label.toLowerCase().includes(q) || o.offset.toLowerCase().includes(q) || o.region?.toLowerCase().includes(q)
|
|
13572
13582
|
);
|
|
13573
13583
|
}, [options, query]);
|
|
13574
|
-
(0,
|
|
13584
|
+
(0, import_react64.useEffect)(() => {
|
|
13575
13585
|
if (!open) return;
|
|
13576
13586
|
const onDoc = (e) => {
|
|
13577
13587
|
if (!wrapRef.current?.contains(e.target)) {
|
|
@@ -13582,7 +13592,7 @@ function TimezonePicker({
|
|
|
13582
13592
|
document.addEventListener("mousedown", onDoc);
|
|
13583
13593
|
return () => document.removeEventListener("mousedown", onDoc);
|
|
13584
13594
|
}, [open]);
|
|
13585
|
-
(0,
|
|
13595
|
+
(0, import_react64.useEffect)(() => {
|
|
13586
13596
|
if (open) requestAnimationFrame(() => inputRef.current?.focus());
|
|
13587
13597
|
}, [open]);
|
|
13588
13598
|
const select = (iana) => {
|
|
@@ -13735,7 +13745,7 @@ function TimezonePicker({
|
|
|
13735
13745
|
|
|
13736
13746
|
// src/components/Toast/Toast.tsx
|
|
13737
13747
|
var import_framer_motion15 = require("framer-motion");
|
|
13738
|
-
var
|
|
13748
|
+
var import_react65 = require("react");
|
|
13739
13749
|
var import_react_dom9 = require("react-dom");
|
|
13740
13750
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
13741
13751
|
var defaultIcons = {
|
|
@@ -13789,7 +13799,7 @@ var defaultIcons = {
|
|
|
13789
13799
|
)
|
|
13790
13800
|
] })
|
|
13791
13801
|
};
|
|
13792
|
-
var ToastContext = (0,
|
|
13802
|
+
var ToastContext = (0, import_react65.createContext)(null);
|
|
13793
13803
|
function ToastBody({ item, onDismiss }) {
|
|
13794
13804
|
const dismiss = () => onDismiss(item.id);
|
|
13795
13805
|
if (item.render) return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: item.render({ id: item.id, dismiss }) });
|
|
@@ -13825,10 +13835,10 @@ function ToastBody({ item, onDismiss }) {
|
|
|
13825
13835
|
] });
|
|
13826
13836
|
}
|
|
13827
13837
|
function PositionStack({ items, position, onDismiss, maxStack }) {
|
|
13828
|
-
const [hovered, setHovered] = (0,
|
|
13829
|
-
const [pinned, setPinned] = (0,
|
|
13838
|
+
const [hovered, setHovered] = (0, import_react65.useState)(false);
|
|
13839
|
+
const [pinned, setPinned] = (0, import_react65.useState)(false);
|
|
13830
13840
|
const expanded = hovered || pinned;
|
|
13831
|
-
const ordered = (0,
|
|
13841
|
+
const ordered = (0, import_react65.useMemo)(() => [...items].reverse(), [items]);
|
|
13832
13842
|
const isBottom = position.startsWith("bottom");
|
|
13833
13843
|
const dir = isBottom ? -1 : 1;
|
|
13834
13844
|
if (pinned && items.length === 0) setPinned(false);
|
|
@@ -13926,10 +13936,10 @@ function ToastProvider({
|
|
|
13926
13936
|
defaultPosition = "bottom-right",
|
|
13927
13937
|
maxStack = 3
|
|
13928
13938
|
}) {
|
|
13929
|
-
const [toasts, setToasts] = (0,
|
|
13930
|
-
const timers = (0,
|
|
13931
|
-
const idCounter2 = (0,
|
|
13932
|
-
const dismiss = (0,
|
|
13939
|
+
const [toasts, setToasts] = (0, import_react65.useState)([]);
|
|
13940
|
+
const timers = (0, import_react65.useRef)(/* @__PURE__ */ new Map());
|
|
13941
|
+
const idCounter2 = (0, import_react65.useRef)(0);
|
|
13942
|
+
const dismiss = (0, import_react65.useCallback)((id) => {
|
|
13933
13943
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
13934
13944
|
const timer = timers.current.get(id);
|
|
13935
13945
|
if (timer) {
|
|
@@ -13937,7 +13947,7 @@ function ToastProvider({
|
|
|
13937
13947
|
timers.current.delete(id);
|
|
13938
13948
|
}
|
|
13939
13949
|
}, []);
|
|
13940
|
-
const dismissAll = (0,
|
|
13950
|
+
const dismissAll = (0, import_react65.useCallback)((position) => {
|
|
13941
13951
|
setToasts((prev) => {
|
|
13942
13952
|
const remaining = position ? prev.filter((t) => t.position !== position) : [];
|
|
13943
13953
|
for (const t of prev) {
|
|
@@ -13952,7 +13962,7 @@ function ToastProvider({
|
|
|
13952
13962
|
return remaining;
|
|
13953
13963
|
});
|
|
13954
13964
|
}, []);
|
|
13955
|
-
const toast = (0,
|
|
13965
|
+
const toast = (0, import_react65.useCallback)(
|
|
13956
13966
|
(options) => {
|
|
13957
13967
|
const id = `toast-${++idCounter2.current}`;
|
|
13958
13968
|
const item = {
|
|
@@ -13977,7 +13987,7 @@ function ToastProvider({
|
|
|
13977
13987
|
},
|
|
13978
13988
|
[dismiss, defaultPosition]
|
|
13979
13989
|
);
|
|
13980
|
-
const groups = (0,
|
|
13990
|
+
const groups = (0, import_react65.useMemo)(() => {
|
|
13981
13991
|
const out = {
|
|
13982
13992
|
"top-left": [],
|
|
13983
13993
|
"top-center": [],
|
|
@@ -14010,7 +14020,7 @@ function ToastProvider({
|
|
|
14010
14020
|
] });
|
|
14011
14021
|
}
|
|
14012
14022
|
function useToast() {
|
|
14013
|
-
const ctx = (0,
|
|
14023
|
+
const ctx = (0, import_react65.useContext)(ToastContext);
|
|
14014
14024
|
if (!ctx) throw new Error("useToast must be used within a ToastProvider");
|
|
14015
14025
|
const { toast: raw, dismiss, dismissAll } = ctx;
|
|
14016
14026
|
const toast = Object.assign((options) => raw(options), {
|
|
@@ -14193,7 +14203,7 @@ function ToolCard({
|
|
|
14193
14203
|
|
|
14194
14204
|
// src/components/Tooltip/Tooltip.tsx
|
|
14195
14205
|
var import_framer_motion16 = require("framer-motion");
|
|
14196
|
-
var
|
|
14206
|
+
var import_react66 = require("react");
|
|
14197
14207
|
var import_react_aria15 = require("react-aria");
|
|
14198
14208
|
var import_react_dom10 = require("react-dom");
|
|
14199
14209
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
@@ -14226,21 +14236,21 @@ function TooltipContent({
|
|
|
14226
14236
|
offset
|
|
14227
14237
|
}) {
|
|
14228
14238
|
const { tooltipProps } = (0, import_react_aria15.useTooltip)({ isOpen: state.isOpen }, state);
|
|
14229
|
-
const tipRef = (0,
|
|
14230
|
-
const [coords, setCoords] = (0,
|
|
14231
|
-
const reposition = (0,
|
|
14239
|
+
const tipRef = (0, import_react66.useRef)(null);
|
|
14240
|
+
const [coords, setCoords] = (0, import_react66.useState)(null);
|
|
14241
|
+
const reposition = (0, import_react66.useCallback)(() => {
|
|
14232
14242
|
if (!triggerRef.current || !tipRef.current) return;
|
|
14233
14243
|
const trigRect = triggerRef.current.getBoundingClientRect();
|
|
14234
14244
|
const tipRect = tipRef.current.getBoundingClientRect();
|
|
14235
14245
|
setCoords(computePosition3(trigRect, tipRect, position, offset));
|
|
14236
14246
|
}, [triggerRef, position, offset]);
|
|
14237
|
-
(0,
|
|
14247
|
+
(0, import_react66.useLayoutEffect)(() => {
|
|
14238
14248
|
if (!state.isOpen) return;
|
|
14239
14249
|
reposition();
|
|
14240
14250
|
const id = requestAnimationFrame(reposition);
|
|
14241
14251
|
return () => cancelAnimationFrame(id);
|
|
14242
14252
|
}, [state.isOpen, reposition]);
|
|
14243
|
-
(0,
|
|
14253
|
+
(0, import_react66.useEffect)(() => {
|
|
14244
14254
|
if (!state.isOpen) return;
|
|
14245
14255
|
const handler = () => reposition();
|
|
14246
14256
|
window.addEventListener("scroll", handler, true);
|
|
@@ -14296,11 +14306,11 @@ function Tooltip({
|
|
|
14296
14306
|
children,
|
|
14297
14307
|
className
|
|
14298
14308
|
}) {
|
|
14299
|
-
const triggerRef = (0,
|
|
14309
|
+
const triggerRef = (0, import_react66.useRef)(null);
|
|
14300
14310
|
const state = $3834487504f4fc00$export$4d40659c25ecb50b({ delay });
|
|
14301
14311
|
const { triggerProps } = (0, import_react_aria15.useTooltipTrigger)({ delay }, state, triggerRef);
|
|
14302
14312
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
14303
|
-
(0,
|
|
14313
|
+
(0, import_react66.cloneElement)(children, {
|
|
14304
14314
|
...triggerProps,
|
|
14305
14315
|
ref: triggerRef
|
|
14306
14316
|
}),
|
|
@@ -14377,7 +14387,7 @@ function TopBar({
|
|
|
14377
14387
|
}
|
|
14378
14388
|
|
|
14379
14389
|
// src/components/TraceStep/TraceStep.tsx
|
|
14380
|
-
var
|
|
14390
|
+
var import_react67 = require("react");
|
|
14381
14391
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
14382
14392
|
var KIND_GLYPH = {
|
|
14383
14393
|
thought: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("path", { d: "M3 5a3 3 0 0 1 6 0c0 1.5-1 2-1 3.5h-4C4 7 3 6.5 3 5z M5 10h2", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) }),
|
|
@@ -14403,7 +14413,7 @@ function TraceStep({
|
|
|
14403
14413
|
isLast = false,
|
|
14404
14414
|
className
|
|
14405
14415
|
}) {
|
|
14406
|
-
const [open, setOpen] = (0,
|
|
14416
|
+
const [open, setOpen] = (0, import_react67.useState)(defaultOpen);
|
|
14407
14417
|
const canExpand = !!children;
|
|
14408
14418
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsxs)(
|
|
14409
14419
|
"div",
|
|
@@ -14492,10 +14502,10 @@ function UserCard({ name, role, avatar, initial, stats, action, className }) {
|
|
|
14492
14502
|
}
|
|
14493
14503
|
|
|
14494
14504
|
// src/components/WorkflowEditor/WorkflowEditor.tsx
|
|
14495
|
-
var
|
|
14505
|
+
var import_react69 = require("react");
|
|
14496
14506
|
|
|
14497
14507
|
// src/hooks/useWorkflow.ts
|
|
14498
|
-
var
|
|
14508
|
+
var import_react68 = require("react");
|
|
14499
14509
|
|
|
14500
14510
|
// src/workflow/types.ts
|
|
14501
14511
|
var types_exports = {};
|
|
@@ -14975,7 +14985,7 @@ function genId(prefix) {
|
|
|
14975
14985
|
return `${prefix}_${Date.now().toString(36)}_${idCounter}`;
|
|
14976
14986
|
}
|
|
14977
14987
|
function useWorkflow(options = {}) {
|
|
14978
|
-
const initial = (0,
|
|
14988
|
+
const initial = (0, import_react68.useMemo)(
|
|
14979
14989
|
() => buildInitialWorkflow({
|
|
14980
14990
|
metadata: options.metadata ? { ...options.metadata } : void 0,
|
|
14981
14991
|
canvas: {
|
|
@@ -15008,12 +15018,12 @@ function useWorkflow(options = {}) {
|
|
|
15008
15018
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15009
15019
|
[]
|
|
15010
15020
|
);
|
|
15011
|
-
const [workflow, dispatch] = (0,
|
|
15012
|
-
const addNode = (0,
|
|
15021
|
+
const [workflow, dispatch] = (0, import_react68.useReducer)(reducer, initial);
|
|
15022
|
+
const addNode = (0, import_react68.useCallback)(
|
|
15013
15023
|
(node) => dispatch({ type: "ADD_NODE", payload: node }),
|
|
15014
15024
|
[]
|
|
15015
15025
|
);
|
|
15016
|
-
const createNode = (0,
|
|
15026
|
+
const createNode = (0, import_react68.useCallback)(
|
|
15017
15027
|
(partial) => {
|
|
15018
15028
|
const id = partial.id ?? genId("node");
|
|
15019
15029
|
const ports = partial.ports ?? {
|
|
@@ -15062,27 +15072,27 @@ function useWorkflow(options = {}) {
|
|
|
15062
15072
|
},
|
|
15063
15073
|
[]
|
|
15064
15074
|
);
|
|
15065
|
-
const updateNode = (0,
|
|
15075
|
+
const updateNode = (0, import_react68.useCallback)(
|
|
15066
15076
|
(id, updates) => dispatch({ type: "UPDATE_NODE", payload: { id, updates } }),
|
|
15067
15077
|
[]
|
|
15068
15078
|
);
|
|
15069
|
-
const deleteNode = (0,
|
|
15079
|
+
const deleteNode = (0, import_react68.useCallback)(
|
|
15070
15080
|
(id) => dispatch({ type: "DELETE_NODE", payload: id }),
|
|
15071
15081
|
[]
|
|
15072
15082
|
);
|
|
15073
|
-
const deleteNodes = (0,
|
|
15083
|
+
const deleteNodes = (0, import_react68.useCallback)(
|
|
15074
15084
|
(ids) => dispatch({ type: "DELETE_NODES", payload: ids }),
|
|
15075
15085
|
[]
|
|
15076
15086
|
);
|
|
15077
|
-
const replaceNodes = (0,
|
|
15087
|
+
const replaceNodes = (0, import_react68.useCallback)(
|
|
15078
15088
|
(nodes) => dispatch({ type: "REPLACE_NODES", payload: nodes }),
|
|
15079
15089
|
[]
|
|
15080
15090
|
);
|
|
15081
|
-
const addEdge = (0,
|
|
15091
|
+
const addEdge = (0, import_react68.useCallback)(
|
|
15082
15092
|
(edge) => dispatch({ type: "ADD_EDGE", payload: edge }),
|
|
15083
15093
|
[]
|
|
15084
15094
|
);
|
|
15085
|
-
const createEdge = (0,
|
|
15095
|
+
const createEdge = (0, import_react68.useCallback)(
|
|
15086
15096
|
(source, sourcePort, target, targetPort) => {
|
|
15087
15097
|
const edge = {
|
|
15088
15098
|
id: genId("edge"),
|
|
@@ -15100,20 +15110,20 @@ function useWorkflow(options = {}) {
|
|
|
15100
15110
|
},
|
|
15101
15111
|
[]
|
|
15102
15112
|
);
|
|
15103
|
-
const deleteEdge = (0,
|
|
15113
|
+
const deleteEdge = (0, import_react68.useCallback)(
|
|
15104
15114
|
(id) => dispatch({ type: "DELETE_EDGE", payload: id }),
|
|
15105
15115
|
[]
|
|
15106
15116
|
);
|
|
15107
|
-
const replaceEdges = (0,
|
|
15117
|
+
const replaceEdges = (0, import_react68.useCallback)(
|
|
15108
15118
|
(edges) => dispatch({ type: "REPLACE_EDGES", payload: edges }),
|
|
15109
15119
|
[]
|
|
15110
15120
|
);
|
|
15111
|
-
const startConnecting = (0,
|
|
15121
|
+
const startConnecting = (0, import_react68.useCallback)(
|
|
15112
15122
|
(nodeId, portId, portType) => dispatch({ type: "START_CONNECTING", payload: { nodeId, portId, portType } }),
|
|
15113
15123
|
[]
|
|
15114
15124
|
);
|
|
15115
|
-
const endConnecting = (0,
|
|
15116
|
-
const selectNode = (0,
|
|
15125
|
+
const endConnecting = (0, import_react68.useCallback)(() => dispatch({ type: "END_CONNECTING" }), []);
|
|
15126
|
+
const selectNode = (0, import_react68.useCallback)(
|
|
15117
15127
|
(id, multi = false) => {
|
|
15118
15128
|
if (multi) {
|
|
15119
15129
|
const current = workflow.canvas.selectedNodes;
|
|
@@ -15125,36 +15135,36 @@ function useWorkflow(options = {}) {
|
|
|
15125
15135
|
},
|
|
15126
15136
|
[workflow.canvas.selectedNodes]
|
|
15127
15137
|
);
|
|
15128
|
-
const selectNodes = (0,
|
|
15138
|
+
const selectNodes = (0, import_react68.useCallback)(
|
|
15129
15139
|
(ids) => dispatch({ type: "SELECT_NODES", payload: ids }),
|
|
15130
15140
|
[]
|
|
15131
15141
|
);
|
|
15132
|
-
const selectEdge = (0,
|
|
15142
|
+
const selectEdge = (0, import_react68.useCallback)(
|
|
15133
15143
|
(id) => dispatch({ type: "SELECT_EDGE", payload: id }),
|
|
15134
15144
|
[]
|
|
15135
15145
|
);
|
|
15136
|
-
const deselectAll = (0,
|
|
15137
|
-
const zoomIn = (0,
|
|
15146
|
+
const deselectAll = (0, import_react68.useCallback)(() => dispatch({ type: "DESELECT_ALL" }), []);
|
|
15147
|
+
const zoomIn = (0, import_react68.useCallback)(() => {
|
|
15138
15148
|
const z = Math.min(workflow.canvas.viewport.zoom * 1.2, 2);
|
|
15139
15149
|
dispatch({ type: "UPDATE_VIEWPORT", payload: { zoom: z } });
|
|
15140
15150
|
}, [workflow.canvas.viewport.zoom]);
|
|
15141
|
-
const zoomOut = (0,
|
|
15151
|
+
const zoomOut = (0, import_react68.useCallback)(() => {
|
|
15142
15152
|
const z = Math.max(workflow.canvas.viewport.zoom / 1.2, 0.25);
|
|
15143
15153
|
dispatch({ type: "UPDATE_VIEWPORT", payload: { zoom: z } });
|
|
15144
15154
|
}, [workflow.canvas.viewport.zoom]);
|
|
15145
|
-
const resetViewport = (0,
|
|
15155
|
+
const resetViewport = (0, import_react68.useCallback)(
|
|
15146
15156
|
() => dispatch({ type: "UPDATE_VIEWPORT", payload: { x: 0, y: 0, zoom: 1 } }),
|
|
15147
15157
|
[]
|
|
15148
15158
|
);
|
|
15149
|
-
const setViewport = (0,
|
|
15159
|
+
const setViewport = (0, import_react68.useCallback)(
|
|
15150
15160
|
(viewport) => dispatch({ type: "UPDATE_VIEWPORT", payload: viewport }),
|
|
15151
15161
|
[]
|
|
15152
15162
|
);
|
|
15153
|
-
const undo = (0,
|
|
15154
|
-
const redo = (0,
|
|
15163
|
+
const undo = (0, import_react68.useCallback)(() => dispatch({ type: "UNDO" }), []);
|
|
15164
|
+
const redo = (0, import_react68.useCallback)(() => dispatch({ type: "REDO" }), []);
|
|
15155
15165
|
const canUndo = workflow.canvas.history.past.length > 0;
|
|
15156
15166
|
const canRedo = workflow.canvas.history.future.length > 0;
|
|
15157
|
-
const validate = (0,
|
|
15167
|
+
const validate = (0, import_react68.useCallback)(() => workflow.validation, [workflow.validation]);
|
|
15158
15168
|
return {
|
|
15159
15169
|
workflow,
|
|
15160
15170
|
dispatch,
|
|
@@ -15247,47 +15257,47 @@ function WorkflowEditor({
|
|
|
15247
15257
|
}) {
|
|
15248
15258
|
const wf = useWorkflow(options);
|
|
15249
15259
|
const { workflow, dispatch, canUndo, canRedo, undo, redo } = wf;
|
|
15250
|
-
const [uncontrolledLock, setUncontrolledLock] = (0,
|
|
15251
|
-
const [uncontrolledDrawer, setUncontrolledDrawer] = (0,
|
|
15252
|
-
const [uncontrolledHistory, setUncontrolledHistory] = (0,
|
|
15253
|
-
const [uncontrolledDebug, setUncontrolledDebug] = (0,
|
|
15260
|
+
const [uncontrolledLock, setUncontrolledLock] = (0, import_react69.useState)(false);
|
|
15261
|
+
const [uncontrolledDrawer, setUncontrolledDrawer] = (0, import_react69.useState)(!!drawer);
|
|
15262
|
+
const [uncontrolledHistory, setUncontrolledHistory] = (0, import_react69.useState)(false);
|
|
15263
|
+
const [uncontrolledDebug, setUncontrolledDebug] = (0, import_react69.useState)(false);
|
|
15254
15264
|
const isLockMode = controlledLockMode ?? uncontrolledLock;
|
|
15255
15265
|
const isDrawerOpen = controlledDrawerOpen ?? uncontrolledDrawer;
|
|
15256
15266
|
const isHistoryOpen = controlledHistoryOpen ?? uncontrolledHistory;
|
|
15257
15267
|
const isDebugOpen = controlledDebugOpen ?? uncontrolledDebug;
|
|
15258
|
-
const toggleLock = (0,
|
|
15268
|
+
const toggleLock = (0, import_react69.useCallback)(() => {
|
|
15259
15269
|
const next = !isLockMode;
|
|
15260
15270
|
if (controlledLockMode === void 0) setUncontrolledLock(next);
|
|
15261
15271
|
onToggleLockMode?.(next);
|
|
15262
15272
|
}, [isLockMode, controlledLockMode, onToggleLockMode]);
|
|
15263
|
-
const toggleDrawer = (0,
|
|
15273
|
+
const toggleDrawer = (0, import_react69.useCallback)(() => {
|
|
15264
15274
|
const next = !isDrawerOpen;
|
|
15265
15275
|
if (controlledDrawerOpen === void 0) setUncontrolledDrawer(next);
|
|
15266
15276
|
onToggleDrawer?.(next);
|
|
15267
15277
|
}, [isDrawerOpen, controlledDrawerOpen, onToggleDrawer]);
|
|
15268
|
-
const toggleHistory = (0,
|
|
15278
|
+
const toggleHistory = (0, import_react69.useCallback)(() => {
|
|
15269
15279
|
const next = !isHistoryOpen;
|
|
15270
15280
|
if (controlledHistoryOpen === void 0) setUncontrolledHistory(next);
|
|
15271
15281
|
onToggleHistory?.(next);
|
|
15272
15282
|
}, [isHistoryOpen, controlledHistoryOpen, onToggleHistory]);
|
|
15273
|
-
const toggleDebug = (0,
|
|
15283
|
+
const toggleDebug = (0, import_react69.useCallback)(() => {
|
|
15274
15284
|
const next = !isDebugOpen;
|
|
15275
15285
|
if (controlledDebugOpen === void 0) setUncontrolledDebug(next);
|
|
15276
15286
|
onToggleDebug?.(next);
|
|
15277
15287
|
}, [isDebugOpen, controlledDebugOpen, onToggleDebug]);
|
|
15278
|
-
const handleReset = (0,
|
|
15288
|
+
const handleReset = (0, import_react69.useCallback)(() => {
|
|
15279
15289
|
if (onReset) onReset();
|
|
15280
15290
|
else dispatch({ type: "RESET" });
|
|
15281
15291
|
}, [onReset, dispatch]);
|
|
15282
|
-
const [canvasSize, setCanvasSize] = (0,
|
|
15292
|
+
const [canvasSize, setCanvasSize] = (0, import_react69.useState)({
|
|
15283
15293
|
w: 0,
|
|
15284
15294
|
h: 0
|
|
15285
15295
|
});
|
|
15286
|
-
const handleCanvasRef = (0,
|
|
15296
|
+
const handleCanvasRef = (0, import_react69.useCallback)((node) => {
|
|
15287
15297
|
if (!node) return;
|
|
15288
15298
|
setCanvasSize({ w: node.clientWidth, h: node.clientHeight });
|
|
15289
15299
|
}, []);
|
|
15290
|
-
const fitToView = (0,
|
|
15300
|
+
const fitToView = (0, import_react69.useCallback)(() => {
|
|
15291
15301
|
const viewport = computeFitViewport(
|
|
15292
15302
|
workflow.canvas.nodes,
|
|
15293
15303
|
canvasSize.w || 800,
|
|
@@ -15296,7 +15306,7 @@ function WorkflowEditor({
|
|
|
15296
15306
|
if (viewport) wf.setViewport(viewport);
|
|
15297
15307
|
}, [workflow.canvas.nodes, canvasSize, wf]);
|
|
15298
15308
|
const policies = workflow.policies;
|
|
15299
|
-
const validateConnection = (0,
|
|
15309
|
+
const validateConnection = (0, import_react69.useCallback)(
|
|
15300
15310
|
(targetNodeId, targetPortId, targetPortType) => {
|
|
15301
15311
|
const from = workflow.canvas.connectingFrom;
|
|
15302
15312
|
if (!from) return { valid: true };
|
|
@@ -15342,7 +15352,7 @@ function WorkflowEditor({
|
|
|
15342
15352
|
},
|
|
15343
15353
|
[policies, workflow.canvas.connectingFrom, workflow.canvas.edges]
|
|
15344
15354
|
);
|
|
15345
|
-
const handleEndConnecting = (0,
|
|
15355
|
+
const handleEndConnecting = (0, import_react69.useCallback)(
|
|
15346
15356
|
(target) => {
|
|
15347
15357
|
const from = workflow.canvas.connectingFrom;
|
|
15348
15358
|
if (!from) return;
|
|
@@ -15365,7 +15375,7 @@ function WorkflowEditor({
|
|
|
15365
15375
|
[workflow.canvas.connectingFrom, validateConnection, wf]
|
|
15366
15376
|
);
|
|
15367
15377
|
const selectedNodeId = workflow.canvas.selectedNodes[0];
|
|
15368
|
-
const defaultToolbar = (0,
|
|
15378
|
+
const defaultToolbar = (0, import_react69.useMemo)(
|
|
15369
15379
|
() => /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(FlowToolbar, { placement: "left", children: [
|
|
15370
15380
|
onSave && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
15371
15381
|
FlowToolbarButton,
|
|
@@ -15568,7 +15578,7 @@ function DefaultEmptyState() {
|
|
|
15568
15578
|
}
|
|
15569
15579
|
|
|
15570
15580
|
// src/components/XmlViewer/XmlViewer.tsx
|
|
15571
|
-
var
|
|
15581
|
+
var import_react70 = require("react");
|
|
15572
15582
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
15573
15583
|
function parseXml(src) {
|
|
15574
15584
|
if (typeof window !== "undefined" && typeof window.DOMParser !== "undefined") {
|
|
@@ -15624,7 +15634,7 @@ function XmlViewer({
|
|
|
15624
15634
|
truncateAt = 200,
|
|
15625
15635
|
className
|
|
15626
15636
|
}) {
|
|
15627
|
-
const parsed = (0,
|
|
15637
|
+
const parsed = (0, import_react70.useMemo)(() => parseXml(data), [data]);
|
|
15628
15638
|
return /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: cn("ods-xml-viewer", className), children: [
|
|
15629
15639
|
(title || status || parsed.error) && /* @__PURE__ */ (0, import_jsx_runtime98.jsxs)("div", { className: "ods-xml-viewer__head", children: [
|
|
15630
15640
|
title && /* @__PURE__ */ (0, import_jsx_runtime98.jsx)("span", { className: "ods-xml-viewer__title", children: title }),
|
|
@@ -15650,7 +15660,7 @@ function XmlNodeRow({
|
|
|
15650
15660
|
showAttributes,
|
|
15651
15661
|
truncateAt
|
|
15652
15662
|
}) {
|
|
15653
|
-
const [open, setOpen] = (0,
|
|
15663
|
+
const [open, setOpen] = (0, import_react70.useState)(depth < defaultExpandDepth);
|
|
15654
15664
|
const pad2 = depth * 14;
|
|
15655
15665
|
if (node.type === "text") {
|
|
15656
15666
|
const t = (node.text ?? "").trim();
|
|
@@ -15749,7 +15759,7 @@ function XmlNodeRow({
|
|
|
15749
15759
|
}
|
|
15750
15760
|
|
|
15751
15761
|
// src/components/YamlViewer/YamlViewer.tsx
|
|
15752
|
-
var
|
|
15762
|
+
var import_react71 = require("react");
|
|
15753
15763
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
15754
15764
|
function toYaml(value, indent = 0) {
|
|
15755
15765
|
const pad2 = " ".repeat(indent);
|
|
@@ -15886,7 +15896,7 @@ function YamlViewer({
|
|
|
15886
15896
|
status,
|
|
15887
15897
|
className
|
|
15888
15898
|
}) {
|
|
15889
|
-
const text = (0,
|
|
15899
|
+
const text = (0, import_react71.useMemo)(() => {
|
|
15890
15900
|
if (typeof data === "string") return data;
|
|
15891
15901
|
try {
|
|
15892
15902
|
return toYaml(data);
|
|
@@ -15894,8 +15904,8 @@ function YamlViewer({
|
|
|
15894
15904
|
return JSON.stringify(data, null, 2);
|
|
15895
15905
|
}
|
|
15896
15906
|
}, [data]);
|
|
15897
|
-
const tokens = (0,
|
|
15898
|
-
const [collapsed, setCollapsed] = (0,
|
|
15907
|
+
const tokens = (0, import_react71.useMemo)(() => tokenizeYaml(text), [text]);
|
|
15908
|
+
const [collapsed, setCollapsed] = (0, import_react71.useState)(() => {
|
|
15899
15909
|
const s = /* @__PURE__ */ new Set();
|
|
15900
15910
|
tokens.forEach((t) => {
|
|
15901
15911
|
if (t.hasChildren && t.depth >= defaultExpandDepth) s.add(t.index);
|
|
@@ -15910,7 +15920,7 @@ function YamlViewer({
|
|
|
15910
15920
|
return next;
|
|
15911
15921
|
});
|
|
15912
15922
|
};
|
|
15913
|
-
const hidden = (0,
|
|
15923
|
+
const hidden = (0, import_react71.useMemo)(() => {
|
|
15914
15924
|
const hidden2 = /* @__PURE__ */ new Set();
|
|
15915
15925
|
for (let i = 0; i < tokens.length; i++) {
|
|
15916
15926
|
const t = tokens[i];
|
|
@@ -16020,13 +16030,13 @@ function YamlViewer({
|
|
|
16020
16030
|
|
|
16021
16031
|
// src/provider/OdsProvider.tsx
|
|
16022
16032
|
var import_config = require("@octaviaflow/config");
|
|
16023
|
-
var
|
|
16033
|
+
var import_react72 = require("react");
|
|
16024
16034
|
var import_react_aria16 = require("react-aria");
|
|
16025
16035
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
16026
|
-
var OdsContext = (0,
|
|
16036
|
+
var OdsContext = (0, import_react72.createContext)(null);
|
|
16027
16037
|
function OdsProvider({ config: userConfig, children }) {
|
|
16028
|
-
const resolved = (0,
|
|
16029
|
-
(0,
|
|
16038
|
+
const resolved = (0, import_react72.useMemo)(() => (0, import_config.resolveConfig)(userConfig), [userConfig]);
|
|
16039
|
+
(0, import_react72.useEffect)(() => {
|
|
16030
16040
|
const cssVarsBlock = (0, import_config.generateCssVars)(resolved);
|
|
16031
16041
|
const match = cssVarsBlock.match(/:root\s*\{([\s\S]*)\}/);
|
|
16032
16042
|
if (match) {
|
|
@@ -16042,11 +16052,11 @@ function OdsProvider({ config: userConfig, children }) {
|
|
|
16042
16052
|
}
|
|
16043
16053
|
}
|
|
16044
16054
|
}, [resolved]);
|
|
16045
|
-
const contextValue = (0,
|
|
16055
|
+
const contextValue = (0, import_react72.useMemo)(() => ({ config: resolved }), [resolved]);
|
|
16046
16056
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(OdsContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_react_aria16.OverlayProvider, { children }) });
|
|
16047
16057
|
}
|
|
16048
16058
|
function useOds() {
|
|
16049
|
-
const ctx = (0,
|
|
16059
|
+
const ctx = (0, import_react72.useContext)(OdsContext);
|
|
16050
16060
|
if (!ctx) {
|
|
16051
16061
|
throw new Error("useOds must be used within an OdsProvider");
|
|
16052
16062
|
}
|
|
@@ -16062,7 +16072,7 @@ var emptyMotion = {
|
|
|
16062
16072
|
};
|
|
16063
16073
|
function useOdsMotion() {
|
|
16064
16074
|
const config = useOds();
|
|
16065
|
-
return (0,
|
|
16075
|
+
return (0, import_react72.useMemo)(() => {
|
|
16066
16076
|
if (!config.motion.enabled) {
|
|
16067
16077
|
return emptyMotion;
|
|
16068
16078
|
}
|