@neo-ui-kit/react 1.2.3 → 1.3.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/README.md +50 -1
- package/dist/chunks/{chunk-RHMNSDIW.js → chunk-TQWTM23C.js} +480 -185
- package/dist/chunks/{chunk-YKCUOZ7V.js → chunk-WOUWYJ6U.js} +85 -1
- package/dist/components/artwork/QuantumField/QuantumFieldExperience.d.ts +6 -0
- package/dist/components/controls/ThemePicker/ThemePicker.d.ts +2 -0
- package/dist/components/controls/ThemePicker/styles.css +45 -10
- package/dist/components/forms/FormFields/FormFields.d.ts +10 -4
- package/dist/components/forms/FormFields/styles.css +3 -0
- package/dist/components/foundation/LoaderGenerator/LoaderGenerator.d.ts +2 -2
- package/dist/core.js +2 -4
- package/dist/forms.js +2 -2
- package/dist/index.js +705 -980
- package/package.json +1 -1
- package/dist/chunks/chunk-JZ4GDTH5.js +0 -87
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
themes,
|
|
2
3
|
usePauseOffscreen
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WOUWYJ6U.js";
|
|
4
5
|
import {
|
|
5
6
|
assignRef,
|
|
6
7
|
clamp,
|
|
@@ -908,10 +909,167 @@ var FilePicker = (p) => {
|
|
|
908
909
|
] });
|
|
909
910
|
};
|
|
910
911
|
|
|
911
|
-
// src/components/controls/
|
|
912
|
+
// src/components/controls/Tab/Tab.tsx
|
|
912
913
|
import { forwardRef as forwardRef3 } from "react";
|
|
913
|
-
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
914
|
-
var
|
|
914
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
915
|
+
var Tab = /* @__PURE__ */ forwardRef3(function Tab2({
|
|
916
|
+
selected = false,
|
|
917
|
+
panelId,
|
|
918
|
+
icon,
|
|
919
|
+
endIcon,
|
|
920
|
+
label,
|
|
921
|
+
children,
|
|
922
|
+
tabIndex,
|
|
923
|
+
variant: _variant,
|
|
924
|
+
loading: _loading,
|
|
925
|
+
round: _round,
|
|
926
|
+
size: _size,
|
|
927
|
+
tone: _tone,
|
|
928
|
+
material: _material,
|
|
929
|
+
...p
|
|
930
|
+
}, ref) {
|
|
931
|
+
return /* @__PURE__ */ jsxs7(
|
|
932
|
+
"button",
|
|
933
|
+
{
|
|
934
|
+
...p,
|
|
935
|
+
...mark("Tab", { ...p, size: _size }),
|
|
936
|
+
ref,
|
|
937
|
+
type: "button",
|
|
938
|
+
role: "tab",
|
|
939
|
+
"aria-selected": selected,
|
|
940
|
+
"aria-controls": panelId,
|
|
941
|
+
tabIndex: tabIndex ?? (selected ? 0 : -1),
|
|
942
|
+
children: [
|
|
943
|
+
icon && /* @__PURE__ */ jsx10(Icon, { name: icon }),
|
|
944
|
+
/* @__PURE__ */ jsx10("span", { className: "ad-tab-label", children: children ?? label }),
|
|
945
|
+
endIcon && /* @__PURE__ */ jsx10(Icon, { name: endIcon })
|
|
946
|
+
]
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
// src/components/controls/Tabs/Tabs.tsx
|
|
952
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef6, useState as useState3 } from "react";
|
|
953
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
954
|
+
function Tabs(p) {
|
|
955
|
+
const tr = useTr();
|
|
956
|
+
const items = p.items ?? [
|
|
957
|
+
{ value: "appearance", label: tr("\u0412\u043D\u0435\u0448\u043D\u0438\u0439 \u0432\u0438\u0434"), icon: "palette" },
|
|
958
|
+
{ value: "audio", label: tr("\u0410\u0443\u0434\u0438\u043E"), icon: "audio" },
|
|
959
|
+
{ value: "advanced", label: tr("\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u043E"), icon: "wrench" }
|
|
960
|
+
];
|
|
961
|
+
const [value, setValue] = useControllable(
|
|
962
|
+
p.value,
|
|
963
|
+
p.defaultValue ?? items.find((item) => !item.disabled)?.value ?? "",
|
|
964
|
+
p.onValueChange
|
|
965
|
+
);
|
|
966
|
+
const buttons = useRef6([]);
|
|
967
|
+
const selected = items.findIndex((item) => item.value === value && !item.disabled);
|
|
968
|
+
const firstEnabled = items.findIndex((item) => !item.disabled);
|
|
969
|
+
const fallback = items[firstEnabled]?.value;
|
|
970
|
+
useLayoutEffect3(() => {
|
|
971
|
+
if (p.value === void 0 && selected < 0 && fallback !== void 0) setValue(fallback);
|
|
972
|
+
}, [p.value, selected, fallback, setValue]);
|
|
973
|
+
const [place2, setPlace] = useState3();
|
|
974
|
+
const [moving, setMoving] = useState3(false);
|
|
975
|
+
const first = useRef6(true);
|
|
976
|
+
useLayoutEffect3(() => {
|
|
977
|
+
const tab = buttons.current[selected];
|
|
978
|
+
if (!tab) return setPlace(void 0);
|
|
979
|
+
const update = () => setPlace({
|
|
980
|
+
"--ad-tabs-x": `${tab.offsetLeft}px`,
|
|
981
|
+
"--ad-tabs-w": `${tab.offsetWidth}px`
|
|
982
|
+
});
|
|
983
|
+
update();
|
|
984
|
+
const observer = createResizeObserver(update);
|
|
985
|
+
observer.observe(tab);
|
|
986
|
+
if (tab.parentElement) observer.observe(tab.parentElement);
|
|
987
|
+
let timer = 0;
|
|
988
|
+
if (!first.current) {
|
|
989
|
+
setMoving(true);
|
|
990
|
+
timer = window.setTimeout(() => setMoving(false), 420);
|
|
991
|
+
}
|
|
992
|
+
first.current = false;
|
|
993
|
+
return () => {
|
|
994
|
+
observer.disconnect();
|
|
995
|
+
clearTimeout(timer);
|
|
996
|
+
};
|
|
997
|
+
}, [selected, items.length]);
|
|
998
|
+
return /* @__PURE__ */ jsxs8(
|
|
999
|
+
"nav",
|
|
1000
|
+
{
|
|
1001
|
+
...mark("Tabs", p),
|
|
1002
|
+
role: "tablist",
|
|
1003
|
+
"aria-label": p.label ?? tr("\u0420\u0430\u0437\u0434\u0435\u043B\u044B"),
|
|
1004
|
+
"data-moving": moving || void 0,
|
|
1005
|
+
onPointerDown: (e) => {
|
|
1006
|
+
const tab = e.target.closest(".ad-tab");
|
|
1007
|
+
if (tab && !tab.matches(":disabled")) ripple(tab, e.clientX, e.clientY);
|
|
1008
|
+
},
|
|
1009
|
+
onKeyDown: (e) => {
|
|
1010
|
+
if (!["ArrowLeft", "ArrowRight", "Home", "End"].includes(e.key)) return;
|
|
1011
|
+
const available = items.map((item, index) => ({ item, index })).filter((x) => !x.item.disabled);
|
|
1012
|
+
if (!available.length) return;
|
|
1013
|
+
e.preventDefault();
|
|
1014
|
+
const current = available.findIndex(
|
|
1015
|
+
(x) => buttons.current[x.index] === document.activeElement
|
|
1016
|
+
);
|
|
1017
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? available.length - 1 : (current + (e.key === "ArrowRight" ? 1 : -1) + available.length) % available.length;
|
|
1018
|
+
setValue(available[next].item.value);
|
|
1019
|
+
buttons.current[available[next].index]?.focus();
|
|
1020
|
+
},
|
|
1021
|
+
children: [
|
|
1022
|
+
place2 && /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
1023
|
+
/* @__PURE__ */ jsx11("span", { className: "ad-tabs-trail", style: place2, "aria-hidden": true }),
|
|
1024
|
+
/* @__PURE__ */ jsxs8("span", { className: "ad-tabs-indicator", style: place2, "aria-hidden": true, children: [
|
|
1025
|
+
/* @__PURE__ */ jsx11("span", { className: "ad-tabs-halo" }),
|
|
1026
|
+
/* @__PURE__ */ jsx11("span", { className: "ad-tabs-blade", children: /* @__PURE__ */ jsx11("span", { className: "ad-tabs-blade-edge" }) })
|
|
1027
|
+
] }),
|
|
1028
|
+
/* @__PURE__ */ jsx11("span", { className: "ad-tabs-rail", style: place2, "aria-hidden": true })
|
|
1029
|
+
] }),
|
|
1030
|
+
items.map((item, index) => /* @__PURE__ */ jsx11(
|
|
1031
|
+
Tab,
|
|
1032
|
+
{
|
|
1033
|
+
id: item.id,
|
|
1034
|
+
ref: (n) => {
|
|
1035
|
+
buttons.current[index] = n;
|
|
1036
|
+
},
|
|
1037
|
+
icon: item.icon,
|
|
1038
|
+
panelId: item.panelId,
|
|
1039
|
+
disabled: item.disabled,
|
|
1040
|
+
size: p.size,
|
|
1041
|
+
selected: item.value === value,
|
|
1042
|
+
tabIndex: index === (selected < 0 ? firstEnabled : selected) ? 0 : -1,
|
|
1043
|
+
onClick: () => setValue(item.value),
|
|
1044
|
+
children: item.label
|
|
1045
|
+
},
|
|
1046
|
+
item.value
|
|
1047
|
+
))
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
// src/components/controls/SegmentedControl/SegmentedControl.tsx
|
|
1054
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
1055
|
+
var SegmentedControl = (p) => {
|
|
1056
|
+
const tr = useTr();
|
|
1057
|
+
return /* @__PURE__ */ jsx12("div", { ...mark("SegmentedControl", p), children: /* @__PURE__ */ jsx12(
|
|
1058
|
+
Tabs,
|
|
1059
|
+
{
|
|
1060
|
+
...p,
|
|
1061
|
+
items: p.items ?? [
|
|
1062
|
+
{ value: "list", label: tr("\u0421\u043F\u0438\u0441\u043E\u043A"), icon: "list" },
|
|
1063
|
+
{ value: "grid", label: tr("\u041F\u043B\u0438\u0442\u043A\u0430"), icon: "grid" }
|
|
1064
|
+
]
|
|
1065
|
+
}
|
|
1066
|
+
) });
|
|
1067
|
+
};
|
|
1068
|
+
|
|
1069
|
+
// src/components/controls/Slider/Slider.tsx
|
|
1070
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
1071
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1072
|
+
var Slider = /* @__PURE__ */ forwardRef4(function Slider2(p, ref) {
|
|
915
1073
|
const tr = useTr();
|
|
916
1074
|
const min = p.min ?? 0, max = Math.max(min, p.max ?? 100);
|
|
917
1075
|
const [value, setValue] = useControllable(
|
|
@@ -921,7 +1079,7 @@ var Slider = /* @__PURE__ */ forwardRef3(function Slider2(p, ref) {
|
|
|
921
1079
|
);
|
|
922
1080
|
const current = clamp(value, min, max), percent = max === min ? 0 : (current - min) / (max - min) * 100;
|
|
923
1081
|
const ids = useFieldIds(p.label, void 0, p.id, p);
|
|
924
|
-
return /* @__PURE__ */
|
|
1082
|
+
return /* @__PURE__ */ jsx13(FieldFrame, { ids, className: "ad-slider-field", label: p.label, children: /* @__PURE__ */ jsx13(
|
|
925
1083
|
"input",
|
|
926
1084
|
{
|
|
927
1085
|
...mark("Slider", p),
|
|
@@ -942,8 +1100,8 @@ var Slider = /* @__PURE__ */ forwardRef3(function Slider2(p, ref) {
|
|
|
942
1100
|
});
|
|
943
1101
|
|
|
944
1102
|
// src/components/controls/Switch/Switch.tsx
|
|
945
|
-
import { jsx as
|
|
946
|
-
var Switch = (p) => /* @__PURE__ */
|
|
1103
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1104
|
+
var Switch = (p) => /* @__PURE__ */ jsx14(BooleanControl, { kind: "Switch", ...p });
|
|
947
1105
|
|
|
948
1106
|
// src/core/responsive.ts
|
|
949
1107
|
var BREAKPOINTS = ["base", "sm", "md", "lg", "xl"];
|
|
@@ -965,7 +1123,7 @@ function responsiveVars(name, value, format = String, fallback) {
|
|
|
965
1123
|
}
|
|
966
1124
|
|
|
967
1125
|
// src/components/layout/Grid/Grid.tsx
|
|
968
|
-
import { jsx as
|
|
1126
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
969
1127
|
var distribution = {
|
|
970
1128
|
between: "space-between",
|
|
971
1129
|
around: "space-around",
|
|
@@ -1019,7 +1177,7 @@ function Grid({
|
|
|
1019
1177
|
...place("grid-row-start", rowStart, String),
|
|
1020
1178
|
...place("grid-row-end", rowSpan, (v) => `span ${v}`)
|
|
1021
1179
|
} : {};
|
|
1022
|
-
return /* @__PURE__ */
|
|
1180
|
+
return /* @__PURE__ */ jsx15(
|
|
1023
1181
|
Component,
|
|
1024
1182
|
{
|
|
1025
1183
|
...props,
|
|
@@ -1040,8 +1198,8 @@ function Grid({
|
|
|
1040
1198
|
}
|
|
1041
1199
|
|
|
1042
1200
|
// src/components/controls/IconButton/IconButton.tsx
|
|
1043
|
-
import { forwardRef as
|
|
1044
|
-
var IconButton = /* @__PURE__ */
|
|
1201
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
1202
|
+
var IconButton = /* @__PURE__ */ forwardRef5(function IconButton2(p, ref) {
|
|
1045
1203
|
return buttonView(
|
|
1046
1204
|
{
|
|
1047
1205
|
...p,
|
|
@@ -1057,7 +1215,7 @@ var IconButton = /* @__PURE__ */ forwardRef4(function IconButton2(p, ref) {
|
|
|
1057
1215
|
});
|
|
1058
1216
|
|
|
1059
1217
|
// src/components/controls/TextArea/TextArea.tsx
|
|
1060
|
-
import { jsx as
|
|
1218
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1061
1219
|
var TextArea = ({
|
|
1062
1220
|
value,
|
|
1063
1221
|
defaultValue = "",
|
|
@@ -1084,7 +1242,7 @@ var TextArea = ({
|
|
|
1084
1242
|
);
|
|
1085
1243
|
const ids = useFieldIds(label, description || error, textarea.id, textarea);
|
|
1086
1244
|
const floating = labelPlacement === "floating" && !!label;
|
|
1087
|
-
return /* @__PURE__ */
|
|
1245
|
+
return /* @__PURE__ */ jsx16(
|
|
1088
1246
|
FieldFrame,
|
|
1089
1247
|
{
|
|
1090
1248
|
ids,
|
|
@@ -1094,7 +1252,7 @@ var TextArea = ({
|
|
|
1094
1252
|
required: textarea.required,
|
|
1095
1253
|
description,
|
|
1096
1254
|
error,
|
|
1097
|
-
children: /* @__PURE__ */
|
|
1255
|
+
children: /* @__PURE__ */ jsx16(
|
|
1098
1256
|
InputBase,
|
|
1099
1257
|
{
|
|
1100
1258
|
size,
|
|
@@ -1108,7 +1266,7 @@ var TextArea = ({
|
|
|
1108
1266
|
error: !!error,
|
|
1109
1267
|
startAdornment,
|
|
1110
1268
|
endAdornment,
|
|
1111
|
-
children: /* @__PURE__ */
|
|
1269
|
+
children: /* @__PURE__ */ jsx16(
|
|
1112
1270
|
"textarea",
|
|
1113
1271
|
{
|
|
1114
1272
|
...ids.aria,
|
|
@@ -1126,7 +1284,7 @@ var TextArea = ({
|
|
|
1126
1284
|
};
|
|
1127
1285
|
|
|
1128
1286
|
// src/components/controls/TextField/TextField.tsx
|
|
1129
|
-
import { Fragment as
|
|
1287
|
+
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1130
1288
|
var TextField = ({
|
|
1131
1289
|
label,
|
|
1132
1290
|
description,
|
|
@@ -1156,7 +1314,7 @@ var TextField = ({
|
|
|
1156
1314
|
);
|
|
1157
1315
|
const ids = useFieldIds(label, description || error, input.id, input);
|
|
1158
1316
|
const floating = labelPlacement === "floating" && !!label;
|
|
1159
|
-
return /* @__PURE__ */
|
|
1317
|
+
return /* @__PURE__ */ jsx17(
|
|
1160
1318
|
FieldFrame,
|
|
1161
1319
|
{
|
|
1162
1320
|
ids,
|
|
@@ -1166,7 +1324,7 @@ var TextField = ({
|
|
|
1166
1324
|
required: input.required,
|
|
1167
1325
|
description,
|
|
1168
1326
|
error,
|
|
1169
|
-
children: /* @__PURE__ */
|
|
1327
|
+
children: /* @__PURE__ */ jsx17(
|
|
1170
1328
|
InputBase,
|
|
1171
1329
|
{
|
|
1172
1330
|
size,
|
|
@@ -1178,8 +1336,8 @@ var TextField = ({
|
|
|
1178
1336
|
readOnly: input.readOnly,
|
|
1179
1337
|
error: !!error,
|
|
1180
1338
|
startAdornment,
|
|
1181
|
-
endAdornment: /* @__PURE__ */
|
|
1182
|
-
clearable && current && /* @__PURE__ */
|
|
1339
|
+
endAdornment: /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
1340
|
+
clearable && current && /* @__PURE__ */ jsx17(
|
|
1183
1341
|
IconButton,
|
|
1184
1342
|
{
|
|
1185
1343
|
size: "xs",
|
|
@@ -1192,7 +1350,7 @@ var TextField = ({
|
|
|
1192
1350
|
),
|
|
1193
1351
|
endAdornment
|
|
1194
1352
|
] }),
|
|
1195
|
-
children: /* @__PURE__ */
|
|
1353
|
+
children: /* @__PURE__ */ jsx17(
|
|
1196
1354
|
"input",
|
|
1197
1355
|
{
|
|
1198
1356
|
...ids.aria,
|
|
@@ -1211,18 +1369,18 @@ var TextField = ({
|
|
|
1211
1369
|
};
|
|
1212
1370
|
|
|
1213
1371
|
// src/components/controls/Chip/Chip.tsx
|
|
1214
|
-
import { Fragment as
|
|
1372
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1215
1373
|
function Chip({ label, icon, avatar, onRemove, removeLabel, onClick, selected, disabled, ...p }) {
|
|
1216
1374
|
const tr = useTr();
|
|
1217
1375
|
const removeText = removeLabel ?? tr("\u0423\u0431\u0440\u0430\u0442\u044C");
|
|
1218
|
-
const content = /* @__PURE__ */
|
|
1219
|
-
avatar && /* @__PURE__ */
|
|
1220
|
-
icon && /* @__PURE__ */
|
|
1221
|
-
/* @__PURE__ */
|
|
1376
|
+
const content = /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
1377
|
+
avatar && /* @__PURE__ */ jsx18(Avatar, { size: "xs", name: avatar.name, src: avatar.src }),
|
|
1378
|
+
icon && /* @__PURE__ */ jsx18(Icon, { name: icon }),
|
|
1379
|
+
/* @__PURE__ */ jsx18("span", { className: "ad-chip-label", children: label })
|
|
1222
1380
|
] });
|
|
1223
|
-
return /* @__PURE__ */
|
|
1224
|
-
onClick ? /* @__PURE__ */
|
|
1225
|
-
onRemove && /* @__PURE__ */
|
|
1381
|
+
return /* @__PURE__ */ jsxs10("span", { ...mark("Chip", p), "data-selected": selected || void 0, "data-disabled": disabled || void 0, children: [
|
|
1382
|
+
onClick ? /* @__PURE__ */ jsx18("button", { type: "button", className: "ad-chip-body", "aria-pressed": selected, disabled, onClick, children: content }) : /* @__PURE__ */ jsx18("span", { className: "ad-chip-body", children: content }),
|
|
1383
|
+
onRemove && /* @__PURE__ */ jsx18(
|
|
1226
1384
|
"button",
|
|
1227
1385
|
{
|
|
1228
1386
|
type: "button",
|
|
@@ -1233,18 +1391,18 @@ function Chip({ label, icon, avatar, onRemove, removeLabel, onClick, selected, d
|
|
|
1233
1391
|
event.stopPropagation();
|
|
1234
1392
|
onRemove();
|
|
1235
1393
|
},
|
|
1236
|
-
children: /* @__PURE__ */
|
|
1394
|
+
children: /* @__PURE__ */ jsx18(Icon, { name: "close" })
|
|
1237
1395
|
}
|
|
1238
1396
|
)
|
|
1239
1397
|
] });
|
|
1240
1398
|
}
|
|
1241
1399
|
|
|
1242
1400
|
// src/components/controls/TagInput/TagInput.tsx
|
|
1243
|
-
import { useState as
|
|
1401
|
+
import { useState as useState4 } from "react";
|
|
1244
1402
|
|
|
1245
1403
|
// src/components/controls/ChipField.tsx
|
|
1246
|
-
import { useRef as
|
|
1247
|
-
import { jsx as
|
|
1404
|
+
import { useRef as useRef7 } from "react";
|
|
1405
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1248
1406
|
function ChipField({
|
|
1249
1407
|
className,
|
|
1250
1408
|
label,
|
|
@@ -1267,10 +1425,10 @@ function ChipField({
|
|
|
1267
1425
|
inputProps
|
|
1268
1426
|
}) {
|
|
1269
1427
|
const ids = useFieldIds(label, description || error, inputProps?.id, inputProps);
|
|
1270
|
-
const input =
|
|
1428
|
+
const input = useRef7(null);
|
|
1271
1429
|
const floating = labelPlacement === "floating" && !!label;
|
|
1272
1430
|
const hasChips = Array.isArray(chips) ? chips.length > 0 : !!chips;
|
|
1273
|
-
return /* @__PURE__ */
|
|
1431
|
+
return /* @__PURE__ */ jsx19(FieldFrame, { ids, className: `ad-chip-field ${className}`, label: floating ? void 0 : label, required, description, error, children: /* @__PURE__ */ jsx19(
|
|
1274
1432
|
InputBase,
|
|
1275
1433
|
{
|
|
1276
1434
|
ref: boxRef,
|
|
@@ -1284,9 +1442,9 @@ function ChipField({
|
|
|
1284
1442
|
multiline: true,
|
|
1285
1443
|
startAdornment,
|
|
1286
1444
|
onClick: () => input.current?.focus(),
|
|
1287
|
-
children: /* @__PURE__ */
|
|
1445
|
+
children: /* @__PURE__ */ jsxs11("span", { className: "ad-chip-field-items", children: [
|
|
1288
1446
|
chips,
|
|
1289
|
-
/* @__PURE__ */
|
|
1447
|
+
/* @__PURE__ */ jsx19(
|
|
1290
1448
|
"input",
|
|
1291
1449
|
{
|
|
1292
1450
|
...inputProps,
|
|
@@ -1310,7 +1468,7 @@ function ChipField({
|
|
|
1310
1468
|
}
|
|
1311
1469
|
|
|
1312
1470
|
// src/components/controls/TagInput/TagInput.tsx
|
|
1313
|
-
import { jsx as
|
|
1471
|
+
import { jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1314
1472
|
function TagInput({
|
|
1315
1473
|
value: controlled,
|
|
1316
1474
|
defaultValue = [],
|
|
@@ -1324,8 +1482,8 @@ function TagInput({
|
|
|
1324
1482
|
}) {
|
|
1325
1483
|
const tr = useTr();
|
|
1326
1484
|
const [tags, setTags] = useControllable(controlled, defaultValue, onValueChange);
|
|
1327
|
-
const [query, setQuery] =
|
|
1328
|
-
const [refusal, setRefusal] =
|
|
1485
|
+
const [query, setQuery] = useState4("");
|
|
1486
|
+
const [refusal, setRefusal] = useState4();
|
|
1329
1487
|
const full = max !== void 0 && tags.length >= max;
|
|
1330
1488
|
const add = (raw) => {
|
|
1331
1489
|
if (p.disabled || full) return;
|
|
@@ -1343,8 +1501,8 @@ function TagInput({
|
|
|
1343
1501
|
setQuery("");
|
|
1344
1502
|
};
|
|
1345
1503
|
const offered = query ? suggestions.filter((s) => s.toLowerCase().includes(query.toLowerCase()) && !tags.includes(s)).slice(0, 6) : [];
|
|
1346
|
-
return /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1504
|
+
return /* @__PURE__ */ jsxs12("div", { ...mark("TagInput", p), children: [
|
|
1505
|
+
/* @__PURE__ */ jsx20(
|
|
1348
1506
|
ChipField,
|
|
1349
1507
|
{
|
|
1350
1508
|
className: "",
|
|
@@ -1356,7 +1514,7 @@ function TagInput({
|
|
|
1356
1514
|
size: p.size,
|
|
1357
1515
|
variant: p.variant,
|
|
1358
1516
|
labelPlacement: p.labelPlacement,
|
|
1359
|
-
startAdornment: icon ? /* @__PURE__ */
|
|
1517
|
+
startAdornment: icon ? /* @__PURE__ */ jsx20(Icon, { name: icon }) : void 0,
|
|
1360
1518
|
placeholder: full ? void 0 : placeholder ?? tr("\u0414\u043E\u0431\u0430\u0432\u044C\u0442\u0435 \u0442\u0435\u0433 \u0438 \u043D\u0430\u0436\u043C\u0438\u0442\u0435 Enter"),
|
|
1361
1519
|
query,
|
|
1362
1520
|
onQueryChange: (next) => {
|
|
@@ -1386,16 +1544,16 @@ function TagInput({
|
|
|
1386
1544
|
setTags(tags.slice(0, -1));
|
|
1387
1545
|
}
|
|
1388
1546
|
},
|
|
1389
|
-
chips: tags.map((tag) => /* @__PURE__ */
|
|
1547
|
+
chips: tags.map((tag) => /* @__PURE__ */ jsx20(Chip, { label: tag, disabled: p.disabled, onRemove: () => setTags(tags.filter((t) => t !== tag)) }, tag))
|
|
1390
1548
|
}
|
|
1391
1549
|
),
|
|
1392
|
-
!p.disabled && !full && offered.length > 0 && /* @__PURE__ */
|
|
1550
|
+
!p.disabled && !full && offered.length > 0 && /* @__PURE__ */ jsx20("div", { className: "ad-tag-input-suggestions", role: "listbox", "aria-label": tr("\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438"), children: offered.map((tag) => /* @__PURE__ */ jsx20(Chip, { label: tag, icon: "plus", onClick: () => add(tag) }, tag)) })
|
|
1393
1551
|
] });
|
|
1394
1552
|
}
|
|
1395
1553
|
|
|
1396
1554
|
// src/components/controls/PeoplePicker/PeoplePicker.tsx
|
|
1397
|
-
import { useEffect as useEffect4, useId as useId3, useRef as
|
|
1398
|
-
import { jsx as
|
|
1555
|
+
import { useEffect as useEffect4, useId as useId3, useRef as useRef8, useState as useState5 } from "react";
|
|
1556
|
+
import { jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1399
1557
|
var searchDelay = 220;
|
|
1400
1558
|
function PeoplePicker({
|
|
1401
1559
|
people = [],
|
|
@@ -1410,15 +1568,15 @@ function PeoplePicker({
|
|
|
1410
1568
|
}) {
|
|
1411
1569
|
const tr = useTr();
|
|
1412
1570
|
const [chosen, setChosen] = useControllable(controlled, defaultValue, onValueChange);
|
|
1413
|
-
const [query, setQuery] =
|
|
1414
|
-
const [open, setOpen] =
|
|
1415
|
-
const [active, setActive] =
|
|
1416
|
-
const [found, setFound] =
|
|
1417
|
-
const [loading, setLoading] =
|
|
1418
|
-
const [searchError, setSearchError] =
|
|
1419
|
-
const box =
|
|
1571
|
+
const [query, setQuery] = useState5("");
|
|
1572
|
+
const [open, setOpen] = useState5(false);
|
|
1573
|
+
const [active, setActive] = useState5(0);
|
|
1574
|
+
const [found, setFound] = useState5(null);
|
|
1575
|
+
const [loading, setLoading] = useState5(false);
|
|
1576
|
+
const [searchError, setSearchError] = useState5();
|
|
1577
|
+
const box = useRef8(null);
|
|
1420
1578
|
const listId = `${useId3()}-people`;
|
|
1421
|
-
const search =
|
|
1579
|
+
const search = useRef8(onSearch);
|
|
1422
1580
|
search.current = onSearch;
|
|
1423
1581
|
const remote = !!onSearch;
|
|
1424
1582
|
const needle = query.trim().toLowerCase();
|
|
@@ -1471,8 +1629,8 @@ function PeoplePicker({
|
|
|
1471
1629
|
setActive(0);
|
|
1472
1630
|
if (single || limit !== void 0 && chosen.length + 1 >= limit) setOpen(false);
|
|
1473
1631
|
};
|
|
1474
|
-
return /* @__PURE__ */
|
|
1475
|
-
/* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ jsxs13("div", { ...mark("PeoplePicker", p), children: [
|
|
1633
|
+
/* @__PURE__ */ jsx21(
|
|
1476
1634
|
ChipField,
|
|
1477
1635
|
{
|
|
1478
1636
|
className: "",
|
|
@@ -1485,7 +1643,7 @@ function PeoplePicker({
|
|
|
1485
1643
|
size: p.size,
|
|
1486
1644
|
variant: p.variant,
|
|
1487
1645
|
labelPlacement: p.labelPlacement,
|
|
1488
|
-
startAdornment: /* @__PURE__ */
|
|
1646
|
+
startAdornment: /* @__PURE__ */ jsx21(Icon, { name: "users" }),
|
|
1489
1647
|
placeholder: full ? void 0 : placeholder ?? tr("\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u0432\u0432\u043E\u0434\u0438\u0442\u044C \u0438\u043C\u044F"),
|
|
1490
1648
|
query,
|
|
1491
1649
|
onQueryChange: (next) => {
|
|
@@ -1521,7 +1679,7 @@ function PeoplePicker({
|
|
|
1521
1679
|
setChosen(chosen.slice(0, -1));
|
|
1522
1680
|
}
|
|
1523
1681
|
},
|
|
1524
|
-
chips: chosen.map((person) => /* @__PURE__ */
|
|
1682
|
+
chips: chosen.map((person) => /* @__PURE__ */ jsx21(
|
|
1525
1683
|
Chip,
|
|
1526
1684
|
{
|
|
1527
1685
|
label: person.name,
|
|
@@ -1533,7 +1691,7 @@ function PeoplePicker({
|
|
|
1533
1691
|
))
|
|
1534
1692
|
}
|
|
1535
1693
|
),
|
|
1536
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ jsx21(
|
|
1537
1695
|
Popover,
|
|
1538
1696
|
{
|
|
1539
1697
|
id: listId,
|
|
@@ -1546,14 +1704,14 @@ function PeoplePicker({
|
|
|
1546
1704
|
autoFocus: false,
|
|
1547
1705
|
className: "ad-option-popover",
|
|
1548
1706
|
label: tr("\u041B\u044E\u0434\u0438"),
|
|
1549
|
-
children: /* @__PURE__ */
|
|
1550
|
-
loading && /* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1707
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "ad-option-list", children: [
|
|
1708
|
+
loading && /* @__PURE__ */ jsxs13("div", { className: "ad-option-empty", children: [
|
|
1709
|
+
/* @__PURE__ */ jsx21("span", { className: "ad-spinner", "aria-hidden": true }),
|
|
1552
1710
|
" ",
|
|
1553
1711
|
tr("\u0418\u0449\u0435\u043C\u2026")
|
|
1554
1712
|
] }),
|
|
1555
|
-
!loading && (searchError || options.length === 0) && /* @__PURE__ */
|
|
1556
|
-
!loading && !searchError && options.map((person, index) => /* @__PURE__ */
|
|
1713
|
+
!loading && (searchError || options.length === 0) && /* @__PURE__ */ jsx21("div", { className: "ad-option-empty", children: searchError ?? (onSearch && !needle ? tr("\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u0432\u0432\u043E\u0434\u0438\u0442\u044C \u0438\u043C\u044F") : tr("\u041D\u0438\u043A\u043E\u0433\u043E \u043D\u0435 \u043D\u0430\u0448\u043B\u0438")) }),
|
|
1714
|
+
!loading && !searchError && options.map((person, index) => /* @__PURE__ */ jsxs13(
|
|
1557
1715
|
"button",
|
|
1558
1716
|
{
|
|
1559
1717
|
id: `${listId}-option-${index}`,
|
|
@@ -1567,10 +1725,10 @@ function PeoplePicker({
|
|
|
1567
1725
|
onPointerDown: (event) => event.preventDefault(),
|
|
1568
1726
|
onClick: () => pick(person),
|
|
1569
1727
|
children: [
|
|
1570
|
-
/* @__PURE__ */
|
|
1571
|
-
/* @__PURE__ */
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
person.description && /* @__PURE__ */
|
|
1728
|
+
/* @__PURE__ */ jsx21(Avatar, { size: "sm", name: person.name, src: person.src, presence: person.presence }),
|
|
1729
|
+
/* @__PURE__ */ jsxs13("span", { className: "ad-option-text", children: [
|
|
1730
|
+
/* @__PURE__ */ jsx21("span", { className: "ad-option-label", children: person.name }),
|
|
1731
|
+
person.description && /* @__PURE__ */ jsx21("span", { className: "ad-option-description", children: person.description })
|
|
1574
1732
|
] })
|
|
1575
1733
|
]
|
|
1576
1734
|
},
|
|
@@ -1583,8 +1741,8 @@ function PeoplePicker({
|
|
|
1583
1741
|
}
|
|
1584
1742
|
|
|
1585
1743
|
// src/components/controls/DatePicker/DatePicker.tsx
|
|
1586
|
-
import { useEffect as useEffect5, useMemo as useMemo3, useRef as
|
|
1587
|
-
import { jsx as
|
|
1744
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef9, useState as useState6 } from "react";
|
|
1745
|
+
import { jsx as jsx22, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1588
1746
|
var iso = (date) => `${String(date.getFullYear()).padStart(4, "0")}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
1589
1747
|
var calendarDate = (year, month, day) => {
|
|
1590
1748
|
const date = /* @__PURE__ */ new Date(0);
|
|
@@ -1607,13 +1765,13 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1607
1765
|
const locale = requestedLocale ?? intlLocale(inheritedLocale);
|
|
1608
1766
|
const [value, setValue] = useControllable(controlled, defaultValue, onValueChange);
|
|
1609
1767
|
const selected = parse(value);
|
|
1610
|
-
const [open, setOpen] =
|
|
1768
|
+
const [open, setOpen] = useState6(false);
|
|
1611
1769
|
useEffect5(() => {
|
|
1612
1770
|
if (p.disabled) setOpen(false);
|
|
1613
1771
|
}, [p.disabled]);
|
|
1614
|
-
const [text, setText] =
|
|
1615
|
-
const [month, setMonth] =
|
|
1616
|
-
const box =
|
|
1772
|
+
const [text, setText] = useState6(null);
|
|
1773
|
+
const [month, setMonth] = useState6(() => selected ?? /* @__PURE__ */ new Date());
|
|
1774
|
+
const box = useRef9(null);
|
|
1617
1775
|
const ids = useFieldIds(p.label, p.description || p.error, void 0, p);
|
|
1618
1776
|
const format = useMemo3(() => new Intl.DateTimeFormat(locale, { day: "2-digit", month: "2-digit", year: "numeric" }), [locale]);
|
|
1619
1777
|
const weekdays = useMemo3(
|
|
@@ -1634,8 +1792,8 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1634
1792
|
setOpen(false);
|
|
1635
1793
|
};
|
|
1636
1794
|
const shift = (months) => setMonth(new Date(month.getFullYear(), month.getMonth() + months, 1));
|
|
1637
|
-
return /* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1795
|
+
return /* @__PURE__ */ jsxs14("div", { ...mark("DatePicker", p), children: [
|
|
1796
|
+
/* @__PURE__ */ jsx22(FieldFrame, { ids, className: "", label: p.label, required: p.required, description: p.description, error: p.error, children: /* @__PURE__ */ jsx22(
|
|
1639
1797
|
InputBase,
|
|
1640
1798
|
{
|
|
1641
1799
|
ref: box,
|
|
@@ -1643,7 +1801,7 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1643
1801
|
disabled: p.disabled,
|
|
1644
1802
|
error: !!p.error,
|
|
1645
1803
|
filled: !!selected,
|
|
1646
|
-
endAdornment: /* @__PURE__ */
|
|
1804
|
+
endAdornment: /* @__PURE__ */ jsx22(
|
|
1647
1805
|
IconButton,
|
|
1648
1806
|
{
|
|
1649
1807
|
size: "xs",
|
|
@@ -1657,7 +1815,7 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1657
1815
|
}
|
|
1658
1816
|
}
|
|
1659
1817
|
),
|
|
1660
|
-
children: /* @__PURE__ */
|
|
1818
|
+
children: /* @__PURE__ */ jsx22(
|
|
1661
1819
|
"input",
|
|
1662
1820
|
{
|
|
1663
1821
|
...ids.aria,
|
|
@@ -1684,17 +1842,17 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1684
1842
|
)
|
|
1685
1843
|
}
|
|
1686
1844
|
) }),
|
|
1687
|
-
/* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
-
/* @__PURE__ */
|
|
1691
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ jsx22(Popover, { open: open && !p.disabled, onOpenChange: setOpen, anchorRef: box, align: "start", label: tr("\u041A\u0430\u043B\u0435\u043D\u0434\u0430\u0440\u044C"), className: "ad-date-popover", children: /* @__PURE__ */ jsxs14("div", { className: "ad-calendar", children: [
|
|
1846
|
+
/* @__PURE__ */ jsxs14("div", { className: "ad-calendar-head", children: [
|
|
1847
|
+
/* @__PURE__ */ jsx22(IconButton, { size: "xs", variant: "ghost", icon: "prev", label: tr("\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446"), onClick: () => shift(-1) }),
|
|
1848
|
+
/* @__PURE__ */ jsx22("strong", { children: monthLabel }),
|
|
1849
|
+
/* @__PURE__ */ jsx22(IconButton, { size: "xs", variant: "ghost", icon: "prev", className: "ad-calendar-next", label: tr("\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446"), onClick: () => shift(1) })
|
|
1692
1850
|
] }),
|
|
1693
|
-
/* @__PURE__ */
|
|
1694
|
-
weekdays.map((day) => /* @__PURE__ */
|
|
1851
|
+
/* @__PURE__ */ jsxs14("div", { className: "ad-calendar-grid", role: "group", "aria-label": monthLabel, children: [
|
|
1852
|
+
weekdays.map((day) => /* @__PURE__ */ jsx22("span", { className: "ad-calendar-weekday", children: day }, day)),
|
|
1695
1853
|
days.map((date) => {
|
|
1696
1854
|
const day = iso(date);
|
|
1697
|
-
return /* @__PURE__ */
|
|
1855
|
+
return /* @__PURE__ */ jsx22(
|
|
1698
1856
|
"button",
|
|
1699
1857
|
{
|
|
1700
1858
|
type: "button",
|
|
@@ -1711,9 +1869,9 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1711
1869
|
);
|
|
1712
1870
|
})
|
|
1713
1871
|
] }),
|
|
1714
|
-
/* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
selected && /* @__PURE__ */
|
|
1872
|
+
/* @__PURE__ */ jsxs14("div", { className: "ad-calendar-foot", children: [
|
|
1873
|
+
/* @__PURE__ */ jsx22(Button, { size: "xs", variant: "ghost", icon: "clock", disabled: !allowed(today), onClick: () => choose(/* @__PURE__ */ new Date()), children: tr("\u0421\u0435\u0433\u043E\u0434\u043D\u044F") }),
|
|
1874
|
+
selected && /* @__PURE__ */ jsx22(Button, { size: "xs", variant: "ghost", icon: "close", onClick: () => {
|
|
1717
1875
|
setValue("");
|
|
1718
1876
|
setOpen(false);
|
|
1719
1877
|
}, children: tr("\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C") })
|
|
@@ -1723,8 +1881,8 @@ function DatePicker({ value: controlled, defaultValue = "", onValueChange, min,
|
|
|
1723
1881
|
}
|
|
1724
1882
|
|
|
1725
1883
|
// src/components/controls/Autocomplete/Autocomplete.tsx
|
|
1726
|
-
import { useEffect as useEffect6, useMemo as useMemo4, useRef as
|
|
1727
|
-
import { Fragment as
|
|
1884
|
+
import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef10, useState as useState7 } from "react";
|
|
1885
|
+
import { Fragment as Fragment6, jsx as jsx23, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1728
1886
|
var defaultOptions = ["WASAPI Shared", "WASAPI Exclusive", "ASIO"];
|
|
1729
1887
|
var Autocomplete = ({
|
|
1730
1888
|
options = defaultOptions,
|
|
@@ -1755,10 +1913,10 @@ var Autocomplete = ({
|
|
|
1755
1913
|
defaultValue,
|
|
1756
1914
|
onValueChange
|
|
1757
1915
|
);
|
|
1758
|
-
const [open, setOpen] =
|
|
1759
|
-
const [active, setActive] =
|
|
1760
|
-
const inputNode =
|
|
1761
|
-
const box =
|
|
1916
|
+
const [open, setOpen] = useState7(false);
|
|
1917
|
+
const [active, setActive] = useState7(0);
|
|
1918
|
+
const inputNode = useRef10(null);
|
|
1919
|
+
const box = useRef10(null);
|
|
1762
1920
|
const ids = useFieldIds(label, description || error, input.id, input);
|
|
1763
1921
|
const locked = !!(input.disabled || input.readOnly);
|
|
1764
1922
|
useEffect6(() => {
|
|
@@ -1781,7 +1939,7 @@ var Autocomplete = ({
|
|
|
1781
1939
|
inputNode.current?.focus();
|
|
1782
1940
|
};
|
|
1783
1941
|
const floating = labelPlacement === "floating" && !!label;
|
|
1784
|
-
return /* @__PURE__ */
|
|
1942
|
+
return /* @__PURE__ */ jsxs15(
|
|
1785
1943
|
FieldFrame,
|
|
1786
1944
|
{
|
|
1787
1945
|
ids,
|
|
@@ -1792,7 +1950,7 @@ var Autocomplete = ({
|
|
|
1792
1950
|
description,
|
|
1793
1951
|
error,
|
|
1794
1952
|
children: [
|
|
1795
|
-
/* @__PURE__ */
|
|
1953
|
+
/* @__PURE__ */ jsx23(
|
|
1796
1954
|
InputBase,
|
|
1797
1955
|
{
|
|
1798
1956
|
ref: box,
|
|
@@ -1805,8 +1963,8 @@ var Autocomplete = ({
|
|
|
1805
1963
|
readOnly: input.readOnly,
|
|
1806
1964
|
error: !!error,
|
|
1807
1965
|
startAdornment,
|
|
1808
|
-
endAdornment: /* @__PURE__ */
|
|
1809
|
-
clearable && current && /* @__PURE__ */
|
|
1966
|
+
endAdornment: /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
1967
|
+
clearable && current && /* @__PURE__ */ jsx23(
|
|
1810
1968
|
IconButton,
|
|
1811
1969
|
{
|
|
1812
1970
|
size: "xs",
|
|
@@ -1821,7 +1979,7 @@ var Autocomplete = ({
|
|
|
1821
1979
|
}
|
|
1822
1980
|
),
|
|
1823
1981
|
endAdornment,
|
|
1824
|
-
/* @__PURE__ */
|
|
1982
|
+
/* @__PURE__ */ jsx23(
|
|
1825
1983
|
IconButton,
|
|
1826
1984
|
{
|
|
1827
1985
|
size: "xs",
|
|
@@ -1837,7 +1995,7 @@ var Autocomplete = ({
|
|
|
1837
1995
|
}
|
|
1838
1996
|
)
|
|
1839
1997
|
] }),
|
|
1840
|
-
children: /* @__PURE__ */
|
|
1998
|
+
children: /* @__PURE__ */ jsx23(
|
|
1841
1999
|
"input",
|
|
1842
2000
|
{
|
|
1843
2001
|
...ids.aria,
|
|
@@ -1887,7 +2045,7 @@ var Autocomplete = ({
|
|
|
1887
2045
|
)
|
|
1888
2046
|
}
|
|
1889
2047
|
),
|
|
1890
|
-
/* @__PURE__ */
|
|
2048
|
+
/* @__PURE__ */ jsx23(
|
|
1891
2049
|
Popover,
|
|
1892
2050
|
{
|
|
1893
2051
|
id: listId,
|
|
@@ -1900,7 +2058,7 @@ var Autocomplete = ({
|
|
|
1900
2058
|
matchAnchorWidth: true,
|
|
1901
2059
|
className: "ad-option-popover ad-autocomplete-popover",
|
|
1902
2060
|
label: typeof label === "string" ? label : tr("\u041F\u043E\u0434\u0441\u043A\u0430\u0437\u043A\u0438"),
|
|
1903
|
-
children: /* @__PURE__ */
|
|
2061
|
+
children: /* @__PURE__ */ jsx23(
|
|
1904
2062
|
OptionList,
|
|
1905
2063
|
{
|
|
1906
2064
|
id: listId,
|
|
@@ -1919,11 +2077,11 @@ var Autocomplete = ({
|
|
|
1919
2077
|
};
|
|
1920
2078
|
|
|
1921
2079
|
// src/components/controls/Checkbox/Checkbox.tsx
|
|
1922
|
-
import { jsx as
|
|
1923
|
-
var Checkbox = (p) => /* @__PURE__ */
|
|
2080
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2081
|
+
var Checkbox = (p) => /* @__PURE__ */ jsx24(BooleanControl, { kind: "Checkbox", ...p });
|
|
1924
2082
|
|
|
1925
2083
|
// src/components/controls/NumberField/NumberField.tsx
|
|
1926
|
-
import { Fragment as
|
|
2084
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1927
2085
|
var NumberField = ({
|
|
1928
2086
|
value,
|
|
1929
2087
|
defaultValue = 0,
|
|
@@ -1953,7 +2111,7 @@ var NumberField = ({
|
|
|
1953
2111
|
high
|
|
1954
2112
|
)
|
|
1955
2113
|
);
|
|
1956
|
-
return /* @__PURE__ */
|
|
2114
|
+
return /* @__PURE__ */ jsx25(
|
|
1957
2115
|
TextField,
|
|
1958
2116
|
{
|
|
1959
2117
|
...p,
|
|
@@ -1965,10 +2123,10 @@ var NumberField = ({
|
|
|
1965
2123
|
step,
|
|
1966
2124
|
value: String(current),
|
|
1967
2125
|
onValueChange: (v) => setCurrent(v === "" ? "" : Number(v)),
|
|
1968
|
-
endAdornment: /* @__PURE__ */
|
|
2126
|
+
endAdornment: /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
1969
2127
|
endAdornment,
|
|
1970
|
-
controls && /* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
2128
|
+
controls && /* @__PURE__ */ jsxs16(Fragment7, { children: [
|
|
2129
|
+
/* @__PURE__ */ jsx25(
|
|
1972
2130
|
IconButton,
|
|
1973
2131
|
{
|
|
1974
2132
|
size: "xs",
|
|
@@ -1979,7 +2137,7 @@ var NumberField = ({
|
|
|
1979
2137
|
onClick: () => nudge(-1)
|
|
1980
2138
|
}
|
|
1981
2139
|
),
|
|
1982
|
-
/* @__PURE__ */
|
|
2140
|
+
/* @__PURE__ */ jsx25(
|
|
1983
2141
|
IconButton,
|
|
1984
2142
|
{
|
|
1985
2143
|
size: "xs",
|
|
@@ -1997,11 +2155,11 @@ var NumberField = ({
|
|
|
1997
2155
|
};
|
|
1998
2156
|
|
|
1999
2157
|
// src/components/controls/Select/Select.tsx
|
|
2000
|
-
import { forwardRef as
|
|
2001
|
-
import { Fragment as
|
|
2158
|
+
import { forwardRef as forwardRef6, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef11, useState as useState8 } from "react";
|
|
2159
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2002
2160
|
var defaultKey = (value) => typeof value === "object" && value !== null ? JSON.stringify(value) : String(value);
|
|
2003
2161
|
var textOf = (option) => option.text ?? (typeof option.label === "string" || typeof option.label === "number" ? String(option.label) : "");
|
|
2004
|
-
var Select = /* @__PURE__ */
|
|
2162
|
+
var Select = /* @__PURE__ */ forwardRef6(function Select2(p, ref) {
|
|
2005
2163
|
const tr = useTr();
|
|
2006
2164
|
const floating = p.labelPlacement === "floating" && !!p.label;
|
|
2007
2165
|
const keyOf = p.getKey ?? defaultKey;
|
|
@@ -2016,17 +2174,17 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2016
2174
|
p.defaultValue ?? (p.placeholder ? void 0 : options.find((option) => !option.disabled)?.value),
|
|
2017
2175
|
p.onValueChange
|
|
2018
2176
|
);
|
|
2019
|
-
const [open, setOpen] =
|
|
2020
|
-
const [query, setQuery] =
|
|
2021
|
-
const [invalid, setInvalid] =
|
|
2177
|
+
const [open, setOpen] = useState8(false);
|
|
2178
|
+
const [query, setQuery] = useState8("");
|
|
2179
|
+
const [invalid, setInvalid] = useState8(false);
|
|
2022
2180
|
useEffect7(() => {
|
|
2023
2181
|
if (p.disabled) {
|
|
2024
2182
|
setOpen(false);
|
|
2025
2183
|
setQuery("");
|
|
2026
2184
|
}
|
|
2027
2185
|
}, [p.disabled]);
|
|
2028
|
-
const anchor =
|
|
2029
|
-
const box =
|
|
2186
|
+
const anchor = useRef11(null);
|
|
2187
|
+
const box = useRef11(null);
|
|
2030
2188
|
const keyedOptions = useMemo5(() => options.map((option) => ({ option, key: keyOf(option.value) })), [options, keyOf]);
|
|
2031
2189
|
const selectedKey = value === void 0 ? void 0 : keyOf(value);
|
|
2032
2190
|
const selected = keyedOptions.find(({ key }) => key === selectedKey)?.option;
|
|
@@ -2065,12 +2223,12 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2065
2223
|
setQuery("");
|
|
2066
2224
|
anchor.current?.focus();
|
|
2067
2225
|
};
|
|
2068
|
-
const shownValue = selected ? p.renderValue?.(selected) ?? /* @__PURE__ */
|
|
2069
|
-
selected.avatar && /* @__PURE__ */
|
|
2070
|
-
selected.icon && /* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2226
|
+
const shownValue = selected ? p.renderValue?.(selected) ?? /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
2227
|
+
selected.avatar && /* @__PURE__ */ jsx26(Avatar, { size: "xs", name: selected.avatar.name, src: selected.avatar.src }),
|
|
2228
|
+
selected.icon && /* @__PURE__ */ jsx26(Icon, { name: selected.icon }),
|
|
2229
|
+
/* @__PURE__ */ jsx26("span", { className: "ad-select-value-text", children: selected.label })
|
|
2072
2230
|
] }) : p.placeholder ?? tr("\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435");
|
|
2073
|
-
return /* @__PURE__ */
|
|
2231
|
+
return /* @__PURE__ */ jsxs17(
|
|
2074
2232
|
FieldFrame,
|
|
2075
2233
|
{
|
|
2076
2234
|
ids,
|
|
@@ -2081,7 +2239,7 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2081
2239
|
description: p.description,
|
|
2082
2240
|
error,
|
|
2083
2241
|
children: [
|
|
2084
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsx26(
|
|
2085
2243
|
InputBase,
|
|
2086
2244
|
{
|
|
2087
2245
|
ref: box,
|
|
@@ -2092,12 +2250,12 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2092
2250
|
filled: !!selected,
|
|
2093
2251
|
disabled: p.disabled,
|
|
2094
2252
|
error: !!error,
|
|
2095
|
-
startAdornment: p.startAdornment ?? (p.icon ? /* @__PURE__ */
|
|
2096
|
-
endAdornment: /* @__PURE__ */
|
|
2253
|
+
startAdornment: p.startAdornment ?? (p.icon ? /* @__PURE__ */ jsx26(Icon, { name: p.icon }) : void 0),
|
|
2254
|
+
endAdornment: /* @__PURE__ */ jsxs17(Fragment8, { children: [
|
|
2097
2255
|
p.endAdornment,
|
|
2098
|
-
/* @__PURE__ */
|
|
2256
|
+
/* @__PURE__ */ jsx26(Icon, { name: "chevron", className: "ad-select-chevron" })
|
|
2099
2257
|
] }),
|
|
2100
|
-
children: /* @__PURE__ */
|
|
2258
|
+
children: /* @__PURE__ */ jsx26(
|
|
2101
2259
|
"button",
|
|
2102
2260
|
{
|
|
2103
2261
|
...mark("Select", { ...p, style: void 0 }),
|
|
@@ -2117,13 +2275,13 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2117
2275
|
"aria-invalid": !!error || void 0,
|
|
2118
2276
|
"data-placeholder": !selected || void 0,
|
|
2119
2277
|
onClick: () => setOpen((v) => !v),
|
|
2120
|
-
children: /* @__PURE__ */
|
|
2278
|
+
children: /* @__PURE__ */ jsx26("span", { className: "ad-select-value", id: ids.value, children: shownValue })
|
|
2121
2279
|
}
|
|
2122
2280
|
)
|
|
2123
2281
|
}
|
|
2124
2282
|
),
|
|
2125
|
-
p.name && /* @__PURE__ */
|
|
2126
|
-
p.required && /* @__PURE__ */
|
|
2283
|
+
p.name && /* @__PURE__ */ jsx26("input", { type: "hidden", name: p.name, disabled: p.disabled, value: selected ? selected.text ?? selectedKey ?? "" : "" }),
|
|
2284
|
+
p.required && /* @__PURE__ */ jsxs17(
|
|
2127
2285
|
"select",
|
|
2128
2286
|
{
|
|
2129
2287
|
hidden: true,
|
|
@@ -2139,12 +2297,12 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2139
2297
|
anchor.current?.focus();
|
|
2140
2298
|
},
|
|
2141
2299
|
children: [
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
keyedOptions.map(({ option, key }) => /* @__PURE__ */
|
|
2300
|
+
/* @__PURE__ */ jsx26("option", { value: "" }),
|
|
2301
|
+
keyedOptions.map(({ option, key }) => /* @__PURE__ */ jsx26("option", { value: key, disabled: option.disabled, children: textOf(option) }, key))
|
|
2144
2302
|
]
|
|
2145
2303
|
}
|
|
2146
2304
|
),
|
|
2147
|
-
/* @__PURE__ */
|
|
2305
|
+
/* @__PURE__ */ jsxs17(
|
|
2148
2306
|
Popover,
|
|
2149
2307
|
{
|
|
2150
2308
|
open: open && !p.disabled,
|
|
@@ -2163,9 +2321,9 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2163
2321
|
label: typeof p.label === "string" ? p.label : tr("\u0412\u0430\u0440\u0438\u0430\u043D\u0442\u044B"),
|
|
2164
2322
|
autoFocus: !p.searchable,
|
|
2165
2323
|
children: [
|
|
2166
|
-
p.searchable && /* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
/* @__PURE__ */
|
|
2324
|
+
p.searchable && /* @__PURE__ */ jsxs17("label", { className: "ad-option-search", children: [
|
|
2325
|
+
/* @__PURE__ */ jsx26(Icon, { name: "search" }),
|
|
2326
|
+
/* @__PURE__ */ jsx26(
|
|
2169
2327
|
"input",
|
|
2170
2328
|
{
|
|
2171
2329
|
autoFocus: true,
|
|
@@ -2186,7 +2344,7 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2186
2344
|
}
|
|
2187
2345
|
)
|
|
2188
2346
|
] }),
|
|
2189
|
-
rows.length ? /* @__PURE__ */
|
|
2347
|
+
rows.length ? /* @__PURE__ */ jsx26(OptionList, { options: rows, selected: selectedKey, onChoose: choose }) : /* @__PURE__ */ jsx26("div", { className: "ad-option-empty", children: tr("\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E") })
|
|
2190
2348
|
]
|
|
2191
2349
|
}
|
|
2192
2350
|
)
|
|
@@ -2195,13 +2353,137 @@ var Select = /* @__PURE__ */ forwardRef5(function Select2(p, ref) {
|
|
|
2195
2353
|
);
|
|
2196
2354
|
});
|
|
2197
2355
|
|
|
2356
|
+
// src/components/effects/ImageShine/ImageShine.tsx
|
|
2357
|
+
import { useRef as useRef12 } from "react";
|
|
2358
|
+
import { jsx as jsx27, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2359
|
+
function ImageShine({ src, glow = true, label, style, ...p }) {
|
|
2360
|
+
const pauseRef = useRef12(null);
|
|
2361
|
+
usePauseOffscreen(pauseRef);
|
|
2362
|
+
return /* @__PURE__ */ jsxs18(
|
|
2363
|
+
"span",
|
|
2364
|
+
{
|
|
2365
|
+
...mark("ImageShine", p),
|
|
2366
|
+
ref: pauseRef,
|
|
2367
|
+
style: { ...style, "--ad-shine-src": `url("${src}")` },
|
|
2368
|
+
"data-glow": glow || void 0,
|
|
2369
|
+
role: label ? "img" : void 0,
|
|
2370
|
+
"aria-label": label,
|
|
2371
|
+
"aria-hidden": label ? void 0 : true,
|
|
2372
|
+
children: [
|
|
2373
|
+
glow && /* @__PURE__ */ jsx27("img", { className: "ad-image-shine-glow", src, alt: "", draggable: false }),
|
|
2374
|
+
/* @__PURE__ */ jsx27("img", { className: "ad-image-shine-picture", src, alt: "", draggable: false }),
|
|
2375
|
+
/* @__PURE__ */ jsx27("span", { className: "ad-image-shine-sweep", children: /* @__PURE__ */ jsx27("i", {}) })
|
|
2376
|
+
]
|
|
2377
|
+
}
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
|
|
2381
|
+
// src/components/controls/ThemePicker/ThemePicker.tsx
|
|
2382
|
+
import { jsx as jsx28, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2383
|
+
var builtIn = {
|
|
2384
|
+
ruby: "Ruby",
|
|
2385
|
+
light: "Light",
|
|
2386
|
+
green: "Green",
|
|
2387
|
+
violet: "Violet"
|
|
2388
|
+
};
|
|
2389
|
+
function ThemePicker(p) {
|
|
2390
|
+
const tr = useTr();
|
|
2391
|
+
const first = p.options?.[0]?.value ?? "ruby";
|
|
2392
|
+
const [value, setValue] = useControllable(p.value, p.defaultValue ?? first, p.onValueChange);
|
|
2393
|
+
const options = p.options ?? Object.keys(builtIn).map((key) => ({
|
|
2394
|
+
value: key,
|
|
2395
|
+
label: builtIn[key],
|
|
2396
|
+
color: themes[key][0]
|
|
2397
|
+
}));
|
|
2398
|
+
const active = Math.max(0, options.findIndex((option) => option.value === value));
|
|
2399
|
+
return /* @__PURE__ */ jsx28(
|
|
2400
|
+
"div",
|
|
2401
|
+
{
|
|
2402
|
+
...mark("ThemePicker", p),
|
|
2403
|
+
"data-gallery": p.options ? "" : void 0,
|
|
2404
|
+
role: "radiogroup",
|
|
2405
|
+
"aria-label": p.label ?? tr("\u0422\u0435\u043C\u0430"),
|
|
2406
|
+
onKeyDown: (event) => {
|
|
2407
|
+
const buttons = [...event.currentTarget.querySelectorAll('[role="radio"]:not(:disabled)')];
|
|
2408
|
+
const index = buttons.indexOf(document.activeElement);
|
|
2409
|
+
const moves = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1, Home: -index, End: buttons.length - index - 1 };
|
|
2410
|
+
const move = moves[event.key];
|
|
2411
|
+
if (move === void 0 || !buttons.length) return;
|
|
2412
|
+
event.preventDefault();
|
|
2413
|
+
const next = buttons[(index + move + buttons.length) % buttons.length];
|
|
2414
|
+
next.focus();
|
|
2415
|
+
next.click();
|
|
2416
|
+
},
|
|
2417
|
+
children: options.map((option, index) => {
|
|
2418
|
+
const chosen = option.value === value;
|
|
2419
|
+
const radio = { role: "radio", "aria-checked": chosen, tabIndex: index === active ? 0 : -1, disabled: p.disabled, onClick: () => setValue(option.value) };
|
|
2420
|
+
if (!p.options) return /* @__PURE__ */ jsxs19(Button, { size: p.size ?? "sm", ...radio, children: [
|
|
2421
|
+
/* @__PURE__ */ jsx28("span", { className: "ad-theme-swatch", style: { background: option.color } }),
|
|
2422
|
+
option.label
|
|
2423
|
+
] }, option.value);
|
|
2424
|
+
return /* @__PURE__ */ jsxs19(
|
|
2425
|
+
"button",
|
|
2426
|
+
{
|
|
2427
|
+
type: "button",
|
|
2428
|
+
className: "ad-theme-card",
|
|
2429
|
+
"aria-label": option.label,
|
|
2430
|
+
...radio,
|
|
2431
|
+
style: { "--ad-theme-card": option.color },
|
|
2432
|
+
children: [
|
|
2433
|
+
option.background && /* @__PURE__ */ jsx28("img", { className: "ad-theme-card-background", src: option.background, alt: "", loading: "lazy", draggable: false }),
|
|
2434
|
+
/* @__PURE__ */ jsx28("span", { className: "ad-theme-card-preview", children: /* @__PURE__ */ jsx28("span", { className: "ad-theme-card-image", children: option.image && (chosen ? /* @__PURE__ */ jsx28(ImageShine, { src: option.image, glow: false }) : /* @__PURE__ */ jsx28("img", { src: option.image, alt: "", loading: "lazy", draggable: false })) }) }),
|
|
2435
|
+
/* @__PURE__ */ jsxs19("span", { className: "ad-theme-card-caption", children: [
|
|
2436
|
+
/* @__PURE__ */ jsx28("strong", { children: option.label }),
|
|
2437
|
+
option.description && /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: option.description })
|
|
2438
|
+
] }),
|
|
2439
|
+
chosen && /* @__PURE__ */ jsx28("span", { className: "ad-theme-card-check", "aria-hidden": "true", children: /* @__PURE__ */ jsx28(Icon, { name: "check" }) })
|
|
2440
|
+
]
|
|
2441
|
+
},
|
|
2442
|
+
option.value
|
|
2443
|
+
);
|
|
2444
|
+
})
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// src/components/controls/ToggleButton/ToggleButton.tsx
|
|
2450
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
2451
|
+
var ToggleButton = /* @__PURE__ */ forwardRef7(function ToggleButton2({
|
|
2452
|
+
checked,
|
|
2453
|
+
defaultChecked = false,
|
|
2454
|
+
onValueChange,
|
|
2455
|
+
onClick,
|
|
2456
|
+
...p
|
|
2457
|
+
}, ref) {
|
|
2458
|
+
const [value, setValue] = useControllable(
|
|
2459
|
+
checked,
|
|
2460
|
+
defaultChecked,
|
|
2461
|
+
onValueChange
|
|
2462
|
+
);
|
|
2463
|
+
return buttonView(
|
|
2464
|
+
{
|
|
2465
|
+
...p,
|
|
2466
|
+
ref,
|
|
2467
|
+
"aria-label": p["aria-label"] ?? (!p.children ? p.label : void 0),
|
|
2468
|
+
"aria-pressed": value,
|
|
2469
|
+
children: p.children ?? (p.icon ? null : p.label),
|
|
2470
|
+
label: void 0,
|
|
2471
|
+
onClick: (e) => {
|
|
2472
|
+
onClick?.(e);
|
|
2473
|
+
if (!e.defaultPrevented) setValue(!value);
|
|
2474
|
+
}
|
|
2475
|
+
},
|
|
2476
|
+
"ToggleButton"
|
|
2477
|
+
);
|
|
2478
|
+
});
|
|
2479
|
+
|
|
2198
2480
|
// src/components/media/RotaryKnob/RotaryKnob.tsx
|
|
2199
2481
|
import {
|
|
2200
2482
|
useEffect as useEffect8,
|
|
2201
|
-
useLayoutEffect as
|
|
2483
|
+
useLayoutEffect as useLayoutEffect4,
|
|
2202
2484
|
useMemo as useMemo6,
|
|
2203
|
-
useRef as
|
|
2204
|
-
useState as
|
|
2485
|
+
useRef as useRef13,
|
|
2486
|
+
useState as useState9
|
|
2205
2487
|
} from "react";
|
|
2206
2488
|
|
|
2207
2489
|
// src/core/noise.ts
|
|
@@ -2277,20 +2559,20 @@ function paintCanvas(key, width, height, painting) {
|
|
|
2277
2559
|
}
|
|
2278
2560
|
|
|
2279
2561
|
// src/components/media/RotaryKnob/RotaryKnob.tsx
|
|
2280
|
-
import { jsx as
|
|
2562
|
+
import { jsx as jsx29, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2281
2563
|
var RotaryKnob = (p) => {
|
|
2282
2564
|
const tr = useTr();
|
|
2283
|
-
const rootRef =
|
|
2284
|
-
const baseRef =
|
|
2285
|
-
const feedbackRef =
|
|
2286
|
-
const rotorRef =
|
|
2287
|
-
const controlRef =
|
|
2288
|
-
const readoutRef =
|
|
2289
|
-
const controllerRef =
|
|
2290
|
-
const onChangeRef =
|
|
2291
|
-
const onCommitRef =
|
|
2292
|
-
const disabledRef =
|
|
2293
|
-
const readOnlyRef =
|
|
2565
|
+
const rootRef = useRef13(null);
|
|
2566
|
+
const baseRef = useRef13(null);
|
|
2567
|
+
const feedbackRef = useRef13(null);
|
|
2568
|
+
const rotorRef = useRef13(null);
|
|
2569
|
+
const controlRef = useRef13(null);
|
|
2570
|
+
const readoutRef = useRef13(null);
|
|
2571
|
+
const controllerRef = useRef13(null);
|
|
2572
|
+
const onChangeRef = useRef13(p.onValueChange);
|
|
2573
|
+
const onCommitRef = useRef13(p.onValueCommit);
|
|
2574
|
+
const disabledRef = useRef13(!!p.disabled);
|
|
2575
|
+
const readOnlyRef = useRef13(!!p.readOnly);
|
|
2294
2576
|
const numberFormat = useMemo6(
|
|
2295
2577
|
() => new Intl.NumberFormat("ru-RU", { maximumFractionDigits: 1 }),
|
|
2296
2578
|
[]
|
|
@@ -2299,14 +2581,14 @@ var RotaryKnob = (p) => {
|
|
|
2299
2581
|
const span = (p.max ?? 100) - min || 1;
|
|
2300
2582
|
const toPosition = (value) => clamp((value - min) / span * 100);
|
|
2301
2583
|
const toValue = (position) => Math.round((min + position / 100 * span) * 1e6) / 1e6;
|
|
2302
|
-
const controlledPosition =
|
|
2584
|
+
const controlledPosition = useRef13(void 0);
|
|
2303
2585
|
controlledPosition.current = p.value === void 0 ? void 0 : toPosition(p.value);
|
|
2304
2586
|
const displayScale = p.displayScale ?? 1;
|
|
2305
2587
|
const format = (value) => `${numberFormat.format(value * displayScale)}${p.suffix ?? "%"}`;
|
|
2306
|
-
const scale =
|
|
2588
|
+
const scale = useRef13({ toValue, format });
|
|
2307
2589
|
scale.current = { toValue, format };
|
|
2308
|
-
const stepRef =
|
|
2309
|
-
const fineStepRef =
|
|
2590
|
+
const stepRef = useRef13(1);
|
|
2591
|
+
const fineStepRef = useRef13(0.1);
|
|
2310
2592
|
onChangeRef.current = p.onValueChange;
|
|
2311
2593
|
onCommitRef.current = p.onValueCommit;
|
|
2312
2594
|
disabledRef.current = !!p.disabled;
|
|
@@ -2314,11 +2596,11 @@ var RotaryKnob = (p) => {
|
|
|
2314
2596
|
stepRef.current = Math.max(1e-3, (p.step ?? span / 100) / span * 100);
|
|
2315
2597
|
fineStepRef.current = Math.max(1e-3, (p.fineStep ?? span / 1e3) / span * 100);
|
|
2316
2598
|
const initial = toPosition(p.value ?? p.defaultValue ?? min + span * 0.67);
|
|
2317
|
-
const initialRef =
|
|
2318
|
-
const resetRef =
|
|
2599
|
+
const initialRef = useRef13(initial);
|
|
2600
|
+
const resetRef = useRef13(void 0);
|
|
2319
2601
|
resetRef.current = p.resetValue === void 0 ? void 0 : toPosition(p.resetValue);
|
|
2320
2602
|
const diameter = p.diameter ?? { xs: 84, sm: 124, md: 220, lg: 320 }[normalizeSize(p.size) ?? "md"];
|
|
2321
|
-
|
|
2603
|
+
useLayoutEffect4(() => {
|
|
2322
2604
|
const root = rootRef.current;
|
|
2323
2605
|
const canvas = baseRef.current;
|
|
2324
2606
|
const rotor = rotorRef.current;
|
|
@@ -2991,8 +3273,8 @@ var RotaryKnob = (p) => {
|
|
|
2991
3273
|
if (p.value !== void 0)
|
|
2992
3274
|
controllerRef.current?.setValue(toPosition(p.value), false);
|
|
2993
3275
|
}, [p.value, min, span]);
|
|
2994
|
-
const [draft, setDraft] =
|
|
2995
|
-
const cancelled =
|
|
3276
|
+
const [draft, setDraft] = useState9(null);
|
|
3277
|
+
const cancelled = useRef13(false);
|
|
2996
3278
|
const editable = !p.disabled && !p.readOnly;
|
|
2997
3279
|
const applyDraft = () => {
|
|
2998
3280
|
if (cancelled.current) return;
|
|
@@ -3006,7 +3288,7 @@ var RotaryKnob = (p) => {
|
|
|
3006
3288
|
if (changed) controller.commit();
|
|
3007
3289
|
};
|
|
3008
3290
|
const rootProps = mark("RotaryKnob", p, void 0, "knob");
|
|
3009
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ jsxs20(
|
|
3010
3292
|
"div",
|
|
3011
3293
|
{
|
|
3012
3294
|
...rootProps,
|
|
@@ -3022,7 +3304,7 @@ var RotaryKnob = (p) => {
|
|
|
3022
3304
|
"--rotation": "0deg"
|
|
3023
3305
|
},
|
|
3024
3306
|
children: [
|
|
3025
|
-
/* @__PURE__ */
|
|
3307
|
+
/* @__PURE__ */ jsx29(
|
|
3026
3308
|
"canvas",
|
|
3027
3309
|
{
|
|
3028
3310
|
className: "knob__surface knob__base",
|
|
@@ -3030,7 +3312,7 @@ var RotaryKnob = (p) => {
|
|
|
3030
3312
|
ref: baseRef
|
|
3031
3313
|
}
|
|
3032
3314
|
),
|
|
3033
|
-
/* @__PURE__ */
|
|
3315
|
+
/* @__PURE__ */ jsx29(
|
|
3034
3316
|
"canvas",
|
|
3035
3317
|
{
|
|
3036
3318
|
className: "knob__surface knob__feedback",
|
|
@@ -3038,9 +3320,9 @@ var RotaryKnob = (p) => {
|
|
|
3038
3320
|
ref: feedbackRef
|
|
3039
3321
|
}
|
|
3040
3322
|
),
|
|
3041
|
-
/* @__PURE__ */
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsx29("span", { className: "knob__surface knob__rotor-frame", "aria-hidden": "true", children: /* @__PURE__ */ jsx29("canvas", { className: "knob__rotor", ref: rotorRef }) }),
|
|
3324
|
+
/* @__PURE__ */ jsx29("span", { className: "knob__sheen", "aria-hidden": "true" }),
|
|
3325
|
+
/* @__PURE__ */ jsx29(
|
|
3044
3326
|
"div",
|
|
3045
3327
|
{
|
|
3046
3328
|
ref: controlRef,
|
|
@@ -3055,10 +3337,10 @@ var RotaryKnob = (p) => {
|
|
|
3055
3337
|
"aria-valuenow": toValue(initial),
|
|
3056
3338
|
"aria-valuetext": format(toValue(initial)),
|
|
3057
3339
|
"aria-orientation": p.readOnly ? void 0 : "vertical",
|
|
3058
|
-
children: /* @__PURE__ */
|
|
3340
|
+
children: /* @__PURE__ */ jsx29("div", { className: "knob__indicator", "aria-hidden": "true", children: /* @__PURE__ */ jsx29("div", { className: "knob__slot" }) })
|
|
3059
3341
|
}
|
|
3060
3342
|
),
|
|
3061
|
-
p.showValue !== false && /* @__PURE__ */
|
|
3343
|
+
p.showValue !== false && /* @__PURE__ */ jsx29(
|
|
3062
3344
|
"div",
|
|
3063
3345
|
{
|
|
3064
3346
|
ref: readoutRef,
|
|
@@ -3076,7 +3358,7 @@ var RotaryKnob = (p) => {
|
|
|
3076
3358
|
children: format(toValue(initial))
|
|
3077
3359
|
}
|
|
3078
3360
|
),
|
|
3079
|
-
draft !== null && /* @__PURE__ */
|
|
3361
|
+
draft !== null && /* @__PURE__ */ jsx29(
|
|
3080
3362
|
"input",
|
|
3081
3363
|
{
|
|
3082
3364
|
className: "knob__input",
|
|
@@ -3096,8 +3378,8 @@ var RotaryKnob = (p) => {
|
|
|
3096
3378
|
}
|
|
3097
3379
|
}
|
|
3098
3380
|
),
|
|
3099
|
-
p.showLabel && p.label && /* @__PURE__ */
|
|
3100
|
-
/* @__PURE__ */
|
|
3381
|
+
p.showLabel && p.label && /* @__PURE__ */ jsx29("span", { className: "knob__label", "aria-hidden": "true", children: p.label }),
|
|
3382
|
+
/* @__PURE__ */ jsx29("span", { className: "ad-sr-only", children: "\u0417\u0430\u0436\u043C\u0438\u0442\u0435 \u0440\u0443\u0447\u043A\u0443 \u0431\u043B\u0438\u0436\u0435 \u043A \u043A\u0440\u0430\u044E \u0438 \u0432\u0435\u0434\u0438\u0442\u0435 \u043C\u044B\u0448\u044C\u044E \u043F\u043E \u043A\u0440\u0443\u0433\u0443. \u0417\u0430 \u0446\u0435\u043D\u0442\u0440 \u043C\u043E\u0436\u043D\u043E \u0442\u044F\u043D\u0443\u0442\u044C \u0432\u0432\u0435\u0440\u0445 \u0438\u043B\u0438 \u0432\u043D\u0438\u0437. \u041D\u0430\u0436\u0430\u0442\u0438\u0435 \u043D\u0430 \u0432\u043D\u0435\u0448\u043D\u044E\u044E \u0448\u043A\u0430\u043B\u0443 \u0443\u0441\u0442\u0430\u043D\u0430\u0432\u043B\u0438\u0432\u0430\u0435\u0442 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435. \u041A\u043E\u043B\u0435\u0441\u043E \u043C\u044B\u0448\u0438 \u0438 \u0441\u0442\u0440\u0435\u043B\u043A\u0438 \u043C\u0435\u043D\u044F\u044E\u0442 \u0433\u0440\u043E\u043C\u043A\u043E\u0441\u0442\u044C. Shift \u2014 \u0442\u043E\u0447\u043D\u0430\u044F \u0440\u0435\u0433\u0443\u043B\u0438\u0440\u043E\u0432\u043A\u0430. \u0414\u0432\u043E\u0439\u043D\u043E\u0439 \u0449\u0435\u043B\u0447\u043E\u043A \u2014 \u0438\u0441\u0445\u043E\u0434\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435." })
|
|
3101
3383
|
]
|
|
3102
3384
|
}
|
|
3103
3385
|
);
|
|
@@ -3109,10 +3391,10 @@ import {
|
|
|
3109
3391
|
useContext,
|
|
3110
3392
|
useEffect as useEffect9,
|
|
3111
3393
|
useMemo as useMemo7,
|
|
3112
|
-
useRef as
|
|
3113
|
-
useState as
|
|
3394
|
+
useRef as useRef14,
|
|
3395
|
+
useState as useState10
|
|
3114
3396
|
} from "react";
|
|
3115
|
-
import { jsx as
|
|
3397
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
3116
3398
|
var getPath = (value, path) => path.split(".").reduce((current, key) => current == null ? void 0 : Reflect.get(Object(current), key), value);
|
|
3117
3399
|
var setPath = (value, path, next) => {
|
|
3118
3400
|
const keys = path.split(".");
|
|
@@ -3129,8 +3411,8 @@ var setPath = (value, path, next) => {
|
|
|
3129
3411
|
return root;
|
|
3130
3412
|
};
|
|
3131
3413
|
function useForm(options) {
|
|
3132
|
-
const [values, setValues] =
|
|
3133
|
-
const previousInitialKey =
|
|
3414
|
+
const [values, setValues] = useState10(options.initialValues), [errors, setErrors] = useState10({}), [touched, setTouchedState] = useState10({}), [submitting, setSubmitting] = useState10(false), latest = useRef14(values), touchedRef = useRef14(touched), validationId = useRef14(0), submittingRef = useRef14(false), settings = useRef14(options), initialKey = useMemo7(() => JSON.stringify(options.initialValues), [options.initialValues]);
|
|
3415
|
+
const previousInitialKey = useRef14(initialKey);
|
|
3134
3416
|
settings.current = options;
|
|
3135
3417
|
useEffect9(() => {
|
|
3136
3418
|
if (previousInitialKey.current === initialKey) return;
|
|
@@ -3225,7 +3507,7 @@ function Form({
|
|
|
3225
3507
|
children,
|
|
3226
3508
|
className
|
|
3227
3509
|
}) {
|
|
3228
|
-
return /* @__PURE__ */
|
|
3510
|
+
return /* @__PURE__ */ jsx30(Context.Provider, { value: form, children: /* @__PURE__ */ jsx30(
|
|
3229
3511
|
"form",
|
|
3230
3512
|
{
|
|
3231
3513
|
className,
|
|
@@ -3245,7 +3527,7 @@ function useFormContext() {
|
|
|
3245
3527
|
|
|
3246
3528
|
// src/components/forms/FormFields/FormFields.tsx
|
|
3247
3529
|
import { memo } from "react";
|
|
3248
|
-
import { jsx as
|
|
3530
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
3249
3531
|
var defaultFieldRegistry = {
|
|
3250
3532
|
text: TextField,
|
|
3251
3533
|
number: NumberField,
|
|
@@ -3260,7 +3542,11 @@ var defaultFieldRegistry = {
|
|
|
3260
3542
|
people: PeoplePicker,
|
|
3261
3543
|
slider: Slider,
|
|
3262
3544
|
rotary: RotaryKnob,
|
|
3263
|
-
tags: TagInput
|
|
3545
|
+
tags: TagInput,
|
|
3546
|
+
theme: ThemePicker,
|
|
3547
|
+
toggle: ToggleButton,
|
|
3548
|
+
segmented: SegmentedControl,
|
|
3549
|
+
tabs: Tabs
|
|
3264
3550
|
};
|
|
3265
3551
|
var bindings = {
|
|
3266
3552
|
checked: (field) => ({ checked: Boolean(field.value), onValueChange: field.onValueChange }),
|
|
@@ -3284,6 +3570,7 @@ var bindings = {
|
|
|
3284
3570
|
var bindingKind = {
|
|
3285
3571
|
checkbox: "checked",
|
|
3286
3572
|
switch: "checked",
|
|
3573
|
+
toggle: "checked",
|
|
3287
3574
|
file: "file",
|
|
3288
3575
|
rotary: "rotary"
|
|
3289
3576
|
};
|
|
@@ -3294,7 +3581,7 @@ function FormFields({
|
|
|
3294
3581
|
gap = 3
|
|
3295
3582
|
}) {
|
|
3296
3583
|
const form = useFormContext();
|
|
3297
|
-
return /* @__PURE__ */
|
|
3584
|
+
return /* @__PURE__ */ jsx31(Grid, { columns, gap, align: "center", className: "ad-form-fields", children: fields.filter((field) => field.showWhen?.(form.values) ?? true).map((field) => /* @__PURE__ */ jsx31(
|
|
3298
3585
|
StableSlot,
|
|
3299
3586
|
{
|
|
3300
3587
|
field,
|
|
@@ -3309,11 +3596,13 @@ function Slot({
|
|
|
3309
3596
|
form,
|
|
3310
3597
|
registry
|
|
3311
3598
|
}) {
|
|
3599
|
+
if (field.kind === "custom") return /* @__PURE__ */ jsx31(Grid, { span: field.span ?? "full", className: "ad-form-field", "data-custom": "", children: field.render(form.field(field.name), form) });
|
|
3312
3600
|
const kind = field.kind ?? "text", Component = registry[kind] ?? registry.text, props = bindings[bindingKind[kind] ?? "value"](form.field(field.name), kind);
|
|
3313
|
-
return /* @__PURE__ */
|
|
3601
|
+
return /* @__PURE__ */ jsx31(Grid, { span: field.span ?? "full", className: "ad-form-field", children: /* @__PURE__ */ jsx31(Component, { label: field.label, ...field.props, ...props }) });
|
|
3314
3602
|
}
|
|
3315
3603
|
var StableSlot = /* @__PURE__ */ memo(Slot, (previous, next) => {
|
|
3316
3604
|
if (previous.field !== next.field || previous.registry !== next.registry) return false;
|
|
3605
|
+
if (next.field.kind === "custom") return previous.form === next.form;
|
|
3317
3606
|
const before = previous.form.field(previous.field.name);
|
|
3318
3607
|
const after = next.form.field(next.field.name);
|
|
3319
3608
|
return Object.is(before.value, after.value) && before.error === after.error && before.touched === after.touched;
|
|
@@ -3338,6 +3627,9 @@ export {
|
|
|
3338
3627
|
BooleanControl,
|
|
3339
3628
|
Button,
|
|
3340
3629
|
FilePicker,
|
|
3630
|
+
Tab,
|
|
3631
|
+
Tabs,
|
|
3632
|
+
SegmentedControl,
|
|
3341
3633
|
Slider,
|
|
3342
3634
|
Switch,
|
|
3343
3635
|
spacing,
|
|
@@ -3354,6 +3646,9 @@ export {
|
|
|
3354
3646
|
Checkbox,
|
|
3355
3647
|
NumberField,
|
|
3356
3648
|
Select,
|
|
3649
|
+
ImageShine,
|
|
3650
|
+
ThemePicker,
|
|
3651
|
+
ToggleButton,
|
|
3357
3652
|
clamp01,
|
|
3358
3653
|
seeded,
|
|
3359
3654
|
noise,
|