@proyecto-viviana/ui 0.2.5 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +210 -557
- package/dist/index.js.map +7 -1
- package/dist/index.ssr.js +42 -399
- package/dist/index.ssr.js.map +7 -1
- package/dist/radio/index.d.ts +27 -12
- package/dist/radio/index.d.ts.map +1 -1
- package/package.json +11 -12
- package/src/alert/index.tsx +0 -48
- package/src/assets/favicon.png +0 -0
- package/src/assets/fire.gif +0 -0
- package/src/autocomplete/index.tsx +0 -313
- package/src/avatar/index.tsx +0 -75
- package/src/badge/index.tsx +0 -43
- package/src/breadcrumbs/index.tsx +0 -207
- package/src/button/Button.tsx +0 -74
- package/src/button/index.ts +0 -2
- package/src/button/types.ts +0 -24
- package/src/calendar/DateField.tsx +0 -200
- package/src/calendar/DatePicker.tsx +0 -298
- package/src/calendar/RangeCalendar.tsx +0 -236
- package/src/calendar/TimeField.tsx +0 -196
- package/src/calendar/index.tsx +0 -223
- package/src/checkbox/index.tsx +0 -257
- package/src/color/index.tsx +0 -687
- package/src/combobox/index.tsx +0 -383
- package/src/components.css +0 -1077
- package/src/custom/calendar-card/index.tsx +0 -66
- package/src/custom/chip/index.tsx +0 -46
- package/src/custom/conversation/index.tsx +0 -105
- package/src/custom/event-card/index.tsx +0 -132
- package/src/custom/header/index.tsx +0 -33
- package/src/custom/lateral-nav/index.tsx +0 -88
- package/src/custom/logo/index.tsx +0 -58
- package/src/custom/nav-header/index.tsx +0 -42
- package/src/custom/page-layout/index.tsx +0 -29
- package/src/custom/profile-card/index.tsx +0 -64
- package/src/custom/project-card/index.tsx +0 -59
- package/src/custom/timeline-item/index.tsx +0 -105
- package/src/dialog/Dialog.tsx +0 -260
- package/src/dialog/index.tsx +0 -3
- package/src/disclosure/index.tsx +0 -307
- package/src/gridlist/index.tsx +0 -403
- package/src/icon/icons/GitHubIcon.tsx +0 -20
- package/src/icon/index.tsx +0 -48
- package/src/index.ts +0 -322
- package/src/landmark/index.tsx +0 -231
- package/src/link/index.tsx +0 -130
- package/src/listbox/index.tsx +0 -231
- package/src/menu/index.tsx +0 -297
- package/src/meter/index.tsx +0 -163
- package/src/numberfield/index.tsx +0 -482
- package/src/popover/index.tsx +0 -260
- package/src/progress-bar/index.tsx +0 -169
- package/src/radio/index.tsx +0 -173
- package/src/searchfield/index.tsx +0 -453
- package/src/select/index.tsx +0 -349
- package/src/separator/index.tsx +0 -141
- package/src/slider/index.tsx +0 -382
- package/src/styles.css +0 -450
- package/src/switch/ToggleSwitch.tsx +0 -112
- package/src/switch/index.tsx +0 -90
- package/src/table/index.tsx +0 -531
- package/src/tabs/index.tsx +0 -273
- package/src/tag-group/index.tsx +0 -240
- package/src/test-utils/index.ts +0 -32
- package/src/textfield/index.tsx +0 -211
- package/src/theme.css +0 -101
- package/src/toast/index.tsx +0 -324
- package/src/toolbar/index.tsx +0 -108
- package/src/tooltip/index.tsx +0 -197
- package/src/tree/index.tsx +0 -494
package/dist/index.ssr.js
CHANGED
|
@@ -442,10 +442,11 @@ function RadioGroup(props) {
|
|
|
442
442
|
const disabledClass = renderProps.isDisabled ? "opacity-50" : "";
|
|
443
443
|
return [base, orientationClass, disabledClass, customClass].filter(Boolean).join(" ");
|
|
444
444
|
};
|
|
445
|
+
const radioGroupProps = headlessProps;
|
|
445
446
|
return _$createComponent7(RadioSizeContext.Provider, {
|
|
446
447
|
value: size,
|
|
447
448
|
get children() {
|
|
448
|
-
return _$createComponent7(HeadlessRadioGroup, _$mergeProps4(
|
|
449
|
+
return _$createComponent7(HeadlessRadioGroup, _$mergeProps4(radioGroupProps, {
|
|
449
450
|
"class": getClassName,
|
|
450
451
|
"data-size": size,
|
|
451
452
|
get children() {
|
|
@@ -477,31 +478,33 @@ function RadioGroup(props) {
|
|
|
477
478
|
});
|
|
478
479
|
}
|
|
479
480
|
function Radio(props) {
|
|
480
|
-
const
|
|
481
|
-
const
|
|
482
|
-
const sizeStyle = sizeStyles5[sizeFromContext];
|
|
481
|
+
const size = useContext(RadioSizeContext) ?? "md";
|
|
482
|
+
const [local, headlessProps] = splitProps4(props, ["class", "children"]);
|
|
483
483
|
const customClass = local.class ?? "";
|
|
484
|
+
const styles = sizeStyles5[size];
|
|
484
485
|
const getClassName = (renderProps) => {
|
|
485
|
-
const base = "
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
486
|
+
const base = "group flex items-center gap-3 cursor-pointer";
|
|
487
|
+
const disabledClass = renderProps.isDisabled ? "cursor-not-allowed opacity-50" : "";
|
|
488
|
+
return [base, disabledClass, customClass].filter(Boolean).join(" ");
|
|
489
|
+
};
|
|
490
|
+
const getCircleClassName = (renderProps) => {
|
|
491
|
+
const base = `rounded-full border-2 flex items-center justify-center transition-all ${styles.circle}`;
|
|
492
|
+
const selectedClass = renderProps.isSelected ? "border-accent-500 bg-accent-500" : "border-primary-400 bg-transparent group-hover:border-accent-400";
|
|
493
|
+
const disabledClass = renderProps.isDisabled ? "border-primary-600" : "";
|
|
494
|
+
const focusClass = renderProps.isFocusVisible ? "ring-2 ring-accent-500 ring-offset-2 ring-offset-bg" : "";
|
|
495
|
+
return [base, selectedClass, disabledClass, focusClass].filter(Boolean).join(" ");
|
|
496
|
+
};
|
|
497
|
+
const getDotClassName = (renderProps) => {
|
|
498
|
+
const base = `rounded-full bg-white transition-transform ${styles.dot}`;
|
|
499
|
+
const selectedClass = renderProps.isSelected ? "scale-100" : "scale-0";
|
|
500
|
+
return [base, selectedClass].filter(Boolean).join(" ");
|
|
501
|
+
};
|
|
502
|
+
const getLabelClassName = () => {
|
|
503
|
+
return `text-primary-200 select-none ${styles.label}`;
|
|
489
504
|
};
|
|
490
|
-
const circleClass = `relative flex items-center justify-center rounded-full border-2 transition-all duration-200 ${sizeStyle.circle} border-primary-600 bg-transparent hover:border-accent-300`;
|
|
491
|
-
const dotClass = `rounded-full bg-accent transition-all duration-200 ${sizeStyle.dot}`;
|
|
492
|
-
const labelClass = `text-primary-200 ${sizeStyle.label}`;
|
|
493
505
|
return _$createComponent7(HeadlessRadio, _$mergeProps4(headlessProps, {
|
|
494
506
|
"class": getClassName,
|
|
495
|
-
|
|
496
|
-
return [_$ssr7(_tmpl$44, _$ssrAttribute4("class", _$escape7(circleClass, true), false), _$ssrAttribute4("class", _$escape7(dotClass, true), false)), _$createComponent7(Show5, {
|
|
497
|
-
get when() {
|
|
498
|
-
return props.children;
|
|
499
|
-
},
|
|
500
|
-
get children() {
|
|
501
|
-
return _$ssr7(_tmpl$54, _$ssrAttribute4("class", _$escape7(labelClass, true), false), _$escape7(props.children));
|
|
502
|
-
}
|
|
503
|
-
})];
|
|
504
|
-
}
|
|
507
|
+
children: (renderProps) => [_$ssr7(_tmpl$44, _$ssrAttribute4("class", _$escape7(getCircleClassName(renderProps), true), false), _$ssrAttribute4("class", _$escape7(getDotClassName(renderProps), true), false)), _$ssr7(_tmpl$54, _$ssrAttribute4("class", _$escape7(getLabelClassName(), true), false), _$escape7(local.children))]
|
|
505
508
|
}));
|
|
506
509
|
}
|
|
507
510
|
|
|
@@ -864,370 +867,7 @@ import { ssrAttribute as _$ssrAttribute8 } from "solid-js/web";
|
|
|
864
867
|
import { escape as _$escape13 } from "solid-js/web";
|
|
865
868
|
import { splitProps as splitProps8, mergeProps as solidMergeProps4, Show as Show9 } from "solid-js";
|
|
866
869
|
import { createTextField, createFocusRing } from "@proyecto-viviana/solidaria";
|
|
867
|
-
|
|
868
|
-
// ../solid-stately/src/utils/reactivity.ts
|
|
869
|
-
function access(value) {
|
|
870
|
-
return typeof value === "function" ? value() : value;
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
// ../solid-stately/src/textfield/createTextFieldState.ts
|
|
874
|
-
import { createSignal as createSignal3 } from "solid-js";
|
|
875
|
-
function createTextFieldState(props = {}) {
|
|
876
|
-
const getProps = () => access(props);
|
|
877
|
-
const initialProps = getProps();
|
|
878
|
-
const initialValue = initialProps.value ?? initialProps.defaultValue ?? "";
|
|
879
|
-
const [internalValue, setInternalValue] = createSignal3(initialValue);
|
|
880
|
-
const isControlled = () => getProps().value !== void 0;
|
|
881
|
-
const value = () => {
|
|
882
|
-
const p = getProps();
|
|
883
|
-
return isControlled() ? p.value ?? "" : internalValue();
|
|
884
|
-
};
|
|
885
|
-
function setValue(newValue) {
|
|
886
|
-
const p = getProps();
|
|
887
|
-
if (!isControlled()) {
|
|
888
|
-
setInternalValue(newValue);
|
|
889
|
-
}
|
|
890
|
-
p.onChange?.(newValue);
|
|
891
|
-
}
|
|
892
|
-
return {
|
|
893
|
-
value,
|
|
894
|
-
setValue
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
// ../solid-stately/src/numberfield/createNumberFieldState.ts
|
|
899
|
-
import { createSignal as createSignal4, createMemo } from "solid-js";
|
|
900
|
-
function handleDecimalOperation(operator, value1, value2) {
|
|
901
|
-
const getDecimals = (n) => {
|
|
902
|
-
const str = String(n);
|
|
903
|
-
const idx = str.indexOf(".");
|
|
904
|
-
return idx === -1 ? 0 : str.length - idx - 1;
|
|
905
|
-
};
|
|
906
|
-
const decimals = Math.max(getDecimals(value1), getDecimals(value2));
|
|
907
|
-
const multiplier = Math.pow(10, decimals);
|
|
908
|
-
const int1 = Math.round(value1 * multiplier);
|
|
909
|
-
const int2 = Math.round(value2 * multiplier);
|
|
910
|
-
const result = operator === "+" ? int1 + int2 : int1 - int2;
|
|
911
|
-
return result / multiplier;
|
|
912
|
-
}
|
|
913
|
-
function clamp(value, min, max) {
|
|
914
|
-
let result = value;
|
|
915
|
-
if (min != null && result < min) result = min;
|
|
916
|
-
if (max != null && result > max) result = max;
|
|
917
|
-
return result;
|
|
918
|
-
}
|
|
919
|
-
function snapToStep(value, step, min) {
|
|
920
|
-
const base = min ?? 0;
|
|
921
|
-
const diff = value - base;
|
|
922
|
-
const steps = Math.round(diff / step);
|
|
923
|
-
return handleDecimalOperation("+", base, steps * step);
|
|
924
|
-
}
|
|
925
|
-
function createNumberFieldState(props) {
|
|
926
|
-
const getProps = () => access(props);
|
|
927
|
-
const locale = () => getProps().locale ?? "en-US";
|
|
928
|
-
const formatOptions = () => getProps().formatOptions ?? {};
|
|
929
|
-
const formatter = createMemo(() => {
|
|
930
|
-
return new Intl.NumberFormat(locale(), formatOptions());
|
|
931
|
-
});
|
|
932
|
-
const parseNumber = (value) => {
|
|
933
|
-
if (!value || value === "" || value === "-") return NaN;
|
|
934
|
-
const opts = formatOptions();
|
|
935
|
-
const testNumber = formatter().format(1.1);
|
|
936
|
-
const decimalSeparator = testNumber.charAt(1);
|
|
937
|
-
let normalized = value;
|
|
938
|
-
if (decimalSeparator !== ".") {
|
|
939
|
-
normalized = normalized.replace(decimalSeparator, ".");
|
|
940
|
-
}
|
|
941
|
-
normalized = normalized.replace(/[^\d.\-]/g, "");
|
|
942
|
-
const parsed = parseFloat(normalized);
|
|
943
|
-
return parsed;
|
|
944
|
-
};
|
|
945
|
-
const formatNumber = (value) => {
|
|
946
|
-
if (isNaN(value)) return "";
|
|
947
|
-
return formatter().format(value);
|
|
948
|
-
};
|
|
949
|
-
const step = createMemo(() => {
|
|
950
|
-
const p = getProps();
|
|
951
|
-
if (p.step != null) return p.step;
|
|
952
|
-
if (p.formatOptions?.style === "percent") return 0.01;
|
|
953
|
-
return 1;
|
|
954
|
-
});
|
|
955
|
-
const [inputValue, setInputValueInternal] = createSignal4("");
|
|
956
|
-
const [numberValue, setNumberValue] = createSignal4(NaN);
|
|
957
|
-
const initValue = () => {
|
|
958
|
-
const p = getProps();
|
|
959
|
-
const initial = p.value ?? p.defaultValue;
|
|
960
|
-
if (initial != null) {
|
|
961
|
-
setNumberValue(initial);
|
|
962
|
-
setInputValueInternal(formatNumber(initial));
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
let initialized = false;
|
|
966
|
-
const ensureInitialized = () => {
|
|
967
|
-
if (!initialized) {
|
|
968
|
-
initialized = true;
|
|
969
|
-
initValue();
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
const actualNumberValue = createMemo(() => {
|
|
973
|
-
ensureInitialized();
|
|
974
|
-
const p = getProps();
|
|
975
|
-
if (p.value !== void 0) {
|
|
976
|
-
return p.value;
|
|
977
|
-
}
|
|
978
|
-
return numberValue();
|
|
979
|
-
});
|
|
980
|
-
const validate = (value) => {
|
|
981
|
-
if (value === "" || value === "-") return true;
|
|
982
|
-
const opts = formatOptions();
|
|
983
|
-
const testNumber = formatter().format(1.1);
|
|
984
|
-
const decimalSeparator = testNumber.charAt(1);
|
|
985
|
-
const pattern = new RegExp(
|
|
986
|
-
`^-?\\d*${decimalSeparator === "." ? "\\." : decimalSeparator}?\\d*$`
|
|
987
|
-
);
|
|
988
|
-
return pattern.test(value);
|
|
989
|
-
};
|
|
990
|
-
const setInputValue = (value) => {
|
|
991
|
-
ensureInitialized();
|
|
992
|
-
setInputValueInternal(value);
|
|
993
|
-
};
|
|
994
|
-
const commit = () => {
|
|
995
|
-
ensureInitialized();
|
|
996
|
-
const p = getProps();
|
|
997
|
-
const input = inputValue();
|
|
998
|
-
if (input === "" || input === "-") {
|
|
999
|
-
setNumberValue(NaN);
|
|
1000
|
-
setInputValueInternal("");
|
|
1001
|
-
return;
|
|
1002
|
-
}
|
|
1003
|
-
let parsed = parseNumber(input);
|
|
1004
|
-
if (isNaN(parsed)) {
|
|
1005
|
-
setInputValueInternal(formatNumber(actualNumberValue()));
|
|
1006
|
-
return;
|
|
1007
|
-
}
|
|
1008
|
-
parsed = clamp(parsed, p.minValue, p.maxValue);
|
|
1009
|
-
parsed = snapToStep(parsed, step(), p.minValue);
|
|
1010
|
-
setNumberValue(parsed);
|
|
1011
|
-
setInputValueInternal(formatNumber(parsed));
|
|
1012
|
-
if (p.value === void 0) {
|
|
1013
|
-
p.onChange?.(parsed);
|
|
1014
|
-
} else {
|
|
1015
|
-
p.onChange?.(parsed);
|
|
1016
|
-
}
|
|
1017
|
-
};
|
|
1018
|
-
const canIncrement = createMemo(() => {
|
|
1019
|
-
ensureInitialized();
|
|
1020
|
-
const p = getProps();
|
|
1021
|
-
if (p.isDisabled || p.isReadOnly) return false;
|
|
1022
|
-
const current = actualNumberValue();
|
|
1023
|
-
if (isNaN(current)) return true;
|
|
1024
|
-
if (p.maxValue == null) return true;
|
|
1025
|
-
return handleDecimalOperation("+", current, step()) <= p.maxValue;
|
|
1026
|
-
});
|
|
1027
|
-
const canDecrement = createMemo(() => {
|
|
1028
|
-
ensureInitialized();
|
|
1029
|
-
const p = getProps();
|
|
1030
|
-
if (p.isDisabled || p.isReadOnly) return false;
|
|
1031
|
-
const current = actualNumberValue();
|
|
1032
|
-
if (isNaN(current)) return true;
|
|
1033
|
-
if (p.minValue == null) return true;
|
|
1034
|
-
return handleDecimalOperation("-", current, step()) >= p.minValue;
|
|
1035
|
-
});
|
|
1036
|
-
const increment = () => {
|
|
1037
|
-
ensureInitialized();
|
|
1038
|
-
const p = getProps();
|
|
1039
|
-
if (p.isDisabled || p.isReadOnly) return;
|
|
1040
|
-
let current = actualNumberValue();
|
|
1041
|
-
if (isNaN(current)) {
|
|
1042
|
-
current = p.minValue ?? 0;
|
|
1043
|
-
} else {
|
|
1044
|
-
current = snapToStep(current, step(), p.minValue);
|
|
1045
|
-
current = handleDecimalOperation("+", current, step());
|
|
1046
|
-
}
|
|
1047
|
-
current = clamp(current, p.minValue, p.maxValue);
|
|
1048
|
-
setNumberValue(current);
|
|
1049
|
-
setInputValueInternal(formatNumber(current));
|
|
1050
|
-
p.onChange?.(current);
|
|
1051
|
-
};
|
|
1052
|
-
const decrement = () => {
|
|
1053
|
-
ensureInitialized();
|
|
1054
|
-
const p = getProps();
|
|
1055
|
-
if (p.isDisabled || p.isReadOnly) return;
|
|
1056
|
-
let current = actualNumberValue();
|
|
1057
|
-
if (isNaN(current)) {
|
|
1058
|
-
current = p.maxValue ?? 0;
|
|
1059
|
-
} else {
|
|
1060
|
-
current = snapToStep(current, step(), p.minValue);
|
|
1061
|
-
current = handleDecimalOperation("-", current, step());
|
|
1062
|
-
}
|
|
1063
|
-
current = clamp(current, p.minValue, p.maxValue);
|
|
1064
|
-
setNumberValue(current);
|
|
1065
|
-
setInputValueInternal(formatNumber(current));
|
|
1066
|
-
p.onChange?.(current);
|
|
1067
|
-
};
|
|
1068
|
-
const incrementToMax = () => {
|
|
1069
|
-
ensureInitialized();
|
|
1070
|
-
const p = getProps();
|
|
1071
|
-
if (p.isDisabled || p.isReadOnly) return;
|
|
1072
|
-
if (p.maxValue == null) return;
|
|
1073
|
-
const snapped = snapToStep(p.maxValue, step(), p.minValue);
|
|
1074
|
-
setNumberValue(snapped);
|
|
1075
|
-
setInputValueInternal(formatNumber(snapped));
|
|
1076
|
-
p.onChange?.(snapped);
|
|
1077
|
-
};
|
|
1078
|
-
const decrementToMin = () => {
|
|
1079
|
-
ensureInitialized();
|
|
1080
|
-
const p = getProps();
|
|
1081
|
-
if (p.isDisabled || p.isReadOnly) return;
|
|
1082
|
-
if (p.minValue == null) return;
|
|
1083
|
-
setNumberValue(p.minValue);
|
|
1084
|
-
setInputValueInternal(formatNumber(p.minValue));
|
|
1085
|
-
p.onChange?.(p.minValue);
|
|
1086
|
-
};
|
|
1087
|
-
return {
|
|
1088
|
-
get inputValue() {
|
|
1089
|
-
ensureInitialized();
|
|
1090
|
-
return inputValue;
|
|
1091
|
-
},
|
|
1092
|
-
get numberValue() {
|
|
1093
|
-
return actualNumberValue;
|
|
1094
|
-
},
|
|
1095
|
-
canIncrement,
|
|
1096
|
-
canDecrement,
|
|
1097
|
-
isDisabled: () => getProps().isDisabled ?? false,
|
|
1098
|
-
isReadOnly: () => getProps().isReadOnly ?? false,
|
|
1099
|
-
minValue: () => getProps().minValue,
|
|
1100
|
-
maxValue: () => getProps().maxValue,
|
|
1101
|
-
setInputValue,
|
|
1102
|
-
validate,
|
|
1103
|
-
commit,
|
|
1104
|
-
increment,
|
|
1105
|
-
decrement,
|
|
1106
|
-
incrementToMax,
|
|
1107
|
-
decrementToMin
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
// ../solid-stately/src/searchfield/createSearchFieldState.ts
|
|
1112
|
-
import { createSignal as createSignal5, createMemo as createMemo2 } from "solid-js";
|
|
1113
|
-
function createSearchFieldState(props) {
|
|
1114
|
-
const getProps = () => access(props);
|
|
1115
|
-
const isControlled = () => getProps().value !== void 0;
|
|
1116
|
-
const [internalValue, setInternalValue] = createSignal5(
|
|
1117
|
-
getProps().defaultValue ?? ""
|
|
1118
|
-
);
|
|
1119
|
-
const value = createMemo2(() => {
|
|
1120
|
-
const p = getProps();
|
|
1121
|
-
return isControlled() ? p.value ?? "" : internalValue();
|
|
1122
|
-
});
|
|
1123
|
-
const setValue = (newValue) => {
|
|
1124
|
-
const p = getProps();
|
|
1125
|
-
if (!isControlled()) {
|
|
1126
|
-
setInternalValue(newValue);
|
|
1127
|
-
}
|
|
1128
|
-
p.onChange?.(newValue);
|
|
1129
|
-
};
|
|
1130
|
-
return {
|
|
1131
|
-
value,
|
|
1132
|
-
setValue
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
// ../solid-stately/src/slider/createSliderState.ts
|
|
1137
|
-
import { createSignal as createSignal6, createMemo as createMemo3 } from "solid-js";
|
|
1138
|
-
var DEFAULT_MIN = 0;
|
|
1139
|
-
var DEFAULT_MAX = 100;
|
|
1140
|
-
var DEFAULT_STEP = 1;
|
|
1141
|
-
function clamp2(value, min, max) {
|
|
1142
|
-
return Math.min(Math.max(value, min), max);
|
|
1143
|
-
}
|
|
1144
|
-
function snapToStep2(value, min, max, step) {
|
|
1145
|
-
const snapped = Math.round((value - min) / step) * step + min;
|
|
1146
|
-
const decimalPlaces = (step.toString().split(".")[1] || "").length;
|
|
1147
|
-
const rounded = parseFloat(snapped.toFixed(decimalPlaces));
|
|
1148
|
-
return clamp2(rounded, min, max);
|
|
1149
|
-
}
|
|
1150
|
-
function createSliderState(props) {
|
|
1151
|
-
const getProps = () => access(props);
|
|
1152
|
-
const minValue = getProps().minValue ?? DEFAULT_MIN;
|
|
1153
|
-
const maxValue = getProps().maxValue ?? DEFAULT_MAX;
|
|
1154
|
-
const step = getProps().step ?? DEFAULT_STEP;
|
|
1155
|
-
const orientation = getProps().orientation ?? "horizontal";
|
|
1156
|
-
const isDisabled = getProps().isDisabled ?? false;
|
|
1157
|
-
const pageStep = Math.max(step, snapToStep2((maxValue - minValue) / 10, 0, maxValue - minValue, step));
|
|
1158
|
-
const isControlled = () => getProps().value !== void 0;
|
|
1159
|
-
const [internalValue, setInternalValue] = createSignal6(
|
|
1160
|
-
snapToStep2(getProps().defaultValue ?? minValue, minValue, maxValue, step)
|
|
1161
|
-
);
|
|
1162
|
-
const [isDragging, setIsDragging] = createSignal6(false);
|
|
1163
|
-
const [isFocused, setIsFocused] = createSignal6(false);
|
|
1164
|
-
const value = createMemo3(() => {
|
|
1165
|
-
const p = getProps();
|
|
1166
|
-
const rawValue = isControlled() ? p.value ?? minValue : internalValue();
|
|
1167
|
-
return snapToStep2(rawValue, minValue, maxValue, step);
|
|
1168
|
-
});
|
|
1169
|
-
const getValuePercent = createMemo3(() => {
|
|
1170
|
-
return (value() - minValue) / (maxValue - minValue);
|
|
1171
|
-
});
|
|
1172
|
-
const getFormattedValue = createMemo3(() => {
|
|
1173
|
-
const p = getProps();
|
|
1174
|
-
const formatter = new Intl.NumberFormat(p.locale, p.formatOptions);
|
|
1175
|
-
return formatter.format(value());
|
|
1176
|
-
});
|
|
1177
|
-
const setValue = (newValue) => {
|
|
1178
|
-
if (isDisabled) return;
|
|
1179
|
-
const p = getProps();
|
|
1180
|
-
const snappedValue = snapToStep2(newValue, minValue, maxValue, step);
|
|
1181
|
-
if (!isControlled()) {
|
|
1182
|
-
setInternalValue(snappedValue);
|
|
1183
|
-
}
|
|
1184
|
-
p.onChange?.(snappedValue);
|
|
1185
|
-
};
|
|
1186
|
-
const setValuePercent = (percent) => {
|
|
1187
|
-
const clampedPercent = clamp2(percent, 0, 1);
|
|
1188
|
-
const newValue = clampedPercent * (maxValue - minValue) + minValue;
|
|
1189
|
-
setValue(newValue);
|
|
1190
|
-
};
|
|
1191
|
-
const setDragging = (dragging) => {
|
|
1192
|
-
const wasDragging = isDragging();
|
|
1193
|
-
setIsDragging(dragging);
|
|
1194
|
-
if (wasDragging && !dragging) {
|
|
1195
|
-
getProps().onChangeEnd?.(value());
|
|
1196
|
-
}
|
|
1197
|
-
};
|
|
1198
|
-
const increment = (stepMultiplier = 1) => {
|
|
1199
|
-
if (isDisabled) return;
|
|
1200
|
-
setValue(value() + step * stepMultiplier);
|
|
1201
|
-
};
|
|
1202
|
-
const decrement = (stepMultiplier = 1) => {
|
|
1203
|
-
if (isDisabled) return;
|
|
1204
|
-
setValue(value() - step * stepMultiplier);
|
|
1205
|
-
};
|
|
1206
|
-
const setFocused = (focused) => {
|
|
1207
|
-
setIsFocused(focused);
|
|
1208
|
-
};
|
|
1209
|
-
return {
|
|
1210
|
-
value,
|
|
1211
|
-
setValue,
|
|
1212
|
-
setValuePercent,
|
|
1213
|
-
getValuePercent,
|
|
1214
|
-
getFormattedValue,
|
|
1215
|
-
isDragging,
|
|
1216
|
-
setDragging,
|
|
1217
|
-
isFocused,
|
|
1218
|
-
setFocused,
|
|
1219
|
-
increment,
|
|
1220
|
-
decrement,
|
|
1221
|
-
minValue,
|
|
1222
|
-
maxValue,
|
|
1223
|
-
step,
|
|
1224
|
-
pageStep,
|
|
1225
|
-
orientation,
|
|
1226
|
-
isDisabled
|
|
1227
|
-
};
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
// src/textfield/index.tsx
|
|
870
|
+
import { createTextFieldState } from "@proyecto-viviana/solid-stately";
|
|
1231
871
|
var _tmpl$15 = '<span class="text-danger-400 ml-0.5">*</span>';
|
|
1232
872
|
var _tmpl$211 = ["<div", ">", "", "", "", "</div>"];
|
|
1233
873
|
var sizeStyles8 = {
|
|
@@ -1437,7 +1077,7 @@ import { ssrStyleProperty as _$ssrStyleProperty } from "solid-js/web";
|
|
|
1437
1077
|
import { createComponent as _$createComponent14 } from "solid-js/web";
|
|
1438
1078
|
import { ssr as _$ssr14 } from "solid-js/web";
|
|
1439
1079
|
import { escape as _$escape14 } from "solid-js/web";
|
|
1440
|
-
import { splitProps as splitProps10, Show as Show10, createMemo
|
|
1080
|
+
import { splitProps as splitProps10, Show as Show10, createMemo } from "solid-js";
|
|
1441
1081
|
import { createProgressBar } from "@proyecto-viviana/solidaria";
|
|
1442
1082
|
var _tmpl$16 = ['<span class="text-primary-200 font-medium">', "</span>"];
|
|
1443
1083
|
var _tmpl$212 = ['<span class="text-primary-300">', "</span>"];
|
|
@@ -1464,7 +1104,7 @@ var variantStyles5 = {
|
|
|
1464
1104
|
warning: "bg-yellow-500",
|
|
1465
1105
|
danger: "bg-red-500"
|
|
1466
1106
|
};
|
|
1467
|
-
function
|
|
1107
|
+
function clamp(value, min, max) {
|
|
1468
1108
|
return Math.min(Math.max(value, min), max);
|
|
1469
1109
|
}
|
|
1470
1110
|
function ProgressBar(props) {
|
|
@@ -1496,14 +1136,14 @@ function ProgressBar(props) {
|
|
|
1496
1136
|
return ariaProps["aria-label"];
|
|
1497
1137
|
}
|
|
1498
1138
|
});
|
|
1499
|
-
const percentage =
|
|
1139
|
+
const percentage = createMemo(() => {
|
|
1500
1140
|
if (isIndeterminate()) {
|
|
1501
1141
|
return void 0;
|
|
1502
1142
|
}
|
|
1503
1143
|
const value = ariaProps.value ?? 0;
|
|
1504
1144
|
const minValue = ariaProps.minValue ?? 0;
|
|
1505
1145
|
const maxValue = ariaProps.maxValue ?? 100;
|
|
1506
|
-
const clampedValue =
|
|
1146
|
+
const clampedValue = clamp(value, minValue, maxValue);
|
|
1507
1147
|
return (clampedValue - minValue) / (maxValue - minValue) * 100;
|
|
1508
1148
|
});
|
|
1509
1149
|
const valueText = () => progressAria.progressBarProps["aria-valuetext"];
|
|
@@ -1540,7 +1180,7 @@ function ProgressBar(props) {
|
|
|
1540
1180
|
import { createComponent as _$createComponent15 } from "solid-js/web";
|
|
1541
1181
|
import { ssrElement as _$ssrElement4 } from "solid-js/web";
|
|
1542
1182
|
import { mergeProps as _$mergeProps11 } from "solid-js/web";
|
|
1543
|
-
import { splitProps as splitProps11, createMemo as
|
|
1183
|
+
import { splitProps as splitProps11, createMemo as createMemo2, Show as Show11 } from "solid-js";
|
|
1544
1184
|
import { createSeparator } from "@proyecto-viviana/solidaria";
|
|
1545
1185
|
var variantStyles6 = {
|
|
1546
1186
|
default: "bg-bg-100",
|
|
@@ -1562,7 +1202,7 @@ function Separator(props) {
|
|
|
1562
1202
|
const orientation = () => local.orientation ?? "horizontal";
|
|
1563
1203
|
const variant = () => local.variant ?? "default";
|
|
1564
1204
|
const size = () => local.size ?? "md";
|
|
1565
|
-
const elementType =
|
|
1205
|
+
const elementType = createMemo2(() => {
|
|
1566
1206
|
if (orientation() === "vertical") {
|
|
1567
1207
|
return "div";
|
|
1568
1208
|
}
|
|
@@ -1579,7 +1219,7 @@ function Separator(props) {
|
|
|
1579
1219
|
return ariaProps["aria-label"];
|
|
1580
1220
|
}
|
|
1581
1221
|
});
|
|
1582
|
-
const className =
|
|
1222
|
+
const className = createMemo2(() => {
|
|
1583
1223
|
const isVertical = orientation() === "vertical";
|
|
1584
1224
|
const sizeStyles33 = isVertical ? verticalSizeStyles : horizontalSizeStyles;
|
|
1585
1225
|
const base = [
|
|
@@ -1661,7 +1301,7 @@ import { createComponent as _$createComponent17 } from "solid-js/web";
|
|
|
1661
1301
|
import { ssr as _$ssr15 } from "solid-js/web";
|
|
1662
1302
|
import { ssrAttribute as _$ssrAttribute9 } from "solid-js/web";
|
|
1663
1303
|
import { escape as _$escape15 } from "solid-js/web";
|
|
1664
|
-
import { splitProps as splitProps13, createMemo as
|
|
1304
|
+
import { splitProps as splitProps13, createMemo as createMemo3, Show as Show12, For } from "solid-js";
|
|
1665
1305
|
import { Autocomplete, useAutocompleteInput, useAutocompleteCollection, useAutocompleteState } from "@proyecto-viviana/solidaria-components";
|
|
1666
1306
|
var _tmpl$17 = ['<input type="text"', "", ">"];
|
|
1667
1307
|
var _tmpl$213 = ["<ul", ' role="listbox"', ">", "</ul>"];
|
|
@@ -1703,7 +1343,7 @@ function AutocompleteList(props) {
|
|
|
1703
1343
|
const state = useAutocompleteState();
|
|
1704
1344
|
if (!ctx) return null;
|
|
1705
1345
|
const styles = () => sizeStyles11[props.size];
|
|
1706
|
-
const filteredItems =
|
|
1346
|
+
const filteredItems = createMemo3(() => {
|
|
1707
1347
|
if (!ctx.filter) return props.items;
|
|
1708
1348
|
return props.items.filter((item) => {
|
|
1709
1349
|
const textValue = String(item[props.textKey] ?? item.name ?? "");
|
|
@@ -2521,6 +2161,7 @@ import { ssrAttribute as _$ssrAttribute14 } from "solid-js/web";
|
|
|
2521
2161
|
import { escape as _$escape20 } from "solid-js/web";
|
|
2522
2162
|
import { splitProps as splitProps19, mergeProps as solidMergeProps5, Show as Show15 } from "solid-js";
|
|
2523
2163
|
import { createNumberField, createFocusRing as createFocusRing2, createPress, createHover } from "@proyecto-viviana/solidaria";
|
|
2164
|
+
import { createNumberFieldState } from "@proyecto-viviana/solid-stately";
|
|
2524
2165
|
var _tmpl$30 = ["<svg", ' viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 3v10M3 8h10"></path></svg>'];
|
|
2525
2166
|
var _tmpl$217 = ["<svg", ' viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M3 8h10"></path></svg>'];
|
|
2526
2167
|
var _tmpl$313 = '<span class="text-danger-500 ml-1">*</span>';
|
|
@@ -2924,6 +2565,7 @@ import { ssrAttribute as _$ssrAttribute15 } from "solid-js/web";
|
|
|
2924
2565
|
import { escape as _$escape21 } from "solid-js/web";
|
|
2925
2566
|
import { splitProps as splitProps20, mergeProps as solidMergeProps6, Show as Show16 } from "solid-js";
|
|
2926
2567
|
import { createSearchField, createFocusRing as createFocusRing3, createPress as createPress2, createHover as createHover2 } from "@proyecto-viviana/solidaria";
|
|
2568
|
+
import { createSearchFieldState } from "@proyecto-viviana/solid-stately";
|
|
2927
2569
|
var _tmpl$31 = ["<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"></path></svg>'];
|
|
2928
2570
|
var _tmpl$218 = ["<svg", ' viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4L12 12M12 4L4 12" stroke-linecap="round"></path></svg>'];
|
|
2929
2571
|
var _tmpl$314 = '<span class="text-danger-500 ml-1">*</span>';
|
|
@@ -3290,6 +2932,7 @@ import { ssrAttribute as _$ssrAttribute16 } from "solid-js/web";
|
|
|
3290
2932
|
import { escape as _$escape22 } from "solid-js/web";
|
|
3291
2933
|
import { splitProps as splitProps21, mergeProps as solidMergeProps7, Show as Show17 } from "solid-js";
|
|
3292
2934
|
import { createSlider, createFocusRing as createFocusRing4, createHover as createHover3 } from "@proyecto-viviana/solidaria";
|
|
2935
|
+
import { createSliderState } from "@proyecto-viviana/solid-stately";
|
|
3293
2936
|
var _tmpl$40 = ["<div", ">", "", "</div>"];
|
|
3294
2937
|
var _tmpl$219 = ["<div", ' style="', '"></div>'];
|
|
3295
2938
|
var _tmpl$315 = ['<div class="flex justify-between mt-1"><span', ">", "</span><span", ">", "</span></div>"];
|
|
@@ -4139,7 +3782,7 @@ import { ssrStyleProperty as _$ssrStyleProperty4 } from "solid-js/web";
|
|
|
4139
3782
|
import { createComponent as _$createComponent29 } from "solid-js/web";
|
|
4140
3783
|
import { ssr as _$ssr26 } from "solid-js/web";
|
|
4141
3784
|
import { escape as _$escape26 } from "solid-js/web";
|
|
4142
|
-
import { splitProps as splitProps25, Show as Show21, createMemo as
|
|
3785
|
+
import { splitProps as splitProps25, Show as Show21, createMemo as createMemo4 } from "solid-js";
|
|
4143
3786
|
import { createMeter } from "@proyecto-viviana/solidaria";
|
|
4144
3787
|
var _tmpl$60 = ['<span class="text-primary-200 font-medium">', "</span>"];
|
|
4145
3788
|
var _tmpl$222 = ['<span class="text-primary-300">', "</span>"];
|
|
@@ -4167,7 +3810,7 @@ var variantStyles12 = {
|
|
|
4167
3810
|
danger: "bg-red-500",
|
|
4168
3811
|
info: "bg-blue-500"
|
|
4169
3812
|
};
|
|
4170
|
-
function
|
|
3813
|
+
function clamp2(value, min, max) {
|
|
4171
3814
|
return Math.min(Math.max(value, min), max);
|
|
4172
3815
|
}
|
|
4173
3816
|
function Meter(props) {
|
|
@@ -4195,11 +3838,11 @@ function Meter(props) {
|
|
|
4195
3838
|
return ariaProps["aria-label"];
|
|
4196
3839
|
}
|
|
4197
3840
|
});
|
|
4198
|
-
const percentage =
|
|
3841
|
+
const percentage = createMemo4(() => {
|
|
4199
3842
|
const value = ariaProps.value ?? 0;
|
|
4200
3843
|
const minValue = ariaProps.minValue ?? 0;
|
|
4201
3844
|
const maxValue = ariaProps.maxValue ?? 100;
|
|
4202
|
-
const clampedValue =
|
|
3845
|
+
const clampedValue = clamp2(value, minValue, maxValue);
|
|
4203
3846
|
return (clampedValue - minValue) / (maxValue - minValue) * 100;
|
|
4204
3847
|
});
|
|
4205
3848
|
const valueText = () => meterAria.meterProps["aria-valuetext"];
|
|
@@ -6988,4 +6631,4 @@ export {
|
|
|
6988
6631
|
useLandmarkController,
|
|
6989
6632
|
useToastContext
|
|
6990
6633
|
};
|
|
6991
|
-
//# sourceMappingURL=index.ssr.js.map
|
|
6634
|
+
//# sourceMappingURL=index.ssr.js.map
|