sellmate-design-system-react 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SActionModal/SActionModal.cjs +129 -1
- package/dist/components/SActionModal/SActionModal.cjs.map +1 -1
- package/dist/components/SActionModal/SActionModal.js +129 -1
- package/dist/components/SActionModal/SActionModal.js.map +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.cjs +156 -3
- package/dist/components/SBarcodeInput/SBarcodeInput.cjs.map +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.js +157 -4
- package/dist/components/SBarcodeInput/SBarcodeInput.js.map +1 -1
- package/dist/components/SButton/SButton.cjs +129 -1
- package/dist/components/SButton/SButton.cjs.map +1 -1
- package/dist/components/SButton/SButton.js +129 -1
- package/dist/components/SButton/SButton.js.map +1 -1
- package/dist/components/SCalendar/SCalendar.cjs +131 -3
- package/dist/components/SCalendar/SCalendar.cjs.map +1 -1
- package/dist/components/SCalendar/SCalendar.d.ts +3 -1
- package/dist/components/SCalendar/SCalendar.js +131 -3
- package/dist/components/SCalendar/SCalendar.js.map +1 -1
- package/dist/components/SCallout/SCallout.cjs +129 -1
- package/dist/components/SCallout/SCallout.cjs.map +1 -1
- package/dist/components/SCallout/SCallout.js +129 -1
- package/dist/components/SCallout/SCallout.js.map +1 -1
- package/dist/components/SCheckbox/SCheckbox.cjs +129 -1
- package/dist/components/SCheckbox/SCheckbox.cjs.map +1 -1
- package/dist/components/SCheckbox/SCheckbox.js +129 -1
- package/dist/components/SCheckbox/SCheckbox.js.map +1 -1
- package/dist/components/SChip/SChip.cjs +130 -3
- package/dist/components/SChip/SChip.cjs.map +1 -1
- package/dist/components/SChip/SChip.js +130 -3
- package/dist/components/SChip/SChip.js.map +1 -1
- package/dist/components/SChipInput/SChipInput.cjs +153 -3
- package/dist/components/SChipInput/SChipInput.cjs.map +1 -1
- package/dist/components/SChipInput/SChipInput.js +153 -3
- package/dist/components/SChipInput/SChipInput.js.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.cjs +129 -1
- package/dist/components/SConfirmModal/SConfirmModal.cjs.map +1 -1
- package/dist/components/SConfirmModal/SConfirmModal.js +129 -1
- package/dist/components/SConfirmModal/SConfirmModal.js.map +1 -1
- package/dist/components/SDatePicker/SDatePicker.cjs +158 -5
- package/dist/components/SDatePicker/SDatePicker.cjs.map +1 -1
- package/dist/components/SDatePicker/SDatePicker.js +158 -5
- package/dist/components/SDatePicker/SDatePicker.js.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs +156 -3
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.js +156 -3
- package/dist/components/SDateRangePicker/SDateRangePicker.js.map +1 -1
- package/dist/components/SDropdownButton/SDropdownButton.cjs +129 -1
- package/dist/components/SDropdownButton/SDropdownButton.cjs.map +1 -1
- package/dist/components/SDropdownButton/SDropdownButton.js +129 -1
- package/dist/components/SDropdownButton/SDropdownButton.js.map +1 -1
- package/dist/components/SField/SField.cjs +129 -1
- package/dist/components/SField/SField.cjs.map +1 -1
- package/dist/components/SField/SField.js +129 -1
- package/dist/components/SField/SField.js.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.cjs +156 -3
- package/dist/components/SFilePicker/SFilePicker.cjs.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.js +156 -3
- package/dist/components/SFilePicker/SFilePicker.js.map +1 -1
- package/dist/components/SForm/SForm.cjs +91 -0
- package/dist/components/SForm/SForm.cjs.map +1 -0
- package/dist/components/SForm/SForm.d.ts +33 -0
- package/dist/components/SForm/SForm.js +89 -0
- package/dist/components/SForm/SForm.js.map +1 -0
- package/dist/components/SForm/index.d.ts +1 -0
- package/dist/components/SGhostButton/SGhostButton.cjs +129 -1
- package/dist/components/SGhostButton/SGhostButton.cjs.map +1 -1
- package/dist/components/SGhostButton/SGhostButton.js +129 -1
- package/dist/components/SGhostButton/SGhostButton.js.map +1 -1
- package/dist/components/SGuide/SGuide.cjs +129 -1
- package/dist/components/SGuide/SGuide.cjs.map +1 -1
- package/dist/components/SGuide/SGuide.js +129 -1
- package/dist/components/SGuide/SGuide.js.map +1 -1
- package/dist/components/SIcon/SIcon.cjs +129 -1
- package/dist/components/SIcon/SIcon.cjs.map +1 -1
- package/dist/components/SIcon/SIcon.d.ts +3 -2
- package/dist/components/SIcon/SIcon.js +129 -1
- package/dist/components/SIcon/SIcon.js.map +1 -1
- package/dist/components/SInput/SInput.cjs +156 -3
- package/dist/components/SInput/SInput.cjs.map +1 -1
- package/dist/components/SInput/SInput.js +157 -4
- package/dist/components/SInput/SInput.js.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs +212 -5
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.js +212 -5
- package/dist/components/SKeyValueTable/SKeyValueTable.js.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.cjs +129 -1
- package/dist/components/SLoadingModal/SLoadingModal.cjs.map +1 -1
- package/dist/components/SLoadingModal/SLoadingModal.js +129 -1
- package/dist/components/SLoadingModal/SLoadingModal.js.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.cjs +129 -1
- package/dist/components/SModalContainer/SModalContainer.cjs.map +1 -1
- package/dist/components/SModalContainer/SModalContainer.js +129 -1
- package/dist/components/SModalContainer/SModalContainer.js.map +1 -1
- package/dist/components/SNumberInput/SNumberInput.cjs +156 -3
- package/dist/components/SNumberInput/SNumberInput.cjs.map +1 -1
- package/dist/components/SNumberInput/SNumberInput.js +156 -3
- package/dist/components/SNumberInput/SNumberInput.js.map +1 -1
- package/dist/components/SPagination/SPagination.cjs +129 -1
- package/dist/components/SPagination/SPagination.cjs.map +1 -1
- package/dist/components/SPagination/SPagination.js +129 -1
- package/dist/components/SPagination/SPagination.js.map +1 -1
- package/dist/components/SPopover/SPopover.cjs +129 -1
- package/dist/components/SPopover/SPopover.cjs.map +1 -1
- package/dist/components/SPopover/SPopover.d.ts +3 -1
- package/dist/components/SPopover/SPopover.js +129 -1
- package/dist/components/SPopover/SPopover.js.map +1 -1
- package/dist/components/SPopup/SPopup.cjs +129 -1
- package/dist/components/SPopup/SPopup.cjs.map +1 -1
- package/dist/components/SPopup/SPopup.js +129 -1
- package/dist/components/SPopup/SPopup.js.map +1 -1
- package/dist/components/SSelect/SSelect.cjs +156 -3
- package/dist/components/SSelect/SSelect.cjs.map +1 -1
- package/dist/components/SSelect/SSelect.js +157 -4
- package/dist/components/SSelect/SSelect.js.map +1 -1
- package/dist/components/STable/STable.cjs +156 -3
- package/dist/components/STable/STable.cjs.map +1 -1
- package/dist/components/STable/STable.d.ts +3 -1
- package/dist/components/STable/STable.js +156 -3
- package/dist/components/STable/STable.js.map +1 -1
- package/dist/components/STabs/STabs.cjs +129 -1
- package/dist/components/STabs/STabs.cjs.map +1 -1
- package/dist/components/STabs/STabs.js +129 -1
- package/dist/components/STabs/STabs.js.map +1 -1
- package/dist/components/STag/STag.cjs +129 -1
- package/dist/components/STag/STag.cjs.map +1 -1
- package/dist/components/STag/STag.js +129 -1
- package/dist/components/STag/STag.js.map +1 -1
- package/dist/components/STextLink/STextLink.cjs +129 -1
- package/dist/components/STextLink/STextLink.cjs.map +1 -1
- package/dist/components/STextLink/STextLink.d.ts +3 -2
- package/dist/components/STextLink/STextLink.js +129 -1
- package/dist/components/STextLink/STextLink.js.map +1 -1
- package/dist/components/STextarea/STextarea.cjs +156 -3
- package/dist/components/STextarea/STextarea.cjs.map +1 -1
- package/dist/components/STextarea/STextarea.js +157 -4
- package/dist/components/STextarea/STextarea.js.map +1 -1
- package/dist/components/SToast/SToast.cjs +129 -1
- package/dist/components/SToast/SToast.cjs.map +1 -1
- package/dist/components/SToast/SToast.js +129 -1
- package/dist/components/SToast/SToast.js.map +1 -1
- package/dist/components/SToast/SToastContainer.cjs +129 -1
- package/dist/components/SToast/SToastContainer.cjs.map +1 -1
- package/dist/components/SToast/SToastContainer.js +129 -1
- package/dist/components/SToast/SToastContainer.js.map +1 -1
- package/dist/components/STooltip/STooltip.cjs +129 -1
- package/dist/components/STooltip/STooltip.cjs.map +1 -1
- package/dist/components/STooltip/STooltip.d.ts +3 -1
- package/dist/components/STooltip/STooltip.js +129 -1
- package/dist/components/STooltip/STooltip.js.map +1 -1
- package/dist/index.cjs +306 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +303 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/color.cjs +135 -0
- package/dist/lib/color.cjs.map +1 -0
- package/dist/lib/color.d.ts +28 -0
- package/dist/lib/color.js +131 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/lib/form.cjs +23 -0
- package/dist/lib/form.cjs.map +1 -1
- package/dist/lib/form.d.ts +25 -0
- package/dist/lib/form.js +21 -1
- package/dist/lib/form.js.map +1 -1
- package/dist/styles.css +25 -0
- package/package.json +1 -1
|
@@ -30,6 +30,134 @@ var RPopover__namespace = /*#__PURE__*/_interopNamespace(RPopover);
|
|
|
30
30
|
function cn(...inputs) {
|
|
31
31
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
32
32
|
}
|
|
33
|
+
|
|
34
|
+
// src/lib/color.ts
|
|
35
|
+
var COLOR_KEYS = [
|
|
36
|
+
"white",
|
|
37
|
+
"black",
|
|
38
|
+
"grey_10",
|
|
39
|
+
"grey_20",
|
|
40
|
+
"grey_25",
|
|
41
|
+
"grey_30",
|
|
42
|
+
"grey_35",
|
|
43
|
+
"grey_45",
|
|
44
|
+
"grey_50",
|
|
45
|
+
"grey_55",
|
|
46
|
+
"grey_60",
|
|
47
|
+
"grey_65",
|
|
48
|
+
"grey_70",
|
|
49
|
+
"grey_80",
|
|
50
|
+
"grey_85",
|
|
51
|
+
"grey_90",
|
|
52
|
+
"grey_95",
|
|
53
|
+
"grey_05",
|
|
54
|
+
"red_15",
|
|
55
|
+
"red_20",
|
|
56
|
+
"red_30",
|
|
57
|
+
"red_45",
|
|
58
|
+
"red_60",
|
|
59
|
+
"red_70",
|
|
60
|
+
"red_75",
|
|
61
|
+
"red_80",
|
|
62
|
+
"red_85",
|
|
63
|
+
"red_90",
|
|
64
|
+
"red_95",
|
|
65
|
+
"red_99",
|
|
66
|
+
"orange_10",
|
|
67
|
+
"orange_20",
|
|
68
|
+
"orange_35",
|
|
69
|
+
"orange_45",
|
|
70
|
+
"orange_55",
|
|
71
|
+
"orange_60",
|
|
72
|
+
"orange_65",
|
|
73
|
+
"orange_75",
|
|
74
|
+
"orange_85",
|
|
75
|
+
"orange_90",
|
|
76
|
+
"orange_95",
|
|
77
|
+
"orange_99",
|
|
78
|
+
"yellow_10",
|
|
79
|
+
"yellow_20",
|
|
80
|
+
"yellow_25",
|
|
81
|
+
"yellow_30",
|
|
82
|
+
"yellow_40",
|
|
83
|
+
"yellow_45",
|
|
84
|
+
"yellow_50",
|
|
85
|
+
"yellow_60",
|
|
86
|
+
"yellow_70",
|
|
87
|
+
"yellow_80",
|
|
88
|
+
"yellow_90",
|
|
89
|
+
"yellow_95",
|
|
90
|
+
"olive_10",
|
|
91
|
+
"olive_15",
|
|
92
|
+
"olive_20",
|
|
93
|
+
"olive_30",
|
|
94
|
+
"olive_45",
|
|
95
|
+
"olive_55",
|
|
96
|
+
"olive_65",
|
|
97
|
+
"olive_70",
|
|
98
|
+
"olive_80",
|
|
99
|
+
"olive_90",
|
|
100
|
+
"olive_95",
|
|
101
|
+
"olive_05",
|
|
102
|
+
"green_15",
|
|
103
|
+
"green_25",
|
|
104
|
+
"green_45",
|
|
105
|
+
"green_55",
|
|
106
|
+
"green_65",
|
|
107
|
+
"green_70",
|
|
108
|
+
"green_75",
|
|
109
|
+
"green_80",
|
|
110
|
+
"green_85",
|
|
111
|
+
"green_90",
|
|
112
|
+
"green_95",
|
|
113
|
+
"green_99",
|
|
114
|
+
"steelblue_10",
|
|
115
|
+
"steelblue_25",
|
|
116
|
+
"steelblue_45",
|
|
117
|
+
"steelblue_60",
|
|
118
|
+
"steelblue_65",
|
|
119
|
+
"steelblue_70",
|
|
120
|
+
"steelblue_75",
|
|
121
|
+
"steelblue_80",
|
|
122
|
+
"steelblue_85",
|
|
123
|
+
"steelblue_90",
|
|
124
|
+
"steelblue_95",
|
|
125
|
+
"steelblue_99",
|
|
126
|
+
"oceanblue_15",
|
|
127
|
+
"oceanblue_25",
|
|
128
|
+
"oceanblue_50",
|
|
129
|
+
"oceanblue_60",
|
|
130
|
+
"oceanblue_65",
|
|
131
|
+
"oceanblue_70",
|
|
132
|
+
"oceanblue_75",
|
|
133
|
+
"oceanblue_80",
|
|
134
|
+
"oceanblue_85",
|
|
135
|
+
"oceanblue_90",
|
|
136
|
+
"oceanblue_95",
|
|
137
|
+
"oceanblue_99",
|
|
138
|
+
"brilliantblue_10",
|
|
139
|
+
"brilliantblue_20",
|
|
140
|
+
"brilliantblue_25",
|
|
141
|
+
"brilliantblue_40",
|
|
142
|
+
"brilliantblue_50",
|
|
143
|
+
"brilliantblue_60",
|
|
144
|
+
"brilliantblue_70",
|
|
145
|
+
"brilliantblue_75",
|
|
146
|
+
"brilliantblue_80",
|
|
147
|
+
"brilliantblue_85",
|
|
148
|
+
"brilliantblue_90",
|
|
149
|
+
"brilliantblue_95",
|
|
150
|
+
"brilliantblue_99",
|
|
151
|
+
"brilliantblue_05"
|
|
152
|
+
];
|
|
153
|
+
var KEY_SET = new Set(COLOR_KEYS);
|
|
154
|
+
function isColorKey(input) {
|
|
155
|
+
return KEY_SET.has(input);
|
|
156
|
+
}
|
|
157
|
+
function resolveColor(input, fallback) {
|
|
158
|
+
if (input === null || input === void 0 || input === "") return fallback;
|
|
159
|
+
return isColorKey(input) ? `var(--color-${input.replace(/_/g, "-")})` : input;
|
|
160
|
+
}
|
|
33
161
|
var Icon_add = (p) => {
|
|
34
162
|
const { size = 24, ...rest } = p;
|
|
35
163
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2729,7 +2857,7 @@ var SIcon = react.forwardRef(function SIcon2({ name, size = 24, color, rotate, l
|
|
|
2729
2857
|
{
|
|
2730
2858
|
ref,
|
|
2731
2859
|
className: cn("inline-flex items-center justify-center", rotateClass, className),
|
|
2732
|
-
style: { color, ...style },
|
|
2860
|
+
style: { color: resolveColor(color), ...style },
|
|
2733
2861
|
role: label ? "img" : void 0,
|
|
2734
2862
|
"aria-label": label,
|
|
2735
2863
|
"aria-hidden": label ? void 0 : true,
|
|
@@ -2876,8 +3004,6 @@ var STooltip = react.forwardRef(function STooltip2({
|
|
|
2876
3004
|
] });
|
|
2877
3005
|
});
|
|
2878
3006
|
STooltip.displayName = "STooltip";
|
|
2879
|
-
|
|
2880
|
-
// src/lib/form.ts
|
|
2881
3007
|
function runRules(value, rules) {
|
|
2882
3008
|
if (!rules || rules.length === 0) return "";
|
|
2883
3009
|
for (const rule of rules) {
|
|
@@ -2886,6 +3012,24 @@ function runRules(value, rules) {
|
|
|
2886
3012
|
}
|
|
2887
3013
|
return "";
|
|
2888
3014
|
}
|
|
3015
|
+
var FormContext = react.createContext(null);
|
|
3016
|
+
function useFormContext() {
|
|
3017
|
+
return react.useContext(FormContext);
|
|
3018
|
+
}
|
|
3019
|
+
function useFormField(field) {
|
|
3020
|
+
const ctx = useFormContext();
|
|
3021
|
+
const cbRef = react.useRef(field);
|
|
3022
|
+
cbRef.current = field;
|
|
3023
|
+
const name = field.name ?? "";
|
|
3024
|
+
react.useEffect(() => {
|
|
3025
|
+
if (!ctx) return;
|
|
3026
|
+
return ctx.register({
|
|
3027
|
+
name,
|
|
3028
|
+
validate: () => cbRef.current.validate(),
|
|
3029
|
+
resetValidation: () => cbRef.current.resetValidation()
|
|
3030
|
+
});
|
|
3031
|
+
}, [ctx, name]);
|
|
3032
|
+
}
|
|
2889
3033
|
var FIELD_SIZE = {
|
|
2890
3034
|
sm: { height: 28, radius: 4, fieldGap: 12, labelGap: 6, fontSize: 12, lineHeight: 20, icon: 12 },
|
|
2891
3035
|
md: { height: 36, radius: 6, fieldGap: 16, labelGap: 8, fontSize: 14, lineHeight: 24, icon: 12 }
|
|
@@ -3070,6 +3214,15 @@ var SInput = react.forwardRef(function SInput2({
|
|
|
3070
3214
|
const isPassword = type === "password";
|
|
3071
3215
|
const inputType = isPassword ? visible ? "text" : "password" : type;
|
|
3072
3216
|
const hasValue = value !== void 0 && value !== null && String(value) !== "";
|
|
3217
|
+
useFormField({
|
|
3218
|
+
name: rest.name,
|
|
3219
|
+
validate: () => {
|
|
3220
|
+
const msg = runRules(value, rules);
|
|
3221
|
+
setRuleError(msg);
|
|
3222
|
+
return msg === "";
|
|
3223
|
+
},
|
|
3224
|
+
resetValidation: () => setRuleError("")
|
|
3225
|
+
});
|
|
3073
3226
|
const resolvedError = error || ruleError !== "";
|
|
3074
3227
|
const resolvedErrorMessage = ruleError !== "" ? ruleError : errorMessage;
|
|
3075
3228
|
const resolvedStatus = status ?? (rules && rules.length > 0 ? ruleError !== "" ? "error" : void 0 : void 0);
|