@proyecto-viviana/ui 0.2.2 → 0.2.5
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/index.js +378 -18
- package/dist/index.js.map +1 -7
- package/dist/index.ssr.js +378 -18
- package/dist/index.ssr.js.map +1 -7
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1147,7 +1147,370 @@ import { spread as _$spread2 } from "solid-js/web";
|
|
|
1147
1147
|
import { mergeProps as _$mergeProps8 } from "solid-js/web";
|
|
1148
1148
|
import { splitProps as splitProps8, mergeProps as solidMergeProps4, Show as Show9 } from "solid-js";
|
|
1149
1149
|
import { createTextField, createFocusRing } from "@proyecto-viviana/solidaria";
|
|
1150
|
-
|
|
1150
|
+
|
|
1151
|
+
// ../solid-stately/src/utils/reactivity.ts
|
|
1152
|
+
function access(value) {
|
|
1153
|
+
return typeof value === "function" ? value() : value;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// ../solid-stately/src/textfield/createTextFieldState.ts
|
|
1157
|
+
import { createSignal as createSignal3 } from "solid-js";
|
|
1158
|
+
function createTextFieldState(props = {}) {
|
|
1159
|
+
const getProps = () => access(props);
|
|
1160
|
+
const initialProps = getProps();
|
|
1161
|
+
const initialValue = initialProps.value ?? initialProps.defaultValue ?? "";
|
|
1162
|
+
const [internalValue, setInternalValue] = createSignal3(initialValue);
|
|
1163
|
+
const isControlled = () => getProps().value !== void 0;
|
|
1164
|
+
const value = () => {
|
|
1165
|
+
const p = getProps();
|
|
1166
|
+
return isControlled() ? p.value ?? "" : internalValue();
|
|
1167
|
+
};
|
|
1168
|
+
function setValue(newValue) {
|
|
1169
|
+
const p = getProps();
|
|
1170
|
+
if (!isControlled()) {
|
|
1171
|
+
setInternalValue(newValue);
|
|
1172
|
+
}
|
|
1173
|
+
p.onChange?.(newValue);
|
|
1174
|
+
}
|
|
1175
|
+
return {
|
|
1176
|
+
value,
|
|
1177
|
+
setValue
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
// ../solid-stately/src/numberfield/createNumberFieldState.ts
|
|
1182
|
+
import { createSignal as createSignal4, createMemo } from "solid-js";
|
|
1183
|
+
function handleDecimalOperation(operator, value1, value2) {
|
|
1184
|
+
const getDecimals = (n) => {
|
|
1185
|
+
const str = String(n);
|
|
1186
|
+
const idx = str.indexOf(".");
|
|
1187
|
+
return idx === -1 ? 0 : str.length - idx - 1;
|
|
1188
|
+
};
|
|
1189
|
+
const decimals = Math.max(getDecimals(value1), getDecimals(value2));
|
|
1190
|
+
const multiplier = Math.pow(10, decimals);
|
|
1191
|
+
const int1 = Math.round(value1 * multiplier);
|
|
1192
|
+
const int2 = Math.round(value2 * multiplier);
|
|
1193
|
+
const result = operator === "+" ? int1 + int2 : int1 - int2;
|
|
1194
|
+
return result / multiplier;
|
|
1195
|
+
}
|
|
1196
|
+
function clamp(value, min, max) {
|
|
1197
|
+
let result = value;
|
|
1198
|
+
if (min != null && result < min) result = min;
|
|
1199
|
+
if (max != null && result > max) result = max;
|
|
1200
|
+
return result;
|
|
1201
|
+
}
|
|
1202
|
+
function snapToStep(value, step, min) {
|
|
1203
|
+
const base = min ?? 0;
|
|
1204
|
+
const diff = value - base;
|
|
1205
|
+
const steps = Math.round(diff / step);
|
|
1206
|
+
return handleDecimalOperation("+", base, steps * step);
|
|
1207
|
+
}
|
|
1208
|
+
function createNumberFieldState(props) {
|
|
1209
|
+
const getProps = () => access(props);
|
|
1210
|
+
const locale = () => getProps().locale ?? "en-US";
|
|
1211
|
+
const formatOptions = () => getProps().formatOptions ?? {};
|
|
1212
|
+
const formatter = createMemo(() => {
|
|
1213
|
+
return new Intl.NumberFormat(locale(), formatOptions());
|
|
1214
|
+
});
|
|
1215
|
+
const parseNumber = (value) => {
|
|
1216
|
+
if (!value || value === "" || value === "-") return NaN;
|
|
1217
|
+
const opts = formatOptions();
|
|
1218
|
+
const testNumber = formatter().format(1.1);
|
|
1219
|
+
const decimalSeparator = testNumber.charAt(1);
|
|
1220
|
+
let normalized = value;
|
|
1221
|
+
if (decimalSeparator !== ".") {
|
|
1222
|
+
normalized = normalized.replace(decimalSeparator, ".");
|
|
1223
|
+
}
|
|
1224
|
+
normalized = normalized.replace(/[^\d.\-]/g, "");
|
|
1225
|
+
const parsed = parseFloat(normalized);
|
|
1226
|
+
return parsed;
|
|
1227
|
+
};
|
|
1228
|
+
const formatNumber = (value) => {
|
|
1229
|
+
if (isNaN(value)) return "";
|
|
1230
|
+
return formatter().format(value);
|
|
1231
|
+
};
|
|
1232
|
+
const step = createMemo(() => {
|
|
1233
|
+
const p = getProps();
|
|
1234
|
+
if (p.step != null) return p.step;
|
|
1235
|
+
if (p.formatOptions?.style === "percent") return 0.01;
|
|
1236
|
+
return 1;
|
|
1237
|
+
});
|
|
1238
|
+
const [inputValue, setInputValueInternal] = createSignal4("");
|
|
1239
|
+
const [numberValue, setNumberValue] = createSignal4(NaN);
|
|
1240
|
+
const initValue = () => {
|
|
1241
|
+
const p = getProps();
|
|
1242
|
+
const initial = p.value ?? p.defaultValue;
|
|
1243
|
+
if (initial != null) {
|
|
1244
|
+
setNumberValue(initial);
|
|
1245
|
+
setInputValueInternal(formatNumber(initial));
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
let initialized = false;
|
|
1249
|
+
const ensureInitialized = () => {
|
|
1250
|
+
if (!initialized) {
|
|
1251
|
+
initialized = true;
|
|
1252
|
+
initValue();
|
|
1253
|
+
}
|
|
1254
|
+
};
|
|
1255
|
+
const actualNumberValue = createMemo(() => {
|
|
1256
|
+
ensureInitialized();
|
|
1257
|
+
const p = getProps();
|
|
1258
|
+
if (p.value !== void 0) {
|
|
1259
|
+
return p.value;
|
|
1260
|
+
}
|
|
1261
|
+
return numberValue();
|
|
1262
|
+
});
|
|
1263
|
+
const validate = (value) => {
|
|
1264
|
+
if (value === "" || value === "-") return true;
|
|
1265
|
+
const opts = formatOptions();
|
|
1266
|
+
const testNumber = formatter().format(1.1);
|
|
1267
|
+
const decimalSeparator = testNumber.charAt(1);
|
|
1268
|
+
const pattern = new RegExp(
|
|
1269
|
+
`^-?\\d*${decimalSeparator === "." ? "\\." : decimalSeparator}?\\d*$`
|
|
1270
|
+
);
|
|
1271
|
+
return pattern.test(value);
|
|
1272
|
+
};
|
|
1273
|
+
const setInputValue = (value) => {
|
|
1274
|
+
ensureInitialized();
|
|
1275
|
+
setInputValueInternal(value);
|
|
1276
|
+
};
|
|
1277
|
+
const commit = () => {
|
|
1278
|
+
ensureInitialized();
|
|
1279
|
+
const p = getProps();
|
|
1280
|
+
const input = inputValue();
|
|
1281
|
+
if (input === "" || input === "-") {
|
|
1282
|
+
setNumberValue(NaN);
|
|
1283
|
+
setInputValueInternal("");
|
|
1284
|
+
return;
|
|
1285
|
+
}
|
|
1286
|
+
let parsed = parseNumber(input);
|
|
1287
|
+
if (isNaN(parsed)) {
|
|
1288
|
+
setInputValueInternal(formatNumber(actualNumberValue()));
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
parsed = clamp(parsed, p.minValue, p.maxValue);
|
|
1292
|
+
parsed = snapToStep(parsed, step(), p.minValue);
|
|
1293
|
+
setNumberValue(parsed);
|
|
1294
|
+
setInputValueInternal(formatNumber(parsed));
|
|
1295
|
+
if (p.value === void 0) {
|
|
1296
|
+
p.onChange?.(parsed);
|
|
1297
|
+
} else {
|
|
1298
|
+
p.onChange?.(parsed);
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
const canIncrement = createMemo(() => {
|
|
1302
|
+
ensureInitialized();
|
|
1303
|
+
const p = getProps();
|
|
1304
|
+
if (p.isDisabled || p.isReadOnly) return false;
|
|
1305
|
+
const current = actualNumberValue();
|
|
1306
|
+
if (isNaN(current)) return true;
|
|
1307
|
+
if (p.maxValue == null) return true;
|
|
1308
|
+
return handleDecimalOperation("+", current, step()) <= p.maxValue;
|
|
1309
|
+
});
|
|
1310
|
+
const canDecrement = createMemo(() => {
|
|
1311
|
+
ensureInitialized();
|
|
1312
|
+
const p = getProps();
|
|
1313
|
+
if (p.isDisabled || p.isReadOnly) return false;
|
|
1314
|
+
const current = actualNumberValue();
|
|
1315
|
+
if (isNaN(current)) return true;
|
|
1316
|
+
if (p.minValue == null) return true;
|
|
1317
|
+
return handleDecimalOperation("-", current, step()) >= p.minValue;
|
|
1318
|
+
});
|
|
1319
|
+
const increment = () => {
|
|
1320
|
+
ensureInitialized();
|
|
1321
|
+
const p = getProps();
|
|
1322
|
+
if (p.isDisabled || p.isReadOnly) return;
|
|
1323
|
+
let current = actualNumberValue();
|
|
1324
|
+
if (isNaN(current)) {
|
|
1325
|
+
current = p.minValue ?? 0;
|
|
1326
|
+
} else {
|
|
1327
|
+
current = snapToStep(current, step(), p.minValue);
|
|
1328
|
+
current = handleDecimalOperation("+", current, step());
|
|
1329
|
+
}
|
|
1330
|
+
current = clamp(current, p.minValue, p.maxValue);
|
|
1331
|
+
setNumberValue(current);
|
|
1332
|
+
setInputValueInternal(formatNumber(current));
|
|
1333
|
+
p.onChange?.(current);
|
|
1334
|
+
};
|
|
1335
|
+
const decrement = () => {
|
|
1336
|
+
ensureInitialized();
|
|
1337
|
+
const p = getProps();
|
|
1338
|
+
if (p.isDisabled || p.isReadOnly) return;
|
|
1339
|
+
let current = actualNumberValue();
|
|
1340
|
+
if (isNaN(current)) {
|
|
1341
|
+
current = p.maxValue ?? 0;
|
|
1342
|
+
} else {
|
|
1343
|
+
current = snapToStep(current, step(), p.minValue);
|
|
1344
|
+
current = handleDecimalOperation("-", current, step());
|
|
1345
|
+
}
|
|
1346
|
+
current = clamp(current, p.minValue, p.maxValue);
|
|
1347
|
+
setNumberValue(current);
|
|
1348
|
+
setInputValueInternal(formatNumber(current));
|
|
1349
|
+
p.onChange?.(current);
|
|
1350
|
+
};
|
|
1351
|
+
const incrementToMax = () => {
|
|
1352
|
+
ensureInitialized();
|
|
1353
|
+
const p = getProps();
|
|
1354
|
+
if (p.isDisabled || p.isReadOnly) return;
|
|
1355
|
+
if (p.maxValue == null) return;
|
|
1356
|
+
const snapped = snapToStep(p.maxValue, step(), p.minValue);
|
|
1357
|
+
setNumberValue(snapped);
|
|
1358
|
+
setInputValueInternal(formatNumber(snapped));
|
|
1359
|
+
p.onChange?.(snapped);
|
|
1360
|
+
};
|
|
1361
|
+
const decrementToMin = () => {
|
|
1362
|
+
ensureInitialized();
|
|
1363
|
+
const p = getProps();
|
|
1364
|
+
if (p.isDisabled || p.isReadOnly) return;
|
|
1365
|
+
if (p.minValue == null) return;
|
|
1366
|
+
setNumberValue(p.minValue);
|
|
1367
|
+
setInputValueInternal(formatNumber(p.minValue));
|
|
1368
|
+
p.onChange?.(p.minValue);
|
|
1369
|
+
};
|
|
1370
|
+
return {
|
|
1371
|
+
get inputValue() {
|
|
1372
|
+
ensureInitialized();
|
|
1373
|
+
return inputValue;
|
|
1374
|
+
},
|
|
1375
|
+
get numberValue() {
|
|
1376
|
+
return actualNumberValue;
|
|
1377
|
+
},
|
|
1378
|
+
canIncrement,
|
|
1379
|
+
canDecrement,
|
|
1380
|
+
isDisabled: () => getProps().isDisabled ?? false,
|
|
1381
|
+
isReadOnly: () => getProps().isReadOnly ?? false,
|
|
1382
|
+
minValue: () => getProps().minValue,
|
|
1383
|
+
maxValue: () => getProps().maxValue,
|
|
1384
|
+
setInputValue,
|
|
1385
|
+
validate,
|
|
1386
|
+
commit,
|
|
1387
|
+
increment,
|
|
1388
|
+
decrement,
|
|
1389
|
+
incrementToMax,
|
|
1390
|
+
decrementToMin
|
|
1391
|
+
};
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
// ../solid-stately/src/searchfield/createSearchFieldState.ts
|
|
1395
|
+
import { createSignal as createSignal5, createMemo as createMemo2 } from "solid-js";
|
|
1396
|
+
function createSearchFieldState(props) {
|
|
1397
|
+
const getProps = () => access(props);
|
|
1398
|
+
const isControlled = () => getProps().value !== void 0;
|
|
1399
|
+
const [internalValue, setInternalValue] = createSignal5(
|
|
1400
|
+
getProps().defaultValue ?? ""
|
|
1401
|
+
);
|
|
1402
|
+
const value = createMemo2(() => {
|
|
1403
|
+
const p = getProps();
|
|
1404
|
+
return isControlled() ? p.value ?? "" : internalValue();
|
|
1405
|
+
});
|
|
1406
|
+
const setValue = (newValue) => {
|
|
1407
|
+
const p = getProps();
|
|
1408
|
+
if (!isControlled()) {
|
|
1409
|
+
setInternalValue(newValue);
|
|
1410
|
+
}
|
|
1411
|
+
p.onChange?.(newValue);
|
|
1412
|
+
};
|
|
1413
|
+
return {
|
|
1414
|
+
value,
|
|
1415
|
+
setValue
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
// ../solid-stately/src/slider/createSliderState.ts
|
|
1420
|
+
import { createSignal as createSignal6, createMemo as createMemo3 } from "solid-js";
|
|
1421
|
+
var DEFAULT_MIN = 0;
|
|
1422
|
+
var DEFAULT_MAX = 100;
|
|
1423
|
+
var DEFAULT_STEP = 1;
|
|
1424
|
+
function clamp2(value, min, max) {
|
|
1425
|
+
return Math.min(Math.max(value, min), max);
|
|
1426
|
+
}
|
|
1427
|
+
function snapToStep2(value, min, max, step) {
|
|
1428
|
+
const snapped = Math.round((value - min) / step) * step + min;
|
|
1429
|
+
const decimalPlaces = (step.toString().split(".")[1] || "").length;
|
|
1430
|
+
const rounded = parseFloat(snapped.toFixed(decimalPlaces));
|
|
1431
|
+
return clamp2(rounded, min, max);
|
|
1432
|
+
}
|
|
1433
|
+
function createSliderState(props) {
|
|
1434
|
+
const getProps = () => access(props);
|
|
1435
|
+
const minValue = getProps().minValue ?? DEFAULT_MIN;
|
|
1436
|
+
const maxValue = getProps().maxValue ?? DEFAULT_MAX;
|
|
1437
|
+
const step = getProps().step ?? DEFAULT_STEP;
|
|
1438
|
+
const orientation = getProps().orientation ?? "horizontal";
|
|
1439
|
+
const isDisabled = getProps().isDisabled ?? false;
|
|
1440
|
+
const pageStep = Math.max(step, snapToStep2((maxValue - minValue) / 10, 0, maxValue - minValue, step));
|
|
1441
|
+
const isControlled = () => getProps().value !== void 0;
|
|
1442
|
+
const [internalValue, setInternalValue] = createSignal6(
|
|
1443
|
+
snapToStep2(getProps().defaultValue ?? minValue, minValue, maxValue, step)
|
|
1444
|
+
);
|
|
1445
|
+
const [isDragging, setIsDragging] = createSignal6(false);
|
|
1446
|
+
const [isFocused, setIsFocused] = createSignal6(false);
|
|
1447
|
+
const value = createMemo3(() => {
|
|
1448
|
+
const p = getProps();
|
|
1449
|
+
const rawValue = isControlled() ? p.value ?? minValue : internalValue();
|
|
1450
|
+
return snapToStep2(rawValue, minValue, maxValue, step);
|
|
1451
|
+
});
|
|
1452
|
+
const getValuePercent = createMemo3(() => {
|
|
1453
|
+
return (value() - minValue) / (maxValue - minValue);
|
|
1454
|
+
});
|
|
1455
|
+
const getFormattedValue = createMemo3(() => {
|
|
1456
|
+
const p = getProps();
|
|
1457
|
+
const formatter = new Intl.NumberFormat(p.locale, p.formatOptions);
|
|
1458
|
+
return formatter.format(value());
|
|
1459
|
+
});
|
|
1460
|
+
const setValue = (newValue) => {
|
|
1461
|
+
if (isDisabled) return;
|
|
1462
|
+
const p = getProps();
|
|
1463
|
+
const snappedValue = snapToStep2(newValue, minValue, maxValue, step);
|
|
1464
|
+
if (!isControlled()) {
|
|
1465
|
+
setInternalValue(snappedValue);
|
|
1466
|
+
}
|
|
1467
|
+
p.onChange?.(snappedValue);
|
|
1468
|
+
};
|
|
1469
|
+
const setValuePercent = (percent) => {
|
|
1470
|
+
const clampedPercent = clamp2(percent, 0, 1);
|
|
1471
|
+
const newValue = clampedPercent * (maxValue - minValue) + minValue;
|
|
1472
|
+
setValue(newValue);
|
|
1473
|
+
};
|
|
1474
|
+
const setDragging = (dragging) => {
|
|
1475
|
+
const wasDragging = isDragging();
|
|
1476
|
+
setIsDragging(dragging);
|
|
1477
|
+
if (wasDragging && !dragging) {
|
|
1478
|
+
getProps().onChangeEnd?.(value());
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
const increment = (stepMultiplier = 1) => {
|
|
1482
|
+
if (isDisabled) return;
|
|
1483
|
+
setValue(value() + step * stepMultiplier);
|
|
1484
|
+
};
|
|
1485
|
+
const decrement = (stepMultiplier = 1) => {
|
|
1486
|
+
if (isDisabled) return;
|
|
1487
|
+
setValue(value() - step * stepMultiplier);
|
|
1488
|
+
};
|
|
1489
|
+
const setFocused = (focused) => {
|
|
1490
|
+
setIsFocused(focused);
|
|
1491
|
+
};
|
|
1492
|
+
return {
|
|
1493
|
+
value,
|
|
1494
|
+
setValue,
|
|
1495
|
+
setValuePercent,
|
|
1496
|
+
getValuePercent,
|
|
1497
|
+
getFormattedValue,
|
|
1498
|
+
isDragging,
|
|
1499
|
+
setDragging,
|
|
1500
|
+
isFocused,
|
|
1501
|
+
setFocused,
|
|
1502
|
+
increment,
|
|
1503
|
+
decrement,
|
|
1504
|
+
minValue,
|
|
1505
|
+
maxValue,
|
|
1506
|
+
step,
|
|
1507
|
+
pageStep,
|
|
1508
|
+
orientation,
|
|
1509
|
+
isDisabled
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
// src/textfield/index.tsx
|
|
1151
1514
|
var _tmpl$15 = /* @__PURE__ */ _$template13(`<span class="text-danger-400 ml-0.5">*`);
|
|
1152
1515
|
var _tmpl$211 = /* @__PURE__ */ _$template13(`<label><!$><!/><!$><!/>`);
|
|
1153
1516
|
var _tmpl$38 = /* @__PURE__ */ _$template13(`<p>`);
|
|
@@ -1405,7 +1768,7 @@ import { insert as _$insert13 } from "solid-js/web";
|
|
|
1405
1768
|
import { memo as _$memo10 } from "solid-js/web";
|
|
1406
1769
|
import { spread as _$spread3 } from "solid-js/web";
|
|
1407
1770
|
import { mergeProps as _$mergeProps10 } from "solid-js/web";
|
|
1408
|
-
import { splitProps as splitProps10, Show as Show10, createMemo } from "solid-js";
|
|
1771
|
+
import { splitProps as splitProps10, Show as Show10, createMemo as createMemo4 } from "solid-js";
|
|
1409
1772
|
import { createProgressBar } from "@proyecto-viviana/solidaria";
|
|
1410
1773
|
var _tmpl$16 = /* @__PURE__ */ _$template14(`<span class="text-primary-200 font-medium">`);
|
|
1411
1774
|
var _tmpl$212 = /* @__PURE__ */ _$template14(`<span class=text-primary-300>`);
|
|
@@ -1432,7 +1795,7 @@ var variantStyles5 = {
|
|
|
1432
1795
|
warning: "bg-yellow-500",
|
|
1433
1796
|
danger: "bg-red-500"
|
|
1434
1797
|
};
|
|
1435
|
-
function
|
|
1798
|
+
function clamp3(value, min, max) {
|
|
1436
1799
|
return Math.min(Math.max(value, min), max);
|
|
1437
1800
|
}
|
|
1438
1801
|
function ProgressBar(props) {
|
|
@@ -1464,14 +1827,14 @@ function ProgressBar(props) {
|
|
|
1464
1827
|
return ariaProps["aria-label"];
|
|
1465
1828
|
}
|
|
1466
1829
|
});
|
|
1467
|
-
const percentage =
|
|
1830
|
+
const percentage = createMemo4(() => {
|
|
1468
1831
|
if (isIndeterminate()) {
|
|
1469
1832
|
return void 0;
|
|
1470
1833
|
}
|
|
1471
1834
|
const value = ariaProps.value ?? 0;
|
|
1472
1835
|
const minValue = ariaProps.minValue ?? 0;
|
|
1473
1836
|
const maxValue = ariaProps.maxValue ?? 100;
|
|
1474
|
-
const clampedValue =
|
|
1837
|
+
const clampedValue = clamp3(value, minValue, maxValue);
|
|
1475
1838
|
return (clampedValue - minValue) / (maxValue - minValue) * 100;
|
|
1476
1839
|
});
|
|
1477
1840
|
const valueText = () => progressAria.progressBarProps["aria-valuetext"];
|
|
@@ -1536,7 +1899,7 @@ import { getNextElement as _$getNextElement15 } from "solid-js/web";
|
|
|
1536
1899
|
import { runHydrationEvents as _$runHydrationEvents7 } from "solid-js/web";
|
|
1537
1900
|
import { spread as _$spread4 } from "solid-js/web";
|
|
1538
1901
|
import { mergeProps as _$mergeProps11 } from "solid-js/web";
|
|
1539
|
-
import { splitProps as splitProps11, createMemo as
|
|
1902
|
+
import { splitProps as splitProps11, createMemo as createMemo5, Show as Show11 } from "solid-js";
|
|
1540
1903
|
import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
1541
1904
|
var _tmpl$17 = /* @__PURE__ */ _$template15(`<div>`);
|
|
1542
1905
|
var _tmpl$213 = /* @__PURE__ */ _$template15(`<hr>`);
|
|
@@ -1560,7 +1923,7 @@ function Separator(props) {
|
|
|
1560
1923
|
const orientation = () => local.orientation ?? "horizontal";
|
|
1561
1924
|
const variant = () => local.variant ?? "default";
|
|
1562
1925
|
const size = () => local.size ?? "md";
|
|
1563
|
-
const elementType =
|
|
1926
|
+
const elementType = createMemo5(() => {
|
|
1564
1927
|
if (orientation() === "vertical") {
|
|
1565
1928
|
return "div";
|
|
1566
1929
|
}
|
|
@@ -1577,7 +1940,7 @@ function Separator(props) {
|
|
|
1577
1940
|
return ariaProps["aria-label"];
|
|
1578
1941
|
}
|
|
1579
1942
|
});
|
|
1580
|
-
const className =
|
|
1943
|
+
const className = createMemo5(() => {
|
|
1581
1944
|
const isVertical = orientation() === "vertical";
|
|
1582
1945
|
const sizeStyles33 = isVertical ? verticalSizeStyles : horizontalSizeStyles;
|
|
1583
1946
|
const base = [
|
|
@@ -1677,7 +2040,7 @@ import { addEventListener as _$addEventListener3 } from "solid-js/web";
|
|
|
1677
2040
|
import { setProperty as _$setProperty } from "solid-js/web";
|
|
1678
2041
|
import { effect as _$effect14 } from "solid-js/web";
|
|
1679
2042
|
import { use as _$use2 } from "solid-js/web";
|
|
1680
|
-
import { splitProps as splitProps13, createMemo as
|
|
2043
|
+
import { splitProps as splitProps13, createMemo as createMemo6, Show as Show12, For } from "solid-js";
|
|
1681
2044
|
import { Autocomplete, useAutocompleteInput, useAutocompleteCollection, useAutocompleteState } from "@proyecto-viviana/solidaria-components";
|
|
1682
2045
|
var _tmpl$18 = /* @__PURE__ */ _$template16(`<input type=text>`);
|
|
1683
2046
|
var _tmpl$214 = /* @__PURE__ */ _$template16(`<ul role=listbox>`);
|
|
@@ -1755,7 +2118,7 @@ function AutocompleteList(props) {
|
|
|
1755
2118
|
const state = useAutocompleteState();
|
|
1756
2119
|
if (!ctx) return null;
|
|
1757
2120
|
const styles = () => sizeStyles11[props.size];
|
|
1758
|
-
const filteredItems =
|
|
2121
|
+
const filteredItems = createMemo6(() => {
|
|
1759
2122
|
if (!ctx.filter) return props.items;
|
|
1760
2123
|
return props.items.filter((item) => {
|
|
1761
2124
|
const textValue = String(item[props.textKey] ?? item.name ?? "");
|
|
@@ -2727,7 +3090,6 @@ import { effect as _$effect19 } from "solid-js/web";
|
|
|
2727
3090
|
import { getNextElement as _$getNextElement21 } from "solid-js/web";
|
|
2728
3091
|
import { splitProps as splitProps19, mergeProps as solidMergeProps5, Show as Show15 } from "solid-js";
|
|
2729
3092
|
import { createNumberField, createFocusRing as createFocusRing2, createPress, createHover } from "@proyecto-viviana/solidaria";
|
|
2730
|
-
import { createNumberFieldState } from "@proyecto-viviana/solid-stately";
|
|
2731
3093
|
var _tmpl$31 = /* @__PURE__ */ _$template21(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2><path d="M8 3v10M3 8h10">`);
|
|
2732
3094
|
var _tmpl$218 = /* @__PURE__ */ _$template21(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2><path d="M3 8h10">`);
|
|
2733
3095
|
var _tmpl$314 = /* @__PURE__ */ _$template21(`<span class="text-danger-500 ml-1">*`);
|
|
@@ -3184,7 +3546,6 @@ import { effect as _$effect20 } from "solid-js/web";
|
|
|
3184
3546
|
import { getNextElement as _$getNextElement22 } from "solid-js/web";
|
|
3185
3547
|
import { splitProps as splitProps20, mergeProps as solidMergeProps6, Show as Show16 } from "solid-js";
|
|
3186
3548
|
import { createSearchField, createFocusRing as createFocusRing3, createPress as createPress2, createHover as createHover2 } from "@proyecto-viviana/solidaria";
|
|
3187
|
-
import { createSearchFieldState } from "@proyecto-viviana/solid-stately";
|
|
3188
3549
|
var _tmpl$40 = /* @__PURE__ */ _$template22(`<svg viewBox="0 0 20 20"fill=none stroke=currentColor stroke-width=2><circle cx=8 cy=8 r=5></circle><path d="M12 12L17 17"stroke-linecap=round>`);
|
|
3189
3550
|
var _tmpl$219 = /* @__PURE__ */ _$template22(`<svg viewBox="0 0 16 16"fill=none stroke=currentColor stroke-width=2><path d="M4 4L12 12M12 4L4 12"stroke-linecap=round>`);
|
|
3190
3551
|
var _tmpl$315 = /* @__PURE__ */ _$template22(`<span class="text-danger-500 ml-1">*`);
|
|
@@ -3614,7 +3975,6 @@ import { mergeProps as _$mergeProps21 } from "solid-js/web";
|
|
|
3614
3975
|
import { memo as _$memo18 } from "solid-js/web";
|
|
3615
3976
|
import { splitProps as splitProps21, mergeProps as solidMergeProps7, Show as Show17 } from "solid-js";
|
|
3616
3977
|
import { createSlider, createFocusRing as createFocusRing4, createHover as createHover3 } from "@proyecto-viviana/solidaria";
|
|
3617
|
-
import { createSliderState } from "@proyecto-viviana/solid-stately";
|
|
3618
3978
|
var _tmpl$41 = /* @__PURE__ */ _$template23(`<span>`);
|
|
3619
3979
|
var _tmpl$220 = /* @__PURE__ */ _$template23(`<output>`);
|
|
3620
3980
|
var _tmpl$316 = /* @__PURE__ */ _$template23(`<div><!$><!/><!$><!/>`);
|
|
@@ -4578,7 +4938,7 @@ import { insert as _$insert23 } from "solid-js/web";
|
|
|
4578
4938
|
import { memo as _$memo22 } from "solid-js/web";
|
|
4579
4939
|
import { spread as _$spread8 } from "solid-js/web";
|
|
4580
4940
|
import { mergeProps as _$mergeProps25 } from "solid-js/web";
|
|
4581
|
-
import { splitProps as splitProps25, Show as Show21, createMemo as
|
|
4941
|
+
import { splitProps as splitProps25, Show as Show21, createMemo as createMemo7 } from "solid-js";
|
|
4582
4942
|
import { createMeter } from "@proyecto-viviana/solidaria";
|
|
4583
4943
|
var _tmpl$61 = /* @__PURE__ */ _$template27(`<span class="text-primary-200 font-medium">`);
|
|
4584
4944
|
var _tmpl$223 = /* @__PURE__ */ _$template27(`<span class=text-primary-300>`);
|
|
@@ -4606,7 +4966,7 @@ var variantStyles12 = {
|
|
|
4606
4966
|
danger: "bg-red-500",
|
|
4607
4967
|
info: "bg-blue-500"
|
|
4608
4968
|
};
|
|
4609
|
-
function
|
|
4969
|
+
function clamp4(value, min, max) {
|
|
4610
4970
|
return Math.min(Math.max(value, min), max);
|
|
4611
4971
|
}
|
|
4612
4972
|
function Meter(props) {
|
|
@@ -4634,11 +4994,11 @@ function Meter(props) {
|
|
|
4634
4994
|
return ariaProps["aria-label"];
|
|
4635
4995
|
}
|
|
4636
4996
|
});
|
|
4637
|
-
const percentage =
|
|
4997
|
+
const percentage = createMemo7(() => {
|
|
4638
4998
|
const value = ariaProps.value ?? 0;
|
|
4639
4999
|
const minValue = ariaProps.minValue ?? 0;
|
|
4640
5000
|
const maxValue = ariaProps.maxValue ?? 100;
|
|
4641
|
-
const clampedValue =
|
|
5001
|
+
const clampedValue = clamp4(value, minValue, maxValue);
|
|
4642
5002
|
return (clampedValue - minValue) / (maxValue - minValue) * 100;
|
|
4643
5003
|
});
|
|
4644
5004
|
const valueText = () => meterAria.meterProps["aria-valuetext"];
|
|
@@ -8219,4 +8579,4 @@ export {
|
|
|
8219
8579
|
useLandmarkController,
|
|
8220
8580
|
useToastContext
|
|
8221
8581
|
};
|
|
8222
|
-
//# sourceMappingURL=index.js.map
|
|
8582
|
+
//# sourceMappingURL=index.js.map
|