sellmate-design-system-react 0.1.3 → 0.1.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/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 +157 -4
- package/dist/components/SBarcodeInput/SBarcodeInput.cjs.map +1 -1
- package/dist/components/SBarcodeInput/SBarcodeInput.js +158 -5
- 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 +130 -2
- package/dist/components/SCheckbox/SCheckbox.cjs.map +1 -1
- package/dist/components/SCheckbox/SCheckbox.js +130 -2
- 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 +154 -4
- package/dist/components/SChipInput/SChipInput.cjs.map +1 -1
- package/dist/components/SChipInput/SChipInput.js +154 -4
- 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 +159 -6
- package/dist/components/SDatePicker/SDatePicker.cjs.map +1 -1
- package/dist/components/SDatePicker/SDatePicker.js +159 -6
- package/dist/components/SDatePicker/SDatePicker.js.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs +157 -4
- package/dist/components/SDateRangePicker/SDateRangePicker.cjs.map +1 -1
- package/dist/components/SDateRangePicker/SDateRangePicker.js +157 -4
- 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 +130 -2
- package/dist/components/SField/SField.cjs.map +1 -1
- package/dist/components/SField/SField.js +130 -2
- package/dist/components/SField/SField.js.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.cjs +157 -4
- package/dist/components/SFilePicker/SFilePicker.cjs.map +1 -1
- package/dist/components/SFilePicker/SFilePicker.js +157 -4
- 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 +157 -4
- package/dist/components/SInput/SInput.cjs.map +1 -1
- package/dist/components/SInput/SInput.js +158 -5
- package/dist/components/SInput/SInput.js.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs +214 -7
- package/dist/components/SKeyValueTable/SKeyValueTable.cjs.map +1 -1
- package/dist/components/SKeyValueTable/SKeyValueTable.js +214 -7
- 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 +157 -4
- package/dist/components/SNumberInput/SNumberInput.cjs.map +1 -1
- package/dist/components/SNumberInput/SNumberInput.js +157 -4
- 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 +157 -4
- package/dist/components/SSelect/SSelect.cjs.map +1 -1
- package/dist/components/SSelect/SSelect.js +158 -5
- package/dist/components/SSelect/SSelect.js.map +1 -1
- package/dist/components/STable/STable.cjs +161 -6
- package/dist/components/STable/STable.cjs.map +1 -1
- package/dist/components/STable/STable.d.ts +3 -1
- package/dist/components/STable/STable.js +161 -6
- 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 +157 -4
- package/dist/components/STextarea/STextarea.cjs.map +1 -1
- package/dist/components/STextarea/STextarea.js +158 -5
- 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 +130 -2
- package/dist/components/STooltip/STooltip.cjs.map +1 -1
- package/dist/components/STooltip/STooltip.d.ts +3 -1
- package/dist/components/STooltip/STooltip.js +130 -2
- package/dist/components/STooltip/STooltip.js.map +1 -1
- package/dist/index.cjs +311 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +308 -9
- 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 +35 -3
- package/package.json +1 -1
|
@@ -37,6 +37,134 @@ PortalContainerContext.Provider;
|
|
|
37
37
|
function usePortalContainer() {
|
|
38
38
|
return react.useContext(PortalContainerContext) ?? void 0;
|
|
39
39
|
}
|
|
40
|
+
|
|
41
|
+
// src/lib/color.ts
|
|
42
|
+
var COLOR_KEYS = [
|
|
43
|
+
"white",
|
|
44
|
+
"black",
|
|
45
|
+
"grey_10",
|
|
46
|
+
"grey_20",
|
|
47
|
+
"grey_25",
|
|
48
|
+
"grey_30",
|
|
49
|
+
"grey_35",
|
|
50
|
+
"grey_45",
|
|
51
|
+
"grey_50",
|
|
52
|
+
"grey_55",
|
|
53
|
+
"grey_60",
|
|
54
|
+
"grey_65",
|
|
55
|
+
"grey_70",
|
|
56
|
+
"grey_80",
|
|
57
|
+
"grey_85",
|
|
58
|
+
"grey_90",
|
|
59
|
+
"grey_95",
|
|
60
|
+
"grey_05",
|
|
61
|
+
"red_15",
|
|
62
|
+
"red_20",
|
|
63
|
+
"red_30",
|
|
64
|
+
"red_45",
|
|
65
|
+
"red_60",
|
|
66
|
+
"red_70",
|
|
67
|
+
"red_75",
|
|
68
|
+
"red_80",
|
|
69
|
+
"red_85",
|
|
70
|
+
"red_90",
|
|
71
|
+
"red_95",
|
|
72
|
+
"red_99",
|
|
73
|
+
"orange_10",
|
|
74
|
+
"orange_20",
|
|
75
|
+
"orange_35",
|
|
76
|
+
"orange_45",
|
|
77
|
+
"orange_55",
|
|
78
|
+
"orange_60",
|
|
79
|
+
"orange_65",
|
|
80
|
+
"orange_75",
|
|
81
|
+
"orange_85",
|
|
82
|
+
"orange_90",
|
|
83
|
+
"orange_95",
|
|
84
|
+
"orange_99",
|
|
85
|
+
"yellow_10",
|
|
86
|
+
"yellow_20",
|
|
87
|
+
"yellow_25",
|
|
88
|
+
"yellow_30",
|
|
89
|
+
"yellow_40",
|
|
90
|
+
"yellow_45",
|
|
91
|
+
"yellow_50",
|
|
92
|
+
"yellow_60",
|
|
93
|
+
"yellow_70",
|
|
94
|
+
"yellow_80",
|
|
95
|
+
"yellow_90",
|
|
96
|
+
"yellow_95",
|
|
97
|
+
"olive_10",
|
|
98
|
+
"olive_15",
|
|
99
|
+
"olive_20",
|
|
100
|
+
"olive_30",
|
|
101
|
+
"olive_45",
|
|
102
|
+
"olive_55",
|
|
103
|
+
"olive_65",
|
|
104
|
+
"olive_70",
|
|
105
|
+
"olive_80",
|
|
106
|
+
"olive_90",
|
|
107
|
+
"olive_95",
|
|
108
|
+
"olive_05",
|
|
109
|
+
"green_15",
|
|
110
|
+
"green_25",
|
|
111
|
+
"green_45",
|
|
112
|
+
"green_55",
|
|
113
|
+
"green_65",
|
|
114
|
+
"green_70",
|
|
115
|
+
"green_75",
|
|
116
|
+
"green_80",
|
|
117
|
+
"green_85",
|
|
118
|
+
"green_90",
|
|
119
|
+
"green_95",
|
|
120
|
+
"green_99",
|
|
121
|
+
"steelblue_10",
|
|
122
|
+
"steelblue_25",
|
|
123
|
+
"steelblue_45",
|
|
124
|
+
"steelblue_60",
|
|
125
|
+
"steelblue_65",
|
|
126
|
+
"steelblue_70",
|
|
127
|
+
"steelblue_75",
|
|
128
|
+
"steelblue_80",
|
|
129
|
+
"steelblue_85",
|
|
130
|
+
"steelblue_90",
|
|
131
|
+
"steelblue_95",
|
|
132
|
+
"steelblue_99",
|
|
133
|
+
"oceanblue_15",
|
|
134
|
+
"oceanblue_25",
|
|
135
|
+
"oceanblue_50",
|
|
136
|
+
"oceanblue_60",
|
|
137
|
+
"oceanblue_65",
|
|
138
|
+
"oceanblue_70",
|
|
139
|
+
"oceanblue_75",
|
|
140
|
+
"oceanblue_80",
|
|
141
|
+
"oceanblue_85",
|
|
142
|
+
"oceanblue_90",
|
|
143
|
+
"oceanblue_95",
|
|
144
|
+
"oceanblue_99",
|
|
145
|
+
"brilliantblue_10",
|
|
146
|
+
"brilliantblue_20",
|
|
147
|
+
"brilliantblue_25",
|
|
148
|
+
"brilliantblue_40",
|
|
149
|
+
"brilliantblue_50",
|
|
150
|
+
"brilliantblue_60",
|
|
151
|
+
"brilliantblue_70",
|
|
152
|
+
"brilliantblue_75",
|
|
153
|
+
"brilliantblue_80",
|
|
154
|
+
"brilliantblue_85",
|
|
155
|
+
"brilliantblue_90",
|
|
156
|
+
"brilliantblue_95",
|
|
157
|
+
"brilliantblue_99",
|
|
158
|
+
"brilliantblue_05"
|
|
159
|
+
];
|
|
160
|
+
var KEY_SET = new Set(COLOR_KEYS);
|
|
161
|
+
function isColorKey(input) {
|
|
162
|
+
return KEY_SET.has(input);
|
|
163
|
+
}
|
|
164
|
+
function resolveColor(input, fallback) {
|
|
165
|
+
if (input === null || input === void 0 || input === "") return fallback;
|
|
166
|
+
return isColorKey(input) ? `var(--color-${input.replace(/_/g, "-")})` : input;
|
|
167
|
+
}
|
|
40
168
|
var Icon_add = (p) => {
|
|
41
169
|
const { size = 24, ...rest } = p;
|
|
42
170
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2736,7 +2864,7 @@ var SIcon = react.forwardRef(function SIcon2({ name, size = 24, color, rotate, l
|
|
|
2736
2864
|
{
|
|
2737
2865
|
ref,
|
|
2738
2866
|
className: cn("inline-flex items-center justify-center", rotateClass, className),
|
|
2739
|
-
style: { color, ...style },
|
|
2867
|
+
style: { color: resolveColor(color), ...style },
|
|
2740
2868
|
role: label ? "img" : void 0,
|
|
2741
2869
|
"aria-label": label,
|
|
2742
2870
|
"aria-hidden": label ? void 0 : true,
|
|
@@ -2760,7 +2888,7 @@ var HIDE_DELAY_MS = 100;
|
|
|
2760
2888
|
function useBody(content, message = []) {
|
|
2761
2889
|
if (content != null) return content;
|
|
2762
2890
|
if (message.length === 0) return null;
|
|
2763
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2891
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: message.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { children: line }, i)) });
|
|
2764
2892
|
}
|
|
2765
2893
|
var STooltip = react.forwardRef(function STooltip2({
|
|
2766
2894
|
content,
|
|
@@ -2878,8 +3006,6 @@ var STooltip = react.forwardRef(function STooltip2({
|
|
|
2878
3006
|
] });
|
|
2879
3007
|
});
|
|
2880
3008
|
STooltip.displayName = "STooltip";
|
|
2881
|
-
|
|
2882
|
-
// src/lib/form.ts
|
|
2883
3009
|
function runRules(value, rules) {
|
|
2884
3010
|
if (!rules || rules.length === 0) return "";
|
|
2885
3011
|
for (const rule of rules) {
|
|
@@ -2888,6 +3014,24 @@ function runRules(value, rules) {
|
|
|
2888
3014
|
}
|
|
2889
3015
|
return "";
|
|
2890
3016
|
}
|
|
3017
|
+
var FormContext = react.createContext(null);
|
|
3018
|
+
function useFormContext() {
|
|
3019
|
+
return react.useContext(FormContext);
|
|
3020
|
+
}
|
|
3021
|
+
function useFormField(field) {
|
|
3022
|
+
const ctx = useFormContext();
|
|
3023
|
+
const cbRef = react.useRef(field);
|
|
3024
|
+
cbRef.current = field;
|
|
3025
|
+
const name = field.name ?? "";
|
|
3026
|
+
react.useEffect(() => {
|
|
3027
|
+
if (!ctx) return;
|
|
3028
|
+
return ctx.register({
|
|
3029
|
+
name,
|
|
3030
|
+
validate: () => cbRef.current.validate(),
|
|
3031
|
+
resetValidation: () => cbRef.current.resetValidation()
|
|
3032
|
+
});
|
|
3033
|
+
}, [ctx, name]);
|
|
3034
|
+
}
|
|
2891
3035
|
var FIELD_SIZE = {
|
|
2892
3036
|
sm: { height: 28, radius: 4, fieldGap: 12, labelGap: 6, fontSize: 12, lineHeight: 20, icon: 12 },
|
|
2893
3037
|
md: { height: 36, radius: 6, fieldGap: 16, labelGap: 8, fontSize: 14, lineHeight: 24, icon: 12 }
|
|
@@ -3180,6 +3324,15 @@ var SSelect = react.forwardRef(function SSelect2({
|
|
|
3180
3324
|
const arr = Array.isArray(value) ? value : [value];
|
|
3181
3325
|
return arr.map((v) => v != null && typeof v === "object" ? v.value : v).filter((v) => v != null && v !== "").map(String);
|
|
3182
3326
|
}, [value]);
|
|
3327
|
+
useFormField({
|
|
3328
|
+
name,
|
|
3329
|
+
validate: () => {
|
|
3330
|
+
const msg = runRules(multi ? selected : selected[0] ?? "", rules);
|
|
3331
|
+
setRuleError(msg);
|
|
3332
|
+
return msg === "";
|
|
3333
|
+
},
|
|
3334
|
+
resetValidation: () => setRuleError("")
|
|
3335
|
+
});
|
|
3183
3336
|
const emit = (next) => {
|
|
3184
3337
|
if (!onValueChange) return;
|
|
3185
3338
|
const mapped = next.map(
|