@aviala-design/spiral 2.7.1 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component-changelogs.json +10 -0
- package/dist/index.cjs +539 -520
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.js +512 -491
- package/dist/index.js.map +1 -1
- package/dist/props.json +1 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -208,6 +208,7 @@ __export(index_exports, {
|
|
|
208
208
|
useDirection: () => useDirection,
|
|
209
209
|
useLocale: () => useLocale,
|
|
210
210
|
useLocaleMessages: () => useLocaleMessages,
|
|
211
|
+
useResolvedControlError: () => useResolvedControlError,
|
|
211
212
|
useRtl: () => useRtl,
|
|
212
213
|
useTheme: () => useTheme,
|
|
213
214
|
useThemeLayoutKey: () => useThemeLayoutKey,
|
|
@@ -1144,7 +1145,7 @@ Button.displayName = "Button";
|
|
|
1144
1145
|
|
|
1145
1146
|
// src/components/input.tsx
|
|
1146
1147
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
1147
|
-
var
|
|
1148
|
+
var import_react15 = require("react");
|
|
1148
1149
|
|
|
1149
1150
|
// src/lib/render-slot-icon.tsx
|
|
1150
1151
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
@@ -1283,8 +1284,227 @@ var Badge = (0, import_react12.forwardRef)(
|
|
|
1283
1284
|
);
|
|
1284
1285
|
Badge.displayName = "Badge";
|
|
1285
1286
|
|
|
1286
|
-
// src/components/
|
|
1287
|
+
// src/components/form-field.tsx
|
|
1288
|
+
var import_icons4 = require("@aviala-design/icons");
|
|
1289
|
+
var import_react14 = require("react");
|
|
1290
|
+
var import_react_hook_form = require("react-hook-form");
|
|
1291
|
+
|
|
1292
|
+
// src/components/typeface.tsx
|
|
1293
|
+
var import_react13 = require("react");
|
|
1287
1294
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1295
|
+
var typefaceLayouts = {
|
|
1296
|
+
allCustom: [
|
|
1297
|
+
{ level: "text", children: null },
|
|
1298
|
+
{ level: "caption", children: null }
|
|
1299
|
+
],
|
|
1300
|
+
textCaption: [
|
|
1301
|
+
{ level: "text", children: null },
|
|
1302
|
+
{ level: "caption", children: null }
|
|
1303
|
+
],
|
|
1304
|
+
textCaptionSubtitle: [
|
|
1305
|
+
{ level: "subtitle", children: null },
|
|
1306
|
+
{ level: "text", children: null },
|
|
1307
|
+
{ level: "caption", children: null }
|
|
1308
|
+
],
|
|
1309
|
+
textTitle: [
|
|
1310
|
+
{ level: "title", children: null },
|
|
1311
|
+
{ level: "text", children: null }
|
|
1312
|
+
],
|
|
1313
|
+
textHeadline2: [
|
|
1314
|
+
{ level: "headline2", children: null },
|
|
1315
|
+
{ level: "text", children: null }
|
|
1316
|
+
],
|
|
1317
|
+
textHeadline1: [
|
|
1318
|
+
{ level: "headline1", children: null },
|
|
1319
|
+
{ level: "text", children: null }
|
|
1320
|
+
]
|
|
1321
|
+
};
|
|
1322
|
+
var Typeface = (0, import_react13.forwardRef)(
|
|
1323
|
+
({
|
|
1324
|
+
className,
|
|
1325
|
+
content = "allCustom",
|
|
1326
|
+
primary,
|
|
1327
|
+
secondary,
|
|
1328
|
+
tertiary,
|
|
1329
|
+
primaryContent = "text",
|
|
1330
|
+
secondaryContent = "text",
|
|
1331
|
+
tertiaryContent = "text",
|
|
1332
|
+
tone = "default",
|
|
1333
|
+
children,
|
|
1334
|
+
...props
|
|
1335
|
+
}, ref) => {
|
|
1336
|
+
const layout = typefaceLayouts[content];
|
|
1337
|
+
const values = resolveTypefaceValues(content, primary, secondary, tertiary, children);
|
|
1338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { ref, className: cn("aviala-typeface", className), "data-content": content, ...props, children: layout.map((line, index) => {
|
|
1339
|
+
const value = values[index];
|
|
1340
|
+
if (value === void 0 || value === null || value === false) return null;
|
|
1341
|
+
const lineContent = index === 0 ? primaryContent : index === 1 ? secondaryContent : tertiaryContent;
|
|
1342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "aviala-typeface__line", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Typography, { level: line.level, content: lineContent, tone, children: value }) }, `${line.level}-${index}`);
|
|
1343
|
+
}) });
|
|
1344
|
+
}
|
|
1345
|
+
);
|
|
1346
|
+
Typeface.displayName = "Typeface";
|
|
1347
|
+
function resolveTypefaceValues(content, primary, secondary, tertiary, children) {
|
|
1348
|
+
if (primary !== void 0 || secondary !== void 0 || tertiary !== void 0) {
|
|
1349
|
+
return [primary, secondary, tertiary];
|
|
1350
|
+
}
|
|
1351
|
+
if (children == null || children === false) {
|
|
1352
|
+
return typefaceLayouts[content].map(() => "Text");
|
|
1353
|
+
}
|
|
1354
|
+
if (Array.isArray(children)) {
|
|
1355
|
+
return children;
|
|
1356
|
+
}
|
|
1357
|
+
return [children];
|
|
1358
|
+
}
|
|
1359
|
+
var TypefacePair = (0, import_react13.forwardRef)(
|
|
1360
|
+
({ title, description, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1361
|
+
Typeface,
|
|
1362
|
+
{
|
|
1363
|
+
ref,
|
|
1364
|
+
content: "textCaption",
|
|
1365
|
+
primary: title,
|
|
1366
|
+
secondary: description,
|
|
1367
|
+
...props
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
);
|
|
1371
|
+
TypefacePair.displayName = "TypefacePair";
|
|
1372
|
+
|
|
1373
|
+
// src/components/form-field.tsx
|
|
1374
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1375
|
+
var FormFieldControlContext = (0, import_react14.createContext)(null);
|
|
1376
|
+
function useResolvedControlError(errorProp) {
|
|
1377
|
+
const ctx = (0, import_react14.useContext)(FormFieldControlContext);
|
|
1378
|
+
return errorProp ?? ctx?.invalid ?? false;
|
|
1379
|
+
}
|
|
1380
|
+
var FormFieldLayout = (0, import_react14.forwardRef)(
|
|
1381
|
+
({
|
|
1382
|
+
className,
|
|
1383
|
+
label,
|
|
1384
|
+
htmlFor,
|
|
1385
|
+
description,
|
|
1386
|
+
error,
|
|
1387
|
+
info,
|
|
1388
|
+
alert,
|
|
1389
|
+
required,
|
|
1390
|
+
direction = "vertical",
|
|
1391
|
+
children,
|
|
1392
|
+
...props
|
|
1393
|
+
}, ref) => {
|
|
1394
|
+
const reactId = (0, import_react14.useId)();
|
|
1395
|
+
const labelId = `${reactId}-label`;
|
|
1396
|
+
const hasLabel = label != null && label !== "";
|
|
1397
|
+
const invalid = Boolean(error);
|
|
1398
|
+
const controlContext = (0, import_react14.useMemo)(() => ({ invalid }), [invalid]);
|
|
1399
|
+
const labelNode = hasLabel || description ? htmlFor ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor, className: "aviala-form__label aviala-form__label--control", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1400
|
+
Typeface,
|
|
1401
|
+
{
|
|
1402
|
+
id: labelId,
|
|
1403
|
+
content: "textCaption",
|
|
1404
|
+
primary: hasLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1405
|
+
label,
|
|
1406
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "aviala-form__required", "aria-hidden": true, children: "*" }) : null
|
|
1407
|
+
] }) : void 0,
|
|
1408
|
+
secondary: description
|
|
1409
|
+
}
|
|
1410
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1411
|
+
Typeface,
|
|
1412
|
+
{
|
|
1413
|
+
id: labelId,
|
|
1414
|
+
className: "aviala-form__label",
|
|
1415
|
+
content: "textCaption",
|
|
1416
|
+
primary: hasLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
1417
|
+
label,
|
|
1418
|
+
required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "aviala-form__required", "aria-hidden": true, children: "*" }) : null
|
|
1419
|
+
] }) : void 0,
|
|
1420
|
+
secondary: description
|
|
1421
|
+
}
|
|
1422
|
+
) : null;
|
|
1423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1424
|
+
"div",
|
|
1425
|
+
{
|
|
1426
|
+
ref,
|
|
1427
|
+
className: cn("aviala-form", className),
|
|
1428
|
+
"data-direction": direction,
|
|
1429
|
+
"aria-labelledby": hasLabel ? labelId : void 0,
|
|
1430
|
+
...props,
|
|
1431
|
+
children: [
|
|
1432
|
+
labelNode,
|
|
1433
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "aviala-form__content", children: [
|
|
1434
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FormFieldControlContext.Provider, { value: controlContext, children }),
|
|
1435
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "aviala-form__message aviala-form__message--error", role: "alert", children: [
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1437
|
+
import_icons4.SymbolWrongCircle,
|
|
1438
|
+
{
|
|
1439
|
+
className: "aviala-form__message-icon",
|
|
1440
|
+
width: 14,
|
|
1441
|
+
height: 14,
|
|
1442
|
+
"aria-hidden": true
|
|
1443
|
+
}
|
|
1444
|
+
),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Typography, { level: "caption", as: "p", className: "aviala-form__message-text", children: error })
|
|
1446
|
+
] }) : null,
|
|
1447
|
+
info ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "aviala-form__message aviala-form__message--info", children: [
|
|
1448
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1449
|
+
import_icons4.SymbolInformationCircle,
|
|
1450
|
+
{
|
|
1451
|
+
className: "aviala-form__message-icon",
|
|
1452
|
+
width: 14,
|
|
1453
|
+
height: 14,
|
|
1454
|
+
"aria-hidden": true
|
|
1455
|
+
}
|
|
1456
|
+
),
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Typography, { level: "caption", as: "p", className: "aviala-form__message-text", children: info })
|
|
1458
|
+
] }) : null,
|
|
1459
|
+
alert ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "aviala-form__alert", children: alert }) : null
|
|
1460
|
+
] })
|
|
1461
|
+
]
|
|
1462
|
+
}
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1465
|
+
);
|
|
1466
|
+
FormFieldLayout.displayName = "FormFieldLayout";
|
|
1467
|
+
var FormFieldControlled = (0, import_react14.forwardRef)(
|
|
1468
|
+
({
|
|
1469
|
+
control,
|
|
1470
|
+
name,
|
|
1471
|
+
rules,
|
|
1472
|
+
defaultValue,
|
|
1473
|
+
shouldUnregister,
|
|
1474
|
+
disabled,
|
|
1475
|
+
render,
|
|
1476
|
+
error,
|
|
1477
|
+
...layoutProps
|
|
1478
|
+
}, ref) => {
|
|
1479
|
+
const id = (0, import_react14.useId)();
|
|
1480
|
+
const { field, fieldState, formState } = (0, import_react_hook_form.useController)({
|
|
1481
|
+
name,
|
|
1482
|
+
control,
|
|
1483
|
+
rules,
|
|
1484
|
+
defaultValue,
|
|
1485
|
+
shouldUnregister,
|
|
1486
|
+
disabled
|
|
1487
|
+
});
|
|
1488
|
+
const message = error !== void 0 ? error : fieldState.error?.message ?? null;
|
|
1489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FormFieldLayout, { ref, ...layoutProps, htmlFor: id, error: message, children: render({ field, fieldState, formState, id }) });
|
|
1490
|
+
}
|
|
1491
|
+
);
|
|
1492
|
+
FormFieldControlled.displayName = "FormFieldControlled";
|
|
1493
|
+
function isControlledProps(props) {
|
|
1494
|
+
return "render" in props && typeof props.render === "function" && "name" in props;
|
|
1495
|
+
}
|
|
1496
|
+
var FormFieldRoot = (0, import_react14.forwardRef)((props, ref) => {
|
|
1497
|
+
if (isControlledProps(props)) {
|
|
1498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FormFieldControlled, { ref, ...props });
|
|
1499
|
+
}
|
|
1500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FormFieldLayout, { ref, ...props });
|
|
1501
|
+
});
|
|
1502
|
+
var FormField = FormFieldRoot;
|
|
1503
|
+
FormField.displayName = "FormField";
|
|
1504
|
+
var Form = import_react_hook_form.FormProvider;
|
|
1505
|
+
|
|
1506
|
+
// src/components/input.tsx
|
|
1507
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1288
1508
|
function resolveInputState(value, defaultValue, focused) {
|
|
1289
1509
|
const current = value ?? defaultValue ?? "";
|
|
1290
1510
|
if (String(current).length === 0) return "empty";
|
|
@@ -1303,9 +1523,9 @@ var inputRootVariants = (0, import_class_variance_authority5.cva)("aviala-input
|
|
|
1303
1523
|
});
|
|
1304
1524
|
function renderBadgeArea(node) {
|
|
1305
1525
|
if (node == null || node === false) return null;
|
|
1306
|
-
return /* @__PURE__ */ (0,
|
|
1526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "aviala-input__badge-area", children: (0, import_react15.isValidElement)(node) && node.type === Badge ? node : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Badge, { children: node }) });
|
|
1307
1527
|
}
|
|
1308
|
-
var Input = (0,
|
|
1528
|
+
var Input = (0, import_react15.forwardRef)(
|
|
1309
1529
|
({
|
|
1310
1530
|
className,
|
|
1311
1531
|
size = "regular",
|
|
@@ -1315,7 +1535,7 @@ var Input = (0, import_react13.forwardRef)(
|
|
|
1315
1535
|
leftBadge,
|
|
1316
1536
|
rightBadge,
|
|
1317
1537
|
fullWidth = true,
|
|
1318
|
-
error
|
|
1538
|
+
error,
|
|
1319
1539
|
disabled,
|
|
1320
1540
|
type = "text",
|
|
1321
1541
|
value,
|
|
@@ -1325,29 +1545,30 @@ var Input = (0, import_react13.forwardRef)(
|
|
|
1325
1545
|
onBlur,
|
|
1326
1546
|
...props
|
|
1327
1547
|
}, ref) => {
|
|
1328
|
-
const [focused, setFocused] = (0,
|
|
1329
|
-
const [internalValue, setInternalValue] = (0,
|
|
1548
|
+
const [focused, setFocused] = (0, import_react15.useState)(false);
|
|
1549
|
+
const [internalValue, setInternalValue] = (0, import_react15.useState)(() => String(defaultValue ?? ""));
|
|
1330
1550
|
const resolvedValue = value !== void 0 ? String(value) : internalValue;
|
|
1331
1551
|
const inputState = resolveInputState(resolvedValue, void 0, focused);
|
|
1332
|
-
|
|
1552
|
+
const resolvedError = useResolvedControlError(error);
|
|
1553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1333
1554
|
"div",
|
|
1334
1555
|
{
|
|
1335
1556
|
className: cn(inputRootVariants({ fullWidth }), className),
|
|
1336
1557
|
"data-size": size,
|
|
1337
1558
|
"data-all-round": allRound ? "true" : void 0,
|
|
1338
1559
|
"data-input-state": inputState,
|
|
1339
|
-
"data-error":
|
|
1560
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
1340
1561
|
"data-disabled": disabled ? "true" : void 0,
|
|
1341
1562
|
...spiralDebugId("input"),
|
|
1342
1563
|
children: [
|
|
1343
1564
|
renderSlotIcon(leftIcon, "aviala-input__slot", "input.left-icon"),
|
|
1344
1565
|
renderBadgeArea(leftBadge),
|
|
1345
|
-
/* @__PURE__ */ (0,
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1346
1567
|
"div",
|
|
1347
1568
|
{
|
|
1348
1569
|
className: "aviala-input__field relative z-[1] flex min-w-0 flex-1 flex-col justify-center",
|
|
1349
1570
|
...spiralDebugId("input.field"),
|
|
1350
|
-
children: /* @__PURE__ */ (0,
|
|
1571
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1351
1572
|
"input",
|
|
1352
1573
|
{
|
|
1353
1574
|
ref,
|
|
@@ -1355,7 +1576,7 @@ var Input = (0, import_react13.forwardRef)(
|
|
|
1355
1576
|
disabled,
|
|
1356
1577
|
value,
|
|
1357
1578
|
defaultValue,
|
|
1358
|
-
"aria-invalid":
|
|
1579
|
+
"aria-invalid": resolvedError || void 0,
|
|
1359
1580
|
className: cn(
|
|
1360
1581
|
typographyVariants({ level: "text" }),
|
|
1361
1582
|
"w-full min-w-0 border-0 bg-transparent p-0 text-[var(--input-fg,#343333)] outline-none",
|
|
@@ -1390,9 +1611,9 @@ var Input = (0, import_react13.forwardRef)(
|
|
|
1390
1611
|
Input.displayName = "Input";
|
|
1391
1612
|
|
|
1392
1613
|
// src/components/number-input.tsx
|
|
1393
|
-
var
|
|
1394
|
-
var
|
|
1395
|
-
var
|
|
1614
|
+
var import_icons5 = require("@aviala-design/icons");
|
|
1615
|
+
var import_react16 = require("react");
|
|
1616
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1396
1617
|
function assignRef(ref, value) {
|
|
1397
1618
|
if (!ref) return;
|
|
1398
1619
|
if (typeof ref === "function") {
|
|
@@ -1436,10 +1657,10 @@ function decimalPlaces(n) {
|
|
|
1436
1657
|
}
|
|
1437
1658
|
function renderBadgeArea2(node) {
|
|
1438
1659
|
if (node == null || node === false) return null;
|
|
1439
|
-
return /* @__PURE__ */ (0,
|
|
1660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "aviala-input__badge-area", children: (0, import_react16.isValidElement)(node) && node.type === Badge ? node : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Badge, { children: node }) });
|
|
1440
1661
|
}
|
|
1441
1662
|
var numberInputRootVariants = inputRootVariants;
|
|
1442
|
-
var NumberInput = (0,
|
|
1663
|
+
var NumberInput = (0, import_react16.forwardRef)(
|
|
1443
1664
|
({
|
|
1444
1665
|
className,
|
|
1445
1666
|
size = "regular",
|
|
@@ -1451,7 +1672,7 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1451
1672
|
rightBadge,
|
|
1452
1673
|
showControls = true,
|
|
1453
1674
|
fullWidth = true,
|
|
1454
|
-
error
|
|
1675
|
+
error,
|
|
1455
1676
|
disabled,
|
|
1456
1677
|
value,
|
|
1457
1678
|
defaultValue,
|
|
@@ -1466,14 +1687,15 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1466
1687
|
...props
|
|
1467
1688
|
}, ref) => {
|
|
1468
1689
|
const locale = useLocaleMessages("NumberInput");
|
|
1469
|
-
const inputRef = (0,
|
|
1470
|
-
const [focused, setFocused] = (0,
|
|
1471
|
-
const [internalValue, setInternalValue] = (0,
|
|
1690
|
+
const inputRef = (0, import_react16.useRef)(null);
|
|
1691
|
+
const [focused, setFocused] = (0, import_react16.useState)(false);
|
|
1692
|
+
const [internalValue, setInternalValue] = (0, import_react16.useState)(
|
|
1472
1693
|
() => defaultValue === void 0 || defaultValue === null ? "" : String(defaultValue)
|
|
1473
1694
|
);
|
|
1474
1695
|
const isControlled = value !== void 0;
|
|
1475
1696
|
const resolvedValue = isControlled ? value === "" || value === null || value === void 0 ? "" : String(value) : internalValue;
|
|
1476
1697
|
const inputState = resolveInputState2(resolvedValue, void 0, focused);
|
|
1698
|
+
const resolvedError = useResolvedControlError(error);
|
|
1477
1699
|
const numeric = parseNumeric(resolvedValue);
|
|
1478
1700
|
const stepAmount = Number.isFinite(step) && step !== 0 ? Math.abs(step) : 1;
|
|
1479
1701
|
const commitString = (next) => {
|
|
@@ -1490,7 +1712,7 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1490
1712
|
commitString(String(next));
|
|
1491
1713
|
inputRef.current?.focus();
|
|
1492
1714
|
};
|
|
1493
|
-
return /* @__PURE__ */ (0,
|
|
1715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1494
1716
|
"div",
|
|
1495
1717
|
{
|
|
1496
1718
|
className: cn(
|
|
@@ -1502,18 +1724,18 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1502
1724
|
"data-all-round": allRound ? "true" : void 0,
|
|
1503
1725
|
"data-input-state": inputState,
|
|
1504
1726
|
"data-input-style": inputStyle,
|
|
1505
|
-
"data-error":
|
|
1727
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
1506
1728
|
"data-disabled": disabled ? "true" : void 0,
|
|
1507
1729
|
...spiralDebugId("number-input"),
|
|
1508
1730
|
children: [
|
|
1509
1731
|
renderSlotIcon(leftIcon, "aviala-input__slot", "number-input.left-icon"),
|
|
1510
1732
|
renderBadgeArea2(leftBadge),
|
|
1511
|
-
/* @__PURE__ */ (0,
|
|
1733
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1512
1734
|
"div",
|
|
1513
1735
|
{
|
|
1514
1736
|
className: "aviala-input__field relative z-[1] flex min-w-0 flex-1 flex-col justify-center",
|
|
1515
1737
|
...spiralDebugId("number-input.field"),
|
|
1516
|
-
children: /* @__PURE__ */ (0,
|
|
1738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1517
1739
|
"input",
|
|
1518
1740
|
{
|
|
1519
1741
|
ref: (node) => {
|
|
@@ -1527,7 +1749,7 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1527
1749
|
step: stepAmount,
|
|
1528
1750
|
min,
|
|
1529
1751
|
max,
|
|
1530
|
-
"aria-invalid":
|
|
1752
|
+
"aria-invalid": resolvedError || void 0,
|
|
1531
1753
|
className: cn(
|
|
1532
1754
|
typographyVariants({ level: "text" }),
|
|
1533
1755
|
"aviala-number-input__input w-full min-w-0 border-0 bg-transparent p-0 text-[var(--input-fg,#343333)] outline-none",
|
|
@@ -1572,13 +1794,13 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1572
1794
|
),
|
|
1573
1795
|
renderBadgeArea2(rightBadge),
|
|
1574
1796
|
renderSlotIcon(rightIcon, "aviala-input__slot", "number-input.right-icon"),
|
|
1575
|
-
showControls ? /* @__PURE__ */ (0,
|
|
1797
|
+
showControls ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1576
1798
|
"div",
|
|
1577
1799
|
{
|
|
1578
1800
|
className: "aviala-number-input__controls",
|
|
1579
1801
|
...spiralDebugId("number-input.controls"),
|
|
1580
1802
|
children: [
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1803
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1582
1804
|
"button",
|
|
1583
1805
|
{
|
|
1584
1806
|
type: "button",
|
|
@@ -1589,10 +1811,10 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1589
1811
|
onMouseDown: (event) => event.preventDefault(),
|
|
1590
1812
|
onClick: () => applyStep(1),
|
|
1591
1813
|
...spiralDebugId("number-input.step-up"),
|
|
1592
|
-
children: /* @__PURE__ */ (0,
|
|
1814
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons5.DirectionArrowUpLight, { level: "text", biggerSize: true, "aria-hidden": true })
|
|
1593
1815
|
}
|
|
1594
1816
|
),
|
|
1595
|
-
/* @__PURE__ */ (0,
|
|
1817
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1596
1818
|
"button",
|
|
1597
1819
|
{
|
|
1598
1820
|
type: "button",
|
|
@@ -1603,7 +1825,7 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1603
1825
|
onMouseDown: (event) => event.preventDefault(),
|
|
1604
1826
|
onClick: () => applyStep(-1),
|
|
1605
1827
|
...spiralDebugId("number-input.step-down"),
|
|
1606
|
-
children: /* @__PURE__ */ (0,
|
|
1828
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_icons5.DirectionArrowDownLight, { level: "text", biggerSize: true, "aria-hidden": true })
|
|
1607
1829
|
}
|
|
1608
1830
|
)
|
|
1609
1831
|
]
|
|
@@ -1617,9 +1839,9 @@ var NumberInput = (0, import_react14.forwardRef)(
|
|
|
1617
1839
|
NumberInput.displayName = "NumberInput";
|
|
1618
1840
|
|
|
1619
1841
|
// src/components/textarea.tsx
|
|
1620
|
-
var
|
|
1621
|
-
var
|
|
1622
|
-
var
|
|
1842
|
+
var import_icons6 = require("@aviala-design/icons");
|
|
1843
|
+
var import_react17 = require("react");
|
|
1844
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1623
1845
|
function assignRef2(ref, value) {
|
|
1624
1846
|
if (!ref) return;
|
|
1625
1847
|
if (typeof ref === "function") {
|
|
@@ -1633,7 +1855,7 @@ function resolveTextareaState(value, defaultValue, focused) {
|
|
|
1633
1855
|
if (String(current).length === 0) return "empty";
|
|
1634
1856
|
return focused ? "typing" : "fill";
|
|
1635
1857
|
}
|
|
1636
|
-
var Textarea = (0,
|
|
1858
|
+
var Textarea = (0, import_react17.forwardRef)(
|
|
1637
1859
|
({
|
|
1638
1860
|
className,
|
|
1639
1861
|
size = "regular",
|
|
@@ -1641,7 +1863,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1641
1863
|
rightIcon,
|
|
1642
1864
|
showController: showControllerProp,
|
|
1643
1865
|
maxLength,
|
|
1644
|
-
error
|
|
1866
|
+
error,
|
|
1645
1867
|
disabled,
|
|
1646
1868
|
value,
|
|
1647
1869
|
defaultValue,
|
|
@@ -1652,24 +1874,25 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1652
1874
|
...props
|
|
1653
1875
|
}, ref) => {
|
|
1654
1876
|
const locale = useLocaleMessages("Textarea");
|
|
1655
|
-
const rootRef = (0,
|
|
1656
|
-
const textareaRef = (0,
|
|
1657
|
-
const [focused, setFocused] = (0,
|
|
1658
|
-
const [internalValue, setInternalValue] = (0,
|
|
1659
|
-
const [resizing, setResizing] = (0,
|
|
1877
|
+
const rootRef = (0, import_react17.useRef)(null);
|
|
1878
|
+
const textareaRef = (0, import_react17.useRef)(null);
|
|
1879
|
+
const [focused, setFocused] = (0, import_react17.useState)(false);
|
|
1880
|
+
const [internalValue, setInternalValue] = (0, import_react17.useState)(() => String(defaultValue ?? ""));
|
|
1881
|
+
const [resizing, setResizing] = (0, import_react17.useState)(false);
|
|
1660
1882
|
const showController = showControllerProp ?? maxLength !== void 0;
|
|
1661
1883
|
const resolvedSize = size ?? "regular";
|
|
1662
1884
|
const resolvedValue = value !== void 0 ? String(value) : internalValue;
|
|
1663
1885
|
const displayLength = resolvedValue.length;
|
|
1664
1886
|
const inputState = resolveTextareaState(resolvedValue, void 0, focused);
|
|
1665
|
-
const
|
|
1887
|
+
const resolvedError = useResolvedControlError(error);
|
|
1888
|
+
const setTextareaRef = (0, import_react17.useCallback)(
|
|
1666
1889
|
(node) => {
|
|
1667
1890
|
textareaRef.current = node;
|
|
1668
1891
|
assignRef2(ref, node);
|
|
1669
1892
|
},
|
|
1670
1893
|
[ref]
|
|
1671
1894
|
);
|
|
1672
|
-
const handleShellMouseDown = (0,
|
|
1895
|
+
const handleShellMouseDown = (0, import_react17.useCallback)(
|
|
1673
1896
|
(event) => {
|
|
1674
1897
|
if (disabled) return;
|
|
1675
1898
|
const target = event.target;
|
|
@@ -1681,7 +1904,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1681
1904
|
},
|
|
1682
1905
|
[disabled]
|
|
1683
1906
|
);
|
|
1684
|
-
const handleResizePointerDown = (0,
|
|
1907
|
+
const handleResizePointerDown = (0, import_react17.useCallback)(
|
|
1685
1908
|
(event) => {
|
|
1686
1909
|
if (disabled || event.button !== 0) return;
|
|
1687
1910
|
const root = rootRef.current;
|
|
@@ -1719,7 +1942,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1719
1942
|
},
|
|
1720
1943
|
[disabled]
|
|
1721
1944
|
);
|
|
1722
|
-
(0,
|
|
1945
|
+
(0, import_react17.useEffect)(() => {
|
|
1723
1946
|
if (!resizing) return;
|
|
1724
1947
|
const previous = document.body.style.cursor;
|
|
1725
1948
|
const previousUserSelect = document.body.style.userSelect;
|
|
@@ -1730,14 +1953,14 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1730
1953
|
document.body.style.userSelect = previousUserSelect;
|
|
1731
1954
|
};
|
|
1732
1955
|
}, [resizing]);
|
|
1733
|
-
return /* @__PURE__ */ (0,
|
|
1956
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1734
1957
|
"div",
|
|
1735
1958
|
{
|
|
1736
1959
|
ref: rootRef,
|
|
1737
1960
|
className: cn("aviala-textarea", className),
|
|
1738
1961
|
"data-size": resolvedSize,
|
|
1739
1962
|
"data-input-state": inputState,
|
|
1740
|
-
"data-error":
|
|
1963
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
1741
1964
|
"data-has-controller": showController ? "true" : void 0,
|
|
1742
1965
|
"data-disabled": disabled ? "true" : void 0,
|
|
1743
1966
|
"data-resizing": resizing ? "true" : void 0,
|
|
@@ -1746,7 +1969,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1746
1969
|
...spiralDebugId("textarea"),
|
|
1747
1970
|
children: [
|
|
1748
1971
|
renderSlotIcon(leftIcon, "aviala-textarea__slot", "textarea.left-icon"),
|
|
1749
|
-
/* @__PURE__ */ (0,
|
|
1972
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "aviala-textarea__field", ...spiralDebugId("textarea.field"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1750
1973
|
"textarea",
|
|
1751
1974
|
{
|
|
1752
1975
|
ref: setTextareaRef,
|
|
@@ -1754,7 +1977,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1754
1977
|
maxLength,
|
|
1755
1978
|
value,
|
|
1756
1979
|
defaultValue,
|
|
1757
|
-
"aria-invalid":
|
|
1980
|
+
"aria-invalid": resolvedError || void 0,
|
|
1758
1981
|
className: cn("aviala-textarea__input", typographyVariants({ level: "text" })),
|
|
1759
1982
|
onChange: (event) => {
|
|
1760
1983
|
if (value === void 0) {
|
|
@@ -1774,8 +1997,8 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1774
1997
|
}
|
|
1775
1998
|
) }),
|
|
1776
1999
|
renderSlotIcon(rightIcon, "aviala-textarea__slot", "textarea.right-icon"),
|
|
1777
|
-
showController ? /* @__PURE__ */ (0,
|
|
1778
|
-
/* @__PURE__ */ (0,
|
|
2000
|
+
showController ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "aviala-textarea__controller", ...spiralDebugId("textarea.controller"), children: [
|
|
2001
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1779
2002
|
"span",
|
|
1780
2003
|
{
|
|
1781
2004
|
className: cn("aviala-textarea__counter", typographyVariants({ level: "caption" })),
|
|
@@ -1786,7 +2009,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1786
2009
|
]
|
|
1787
2010
|
}
|
|
1788
2011
|
),
|
|
1789
|
-
/* @__PURE__ */ (0,
|
|
2012
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1790
2013
|
"button",
|
|
1791
2014
|
{
|
|
1792
2015
|
type: "button",
|
|
@@ -1796,7 +2019,7 @@ var Textarea = (0, import_react15.forwardRef)(
|
|
|
1796
2019
|
tabIndex: disabled ? -1 : 0,
|
|
1797
2020
|
onPointerDown: handleResizePointerDown,
|
|
1798
2021
|
...spiralDebugId("textarea.resize"),
|
|
1799
|
-
children: /* @__PURE__ */ (0,
|
|
2022
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_icons6.SymbolResize, { thickness: "Regular", mode: "default", "aria-hidden": true })
|
|
1800
2023
|
}
|
|
1801
2024
|
)
|
|
1802
2025
|
] }) : null
|
|
@@ -1810,13 +2033,13 @@ Textarea.displayName = "Textarea";
|
|
|
1810
2033
|
// src/components/select.tsx
|
|
1811
2034
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
1812
2035
|
var SelectPrimitive = __toESM(require("@radix-ui/react-select"), 1);
|
|
1813
|
-
var
|
|
1814
|
-
var
|
|
2036
|
+
var import_icons7 = require("@aviala-design/icons");
|
|
2037
|
+
var import_react19 = require("react");
|
|
1815
2038
|
|
|
1816
2039
|
// src/components/link.tsx
|
|
1817
2040
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
1818
|
-
var
|
|
1819
|
-
var
|
|
2041
|
+
var import_react18 = require("react");
|
|
2042
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1820
2043
|
var levelStyles = {
|
|
1821
2044
|
caption: {
|
|
1822
2045
|
className: typographyVariants({ level: "caption" }),
|
|
@@ -1835,7 +2058,7 @@ function renderIcon2(node, level) {
|
|
|
1835
2058
|
level: iconLevel,
|
|
1836
2059
|
biggerSize: true
|
|
1837
2060
|
});
|
|
1838
|
-
return /* @__PURE__ */ (0,
|
|
2061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1839
2062
|
"span",
|
|
1840
2063
|
{
|
|
1841
2064
|
className: cn(
|
|
@@ -1846,7 +2069,7 @@ function renderIcon2(node, level) {
|
|
|
1846
2069
|
}
|
|
1847
2070
|
);
|
|
1848
2071
|
}
|
|
1849
|
-
var Link = (0,
|
|
2072
|
+
var Link = (0, import_react18.forwardRef)(
|
|
1850
2073
|
({
|
|
1851
2074
|
className,
|
|
1852
2075
|
level = "caption",
|
|
@@ -1876,7 +2099,7 @@ var Link = (0, import_react16.forwardRef)(
|
|
|
1876
2099
|
onClick?.(e);
|
|
1877
2100
|
};
|
|
1878
2101
|
if (asChild) {
|
|
1879
|
-
return /* @__PURE__ */ (0,
|
|
2102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1880
2103
|
Comp,
|
|
1881
2104
|
{
|
|
1882
2105
|
className: sharedClassName,
|
|
@@ -1892,7 +2115,7 @@ var Link = (0, import_react16.forwardRef)(
|
|
|
1892
2115
|
}
|
|
1893
2116
|
);
|
|
1894
2117
|
}
|
|
1895
|
-
return /* @__PURE__ */ (0,
|
|
2118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1896
2119
|
Comp,
|
|
1897
2120
|
{
|
|
1898
2121
|
className: sharedClassName,
|
|
@@ -1906,7 +2129,7 @@ var Link = (0, import_react16.forwardRef)(
|
|
|
1906
2129
|
onClick: handleClick,
|
|
1907
2130
|
children: [
|
|
1908
2131
|
renderIcon2(leftIcon ?? (iconOnly ? rightIcon : void 0), resolvedLevel),
|
|
1909
|
-
!iconOnly && children !== void 0 && children !== null && /* @__PURE__ */ (0,
|
|
2132
|
+
!iconOnly && children !== void 0 && children !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1910
2133
|
"span",
|
|
1911
2134
|
{
|
|
1912
2135
|
className: cn(
|
|
@@ -1925,39 +2148,39 @@ var Link = (0, import_react16.forwardRef)(
|
|
|
1925
2148
|
Link.displayName = "Link";
|
|
1926
2149
|
|
|
1927
2150
|
// src/components/select.tsx
|
|
1928
|
-
var
|
|
2151
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1929
2152
|
var SELECT_SUB_MENU_CLOSE_DELAY_MS = 250;
|
|
1930
2153
|
var SELECT_SUB_MENU_EXIT_ANIM_MS = 150;
|
|
1931
|
-
var SelectSubMenuContext = (0,
|
|
1932
|
-
var SelectDismissContext = (0,
|
|
2154
|
+
var SelectSubMenuContext = (0, import_react19.createContext)(null);
|
|
2155
|
+
var SelectDismissContext = (0, import_react19.createContext)(null);
|
|
1933
2156
|
function useSelectSubMenuContext() {
|
|
1934
|
-
const context = (0,
|
|
2157
|
+
const context = (0, import_react19.useContext)(SelectSubMenuContext);
|
|
1935
2158
|
if (!context) {
|
|
1936
2159
|
throw new Error("Select sub-menu components must be used within SelectContent.");
|
|
1937
2160
|
}
|
|
1938
2161
|
return context;
|
|
1939
2162
|
}
|
|
1940
2163
|
function useSelectSubMenuLayer() {
|
|
1941
|
-
const contentId = (0,
|
|
1942
|
-
const [activeSubItemId, setActiveSubItemId] = (0,
|
|
1943
|
-
const [exitingSubItemId, setExitingSubItemId] = (0,
|
|
1944
|
-
const itemsRef = (0,
|
|
1945
|
-
const closeTimerRef = (0,
|
|
1946
|
-
const exitTimerRef = (0,
|
|
1947
|
-
const pointerRef = (0,
|
|
1948
|
-
const cancelScheduledClose = (0,
|
|
2164
|
+
const contentId = (0, import_react19.useId)();
|
|
2165
|
+
const [activeSubItemId, setActiveSubItemId] = (0, import_react19.useState)(null);
|
|
2166
|
+
const [exitingSubItemId, setExitingSubItemId] = (0, import_react19.useState)(null);
|
|
2167
|
+
const itemsRef = (0, import_react19.useRef)(/* @__PURE__ */ new Map());
|
|
2168
|
+
const closeTimerRef = (0, import_react19.useRef)(void 0);
|
|
2169
|
+
const exitTimerRef = (0, import_react19.useRef)(void 0);
|
|
2170
|
+
const pointerRef = (0, import_react19.useRef)({ x: 0, y: 0 });
|
|
2171
|
+
const cancelScheduledClose = (0, import_react19.useCallback)(() => {
|
|
1949
2172
|
if (closeTimerRef.current !== void 0) {
|
|
1950
2173
|
clearTimeout(closeTimerRef.current);
|
|
1951
2174
|
closeTimerRef.current = void 0;
|
|
1952
2175
|
}
|
|
1953
2176
|
}, []);
|
|
1954
|
-
const clearExitTimer = (0,
|
|
2177
|
+
const clearExitTimer = (0, import_react19.useCallback)(() => {
|
|
1955
2178
|
if (exitTimerRef.current !== void 0) {
|
|
1956
2179
|
clearTimeout(exitTimerRef.current);
|
|
1957
2180
|
exitTimerRef.current = void 0;
|
|
1958
2181
|
}
|
|
1959
2182
|
}, []);
|
|
1960
|
-
const isTargetInSubItemTree = (0,
|
|
2183
|
+
const isTargetInSubItemTree = (0, import_react19.useCallback)((id, target) => {
|
|
1961
2184
|
if (!(target instanceof Node)) return false;
|
|
1962
2185
|
const registration = itemsRef.current.get(id);
|
|
1963
2186
|
if (!registration) return false;
|
|
@@ -1965,7 +2188,7 @@ function useSelectSubMenuLayer() {
|
|
|
1965
2188
|
const content = registration.getContent();
|
|
1966
2189
|
return (root?.contains(target) ?? false) || (content?.contains(target) ?? false);
|
|
1967
2190
|
}, []);
|
|
1968
|
-
const findSubItemIdForTarget = (0,
|
|
2191
|
+
const findSubItemIdForTarget = (0, import_react19.useCallback)((target, excludeId) => {
|
|
1969
2192
|
if (!(target instanceof Node)) return null;
|
|
1970
2193
|
for (const [id, registration] of itemsRef.current) {
|
|
1971
2194
|
if (id === excludeId) continue;
|
|
@@ -1975,7 +2198,7 @@ function useSelectSubMenuLayer() {
|
|
|
1975
2198
|
}
|
|
1976
2199
|
return null;
|
|
1977
2200
|
}, []);
|
|
1978
|
-
const isPointerOverSubItem = (0,
|
|
2201
|
+
const isPointerOverSubItem = (0, import_react19.useCallback)((id) => {
|
|
1979
2202
|
const hovered = document.elementFromPoint(pointerRef.current.x, pointerRef.current.y);
|
|
1980
2203
|
if (!(hovered instanceof Element)) return false;
|
|
1981
2204
|
const registration = itemsRef.current.get(id);
|
|
@@ -1984,7 +2207,7 @@ function useSelectSubMenuLayer() {
|
|
|
1984
2207
|
const content = registration.getContent();
|
|
1985
2208
|
return (root?.contains(hovered) ?? false) || (content?.contains(hovered) ?? false);
|
|
1986
2209
|
}, []);
|
|
1987
|
-
const findSubItemIdAtPointer = (0,
|
|
2210
|
+
const findSubItemIdAtPointer = (0, import_react19.useCallback)((excludeId) => {
|
|
1988
2211
|
const hovered = document.elementFromPoint(pointerRef.current.x, pointerRef.current.y);
|
|
1989
2212
|
if (!(hovered instanceof Element)) return null;
|
|
1990
2213
|
for (const [id, registration] of itemsRef.current) {
|
|
@@ -1995,7 +2218,7 @@ function useSelectSubMenuLayer() {
|
|
|
1995
2218
|
}
|
|
1996
2219
|
return null;
|
|
1997
2220
|
}, []);
|
|
1998
|
-
const beginExit = (0,
|
|
2221
|
+
const beginExit = (0, import_react19.useCallback)(
|
|
1999
2222
|
(id) => {
|
|
2000
2223
|
cancelScheduledClose();
|
|
2001
2224
|
clearExitTimer();
|
|
@@ -2008,7 +2231,7 @@ function useSelectSubMenuLayer() {
|
|
|
2008
2231
|
},
|
|
2009
2232
|
[cancelScheduledClose, clearExitTimer]
|
|
2010
2233
|
);
|
|
2011
|
-
const openSubItem = (0,
|
|
2234
|
+
const openSubItem = (0, import_react19.useCallback)(
|
|
2012
2235
|
(id) => {
|
|
2013
2236
|
cancelScheduledClose();
|
|
2014
2237
|
clearExitTimer();
|
|
@@ -2017,14 +2240,14 @@ function useSelectSubMenuLayer() {
|
|
|
2017
2240
|
},
|
|
2018
2241
|
[cancelScheduledClose, clearExitTimer]
|
|
2019
2242
|
);
|
|
2020
|
-
const closeActiveSubItem = (0,
|
|
2243
|
+
const closeActiveSubItem = (0, import_react19.useCallback)(() => {
|
|
2021
2244
|
if (activeSubItemId) {
|
|
2022
2245
|
beginExit(activeSubItemId);
|
|
2023
2246
|
return;
|
|
2024
2247
|
}
|
|
2025
2248
|
cancelScheduledClose();
|
|
2026
2249
|
}, [activeSubItemId, beginExit, cancelScheduledClose]);
|
|
2027
|
-
const scheduleCloseSubItem = (0,
|
|
2250
|
+
const scheduleCloseSubItem = (0, import_react19.useCallback)(
|
|
2028
2251
|
(id, relatedTarget) => {
|
|
2029
2252
|
if (exitingSubItemId === id) return;
|
|
2030
2253
|
if (isTargetInSubItemTree(id, relatedTarget)) return;
|
|
@@ -2055,29 +2278,29 @@ function useSelectSubMenuLayer() {
|
|
|
2055
2278
|
openSubItem
|
|
2056
2279
|
]
|
|
2057
2280
|
);
|
|
2058
|
-
const registerSubItem = (0,
|
|
2281
|
+
const registerSubItem = (0, import_react19.useCallback)((id, registration) => {
|
|
2059
2282
|
itemsRef.current.set(id, registration);
|
|
2060
2283
|
}, []);
|
|
2061
|
-
const unregisterSubItem = (0,
|
|
2284
|
+
const unregisterSubItem = (0, import_react19.useCallback)((id) => {
|
|
2062
2285
|
itemsRef.current.delete(id);
|
|
2063
2286
|
setActiveSubItemId((current) => current === id ? null : current);
|
|
2064
2287
|
setExitingSubItemId((current) => current === id ? null : current);
|
|
2065
2288
|
}, []);
|
|
2066
|
-
(0,
|
|
2289
|
+
(0, import_react19.useEffect)(() => {
|
|
2067
2290
|
const trackPointer = (event) => {
|
|
2068
2291
|
pointerRef.current = { x: event.clientX, y: event.clientY };
|
|
2069
2292
|
};
|
|
2070
2293
|
document.addEventListener("pointermove", trackPointer, { passive: true });
|
|
2071
2294
|
return () => document.removeEventListener("pointermove", trackPointer);
|
|
2072
2295
|
}, []);
|
|
2073
|
-
(0,
|
|
2296
|
+
(0, import_react19.useEffect)(
|
|
2074
2297
|
() => () => {
|
|
2075
2298
|
cancelScheduledClose();
|
|
2076
2299
|
clearExitTimer();
|
|
2077
2300
|
},
|
|
2078
2301
|
[cancelScheduledClose, clearExitTimer]
|
|
2079
2302
|
);
|
|
2080
|
-
(0,
|
|
2303
|
+
(0, import_react19.useEffect)(() => {
|
|
2081
2304
|
const visibleSubItemId = activeSubItemId ?? exitingSubItemId;
|
|
2082
2305
|
if (!visibleSubItemId) return;
|
|
2083
2306
|
const keepSelectOpen = (event) => {
|
|
@@ -2105,7 +2328,7 @@ function useSelectSubMenuLayer() {
|
|
|
2105
2328
|
document.removeEventListener("keydown", handleEscape, true);
|
|
2106
2329
|
};
|
|
2107
2330
|
}, [activeSubItemId, beginExit, clearExitTimer, exitingSubItemId]);
|
|
2108
|
-
return (0,
|
|
2331
|
+
return (0, import_react19.useMemo)(
|
|
2109
2332
|
() => ({
|
|
2110
2333
|
contentId,
|
|
2111
2334
|
registerSubItem,
|
|
@@ -2133,12 +2356,12 @@ function SelectSubMenu(_props) {
|
|
|
2133
2356
|
}
|
|
2134
2357
|
SelectSubMenu.displayName = "SelectSubMenu";
|
|
2135
2358
|
function isSelectSubMenuElement(child) {
|
|
2136
|
-
return (0,
|
|
2359
|
+
return (0, import_react19.isValidElement)(child) && child.type === SelectSubMenu;
|
|
2137
2360
|
}
|
|
2138
2361
|
function parseSelectSubItemChildren(children) {
|
|
2139
2362
|
const itemNodes = [];
|
|
2140
2363
|
let subMenu = null;
|
|
2141
|
-
|
|
2364
|
+
import_react19.Children.forEach(children, (child) => {
|
|
2142
2365
|
if (isSelectSubMenuElement(child)) {
|
|
2143
2366
|
subMenu = {
|
|
2144
2367
|
children: child.props.children,
|
|
@@ -2165,7 +2388,7 @@ function renderItemIcon(node, iconLevel = "text", debugId) {
|
|
|
2165
2388
|
level: iconLevel,
|
|
2166
2389
|
biggerSize: true
|
|
2167
2390
|
});
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
2391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2169
2392
|
"span",
|
|
2170
2393
|
{
|
|
2171
2394
|
className: cn(
|
|
@@ -2180,17 +2403,17 @@ function renderItemIcon(node, iconLevel = "text", debugId) {
|
|
|
2180
2403
|
}
|
|
2181
2404
|
function renderBadgeSlot(node) {
|
|
2182
2405
|
if (node == null || node === false) return null;
|
|
2183
|
-
return /* @__PURE__ */ (0,
|
|
2406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__badge", children: (0, import_react19.isValidElement)(node) && node.type === Badge ? node : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Badge, { children: node }) });
|
|
2184
2407
|
}
|
|
2185
2408
|
function SelectItemFormRadio() {
|
|
2186
|
-
return /* @__PURE__ */ (0,
|
|
2187
|
-
/* @__PURE__ */ (0,
|
|
2188
|
-
/* @__PURE__ */ (0,
|
|
2409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "aviala-select-item__form-radio", "aria-hidden": true, children: [
|
|
2410
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__form-radio-surface" }),
|
|
2411
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__form-radio-indicator" })
|
|
2189
2412
|
] });
|
|
2190
2413
|
}
|
|
2191
2414
|
function SelectItemFormCheckbox() {
|
|
2192
|
-
return /* @__PURE__ */ (0,
|
|
2193
|
-
|
|
2415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__form-checkbox", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2416
|
+
import_icons7.SymbolRight,
|
|
2194
2417
|
{
|
|
2195
2418
|
className: "aviala-select-item__form-checkbox-icon",
|
|
2196
2419
|
width: 12,
|
|
@@ -2200,25 +2423,25 @@ function SelectItemFormCheckbox() {
|
|
|
2200
2423
|
) });
|
|
2201
2424
|
}
|
|
2202
2425
|
function SelectItemTrailingRadio() {
|
|
2203
|
-
return /* @__PURE__ */ (0,
|
|
2426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectPrimitive.ItemIndicator, { className: "aviala-select-item__trailing-radio", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons7.SymbolRight, { level: "text", biggerSize: true, "aria-hidden": true }) });
|
|
2204
2427
|
}
|
|
2205
2428
|
function SelectItemTrailingCheckbox() {
|
|
2206
|
-
return /* @__PURE__ */ (0,
|
|
2429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectPrimitive.ItemIndicator, { className: "aviala-select-item__trailing-checkbox", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons7.SymbolRight, { level: "text", biggerSize: true, "aria-hidden": true }) });
|
|
2207
2430
|
}
|
|
2208
2431
|
function SelectItemDefaultAvatar() {
|
|
2209
|
-
return /* @__PURE__ */ (0,
|
|
2432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__avatar", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons7.UsersUserCircle, { level: "text", biggerSize: true, "aria-hidden": true }) });
|
|
2210
2433
|
}
|
|
2211
2434
|
function SelectExpandChevron() {
|
|
2212
2435
|
const rtl = useRtl();
|
|
2213
|
-
const Icon2 = rtl ?
|
|
2214
|
-
return /* @__PURE__ */ (0,
|
|
2436
|
+
const Icon2 = rtl ? import_icons7.DirectionArrowLeft : import_icons7.DirectionArrowRight;
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon2, { level: "text", biggerSize: true, "aria-hidden": true });
|
|
2215
2438
|
}
|
|
2216
2439
|
function renderFunctionSlot(itemFunction, layout, showFunctionIcon, icon) {
|
|
2217
2440
|
if (!showFunctionIcon) return null;
|
|
2218
2441
|
if (layout === "checked") return null;
|
|
2219
2442
|
const functionStyle = icon ? iconSlotCssVarStyle(icon, "--select-item-function-icon-size", "text", true) : void 0;
|
|
2220
2443
|
if (icon !== void 0) {
|
|
2221
|
-
return /* @__PURE__ */ (0,
|
|
2444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2222
2445
|
"span",
|
|
2223
2446
|
{
|
|
2224
2447
|
className: "aviala-select-item__function",
|
|
@@ -2230,19 +2453,19 @@ function renderFunctionSlot(itemFunction, layout, showFunctionIcon, icon) {
|
|
|
2230
2453
|
}
|
|
2231
2454
|
switch (itemFunction) {
|
|
2232
2455
|
case "radio":
|
|
2233
|
-
return /* @__PURE__ */ (0,
|
|
2456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__function", ...spiralDebugId("select.content.item.function"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemTrailingRadio, {}) });
|
|
2234
2457
|
case "checkbox":
|
|
2235
|
-
return /* @__PURE__ */ (0,
|
|
2458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__function", ...spiralDebugId("select.content.item.function"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemTrailingCheckbox, {}) });
|
|
2236
2459
|
case "simple":
|
|
2237
2460
|
case "action":
|
|
2238
2461
|
default:
|
|
2239
|
-
return /* @__PURE__ */ (0,
|
|
2462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2240
2463
|
"span",
|
|
2241
2464
|
{
|
|
2242
2465
|
className: "aviala-select-item__function",
|
|
2243
2466
|
style: iconLevelCssVarStyle("text", true, "--select-item-function-icon-size"),
|
|
2244
2467
|
...spiralDebugId("select.content.item.function"),
|
|
2245
|
-
children: /* @__PURE__ */ (0,
|
|
2468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectExpandChevron, {})
|
|
2246
2469
|
}
|
|
2247
2470
|
);
|
|
2248
2471
|
}
|
|
@@ -2253,24 +2476,24 @@ function Select({
|
|
|
2253
2476
|
onOpenChange,
|
|
2254
2477
|
...props
|
|
2255
2478
|
}) {
|
|
2256
|
-
const [internalOpen, setInternalOpen] = (0,
|
|
2479
|
+
const [internalOpen, setInternalOpen] = (0, import_react19.useState)(defaultOpen);
|
|
2257
2480
|
const isControlled = openProp !== void 0;
|
|
2258
2481
|
const open = isControlled ? openProp : internalOpen;
|
|
2259
|
-
const windowBlurCloseRef = (0,
|
|
2260
|
-
const pointerDownCloseRef = (0,
|
|
2261
|
-
const triggerRef = (0,
|
|
2262
|
-
const dismissContextValue = (0,
|
|
2482
|
+
const windowBlurCloseRef = (0, import_react19.useRef)(false);
|
|
2483
|
+
const pointerDownCloseRef = (0, import_react19.useRef)(false);
|
|
2484
|
+
const triggerRef = (0, import_react19.useRef)(null);
|
|
2485
|
+
const dismissContextValue = (0, import_react19.useMemo)(
|
|
2263
2486
|
() => ({ pointerDownCloseRef, triggerRef }),
|
|
2264
2487
|
[]
|
|
2265
2488
|
);
|
|
2266
|
-
(0,
|
|
2489
|
+
(0, import_react19.useEffect)(() => {
|
|
2267
2490
|
const markWindowBlur = () => {
|
|
2268
2491
|
windowBlurCloseRef.current = true;
|
|
2269
2492
|
};
|
|
2270
2493
|
window.addEventListener("blur", markWindowBlur, true);
|
|
2271
2494
|
return () => window.removeEventListener("blur", markWindowBlur, true);
|
|
2272
2495
|
}, []);
|
|
2273
|
-
(0,
|
|
2496
|
+
(0, import_react19.useEffect)(() => {
|
|
2274
2497
|
if (!open) return;
|
|
2275
2498
|
const markPointerDown = () => {
|
|
2276
2499
|
pointerDownCloseRef.current = true;
|
|
@@ -2278,7 +2501,7 @@ function Select({
|
|
|
2278
2501
|
document.addEventListener("pointerdown", markPointerDown, true);
|
|
2279
2502
|
return () => document.removeEventListener("pointerdown", markPointerDown, true);
|
|
2280
2503
|
}, [open]);
|
|
2281
|
-
const handleOpenChange = (0,
|
|
2504
|
+
const handleOpenChange = (0, import_react19.useCallback)(
|
|
2282
2505
|
(nextOpen) => {
|
|
2283
2506
|
if (!nextOpen && windowBlurCloseRef.current && !pointerDownCloseRef.current) {
|
|
2284
2507
|
windowBlurCloseRef.current = false;
|
|
@@ -2295,7 +2518,7 @@ function Select({
|
|
|
2295
2518
|
},
|
|
2296
2519
|
[isControlled, onOpenChange]
|
|
2297
2520
|
);
|
|
2298
|
-
return /* @__PURE__ */ (0,
|
|
2521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectDismissContext.Provider, { value: dismissContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectPrimitive.Root, { open, onOpenChange: handleOpenChange, ...props }) });
|
|
2299
2522
|
}
|
|
2300
2523
|
var SelectValue = SelectPrimitive.Value;
|
|
2301
2524
|
var SelectGroup = SelectPrimitive.Group;
|
|
@@ -2312,17 +2535,17 @@ function getComponentDisplayName(type) {
|
|
|
2312
2535
|
return void 0;
|
|
2313
2536
|
}
|
|
2314
2537
|
function isSelectGroupElement(child) {
|
|
2315
|
-
if (!(0,
|
|
2538
|
+
if (!(0, import_react19.isValidElement)(child)) return false;
|
|
2316
2539
|
if (child.type === SelectGroup) return true;
|
|
2317
2540
|
return getComponentDisplayName(child.type) === "SelectItemGroup";
|
|
2318
2541
|
}
|
|
2319
2542
|
function isSelectMenuItemElement(child) {
|
|
2320
|
-
if (!(0,
|
|
2543
|
+
if (!(0, import_react19.isValidElement)(child)) return false;
|
|
2321
2544
|
const displayName = getComponentDisplayName(child.type);
|
|
2322
2545
|
return displayName !== void 0 && SELECT_MENU_ITEM_DISPLAY_NAMES.has(displayName);
|
|
2323
2546
|
}
|
|
2324
2547
|
function wrapUngroupedSelectItems(children) {
|
|
2325
|
-
const nodes =
|
|
2548
|
+
const nodes = import_react19.Children.toArray(children);
|
|
2326
2549
|
if (nodes.length === 0) return children;
|
|
2327
2550
|
const wrapped = [];
|
|
2328
2551
|
let bareItems = [];
|
|
@@ -2330,7 +2553,7 @@ function wrapUngroupedSelectItems(children) {
|
|
|
2330
2553
|
const flushBareItems = () => {
|
|
2331
2554
|
if (bareItems.length === 0) return;
|
|
2332
2555
|
wrapped.push(
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2556
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectGroup, { className: "aviala-select-group", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aviala-select-group__slot", children: bareItems }) }, `__select-auto-group-${autoGroupIndex++}`)
|
|
2334
2557
|
);
|
|
2335
2558
|
bareItems = [];
|
|
2336
2559
|
};
|
|
@@ -2348,7 +2571,7 @@ function wrapUngroupedSelectItems(children) {
|
|
|
2348
2571
|
flushBareItems();
|
|
2349
2572
|
return wrapped.length === 1 ? wrapped[0] : wrapped;
|
|
2350
2573
|
}
|
|
2351
|
-
var SelectTrigger = (0,
|
|
2574
|
+
var SelectTrigger = (0, import_react19.forwardRef)(
|
|
2352
2575
|
({
|
|
2353
2576
|
className,
|
|
2354
2577
|
size = "regular",
|
|
@@ -2357,11 +2580,12 @@ var SelectTrigger = (0, import_react17.forwardRef)(
|
|
|
2357
2580
|
rightIcon,
|
|
2358
2581
|
expandIcon,
|
|
2359
2582
|
placeholder,
|
|
2360
|
-
error
|
|
2583
|
+
error,
|
|
2361
2584
|
...props
|
|
2362
2585
|
}, ref) => {
|
|
2363
|
-
const dismissContext = (0,
|
|
2364
|
-
|
|
2586
|
+
const dismissContext = (0, import_react19.useContext)(SelectDismissContext);
|
|
2587
|
+
const resolvedError = useResolvedControlError(error);
|
|
2588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2365
2589
|
SelectPrimitive.Trigger,
|
|
2366
2590
|
{
|
|
2367
2591
|
ref: (node) => {
|
|
@@ -2377,12 +2601,13 @@ var SelectTrigger = (0, import_react17.forwardRef)(
|
|
|
2377
2601
|
className: cn("aviala-select-trigger aviala-focus-ring", className),
|
|
2378
2602
|
"data-size": size,
|
|
2379
2603
|
"data-all-round": allRound ? "true" : "false",
|
|
2380
|
-
"data-error":
|
|
2604
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
2605
|
+
"aria-invalid": resolvedError || void 0,
|
|
2381
2606
|
...spiralDebugId("select.trigger"),
|
|
2382
2607
|
...props,
|
|
2383
2608
|
children: [
|
|
2384
2609
|
renderSlotIcon(leftIcon, "aviala-select-trigger__slot", "select.trigger.icon-left"),
|
|
2385
|
-
/* @__PURE__ */ (0,
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-trigger__field", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2386
2611
|
SelectPrimitive.Value,
|
|
2387
2612
|
{
|
|
2388
2613
|
placeholder,
|
|
@@ -2391,15 +2616,15 @@ var SelectTrigger = (0, import_react17.forwardRef)(
|
|
|
2391
2616
|
}
|
|
2392
2617
|
) }),
|
|
2393
2618
|
renderSlotIcon(rightIcon, "aviala-select-trigger__slot", "select.trigger.icon-right"),
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2395
2620
|
"span",
|
|
2396
2621
|
{
|
|
2397
2622
|
className: "aviala-select-trigger__expand",
|
|
2398
2623
|
"aria-hidden": true,
|
|
2399
2624
|
style: expandIcon ? iconSlotCssVarStyle(expandIcon, "--input-slot-icon-size", "text", true) : iconLevelCssVarStyle("text", true, "--input-slot-icon-size"),
|
|
2400
2625
|
...spiralDebugId("select.trigger.expand"),
|
|
2401
|
-
children: expandIcon ?? /* @__PURE__ */ (0,
|
|
2402
|
-
|
|
2626
|
+
children: expandIcon ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2627
|
+
import_icons7.DirectionArrowDownLight,
|
|
2403
2628
|
{
|
|
2404
2629
|
className: "aviala-select-trigger__expand-icon",
|
|
2405
2630
|
level: "text",
|
|
@@ -2415,7 +2640,7 @@ var SelectTrigger = (0, import_react17.forwardRef)(
|
|
|
2415
2640
|
}
|
|
2416
2641
|
);
|
|
2417
2642
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
2418
|
-
var SelectContent = (0,
|
|
2643
|
+
var SelectContent = (0, import_react19.forwardRef)(
|
|
2419
2644
|
({
|
|
2420
2645
|
className,
|
|
2421
2646
|
children,
|
|
@@ -2426,7 +2651,7 @@ var SelectContent = (0, import_react17.forwardRef)(
|
|
|
2426
2651
|
...props
|
|
2427
2652
|
}, ref) => {
|
|
2428
2653
|
const subMenuLayer = useSelectSubMenuLayer();
|
|
2429
|
-
const dismissContext = (0,
|
|
2654
|
+
const dismissContext = (0, import_react19.useContext)(SelectDismissContext);
|
|
2430
2655
|
const handleCloseAutoFocus = (event) => {
|
|
2431
2656
|
onCloseAutoFocus?.(event);
|
|
2432
2657
|
if (event.defaultPrevented) {
|
|
@@ -2441,7 +2666,7 @@ var SelectContent = (0, import_react17.forwardRef)(
|
|
|
2441
2666
|
dismissContext.pointerDownCloseRef.current = false;
|
|
2442
2667
|
}
|
|
2443
2668
|
};
|
|
2444
|
-
const content = /* @__PURE__ */ (0,
|
|
2669
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectSubMenuContext.Provider, { value: subMenuLayer, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2445
2670
|
SelectPrimitive.Content,
|
|
2446
2671
|
{
|
|
2447
2672
|
ref,
|
|
@@ -2451,7 +2676,7 @@ var SelectContent = (0, import_react17.forwardRef)(
|
|
|
2451
2676
|
onCloseAutoFocus: handleCloseAutoFocus,
|
|
2452
2677
|
...spiralDebugId("select.content"),
|
|
2453
2678
|
...props,
|
|
2454
|
-
children: /* @__PURE__ */ (0,
|
|
2679
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2455
2680
|
SelectPrimitive.Viewport,
|
|
2456
2681
|
{
|
|
2457
2682
|
className: "aviala-select-viewport",
|
|
@@ -2462,11 +2687,11 @@ var SelectContent = (0, import_react17.forwardRef)(
|
|
|
2462
2687
|
}
|
|
2463
2688
|
) });
|
|
2464
2689
|
if (!portalled) return content;
|
|
2465
|
-
return /* @__PURE__ */ (0,
|
|
2690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectPrimitive.Portal, { children: content });
|
|
2466
2691
|
}
|
|
2467
2692
|
);
|
|
2468
2693
|
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
2469
|
-
var SelectLabel = (0,
|
|
2694
|
+
var SelectLabel = (0, import_react19.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2470
2695
|
SelectPrimitive.Label,
|
|
2471
2696
|
{
|
|
2472
2697
|
ref,
|
|
@@ -2475,7 +2700,7 @@ var SelectLabel = (0, import_react17.forwardRef)(({ className, ...props }, ref)
|
|
|
2475
2700
|
}
|
|
2476
2701
|
));
|
|
2477
2702
|
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
2478
|
-
var SelectItem = (0,
|
|
2703
|
+
var SelectItem = (0, import_react19.forwardRef)(
|
|
2479
2704
|
({
|
|
2480
2705
|
className,
|
|
2481
2706
|
children,
|
|
@@ -2501,23 +2726,23 @@ var SelectItem = (0, import_react17.forwardRef)(
|
|
|
2501
2726
|
const leftIconLevel = isTitle ? "caption" : "text";
|
|
2502
2727
|
const showTrailingFunction = showFunctionIcon && layout !== "checked" && itemFunction !== "form-radio" && itemFunction !== "form-checkbox";
|
|
2503
2728
|
const textLevel = isTitle ? "caption" : "text";
|
|
2504
|
-
const textContent = isPeople ? /* @__PURE__ */ (0,
|
|
2505
|
-
/* @__PURE__ */ (0,
|
|
2729
|
+
const textContent = isPeople ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "aviala-select-item__content", children: [
|
|
2730
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2506
2731
|
SelectPrimitive.ItemText,
|
|
2507
2732
|
{
|
|
2508
2733
|
className: cn("aviala-select-item__text", typographyVariants({ level: textLevel })),
|
|
2509
2734
|
children
|
|
2510
2735
|
}
|
|
2511
2736
|
),
|
|
2512
|
-
subtitle != null && subtitle !== false ? /* @__PURE__ */ (0,
|
|
2513
|
-
] }) : /* @__PURE__ */ (0,
|
|
2737
|
+
subtitle != null && subtitle !== false ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("aviala-select-item__subtitle", typographyVariants({ level: "caption" })), children: subtitle }) : null
|
|
2738
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2514
2739
|
SelectPrimitive.ItemText,
|
|
2515
2740
|
{
|
|
2516
2741
|
className: cn("aviala-select-item__text", typographyVariants({ level: textLevel })),
|
|
2517
2742
|
children
|
|
2518
2743
|
}
|
|
2519
2744
|
);
|
|
2520
|
-
return /* @__PURE__ */ (0,
|
|
2745
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2521
2746
|
SelectPrimitive.Item,
|
|
2522
2747
|
{
|
|
2523
2748
|
ref,
|
|
@@ -2527,14 +2752,14 @@ var SelectItem = (0, import_react17.forwardRef)(
|
|
|
2527
2752
|
...spiralDebugId("select.content.item"),
|
|
2528
2753
|
...props,
|
|
2529
2754
|
children: [
|
|
2530
|
-
isFormLeading && itemFunction === "form-radio" ? /* @__PURE__ */ (0,
|
|
2531
|
-
isFormLeading && itemFunction === "form-checkbox" ? /* @__PURE__ */ (0,
|
|
2755
|
+
isFormLeading && itemFunction === "form-radio" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemFormRadio, {}) : null,
|
|
2756
|
+
isFormLeading && itemFunction === "form-checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemFormCheckbox, {}) : null,
|
|
2532
2757
|
showLeftIcon && leftIcon ? renderItemIcon(leftIcon, leftIconLevel, "select.content.item.icon-left") : null,
|
|
2533
|
-
isPeople ? avatar ?? /* @__PURE__ */ (0,
|
|
2758
|
+
isPeople ? avatar ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemDefaultAvatar, {}) : null,
|
|
2534
2759
|
textContent,
|
|
2535
2760
|
showBadge ? renderBadgeSlot(badge ?? "Text") : null,
|
|
2536
2761
|
showRightIcon && rightIcon ? renderItemIcon(rightIcon, leftIconLevel, "select.content.item.icon-right") : null,
|
|
2537
|
-
showMoreFunction ? /* @__PURE__ */ (0,
|
|
2762
|
+
showMoreFunction ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__more", children: moreAction ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { level: "text", href: "#", onClick: (event) => event.preventDefault(), children: "Text" }) }) : null,
|
|
2538
2763
|
renderFunctionSlot(itemFunction, layout, showTrailingFunction, icon)
|
|
2539
2764
|
]
|
|
2540
2765
|
}
|
|
@@ -2542,7 +2767,7 @@ var SelectItem = (0, import_react17.forwardRef)(
|
|
|
2542
2767
|
}
|
|
2543
2768
|
);
|
|
2544
2769
|
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
2545
|
-
var SelectSubItem = (0,
|
|
2770
|
+
var SelectSubItem = (0, import_react19.forwardRef)(
|
|
2546
2771
|
({
|
|
2547
2772
|
className,
|
|
2548
2773
|
children,
|
|
@@ -2578,10 +2803,10 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2578
2803
|
if (!subMenu) {
|
|
2579
2804
|
throw new Error("SelectSubItem requires a SelectSubMenu child.");
|
|
2580
2805
|
}
|
|
2581
|
-
const subItemId = (0,
|
|
2582
|
-
const subMenuId = (0,
|
|
2583
|
-
const rootRef = (0,
|
|
2584
|
-
const contentRef = (0,
|
|
2806
|
+
const subItemId = (0, import_react19.useId)();
|
|
2807
|
+
const subMenuId = (0, import_react19.useId)();
|
|
2808
|
+
const rootRef = (0, import_react19.useRef)(null);
|
|
2809
|
+
const contentRef = (0, import_react19.useRef)(null);
|
|
2585
2810
|
const rtl = useRtl();
|
|
2586
2811
|
const direction = useDirection();
|
|
2587
2812
|
const expandKey = rtl ? "ArrowLeft" : "ArrowRight";
|
|
@@ -2591,18 +2816,18 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2591
2816
|
const portalled = portalledProp ?? subMenu.portalled;
|
|
2592
2817
|
const open = isSubItemOpen(subItemId);
|
|
2593
2818
|
const exiting = isSubItemExiting(subItemId);
|
|
2594
|
-
(0,
|
|
2819
|
+
(0, import_react19.useEffect)(() => {
|
|
2595
2820
|
registerSubItem(subItemId, {
|
|
2596
2821
|
getRoot: () => rootRef.current,
|
|
2597
2822
|
getContent: () => contentRef.current
|
|
2598
2823
|
});
|
|
2599
2824
|
return () => unregisterSubItem(subItemId);
|
|
2600
2825
|
}, [registerSubItem, subItemId, unregisterSubItem]);
|
|
2601
|
-
const handleOpen = (0,
|
|
2826
|
+
const handleOpen = (0, import_react19.useCallback)(() => {
|
|
2602
2827
|
if (disabled) return;
|
|
2603
2828
|
openSubItem(subItemId);
|
|
2604
2829
|
}, [disabled, openSubItem, subItemId]);
|
|
2605
|
-
const handlePointerLeave = (0,
|
|
2830
|
+
const handlePointerLeave = (0, import_react19.useCallback)(
|
|
2606
2831
|
(event) => {
|
|
2607
2832
|
scheduleCloseSubItem(subItemId, event.relatedTarget);
|
|
2608
2833
|
},
|
|
@@ -2614,10 +2839,10 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2614
2839
|
const leftIconLevel = isTitle ? "caption" : "text";
|
|
2615
2840
|
const showTrailingFunction = showFunctionIcon && layout !== "checked" && itemFunction !== "form-radio" && itemFunction !== "form-checkbox";
|
|
2616
2841
|
const textLevel = isTitle ? "caption" : "text";
|
|
2617
|
-
const textContent = isPeople ? /* @__PURE__ */ (0,
|
|
2618
|
-
/* @__PURE__ */ (0,
|
|
2619
|
-
subtitle != null && subtitle !== false ? /* @__PURE__ */ (0,
|
|
2620
|
-
] }) : /* @__PURE__ */ (0,
|
|
2842
|
+
const textContent = isPeople ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "aviala-select-item__content", children: [
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("aviala-select-item__text", typographyVariants({ level: textLevel })), children: itemChildren }),
|
|
2844
|
+
subtitle != null && subtitle !== false ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("aviala-select-item__subtitle", typographyVariants({ level: "caption" })), children: subtitle }) : null
|
|
2845
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: cn("aviala-select-item__text", typographyVariants({ level: textLevel })), children: itemChildren });
|
|
2621
2846
|
const handleTriggerBlur = (event) => {
|
|
2622
2847
|
scheduleCloseSubItem(subItemId, event.relatedTarget);
|
|
2623
2848
|
};
|
|
@@ -2635,7 +2860,7 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2635
2860
|
closeActiveSubItem();
|
|
2636
2861
|
}
|
|
2637
2862
|
};
|
|
2638
|
-
const itemRow = /* @__PURE__ */ (0,
|
|
2863
|
+
const itemRow = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2639
2864
|
"button",
|
|
2640
2865
|
{
|
|
2641
2866
|
type: "button",
|
|
@@ -2653,19 +2878,19 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2653
2878
|
onBlur: handleTriggerBlur,
|
|
2654
2879
|
onKeyDown: handleKeyDown,
|
|
2655
2880
|
children: [
|
|
2656
|
-
isFormLeading && itemFunction === "form-radio" ? /* @__PURE__ */ (0,
|
|
2657
|
-
isFormLeading && itemFunction === "form-checkbox" ? /* @__PURE__ */ (0,
|
|
2881
|
+
isFormLeading && itemFunction === "form-radio" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemFormRadio, {}) : null,
|
|
2882
|
+
isFormLeading && itemFunction === "form-checkbox" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemFormCheckbox, {}) : null,
|
|
2658
2883
|
showLeftIcon && leftIcon ? renderItemIcon(leftIcon, leftIconLevel) : null,
|
|
2659
|
-
isPeople ? avatar ?? /* @__PURE__ */ (0,
|
|
2884
|
+
isPeople ? avatar ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItemDefaultAvatar, {}) : null,
|
|
2660
2885
|
textContent,
|
|
2661
2886
|
showBadge ? renderBadgeSlot(badge ?? "Text") : null,
|
|
2662
2887
|
showRightIcon && rightIcon ? renderItemIcon(rightIcon, leftIconLevel) : null,
|
|
2663
|
-
showMoreFunction ? /* @__PURE__ */ (0,
|
|
2888
|
+
showMoreFunction ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "aviala-select-item__more", children: moreAction ?? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Link, { level: "text", href: "#", onClick: (event) => event.preventDefault(), children: "Text" }) }) : null,
|
|
2664
2889
|
renderFunctionSlot(itemFunction, layout, showTrailingFunction, icon)
|
|
2665
2890
|
]
|
|
2666
2891
|
}
|
|
2667
2892
|
);
|
|
2668
|
-
const flyout = /* @__PURE__ */ (0,
|
|
2893
|
+
const flyout = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2669
2894
|
PopoverPrimitive.Content,
|
|
2670
2895
|
{
|
|
2671
2896
|
ref: contentRef,
|
|
@@ -2683,10 +2908,10 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2683
2908
|
onPointerEnter: handleOpen,
|
|
2684
2909
|
onPointerLeave: handlePointerLeave,
|
|
2685
2910
|
onPointerDownOutside: (event) => event.preventDefault(),
|
|
2686
|
-
children: /* @__PURE__ */ (0,
|
|
2911
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aviala-select-viewport aviala-select-sub-content__viewport", children: wrapUngroupedSelectItems(subMenu.children) })
|
|
2687
2912
|
}
|
|
2688
2913
|
);
|
|
2689
|
-
return /* @__PURE__ */ (0,
|
|
2914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PopoverPrimitive.Root, { open, modal: false, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2690
2915
|
"div",
|
|
2691
2916
|
{
|
|
2692
2917
|
ref: (node) => {
|
|
@@ -2701,21 +2926,21 @@ var SelectSubItem = (0, import_react17.forwardRef)(
|
|
|
2701
2926
|
onPointerEnter: handleOpen,
|
|
2702
2927
|
onPointerLeave: handlePointerLeave,
|
|
2703
2928
|
children: [
|
|
2704
|
-
/* @__PURE__ */ (0,
|
|
2705
|
-
portalled ? /* @__PURE__ */ (0,
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PopoverPrimitive.Anchor, { asChild: true, children: itemRow }),
|
|
2930
|
+
portalled ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(PopoverPrimitive.Portal, { children: flyout }) : flyout
|
|
2706
2931
|
]
|
|
2707
2932
|
}
|
|
2708
2933
|
) });
|
|
2709
2934
|
}
|
|
2710
2935
|
);
|
|
2711
2936
|
SelectSubItem.displayName = "SelectSubItem";
|
|
2712
|
-
var SelectSubItemPeople = (0,
|
|
2713
|
-
(props, ref) => /* @__PURE__ */ (0,
|
|
2937
|
+
var SelectSubItemPeople = (0, import_react19.forwardRef)(
|
|
2938
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectSubItem, { ref, layout: "people", ...props })
|
|
2714
2939
|
);
|
|
2715
2940
|
SelectSubItemPeople.displayName = "SelectSubItemPeople";
|
|
2716
|
-
var SelectItemPeople = (0,
|
|
2941
|
+
var SelectItemPeople = (0, import_react19.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectItem, { ref, layout: "people", ...props }));
|
|
2717
2942
|
SelectItemPeople.displayName = "SelectItemPeople";
|
|
2718
|
-
var SelectSeparator = (0,
|
|
2943
|
+
var SelectSeparator = (0, import_react19.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2719
2944
|
SelectPrimitive.Separator,
|
|
2720
2945
|
{
|
|
2721
2946
|
ref,
|
|
@@ -2730,18 +2955,18 @@ function SelectItemGroup({
|
|
|
2730
2955
|
children,
|
|
2731
2956
|
className
|
|
2732
2957
|
}) {
|
|
2733
|
-
return /* @__PURE__ */ (0,
|
|
2734
|
-
label ? /* @__PURE__ */ (0,
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2736
|
-
showDivider ? /* @__PURE__ */ (0,
|
|
2958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(SelectGroup, { className: cn("aviala-select-group", className), children: [
|
|
2959
|
+
label ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectLabel, { children: label }) : null,
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "aviala-select-group__slot", children }),
|
|
2961
|
+
showDivider ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SelectSeparator, {}) : null
|
|
2737
2962
|
] });
|
|
2738
2963
|
}
|
|
2739
2964
|
|
|
2740
2965
|
// src/components/label.tsx
|
|
2741
2966
|
var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
|
|
2742
|
-
var
|
|
2743
|
-
var
|
|
2744
|
-
var Label2 = (0,
|
|
2967
|
+
var import_react20 = require("react");
|
|
2968
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2969
|
+
var Label2 = (0, import_react20.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2745
2970
|
LabelPrimitive.Root,
|
|
2746
2971
|
{
|
|
2747
2972
|
ref,
|
|
@@ -2757,8 +2982,8 @@ Label2.displayName = LabelPrimitive.Root.displayName;
|
|
|
2757
2982
|
|
|
2758
2983
|
// src/components/avatar.tsx
|
|
2759
2984
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
2760
|
-
var
|
|
2761
|
-
var
|
|
2985
|
+
var import_react21 = require("react");
|
|
2986
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2762
2987
|
var avatarVariants = (0, import_class_variance_authority6.cva)("aviala-avatar", {
|
|
2763
2988
|
variants: {
|
|
2764
2989
|
level: {
|
|
@@ -2804,8 +3029,8 @@ var AVATAR_ICON_SIZE = {
|
|
|
2804
3029
|
function renderAvatarIcon(node, level) {
|
|
2805
3030
|
if (!node) return null;
|
|
2806
3031
|
const size = AVATAR_ICON_SIZE[level];
|
|
2807
|
-
if ((0,
|
|
2808
|
-
return (0,
|
|
3032
|
+
if ((0, import_react21.isValidElement)(node) && typeof node.type !== "string") {
|
|
3033
|
+
return (0, import_react21.cloneElement)(
|
|
2809
3034
|
node,
|
|
2810
3035
|
{
|
|
2811
3036
|
width: size,
|
|
@@ -2816,7 +3041,7 @@ function renderAvatarIcon(node, level) {
|
|
|
2816
3041
|
}
|
|
2817
3042
|
return node;
|
|
2818
3043
|
}
|
|
2819
|
-
var Avatar = (0,
|
|
3044
|
+
var Avatar = (0, import_react21.forwardRef)(
|
|
2820
3045
|
({
|
|
2821
3046
|
className,
|
|
2822
3047
|
level = "text",
|
|
@@ -2831,7 +3056,7 @@ var Avatar = (0, import_react19.forwardRef)(
|
|
|
2831
3056
|
}, ref) => {
|
|
2832
3057
|
const resolvedLevel = level ?? "text";
|
|
2833
3058
|
const resolvedContent = content ?? "text";
|
|
2834
|
-
return /* @__PURE__ */ (0,
|
|
3059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2835
3060
|
"span",
|
|
2836
3061
|
{
|
|
2837
3062
|
ref,
|
|
@@ -2847,8 +3072,8 @@ var Avatar = (0, import_react19.forwardRef)(
|
|
|
2847
3072
|
"data-content": resolvedContent,
|
|
2848
3073
|
"data-line-height-fix": lineHeightFix ? "true" : "false",
|
|
2849
3074
|
...props,
|
|
2850
|
-
children: /* @__PURE__ */ (0,
|
|
2851
|
-
resolvedContent === "picture" && src ? /* @__PURE__ */ (0,
|
|
3075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "aviala-avatar__surface", children: [
|
|
3076
|
+
resolvedContent === "picture" && src ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2852
3077
|
"img",
|
|
2853
3078
|
{
|
|
2854
3079
|
className: "aviala-avatar__image",
|
|
@@ -2857,8 +3082,8 @@ var Avatar = (0, import_react19.forwardRef)(
|
|
|
2857
3082
|
...imgProps
|
|
2858
3083
|
}
|
|
2859
3084
|
) : null,
|
|
2860
|
-
resolvedContent === "icon" ? /* @__PURE__ */ (0,
|
|
2861
|
-
resolvedContent === "text" ? /* @__PURE__ */ (0,
|
|
3085
|
+
resolvedContent === "icon" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "aviala-avatar__icon", "aria-hidden": true, children: renderAvatarIcon(icon, resolvedLevel) }) : null,
|
|
3086
|
+
resolvedContent === "text" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2862
3087
|
Typography,
|
|
2863
3088
|
{
|
|
2864
3089
|
level: AVATAR_TEXT_LEVEL[resolvedLevel],
|
|
@@ -2875,10 +3100,10 @@ var Avatar = (0, import_react19.forwardRef)(
|
|
|
2875
3100
|
Avatar.displayName = "Avatar";
|
|
2876
3101
|
|
|
2877
3102
|
// src/components/tag.tsx
|
|
2878
|
-
var
|
|
3103
|
+
var import_icons8 = require("@aviala-design/icons");
|
|
2879
3104
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
2880
|
-
var
|
|
2881
|
-
var
|
|
3105
|
+
var import_react22 = require("react");
|
|
3106
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2882
3107
|
var tagVariants = (0, import_class_variance_authority7.cva)("aviala-tag", {
|
|
2883
3108
|
variants: {
|
|
2884
3109
|
level: {
|
|
@@ -2910,12 +3135,12 @@ function resolveLineHeightFix2(level, lineHeightFix) {
|
|
|
2910
3135
|
return level === "text" ? "subtitle" : "text";
|
|
2911
3136
|
}
|
|
2912
3137
|
function iconSizeForLevel2(level) {
|
|
2913
|
-
return level === "caption" ? (0,
|
|
3138
|
+
return level === "caption" ? (0, import_icons8.resolveIconSizeToken)("text") : (0, import_icons8.resolveIconSizeToken)("text", true);
|
|
2914
3139
|
}
|
|
2915
3140
|
function renderTagIcon(node, level) {
|
|
2916
3141
|
if (!node) return null;
|
|
2917
3142
|
const size = iconSizeForLevel2(level);
|
|
2918
|
-
const content = (0,
|
|
3143
|
+
const content = (0, import_react22.isValidElement)(node) && typeof node.type !== "string" ? (0, import_react22.cloneElement)(
|
|
2919
3144
|
node,
|
|
2920
3145
|
{
|
|
2921
3146
|
width: size,
|
|
@@ -2926,22 +3151,22 @@ function renderTagIcon(node, level) {
|
|
|
2926
3151
|
)
|
|
2927
3152
|
}
|
|
2928
3153
|
) : node;
|
|
2929
|
-
return /* @__PURE__ */ (0,
|
|
3154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "aviala-tag__icon", "aria-hidden": true, children: content });
|
|
2930
3155
|
}
|
|
2931
|
-
var TagClose = (0,
|
|
2932
|
-
({ className, children, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3156
|
+
var TagClose = (0, import_react22.forwardRef)(
|
|
3157
|
+
({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2933
3158
|
"button",
|
|
2934
3159
|
{
|
|
2935
3160
|
ref,
|
|
2936
3161
|
type: "button",
|
|
2937
3162
|
className: cn("aviala-tag__close aviala-focus-ring", className),
|
|
2938
3163
|
...props,
|
|
2939
|
-
children: children ?? /* @__PURE__ */ (0,
|
|
3164
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_icons8.SymbolWrong, { "aria-hidden": true, width: 14, height: 14 })
|
|
2940
3165
|
}
|
|
2941
3166
|
)
|
|
2942
3167
|
);
|
|
2943
3168
|
TagClose.displayName = "TagClose";
|
|
2944
|
-
var Tag = (0,
|
|
3169
|
+
var Tag = (0, import_react22.forwardRef)(
|
|
2945
3170
|
({
|
|
2946
3171
|
className,
|
|
2947
3172
|
children,
|
|
@@ -2965,8 +3190,8 @@ var Tag = (0, import_react20.forwardRef)(
|
|
|
2965
3190
|
const resolvedContent = content ?? "text";
|
|
2966
3191
|
const resolvedLhf = resolveLineHeightFix2(resolvedLevel, lineHeightFix);
|
|
2967
3192
|
const typographyLevel = resolvedLevel;
|
|
2968
|
-
const peopleAvatar = avatar ?? (avatarSrc ? /* @__PURE__ */ (0,
|
|
2969
|
-
return /* @__PURE__ */ (0,
|
|
3193
|
+
const peopleAvatar = avatar ?? (avatarSrc ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Avatar, { level: "text", content: "picture", src: avatarSrc, lineHeightFix: false }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Avatar, { level: "text", content: "text", lineHeightFix: false, children: avatarText ?? (typeof children === "string" ? children.charAt(0) : "?") }));
|
|
3194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2970
3195
|
"span",
|
|
2971
3196
|
{
|
|
2972
3197
|
ref,
|
|
@@ -2985,8 +3210,8 @@ var Tag = (0, import_react20.forwardRef)(
|
|
|
2985
3210
|
"aria-disabled": disabled || void 0,
|
|
2986
3211
|
...props,
|
|
2987
3212
|
children: [
|
|
2988
|
-
resolvedContent === "people" ? /* @__PURE__ */ (0,
|
|
2989
|
-
/* @__PURE__ */ (0,
|
|
3213
|
+
resolvedContent === "people" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "aviala-tag__avatar", children: peopleAvatar }) : renderTagIcon(leftIcon, resolvedLevel),
|
|
3214
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2990
3215
|
Typography,
|
|
2991
3216
|
{
|
|
2992
3217
|
level: typographyLevel,
|
|
@@ -2996,7 +3221,7 @@ var Tag = (0, import_react20.forwardRef)(
|
|
|
2996
3221
|
}
|
|
2997
3222
|
),
|
|
2998
3223
|
resolvedContent === "text" ? renderTagIcon(rightIcon, resolvedLevel) : null,
|
|
2999
|
-
closable ? /* @__PURE__ */ (0,
|
|
3224
|
+
closable ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3000
3225
|
TagClose,
|
|
3001
3226
|
{
|
|
3002
3227
|
"aria-label": resolvedCloseLabel,
|
|
@@ -3016,8 +3241,8 @@ Tag.displayName = "Tag";
|
|
|
3016
3241
|
|
|
3017
3242
|
// src/components/progress.tsx
|
|
3018
3243
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
3019
|
-
var
|
|
3020
|
-
var
|
|
3244
|
+
var import_react23 = require("react");
|
|
3245
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3021
3246
|
var progressVariants = (0, import_class_variance_authority8.cva)("aviala-progress", {
|
|
3022
3247
|
variants: {
|
|
3023
3248
|
type: {
|
|
@@ -3044,7 +3269,7 @@ function clampPercent(value) {
|
|
|
3044
3269
|
if (!Number.isFinite(value)) return 0;
|
|
3045
3270
|
return Math.min(100, Math.max(0, value));
|
|
3046
3271
|
}
|
|
3047
|
-
var Progress = (0,
|
|
3272
|
+
var Progress = (0, import_react23.forwardRef)(
|
|
3048
3273
|
({
|
|
3049
3274
|
className,
|
|
3050
3275
|
type = "default",
|
|
@@ -3066,7 +3291,7 @@ var Progress = (0, import_react21.forwardRef)(
|
|
|
3066
3291
|
const normalizedRadius = center - stroke / 2;
|
|
3067
3292
|
const circumference = normalizedRadius * 2 * Math.PI;
|
|
3068
3293
|
const strokeDashoffset = circumference - percent / 100 * circumference;
|
|
3069
|
-
return /* @__PURE__ */ (0,
|
|
3294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3070
3295
|
"div",
|
|
3071
3296
|
{
|
|
3072
3297
|
ref,
|
|
@@ -3087,15 +3312,15 @@ var Progress = (0, import_react21.forwardRef)(
|
|
|
3087
3312
|
"data-size": resolvedSize,
|
|
3088
3313
|
"data-shape": resolvedShape,
|
|
3089
3314
|
...props,
|
|
3090
|
-
children: resolvedShape === "bar" ? /* @__PURE__ */ (0,
|
|
3091
|
-
/* @__PURE__ */ (0,
|
|
3315
|
+
children: resolvedShape === "bar" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
3316
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "aviala-progress__track", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3092
3317
|
"div",
|
|
3093
3318
|
{
|
|
3094
3319
|
className: "aviala-progress__fill",
|
|
3095
3320
|
style: { width: `${percent}%` }
|
|
3096
3321
|
}
|
|
3097
3322
|
) }),
|
|
3098
|
-
showLabel ? /* @__PURE__ */ (0,
|
|
3323
|
+
showLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3099
3324
|
Typography,
|
|
3100
3325
|
{
|
|
3101
3326
|
level: "caption",
|
|
@@ -3105,7 +3330,7 @@ var Progress = (0, import_react21.forwardRef)(
|
|
|
3105
3330
|
children: displayLabel
|
|
3106
3331
|
}
|
|
3107
3332
|
) : null
|
|
3108
|
-
] }) : /* @__PURE__ */ (0,
|
|
3333
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
3109
3334
|
"svg",
|
|
3110
3335
|
{
|
|
3111
3336
|
className: "aviala-progress__ring",
|
|
@@ -3114,7 +3339,7 @@ var Progress = (0, import_react21.forwardRef)(
|
|
|
3114
3339
|
viewBox: `0 0 ${diameter} ${diameter}`,
|
|
3115
3340
|
"aria-hidden": true,
|
|
3116
3341
|
children: [
|
|
3117
|
-
/* @__PURE__ */ (0,
|
|
3342
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3118
3343
|
"circle",
|
|
3119
3344
|
{
|
|
3120
3345
|
className: "aviala-progress__ring-track",
|
|
@@ -3125,7 +3350,7 @@ var Progress = (0, import_react21.forwardRef)(
|
|
|
3125
3350
|
strokeWidth: stroke
|
|
3126
3351
|
}
|
|
3127
3352
|
),
|
|
3128
|
-
/* @__PURE__ */ (0,
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3129
3354
|
"circle",
|
|
3130
3355
|
{
|
|
3131
3356
|
className: "aviala-progress__ring-fill",
|
|
@@ -3151,8 +3376,8 @@ Progress.displayName = "Progress";
|
|
|
3151
3376
|
|
|
3152
3377
|
// src/components/scroll.tsx
|
|
3153
3378
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
3154
|
-
var
|
|
3155
|
-
var
|
|
3379
|
+
var import_react24 = require("react");
|
|
3380
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3156
3381
|
var scrollVariants = (0, import_class_variance_authority9.cva)("aviala-scroll", {
|
|
3157
3382
|
variants: {
|
|
3158
3383
|
size: {
|
|
@@ -3169,14 +3394,14 @@ var scrollVariants = (0, import_class_variance_authority9.cva)("aviala-scroll",
|
|
|
3169
3394
|
orientation: "vertical"
|
|
3170
3395
|
}
|
|
3171
3396
|
});
|
|
3172
|
-
var Scroll = (0,
|
|
3397
|
+
var Scroll = (0, import_react24.forwardRef)(
|
|
3173
3398
|
({
|
|
3174
3399
|
className,
|
|
3175
3400
|
size = "default",
|
|
3176
3401
|
orientation = "vertical",
|
|
3177
3402
|
children,
|
|
3178
3403
|
...props
|
|
3179
|
-
}, ref) => /* @__PURE__ */ (0,
|
|
3404
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3180
3405
|
"div",
|
|
3181
3406
|
{
|
|
3182
3407
|
ref,
|
|
@@ -3195,93 +3420,12 @@ Scroll.displayName = "Scroll";
|
|
|
3195
3420
|
|
|
3196
3421
|
// src/components/checkbox.tsx
|
|
3197
3422
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
3198
|
-
var
|
|
3199
|
-
|
|
3200
|
-
// src/components/typeface.tsx
|
|
3201
|
-
var import_react23 = require("react");
|
|
3202
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3203
|
-
var typefaceLayouts = {
|
|
3204
|
-
allCustom: [
|
|
3205
|
-
{ level: "text", children: null },
|
|
3206
|
-
{ level: "caption", children: null }
|
|
3207
|
-
],
|
|
3208
|
-
textCaption: [
|
|
3209
|
-
{ level: "text", children: null },
|
|
3210
|
-
{ level: "caption", children: null }
|
|
3211
|
-
],
|
|
3212
|
-
textCaptionSubtitle: [
|
|
3213
|
-
{ level: "subtitle", children: null },
|
|
3214
|
-
{ level: "text", children: null },
|
|
3215
|
-
{ level: "caption", children: null }
|
|
3216
|
-
],
|
|
3217
|
-
textTitle: [
|
|
3218
|
-
{ level: "title", children: null },
|
|
3219
|
-
{ level: "text", children: null }
|
|
3220
|
-
],
|
|
3221
|
-
textHeadline2: [
|
|
3222
|
-
{ level: "headline2", children: null },
|
|
3223
|
-
{ level: "text", children: null }
|
|
3224
|
-
],
|
|
3225
|
-
textHeadline1: [
|
|
3226
|
-
{ level: "headline1", children: null },
|
|
3227
|
-
{ level: "text", children: null }
|
|
3228
|
-
]
|
|
3229
|
-
};
|
|
3230
|
-
var Typeface = (0, import_react23.forwardRef)(
|
|
3231
|
-
({
|
|
3232
|
-
className,
|
|
3233
|
-
content = "allCustom",
|
|
3234
|
-
primary,
|
|
3235
|
-
secondary,
|
|
3236
|
-
tertiary,
|
|
3237
|
-
primaryContent = "text",
|
|
3238
|
-
secondaryContent = "text",
|
|
3239
|
-
tertiaryContent = "text",
|
|
3240
|
-
tone = "default",
|
|
3241
|
-
children,
|
|
3242
|
-
...props
|
|
3243
|
-
}, ref) => {
|
|
3244
|
-
const layout = typefaceLayouts[content];
|
|
3245
|
-
const values = resolveTypefaceValues(content, primary, secondary, tertiary, children);
|
|
3246
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, className: cn("aviala-typeface", className), "data-content": content, ...props, children: layout.map((line, index) => {
|
|
3247
|
-
const value = values[index];
|
|
3248
|
-
if (value === void 0 || value === null || value === false) return null;
|
|
3249
|
-
const lineContent = index === 0 ? primaryContent : index === 1 ? secondaryContent : tertiaryContent;
|
|
3250
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "aviala-typeface__line", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Typography, { level: line.level, content: lineContent, tone, children: value }) }, `${line.level}-${index}`);
|
|
3251
|
-
}) });
|
|
3252
|
-
}
|
|
3253
|
-
);
|
|
3254
|
-
Typeface.displayName = "Typeface";
|
|
3255
|
-
function resolveTypefaceValues(content, primary, secondary, tertiary, children) {
|
|
3256
|
-
if (primary !== void 0 || secondary !== void 0 || tertiary !== void 0) {
|
|
3257
|
-
return [primary, secondary, tertiary];
|
|
3258
|
-
}
|
|
3259
|
-
if (children == null || children === false) {
|
|
3260
|
-
return typefaceLayouts[content].map(() => "Text");
|
|
3261
|
-
}
|
|
3262
|
-
if (Array.isArray(children)) {
|
|
3263
|
-
return children;
|
|
3264
|
-
}
|
|
3265
|
-
return [children];
|
|
3266
|
-
}
|
|
3267
|
-
var TypefacePair = (0, import_react23.forwardRef)(
|
|
3268
|
-
({ title, description, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
3269
|
-
Typeface,
|
|
3270
|
-
{
|
|
3271
|
-
ref,
|
|
3272
|
-
content: "textCaption",
|
|
3273
|
-
primary: title,
|
|
3274
|
-
secondary: description,
|
|
3275
|
-
...props
|
|
3276
|
-
}
|
|
3277
|
-
)
|
|
3278
|
-
);
|
|
3279
|
-
TypefacePair.displayName = "TypefacePair";
|
|
3423
|
+
var import_react25 = require("react");
|
|
3280
3424
|
|
|
3281
3425
|
// src/components/checkbox-check-icon.tsx
|
|
3282
|
-
var
|
|
3426
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3283
3427
|
function CheckboxCheckIcon({ className, ...props }) {
|
|
3284
|
-
return /* @__PURE__ */ (0,
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3285
3429
|
"svg",
|
|
3286
3430
|
{
|
|
3287
3431
|
className: cn("aviala-checkbox__check-icon", className),
|
|
@@ -3291,7 +3435,7 @@ function CheckboxCheckIcon({ className, ...props }) {
|
|
|
3291
3435
|
"aria-hidden": true,
|
|
3292
3436
|
overflow: "visible",
|
|
3293
3437
|
...props,
|
|
3294
|
-
children: /* @__PURE__ */ (0,
|
|
3438
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3295
3439
|
"path",
|
|
3296
3440
|
{
|
|
3297
3441
|
className: "aviala-checkbox__check-path",
|
|
@@ -3308,14 +3452,14 @@ function CheckboxCheckIcon({ className, ...props }) {
|
|
|
3308
3452
|
}
|
|
3309
3453
|
|
|
3310
3454
|
// src/components/checkbox.tsx
|
|
3311
|
-
var
|
|
3312
|
-
var Checkbox = (0,
|
|
3313
|
-
const [motionReady, setMotionReady] = (0,
|
|
3314
|
-
(0,
|
|
3455
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3456
|
+
var Checkbox = (0, import_react25.forwardRef)(({ className, round = false, size = "default", ...props }, ref) => {
|
|
3457
|
+
const [motionReady, setMotionReady] = (0, import_react25.useState)(false);
|
|
3458
|
+
(0, import_react25.useEffect)(() => {
|
|
3315
3459
|
const id = requestAnimationFrame(() => setMotionReady(true));
|
|
3316
3460
|
return () => cancelAnimationFrame(id);
|
|
3317
3461
|
}, []);
|
|
3318
|
-
return /* @__PURE__ */ (0,
|
|
3462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3319
3463
|
CheckboxPrimitive.Root,
|
|
3320
3464
|
{
|
|
3321
3465
|
ref,
|
|
@@ -3325,10 +3469,10 @@ var Checkbox = (0, import_react24.forwardRef)(({ className, round = false, size
|
|
|
3325
3469
|
"data-motion": motionReady ? "ready" : "boot",
|
|
3326
3470
|
...props,
|
|
3327
3471
|
children: [
|
|
3328
|
-
/* @__PURE__ */ (0,
|
|
3329
|
-
/* @__PURE__ */ (0,
|
|
3330
|
-
/* @__PURE__ */ (0,
|
|
3331
|
-
/* @__PURE__ */ (0,
|
|
3472
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "aviala-checkbox__surface" }),
|
|
3473
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CheckboxPrimitive.Indicator, { forceMount: true, className: "aviala-checkbox__indicator", children: [
|
|
3474
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckboxCheckIcon, { className: "aviala-checkbox__indicator-icon aviala-checkbox__indicator-icon--check" }),
|
|
3475
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3332
3476
|
"span",
|
|
3333
3477
|
{
|
|
3334
3478
|
"aria-hidden": true,
|
|
@@ -3341,8 +3485,8 @@ var Checkbox = (0, import_react24.forwardRef)(({ className, round = false, size
|
|
|
3341
3485
|
);
|
|
3342
3486
|
});
|
|
3343
3487
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
3344
|
-
var CheckboxGroup = (0,
|
|
3345
|
-
({ className, direction = "vertical", ...props }, ref) => /* @__PURE__ */ (0,
|
|
3488
|
+
var CheckboxGroup = (0, import_react25.forwardRef)(
|
|
3489
|
+
({ className, direction = "vertical", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3346
3490
|
"div",
|
|
3347
3491
|
{
|
|
3348
3492
|
ref,
|
|
@@ -3356,7 +3500,7 @@ CheckboxGroup.displayName = "CheckboxGroup";
|
|
|
3356
3500
|
function renderIcon3(node) {
|
|
3357
3501
|
if (!node) return null;
|
|
3358
3502
|
const icon = 18;
|
|
3359
|
-
const content = (0,
|
|
3503
|
+
const content = (0, import_react25.isValidElement)(node) && typeof node.type !== "string" ? (0, import_react25.cloneElement)(node, {
|
|
3360
3504
|
width: icon,
|
|
3361
3505
|
height: icon,
|
|
3362
3506
|
className: cn(
|
|
@@ -3364,9 +3508,9 @@ function renderIcon3(node) {
|
|
|
3364
3508
|
"shrink-0"
|
|
3365
3509
|
)
|
|
3366
3510
|
}) : node;
|
|
3367
|
-
return /* @__PURE__ */ (0,
|
|
3511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "aviala-checkbox-input__icon", children: content });
|
|
3368
3512
|
}
|
|
3369
|
-
var CheckboxInput = (0,
|
|
3513
|
+
var CheckboxInput = (0, import_react25.forwardRef)(
|
|
3370
3514
|
({
|
|
3371
3515
|
className,
|
|
3372
3516
|
title,
|
|
@@ -3375,16 +3519,16 @@ var CheckboxInput = (0, import_react24.forwardRef)(
|
|
|
3375
3519
|
disabled,
|
|
3376
3520
|
id,
|
|
3377
3521
|
...props
|
|
3378
|
-
}, ref) => /* @__PURE__ */ (0,
|
|
3522
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3379
3523
|
"label",
|
|
3380
3524
|
{
|
|
3381
3525
|
htmlFor: id,
|
|
3382
3526
|
className: cn("aviala-checkbox-input", className),
|
|
3383
3527
|
"data-disabled": disabled ? "true" : void 0,
|
|
3384
3528
|
children: [
|
|
3385
|
-
/* @__PURE__ */ (0,
|
|
3529
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Checkbox, { ref, id, disabled, ...props }),
|
|
3386
3530
|
renderIcon3(icon),
|
|
3387
|
-
/* @__PURE__ */ (0,
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3388
3532
|
TypefacePair,
|
|
3389
3533
|
{
|
|
3390
3534
|
className: "aviala-checkbox-input__content min-w-0 flex-1",
|
|
@@ -3400,9 +3544,9 @@ CheckboxInput.displayName = "CheckboxInput";
|
|
|
3400
3544
|
|
|
3401
3545
|
// src/components/radio-group.tsx
|
|
3402
3546
|
var RadioGroupPrimitive = __toESM(require("@radix-ui/react-radio-group"), 1);
|
|
3403
|
-
var
|
|
3404
|
-
var
|
|
3405
|
-
var RadioGroup = (0,
|
|
3547
|
+
var import_react26 = require("react");
|
|
3548
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3549
|
+
var RadioGroup = (0, import_react26.forwardRef)(({ className, direction = "vertical", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3406
3550
|
RadioGroupPrimitive.Root,
|
|
3407
3551
|
{
|
|
3408
3552
|
className: cn("aviala-radio-group", className),
|
|
@@ -3412,15 +3556,15 @@ var RadioGroup = (0, import_react25.forwardRef)(({ className, direction = "verti
|
|
|
3412
3556
|
}
|
|
3413
3557
|
));
|
|
3414
3558
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
3415
|
-
var RadioGroupItem = (0,
|
|
3559
|
+
var RadioGroupItem = (0, import_react26.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3416
3560
|
RadioGroupPrimitive.Item,
|
|
3417
3561
|
{
|
|
3418
3562
|
ref,
|
|
3419
3563
|
className: cn("aviala-radio aviala-focus-ring", className),
|
|
3420
3564
|
...props,
|
|
3421
3565
|
children: [
|
|
3422
|
-
/* @__PURE__ */ (0,
|
|
3423
|
-
/* @__PURE__ */ (0,
|
|
3566
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": true, className: "aviala-radio__surface" }),
|
|
3567
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { "aria-hidden": true, className: "aviala-radio__indicator" })
|
|
3424
3568
|
]
|
|
3425
3569
|
}
|
|
3426
3570
|
));
|
|
@@ -3428,7 +3572,7 @@ RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
|
|
|
3428
3572
|
function renderIcon4(node) {
|
|
3429
3573
|
if (!node) return null;
|
|
3430
3574
|
const icon = 18;
|
|
3431
|
-
const content = (0,
|
|
3575
|
+
const content = (0, import_react26.isValidElement)(node) && typeof node.type !== "string" ? (0, import_react26.cloneElement)(node, {
|
|
3432
3576
|
width: icon,
|
|
3433
3577
|
height: icon,
|
|
3434
3578
|
className: cn(
|
|
@@ -3436,9 +3580,9 @@ function renderIcon4(node) {
|
|
|
3436
3580
|
"shrink-0"
|
|
3437
3581
|
)
|
|
3438
3582
|
}) : node;
|
|
3439
|
-
return /* @__PURE__ */ (0,
|
|
3583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "aviala-radio-input__icon", children: content });
|
|
3440
3584
|
}
|
|
3441
|
-
var RadioInput = (0,
|
|
3585
|
+
var RadioInput = (0, import_react26.forwardRef)(
|
|
3442
3586
|
({
|
|
3443
3587
|
className,
|
|
3444
3588
|
title,
|
|
@@ -3448,7 +3592,7 @@ var RadioInput = (0, import_react25.forwardRef)(
|
|
|
3448
3592
|
disabled,
|
|
3449
3593
|
id,
|
|
3450
3594
|
...props
|
|
3451
|
-
}, ref) => /* @__PURE__ */ (0,
|
|
3595
|
+
}, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3452
3596
|
"label",
|
|
3453
3597
|
{
|
|
3454
3598
|
htmlFor: id,
|
|
@@ -3456,9 +3600,9 @@ var RadioInput = (0, import_react25.forwardRef)(
|
|
|
3456
3600
|
"data-style": variant,
|
|
3457
3601
|
"data-disabled": disabled ? "true" : void 0,
|
|
3458
3602
|
children: [
|
|
3459
|
-
/* @__PURE__ */ (0,
|
|
3603
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RadioGroupItem, { ref, id, disabled, ...props }),
|
|
3460
3604
|
renderIcon4(icon),
|
|
3461
|
-
/* @__PURE__ */ (0,
|
|
3605
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3462
3606
|
TypefacePair,
|
|
3463
3607
|
{
|
|
3464
3608
|
className: "aviala-radio-input__content min-w-0 flex-1",
|
|
@@ -3474,9 +3618,9 @@ RadioInput.displayName = "RadioInput";
|
|
|
3474
3618
|
|
|
3475
3619
|
// src/components/switch.tsx
|
|
3476
3620
|
var SwitchPrimitive = __toESM(require("@radix-ui/react-switch"), 1);
|
|
3477
|
-
var
|
|
3478
|
-
var
|
|
3479
|
-
var Switch = (0,
|
|
3621
|
+
var import_react27 = require("react");
|
|
3622
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3623
|
+
var Switch = (0, import_react27.forwardRef)(({ className, size = "regular", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
3480
3624
|
SwitchPrimitive.Root,
|
|
3481
3625
|
{
|
|
3482
3626
|
className: cn(
|
|
@@ -3487,8 +3631,8 @@ var Switch = (0, import_react26.forwardRef)(({ className, size = "regular", ...p
|
|
|
3487
3631
|
ref,
|
|
3488
3632
|
...props,
|
|
3489
3633
|
children: [
|
|
3490
|
-
/* @__PURE__ */ (0,
|
|
3491
|
-
/* @__PURE__ */ (0,
|
|
3634
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { "aria-hidden": true, className: "aviala-switch__surface" }),
|
|
3635
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SwitchPrimitive.Thumb, { className: "aviala-switch__thumb" })
|
|
3492
3636
|
]
|
|
3493
3637
|
}
|
|
3494
3638
|
));
|
|
@@ -3496,13 +3640,13 @@ Switch.displayName = SwitchPrimitive.Root.displayName;
|
|
|
3496
3640
|
|
|
3497
3641
|
// src/components/anchor.tsx
|
|
3498
3642
|
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
3499
|
-
var
|
|
3500
|
-
var
|
|
3501
|
-
var Anchor2 = (0,
|
|
3502
|
-
({ className, as: Tag2 = "nav", ...props }, ref) => /* @__PURE__ */ (0,
|
|
3643
|
+
var import_react28 = require("react");
|
|
3644
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3645
|
+
var Anchor2 = (0, import_react28.forwardRef)(
|
|
3646
|
+
({ className, as: Tag2 = "nav", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Tag2, { ref, className: cn("aviala-anchor", className), ...props })
|
|
3503
3647
|
);
|
|
3504
3648
|
Anchor2.displayName = "Anchor";
|
|
3505
|
-
var AnchorItem = (0,
|
|
3649
|
+
var AnchorItem = (0, import_react28.forwardRef)(
|
|
3506
3650
|
({
|
|
3507
3651
|
className,
|
|
3508
3652
|
activated = false,
|
|
@@ -3512,7 +3656,7 @@ var AnchorItem = (0, import_react27.forwardRef)(
|
|
|
3512
3656
|
...props
|
|
3513
3657
|
}, ref) => {
|
|
3514
3658
|
const Comp = asChild ? import_react_slot4.Slot : "a";
|
|
3515
|
-
return /* @__PURE__ */ (0,
|
|
3659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3516
3660
|
Comp,
|
|
3517
3661
|
{
|
|
3518
3662
|
ref,
|
|
@@ -3521,8 +3665,8 @@ var AnchorItem = (0, import_react27.forwardRef)(
|
|
|
3521
3665
|
"data-indent": String(indentLevel),
|
|
3522
3666
|
...props,
|
|
3523
3667
|
children: [
|
|
3524
|
-
/* @__PURE__ */ (0,
|
|
3525
|
-
/* @__PURE__ */ (0,
|
|
3668
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "aviala-anchor-item__rail", "aria-hidden": true }),
|
|
3669
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "aviala-anchor-item__content", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Typography, { level: "text", as: "span", className: "aviala-anchor-item__label", children }) })
|
|
3526
3670
|
]
|
|
3527
3671
|
}
|
|
3528
3672
|
);
|
|
@@ -3531,11 +3675,11 @@ var AnchorItem = (0, import_react27.forwardRef)(
|
|
|
3531
3675
|
AnchorItem.displayName = "AnchorItem";
|
|
3532
3676
|
|
|
3533
3677
|
// src/components/segmentator.tsx
|
|
3534
|
-
var
|
|
3535
|
-
var
|
|
3536
|
-
var SegmentatorContext = (0,
|
|
3678
|
+
var import_react29 = require("react");
|
|
3679
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3680
|
+
var SegmentatorContext = (0, import_react29.createContext)(null);
|
|
3537
3681
|
function useSegmentatorContext() {
|
|
3538
|
-
const ctx = (0,
|
|
3682
|
+
const ctx = (0, import_react29.useContext)(SegmentatorContext);
|
|
3539
3683
|
if (!ctx) {
|
|
3540
3684
|
throw new Error("SegmentatorItem must be used within SegmentatorGroup");
|
|
3541
3685
|
}
|
|
@@ -3547,7 +3691,7 @@ function renderIcon5(node, dimmed) {
|
|
|
3547
3691
|
level: "text",
|
|
3548
3692
|
biggerSize: true
|
|
3549
3693
|
});
|
|
3550
|
-
return /* @__PURE__ */ (0,
|
|
3694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3551
3695
|
"span",
|
|
3552
3696
|
{
|
|
3553
3697
|
className: cn(
|
|
@@ -3559,10 +3703,10 @@ function renderIcon5(node, dimmed) {
|
|
|
3559
3703
|
);
|
|
3560
3704
|
}
|
|
3561
3705
|
function useSegmentatorState(value, defaultValue, onValueChange) {
|
|
3562
|
-
const [internal, setInternal] = (0,
|
|
3706
|
+
const [internal, setInternal] = (0, import_react29.useState)(defaultValue ?? "");
|
|
3563
3707
|
const isControlled = value !== void 0;
|
|
3564
3708
|
const current = isControlled ? value : internal;
|
|
3565
|
-
const setValue = (0,
|
|
3709
|
+
const setValue = (0, import_react29.useCallback)(
|
|
3566
3710
|
(next) => {
|
|
3567
3711
|
if (!isControlled) setInternal(next);
|
|
3568
3712
|
onValueChange?.(next);
|
|
@@ -3755,13 +3899,13 @@ function metricsApproxEqual(a, b, epsilon = 0.5) {
|
|
|
3755
3899
|
return Math.abs(a.x - b.x) < epsilon && Math.abs(a.y - b.y) < epsilon && Math.abs(a.width - b.width) < epsilon && Math.abs(a.height - b.height) < epsilon;
|
|
3756
3900
|
}
|
|
3757
3901
|
function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
3758
|
-
const thumbElRef = (0,
|
|
3759
|
-
const metricsRef = (0,
|
|
3760
|
-
const dragStateRef = (0,
|
|
3761
|
-
const [thumb, setThumb] = (0,
|
|
3762
|
-
const isInitialMount = (0,
|
|
3902
|
+
const thumbElRef = (0, import_react29.useRef)(null);
|
|
3903
|
+
const metricsRef = (0, import_react29.useRef)(null);
|
|
3904
|
+
const dragStateRef = (0, import_react29.useRef)(dragState);
|
|
3905
|
+
const [thumb, setThumb] = (0, import_react29.useState)(null);
|
|
3906
|
+
const isInitialMount = (0, import_react29.useRef)(true);
|
|
3763
3907
|
dragStateRef.current = dragState;
|
|
3764
|
-
const measureThumb = (0,
|
|
3908
|
+
const measureThumb = (0, import_react29.useCallback)(() => {
|
|
3765
3909
|
const group = groupRef.current;
|
|
3766
3910
|
if (!group) return null;
|
|
3767
3911
|
const selected = group.querySelector(
|
|
@@ -3770,7 +3914,7 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3770
3914
|
if (!selected) return null;
|
|
3771
3915
|
return measureItemThumbMetrics(selected, group);
|
|
3772
3916
|
}, [groupRef]);
|
|
3773
|
-
const syncThumb = (0,
|
|
3917
|
+
const syncThumb = (0, import_react29.useCallback)(
|
|
3774
3918
|
(metrics, instant = false) => {
|
|
3775
3919
|
metricsRef.current = metrics;
|
|
3776
3920
|
setThumb(metrics);
|
|
@@ -3779,7 +3923,7 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3779
3923
|
},
|
|
3780
3924
|
[]
|
|
3781
3925
|
);
|
|
3782
|
-
const writeThumbMetrics = (0,
|
|
3926
|
+
const writeThumbMetrics = (0, import_react29.useCallback)(
|
|
3783
3927
|
(metrics, instant = false) => {
|
|
3784
3928
|
metricsRef.current = metrics;
|
|
3785
3929
|
const el = thumbElRef.current;
|
|
@@ -3787,25 +3931,25 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3787
3931
|
},
|
|
3788
3932
|
[]
|
|
3789
3933
|
);
|
|
3790
|
-
const writeThumbMetricsLive = (0,
|
|
3934
|
+
const writeThumbMetricsLive = (0, import_react29.useCallback)((metrics) => {
|
|
3791
3935
|
metricsRef.current = metrics;
|
|
3792
3936
|
const el = thumbElRef.current;
|
|
3793
3937
|
if (el) applyThumbMetricsLive(el, metrics);
|
|
3794
3938
|
}, []);
|
|
3795
|
-
const remeasureThumb = (0,
|
|
3939
|
+
const remeasureThumb = (0, import_react29.useCallback)(() => {
|
|
3796
3940
|
if (dragStateRef.current.pressing || dragStateRef.current.active) return;
|
|
3797
3941
|
const metrics = measureThumb();
|
|
3798
3942
|
if (!metrics) return;
|
|
3799
3943
|
syncThumb(metrics, true);
|
|
3800
3944
|
}, [measureThumb, syncThumb]);
|
|
3801
|
-
const onThumbRef = (0,
|
|
3945
|
+
const onThumbRef = (0, import_react29.useCallback)((node) => {
|
|
3802
3946
|
thumbElRef.current = node;
|
|
3803
3947
|
if (node && metricsRef.current && isInitialMount.current) {
|
|
3804
3948
|
applyThumbMetrics(node, metricsRef.current, true);
|
|
3805
3949
|
isInitialMount.current = false;
|
|
3806
3950
|
}
|
|
3807
3951
|
}, []);
|
|
3808
|
-
(0,
|
|
3952
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
3809
3953
|
if (dragState.pressing || dragState.active) return;
|
|
3810
3954
|
const group = groupRef.current;
|
|
3811
3955
|
if (group) {
|
|
@@ -3849,7 +3993,7 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3849
3993
|
}
|
|
3850
3994
|
syncThumb(next, false);
|
|
3851
3995
|
}, [selectedValue, measureThumb, syncThumb, dragState.active, dragState.pressing, groupRef]);
|
|
3852
|
-
(0,
|
|
3996
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
3853
3997
|
const group = groupRef.current;
|
|
3854
3998
|
if (!group) return;
|
|
3855
3999
|
const updateOverflowAndThumb = () => {
|
|
@@ -3881,7 +4025,7 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3881
4025
|
group.removeEventListener("scroll", onScroll);
|
|
3882
4026
|
};
|
|
3883
4027
|
}, [groupRef, remeasureThumb]);
|
|
3884
|
-
(0,
|
|
4028
|
+
(0, import_react29.useEffect)(() => {
|
|
3885
4029
|
if (!layoutKey) return;
|
|
3886
4030
|
const frame = requestAnimationFrame(() => {
|
|
3887
4031
|
remeasureThumb();
|
|
@@ -3890,7 +4034,7 @@ function useSegmentatorThumb(groupRef, selectedValue, layoutKey, dragState) {
|
|
|
3890
4034
|
}, [layoutKey, remeasureThumb]);
|
|
3891
4035
|
return { thumb, onThumbRef, writeThumbMetrics, writeThumbMetricsLive };
|
|
3892
4036
|
}
|
|
3893
|
-
var SegmentatorGroup = (0,
|
|
4037
|
+
var SegmentatorGroup = (0, import_react29.forwardRef)(
|
|
3894
4038
|
({
|
|
3895
4039
|
className,
|
|
3896
4040
|
value,
|
|
@@ -3905,16 +4049,16 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
3905
4049
|
...props
|
|
3906
4050
|
}, ref) => {
|
|
3907
4051
|
const [currentValue, setValue] = useSegmentatorState(value, defaultValue, onValueChange);
|
|
3908
|
-
const groupRef = (0,
|
|
4052
|
+
const groupRef = (0, import_react29.useRef)(null);
|
|
3909
4053
|
const layoutKey = useThemeLayoutKey();
|
|
3910
|
-
const consumeClickRef = (0,
|
|
3911
|
-
const pointerDragRef = (0,
|
|
3912
|
-
const [dragState, setDragState] = (0,
|
|
4054
|
+
const consumeClickRef = (0, import_react29.useRef)(false);
|
|
4055
|
+
const pointerDragRef = (0, import_react29.useRef)(null);
|
|
4056
|
+
const [dragState, setDragState] = (0, import_react29.useState)({
|
|
3913
4057
|
pressing: false,
|
|
3914
4058
|
active: false
|
|
3915
4059
|
});
|
|
3916
4060
|
const { thumb, onThumbRef, writeThumbMetrics, writeThumbMetricsLive } = useSegmentatorThumb(groupRef, currentValue, layoutKey, dragState);
|
|
3917
|
-
const resetPointerInteraction = (0,
|
|
4061
|
+
const resetPointerInteraction = (0, import_react29.useCallback)(() => {
|
|
3918
4062
|
pointerDragRef.current?.cleanupWindowListeners?.();
|
|
3919
4063
|
pointerDragRef.current = null;
|
|
3920
4064
|
setDragState({ pressing: false, active: false });
|
|
@@ -3930,7 +4074,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
3930
4074
|
thumbEl.removeAttribute("data-instant");
|
|
3931
4075
|
}
|
|
3932
4076
|
}, []);
|
|
3933
|
-
const finishPointerInteraction = (0,
|
|
4077
|
+
const finishPointerInteraction = (0, import_react29.useCallback)(
|
|
3934
4078
|
(pointerId) => {
|
|
3935
4079
|
const drag = pointerDragRef.current;
|
|
3936
4080
|
const group = groupRef.current;
|
|
@@ -3954,7 +4098,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
3954
4098
|
},
|
|
3955
4099
|
[currentValue, resetPointerInteraction, setValue]
|
|
3956
4100
|
);
|
|
3957
|
-
const updateDragThumb = (0,
|
|
4101
|
+
const updateDragThumb = (0, import_react29.useCallback)(
|
|
3958
4102
|
(clientX, clientY) => {
|
|
3959
4103
|
const group = groupRef.current;
|
|
3960
4104
|
const drag = pointerDragRef.current;
|
|
@@ -4000,7 +4144,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4000
4144
|
},
|
|
4001
4145
|
[direction, writeThumbMetrics, writeThumbMetricsLive]
|
|
4002
4146
|
);
|
|
4003
|
-
const attachWindowDragListeners = (0,
|
|
4147
|
+
const attachWindowDragListeners = (0, import_react29.useCallback)(
|
|
4004
4148
|
(pointerId) => {
|
|
4005
4149
|
const onPointerMove = (event) => {
|
|
4006
4150
|
const drag = pointerDragRef.current;
|
|
@@ -4031,7 +4175,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4031
4175
|
},
|
|
4032
4176
|
[direction, finishPointerInteraction, updateDragThumb]
|
|
4033
4177
|
);
|
|
4034
|
-
const finishPointerDrag = (0,
|
|
4178
|
+
const finishPointerDrag = (0, import_react29.useCallback)(
|
|
4035
4179
|
(event) => {
|
|
4036
4180
|
finishPointerInteraction(event.pointerId);
|
|
4037
4181
|
},
|
|
@@ -4066,10 +4210,10 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4066
4210
|
group.setPointerCapture(event.pointerId);
|
|
4067
4211
|
};
|
|
4068
4212
|
const thumbStyle = thumb ? buildThumbStyle() : void 0;
|
|
4069
|
-
return /* @__PURE__ */ (0,
|
|
4213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4070
4214
|
SegmentatorContext.Provider,
|
|
4071
4215
|
{
|
|
4072
|
-
value: (0,
|
|
4216
|
+
value: (0, import_react29.useMemo)(
|
|
4073
4217
|
() => ({
|
|
4074
4218
|
value: currentValue,
|
|
4075
4219
|
onValueChange: setValue,
|
|
@@ -4081,7 +4225,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4081
4225
|
}),
|
|
4082
4226
|
[currentValue, setValue, mode, direction, allRound, disabled]
|
|
4083
4227
|
),
|
|
4084
|
-
children: /* @__PURE__ */ (0,
|
|
4228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4085
4229
|
"div",
|
|
4086
4230
|
{
|
|
4087
4231
|
ref: (node) => {
|
|
@@ -4104,7 +4248,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4104
4248
|
onLostPointerCapture: finishPointerDrag,
|
|
4105
4249
|
children: [
|
|
4106
4250
|
children,
|
|
4107
|
-
thumb && /* @__PURE__ */ (0,
|
|
4251
|
+
thumb && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4108
4252
|
"span",
|
|
4109
4253
|
{
|
|
4110
4254
|
ref: onThumbRef,
|
|
@@ -4124,7 +4268,7 @@ var SegmentatorGroup = (0, import_react28.forwardRef)(
|
|
|
4124
4268
|
}
|
|
4125
4269
|
);
|
|
4126
4270
|
SegmentatorGroup.displayName = "SegmentatorGroup";
|
|
4127
|
-
var SegmentatorItem = (0,
|
|
4271
|
+
var SegmentatorItem = (0, import_react29.forwardRef)(
|
|
4128
4272
|
({
|
|
4129
4273
|
className,
|
|
4130
4274
|
value,
|
|
@@ -4142,7 +4286,7 @@ var SegmentatorItem = (0, import_react28.forwardRef)(
|
|
|
4142
4286
|
const isDisabled = disabled || ctx.disabled;
|
|
4143
4287
|
const dimmed = isDisabled;
|
|
4144
4288
|
const icon = iconOnly ? leftIcon ?? rightIcon : leftIcon;
|
|
4145
|
-
return /* @__PURE__ */ (0,
|
|
4289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4146
4290
|
"button",
|
|
4147
4291
|
{
|
|
4148
4292
|
ref,
|
|
@@ -4164,9 +4308,9 @@ var SegmentatorItem = (0, import_react28.forwardRef)(
|
|
|
4164
4308
|
onClick?.(e);
|
|
4165
4309
|
},
|
|
4166
4310
|
...props,
|
|
4167
|
-
children: /* @__PURE__ */ (0,
|
|
4311
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "aviala-segmentator-item__content", children: [
|
|
4168
4312
|
renderIcon5(icon, dimmed && !!icon),
|
|
4169
|
-
!iconOnly && /* @__PURE__ */ (0,
|
|
4313
|
+
!iconOnly && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4170
4314
|
"span",
|
|
4171
4315
|
{
|
|
4172
4316
|
className: cn(
|
|
@@ -4185,135 +4329,6 @@ var SegmentatorItem = (0, import_react28.forwardRef)(
|
|
|
4185
4329
|
);
|
|
4186
4330
|
SegmentatorItem.displayName = "SegmentatorItem";
|
|
4187
4331
|
|
|
4188
|
-
// src/components/form-field.tsx
|
|
4189
|
-
var import_icons8 = require("@aviala-design/icons");
|
|
4190
|
-
var import_react29 = require("react");
|
|
4191
|
-
var import_react_hook_form = require("react-hook-form");
|
|
4192
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4193
|
-
var FormFieldLayout = (0, import_react29.forwardRef)(
|
|
4194
|
-
({
|
|
4195
|
-
className,
|
|
4196
|
-
label,
|
|
4197
|
-
htmlFor,
|
|
4198
|
-
description,
|
|
4199
|
-
error,
|
|
4200
|
-
info,
|
|
4201
|
-
alert,
|
|
4202
|
-
required,
|
|
4203
|
-
direction = "vertical",
|
|
4204
|
-
children,
|
|
4205
|
-
...props
|
|
4206
|
-
}, ref) => {
|
|
4207
|
-
const reactId = (0, import_react29.useId)();
|
|
4208
|
-
const labelId = `${reactId}-label`;
|
|
4209
|
-
const hasLabel = label != null && label !== "";
|
|
4210
|
-
const labelNode = hasLabel || description ? htmlFor ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("label", { htmlFor, className: "aviala-form__label aviala-form__label--control", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4211
|
-
Typeface,
|
|
4212
|
-
{
|
|
4213
|
-
id: labelId,
|
|
4214
|
-
content: "textCaption",
|
|
4215
|
-
primary: hasLabel ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4216
|
-
label,
|
|
4217
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "aviala-form__required", "aria-hidden": true, children: "*" }) : null
|
|
4218
|
-
] }) : void 0,
|
|
4219
|
-
secondary: description
|
|
4220
|
-
}
|
|
4221
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4222
|
-
Typeface,
|
|
4223
|
-
{
|
|
4224
|
-
id: labelId,
|
|
4225
|
-
className: "aviala-form__label",
|
|
4226
|
-
content: "textCaption",
|
|
4227
|
-
primary: hasLabel ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4228
|
-
label,
|
|
4229
|
-
required ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "aviala-form__required", "aria-hidden": true, children: "*" }) : null
|
|
4230
|
-
] }) : void 0,
|
|
4231
|
-
secondary: description
|
|
4232
|
-
}
|
|
4233
|
-
) : null;
|
|
4234
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4235
|
-
"div",
|
|
4236
|
-
{
|
|
4237
|
-
ref,
|
|
4238
|
-
className: cn("aviala-form", className),
|
|
4239
|
-
"data-direction": direction,
|
|
4240
|
-
"aria-labelledby": hasLabel ? labelId : void 0,
|
|
4241
|
-
...props,
|
|
4242
|
-
children: [
|
|
4243
|
-
labelNode,
|
|
4244
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "aviala-form__content", children: [
|
|
4245
|
-
children,
|
|
4246
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "aviala-form__message aviala-form__message--error", role: "alert", children: [
|
|
4247
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4248
|
-
import_icons8.SymbolWrongCircle,
|
|
4249
|
-
{
|
|
4250
|
-
className: "aviala-form__message-icon",
|
|
4251
|
-
width: 14,
|
|
4252
|
-
height: 14,
|
|
4253
|
-
"aria-hidden": true
|
|
4254
|
-
}
|
|
4255
|
-
),
|
|
4256
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Typography, { level: "caption", as: "p", className: "aviala-form__message-text", children: error })
|
|
4257
|
-
] }) : null,
|
|
4258
|
-
info ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "aviala-form__message aviala-form__message--info", children: [
|
|
4259
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4260
|
-
import_icons8.SymbolInformationCircle,
|
|
4261
|
-
{
|
|
4262
|
-
className: "aviala-form__message-icon",
|
|
4263
|
-
width: 14,
|
|
4264
|
-
height: 14,
|
|
4265
|
-
"aria-hidden": true
|
|
4266
|
-
}
|
|
4267
|
-
),
|
|
4268
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Typography, { level: "caption", as: "p", className: "aviala-form__message-text", children: info })
|
|
4269
|
-
] }) : null,
|
|
4270
|
-
alert ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "aviala-form__alert", children: alert }) : null
|
|
4271
|
-
] })
|
|
4272
|
-
]
|
|
4273
|
-
}
|
|
4274
|
-
);
|
|
4275
|
-
}
|
|
4276
|
-
);
|
|
4277
|
-
FormFieldLayout.displayName = "FormFieldLayout";
|
|
4278
|
-
var FormFieldControlled = (0, import_react29.forwardRef)(
|
|
4279
|
-
({
|
|
4280
|
-
control,
|
|
4281
|
-
name,
|
|
4282
|
-
rules,
|
|
4283
|
-
defaultValue,
|
|
4284
|
-
shouldUnregister,
|
|
4285
|
-
disabled,
|
|
4286
|
-
render,
|
|
4287
|
-
error,
|
|
4288
|
-
...layoutProps
|
|
4289
|
-
}, ref) => {
|
|
4290
|
-
const id = (0, import_react29.useId)();
|
|
4291
|
-
const { field, fieldState, formState } = (0, import_react_hook_form.useController)({
|
|
4292
|
-
name,
|
|
4293
|
-
control,
|
|
4294
|
-
rules,
|
|
4295
|
-
defaultValue,
|
|
4296
|
-
shouldUnregister,
|
|
4297
|
-
disabled
|
|
4298
|
-
});
|
|
4299
|
-
const message = error !== void 0 ? error : fieldState.error?.message ?? null;
|
|
4300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormFieldLayout, { ref, ...layoutProps, htmlFor: id, error: message, children: render({ field, fieldState, formState, id }) });
|
|
4301
|
-
}
|
|
4302
|
-
);
|
|
4303
|
-
FormFieldControlled.displayName = "FormFieldControlled";
|
|
4304
|
-
function isControlledProps(props) {
|
|
4305
|
-
return "render" in props && typeof props.render === "function" && "name" in props;
|
|
4306
|
-
}
|
|
4307
|
-
var FormFieldRoot = (0, import_react29.forwardRef)((props, ref) => {
|
|
4308
|
-
if (isControlledProps(props)) {
|
|
4309
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormFieldControlled, { ref, ...props });
|
|
4310
|
-
}
|
|
4311
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormFieldLayout, { ref, ...props });
|
|
4312
|
-
});
|
|
4313
|
-
var FormField = FormFieldRoot;
|
|
4314
|
-
FormField.displayName = "FormField";
|
|
4315
|
-
var Form = import_react_hook_form.FormProvider;
|
|
4316
|
-
|
|
4317
4332
|
// src/components/input-group.tsx
|
|
4318
4333
|
var import_react30 = require("react");
|
|
4319
4334
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
@@ -5658,7 +5673,7 @@ var CascaderTrigger = (0, import_react41.forwardRef)(
|
|
|
5658
5673
|
rightIcon,
|
|
5659
5674
|
expandIcon,
|
|
5660
5675
|
placeholder,
|
|
5661
|
-
error
|
|
5676
|
+
error,
|
|
5662
5677
|
displayValue,
|
|
5663
5678
|
separator = "/",
|
|
5664
5679
|
disabled: disabledProp,
|
|
@@ -5669,6 +5684,7 @@ var CascaderTrigger = (0, import_react41.forwardRef)(
|
|
|
5669
5684
|
const { open, disabled: disabledContext, size: sizeContext, selectedPath, getOptionAtPath } = useCascaderContext();
|
|
5670
5685
|
const size = sizeProp ?? sizeContext;
|
|
5671
5686
|
const disabled = disabledProp ?? disabledContext;
|
|
5687
|
+
const resolvedError = useResolvedControlError(error);
|
|
5672
5688
|
const labels = selectedPath.map((_, index) => getOptionAtPath(selectedPath.slice(0, index + 1))?.label).filter((label) => label != null && label !== false);
|
|
5673
5689
|
const resolvedDisplay = displayValue ?? (labels.length > 0 ? labels.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("span", { children: [
|
|
5674
5690
|
index > 0 ? separator : null,
|
|
@@ -5684,7 +5700,7 @@ var CascaderTrigger = (0, import_react41.forwardRef)(
|
|
|
5684
5700
|
"data-size": size,
|
|
5685
5701
|
"data-all-round": allRound ? "true" : "false",
|
|
5686
5702
|
"data-state": open ? "open" : "closed",
|
|
5687
|
-
"data-error":
|
|
5703
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
5688
5704
|
disabled,
|
|
5689
5705
|
"aria-expanded": open,
|
|
5690
5706
|
"aria-haspopup": "listbox",
|
|
@@ -7206,7 +7222,7 @@ var DatePickerTrigger = (0, import_react45.forwardRef)(
|
|
|
7206
7222
|
rightIcon,
|
|
7207
7223
|
placeholder,
|
|
7208
7224
|
rangePlaceholder,
|
|
7209
|
-
error
|
|
7225
|
+
error,
|
|
7210
7226
|
displayValue,
|
|
7211
7227
|
rangeSeparator = " - ",
|
|
7212
7228
|
disabled: disabledProp,
|
|
@@ -7231,6 +7247,7 @@ var DatePickerTrigger = (0, import_react45.forwardRef)(
|
|
|
7231
7247
|
} = useDatePickerContext();
|
|
7232
7248
|
const size = sizeProp ?? sizeContext;
|
|
7233
7249
|
const disabled = disabledProp ?? disabledContext;
|
|
7250
|
+
const resolvedError = useResolvedControlError(error);
|
|
7234
7251
|
const resolvedPlaceholder = placeholder ?? locale.placeholder;
|
|
7235
7252
|
const resolvedRangePlaceholder = rangePlaceholder ?? locale.rangePlaceholder;
|
|
7236
7253
|
const inputRef = (0, import_react45.useRef)(null);
|
|
@@ -7285,7 +7302,7 @@ var DatePickerTrigger = (0, import_react45.forwardRef)(
|
|
|
7285
7302
|
"data-size": size,
|
|
7286
7303
|
"data-all-round": allRound ? "true" : "false",
|
|
7287
7304
|
"data-state": open ? "open" : "closed",
|
|
7288
|
-
"data-error":
|
|
7305
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
7289
7306
|
disabled,
|
|
7290
7307
|
"aria-expanded": open,
|
|
7291
7308
|
"aria-haspopup": "dialog",
|
|
@@ -7317,7 +7334,7 @@ var DatePickerTrigger = (0, import_react45.forwardRef)(
|
|
|
7317
7334
|
"data-size": size,
|
|
7318
7335
|
"data-all-round": allRound ? "true" : "false",
|
|
7319
7336
|
"data-state": open ? "open" : "closed",
|
|
7320
|
-
"data-error":
|
|
7337
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
7321
7338
|
"data-disabled": disabled ? "true" : void 0,
|
|
7322
7339
|
onMouseDown: (event) => {
|
|
7323
7340
|
if (disabled) return;
|
|
@@ -8098,7 +8115,7 @@ var TimePickerTrigger = (0, import_react47.forwardRef)(
|
|
|
8098
8115
|
leftIcon,
|
|
8099
8116
|
rightIcon,
|
|
8100
8117
|
placeholder,
|
|
8101
|
-
error
|
|
8118
|
+
error,
|
|
8102
8119
|
displayValue,
|
|
8103
8120
|
disabled: disabledProp,
|
|
8104
8121
|
...props
|
|
@@ -8107,6 +8124,7 @@ var TimePickerTrigger = (0, import_react47.forwardRef)(
|
|
|
8107
8124
|
const { open, disabled: disabledContext, size: sizeContext, value } = useTimePickerContext();
|
|
8108
8125
|
const size = sizeProp ?? sizeContext;
|
|
8109
8126
|
const disabled = disabledProp ?? disabledContext;
|
|
8127
|
+
const resolvedError = useResolvedControlError(error);
|
|
8110
8128
|
const resolvedPlaceholder = placeholder ?? locale.placeholder;
|
|
8111
8129
|
const formatted = displayValue !== void 0 ? displayValue : formatTimeValue(value.hours, value.minutes);
|
|
8112
8130
|
const hasValue = formatted != null && formatted !== "";
|
|
@@ -8119,7 +8137,7 @@ var TimePickerTrigger = (0, import_react47.forwardRef)(
|
|
|
8119
8137
|
"data-size": size,
|
|
8120
8138
|
"data-all-round": allRound ? "true" : "false",
|
|
8121
8139
|
"data-state": open ? "open" : "closed",
|
|
8122
|
-
"data-error":
|
|
8140
|
+
"data-error": resolvedError ? "true" : void 0,
|
|
8123
8141
|
disabled,
|
|
8124
8142
|
"aria-expanded": open,
|
|
8125
8143
|
"aria-haspopup": "dialog",
|
|
@@ -12073,6 +12091,7 @@ TableCell.displayName = "TableCell";
|
|
|
12073
12091
|
useDirection,
|
|
12074
12092
|
useLocale,
|
|
12075
12093
|
useLocaleMessages,
|
|
12094
|
+
useResolvedControlError,
|
|
12076
12095
|
useRtl,
|
|
12077
12096
|
useTheme,
|
|
12078
12097
|
useThemeLayoutKey,
|