@seedgrid/fe-components 2026.3.4 → 2026.3.9
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/buttons/SgFloatActionButton.d.ts +2 -3
- package/dist/buttons/SgFloatActionButton.d.ts.map +1 -1
- package/dist/buttons/SgFloatActionButton.js +3 -3
- package/dist/buttons/SgSplitButton.d.ts +1 -0
- package/dist/buttons/SgSplitButton.d.ts.map +1 -1
- package/dist/buttons/SgSplitButton.js +2 -2
- package/dist/commons/SgBadge.d.ts +2 -1
- package/dist/commons/SgBadge.d.ts.map +1 -1
- package/dist/commons/SgBadge.js +8 -7
- package/dist/commons/SgBadgeOverlay.d.ts +1 -0
- package/dist/commons/SgBadgeOverlay.d.ts.map +1 -1
- package/dist/commons/SgBadgeOverlay.js +2 -2
- package/dist/commons/SgToastHost.d.ts +17 -0
- package/dist/commons/SgToastHost.d.ts.map +1 -0
- package/dist/commons/SgToastHost.js +45 -0
- package/dist/commons/SgToaster.d.ts +3 -1
- package/dist/commons/SgToaster.d.ts.map +1 -1
- package/dist/commons/SgToaster.js +13 -0
- package/dist/commons/sgToastHostRegistry.d.ts +7 -0
- package/dist/commons/sgToastHostRegistry.d.ts.map +1 -0
- package/dist/commons/sgToastHostRegistry.js +41 -0
- package/dist/gadgets/clock/SgClock.d.ts +2 -1
- package/dist/gadgets/clock/SgClock.d.ts.map +1 -1
- package/dist/gadgets/clock/SgClock.js +15 -15
- package/dist/gadgets/string-animator/SgStringAnimator.d.ts +1 -1
- package/dist/gadgets/string-animator/SgStringAnimator.d.ts.map +1 -1
- package/dist/gadgets/string-animator/SgStringAnimator.js +1 -1
- package/dist/i18n/en-US.d.ts.map +1 -1
- package/dist/i18n/en-US.js +16 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +16 -1
- package/dist/i18n/pt-BR.d.ts.map +1 -1
- package/dist/i18n/pt-BR.js +16 -1
- package/dist/i18n/pt-PT.d.ts.map +1 -1
- package/dist/i18n/pt-PT.js +16 -1
- package/dist/index.d.ts +11 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/inputs/SgCheckboxGroup.d.ts +46 -0
- package/dist/inputs/SgCheckboxGroup.d.ts.map +1 -0
- package/dist/inputs/SgCheckboxGroup.js +158 -0
- package/dist/inputs/{SgCurrencyEdit.d.ts → SgInputCurrency.d.ts} +5 -3
- package/dist/inputs/SgInputCurrency.d.ts.map +1 -0
- package/dist/inputs/{SgCurrencyEdit.js → SgInputCurrency.js} +7 -5
- package/dist/inputs/SgOrderList.d.ts +52 -0
- package/dist/inputs/SgOrderList.d.ts.map +1 -0
- package/dist/inputs/SgOrderList.js +316 -0
- package/dist/inputs/SgPickList.d.ts +71 -0
- package/dist/inputs/SgPickList.d.ts.map +1 -0
- package/dist/inputs/SgPickList.js +362 -0
- package/dist/inputs/SgRadioGroup.d.ts +1 -2
- package/dist/inputs/SgRadioGroup.d.ts.map +1 -1
- package/dist/inputs/SgRadioGroup.js +5 -49
- package/dist/inputs/SgRating.d.ts +2 -0
- package/dist/inputs/SgRating.d.ts.map +1 -1
- package/dist/inputs/SgRating.js +2 -2
- package/dist/inputs/SgTextEditor.d.ts +2 -0
- package/dist/inputs/SgTextEditor.d.ts.map +1 -1
- package/dist/inputs/SgTextEditor.js +2 -2
- package/dist/layout/SgCard.d.ts +1 -1
- package/dist/layout/SgCard.d.ts.map +1 -1
- package/dist/layout/SgCard.js +4 -4
- package/dist/layout/SgCarousel.d.ts +2 -0
- package/dist/layout/SgCarousel.d.ts.map +1 -1
- package/dist/layout/SgCarousel.js +2 -2
- package/dist/layout/SgDockLayout.d.ts +1 -0
- package/dist/layout/SgDockLayout.d.ts.map +1 -1
- package/dist/layout/SgDockLayout.js +2 -2
- package/dist/layout/SgDockZone.d.ts +1 -0
- package/dist/layout/SgDockZone.d.ts.map +1 -1
- package/dist/layout/SgDockZone.js +2 -2
- package/dist/layout/SgGroupBox.d.ts +1 -0
- package/dist/layout/SgGroupBox.d.ts.map +1 -1
- package/dist/layout/SgGroupBox.js +3 -2
- package/dist/layout/SgMenu.d.ts +2 -2
- package/dist/layout/SgMenu.d.ts.map +1 -1
- package/dist/layout/SgMenu.js +22 -22
- package/dist/layout/SgPageControl.d.ts +2 -1
- package/dist/layout/SgPageControl.d.ts.map +1 -1
- package/dist/layout/SgPageControl.js +4 -4
- package/dist/layout/SgToolBar.d.ts +2 -0
- package/dist/layout/SgToolBar.d.ts.map +1 -1
- package/dist/layout/SgToolBar.js +4 -3
- package/dist/layout/SgTreeView.d.ts +1 -0
- package/dist/layout/SgTreeView.d.ts.map +1 -1
- package/dist/layout/SgTreeView.js +2 -2
- package/dist/others/SgPlayground.d.ts +2 -0
- package/dist/others/SgPlayground.d.ts.map +1 -1
- package/dist/others/SgPlayground.js +4 -4
- package/dist/overlay/SgDialog.d.ts +1 -0
- package/dist/overlay/SgDialog.d.ts.map +1 -1
- package/dist/overlay/SgDialog.js +2 -2
- package/dist/sandbox.cjs +96 -78
- package/dist/wizard/SgWizard.d.ts +2 -0
- package/dist/wizard/SgWizard.d.ts.map +1 -1
- package/dist/wizard/SgWizard.js +2 -2
- package/package.json +1 -1
- package/dist/inputs/SgCurrencyEdit.d.ts.map +0 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { SgButton } from "../buttons/SgButton";
|
|
5
|
+
import { SgGroupBox } from "../layout/SgGroupBox";
|
|
6
|
+
import { t, useComponentsI18n } from "../i18n";
|
|
7
|
+
function cn(...parts) {
|
|
8
|
+
return parts.filter(Boolean).join(" ");
|
|
9
|
+
}
|
|
10
|
+
function uniqueValues(values) {
|
|
11
|
+
return Array.from(new Set(values));
|
|
12
|
+
}
|
|
13
|
+
function moveSingleItem(items, fromIndex, toIndex) {
|
|
14
|
+
if (items.length < 2)
|
|
15
|
+
return items;
|
|
16
|
+
if (fromIndex < 0 || fromIndex >= items.length)
|
|
17
|
+
return items;
|
|
18
|
+
if (toIndex < 0 || toIndex > items.length)
|
|
19
|
+
return items;
|
|
20
|
+
if (fromIndex === toIndex || fromIndex + 1 === toIndex)
|
|
21
|
+
return items;
|
|
22
|
+
const next = [...items];
|
|
23
|
+
const [picked] = next.splice(fromIndex, 1);
|
|
24
|
+
if (picked === undefined)
|
|
25
|
+
return items;
|
|
26
|
+
const targetIndex = fromIndex < toIndex ? toIndex - 1 : toIndex;
|
|
27
|
+
const insertAt = Math.max(0, Math.min(targetIndex, next.length));
|
|
28
|
+
next.splice(insertAt, 0, picked);
|
|
29
|
+
return next;
|
|
30
|
+
}
|
|
31
|
+
function moveSelectionTop(items, selected) {
|
|
32
|
+
const picked = items.filter((item) => selected.has(item.value) && !item.disabled);
|
|
33
|
+
if (picked.length === 0)
|
|
34
|
+
return items;
|
|
35
|
+
const rest = items.filter((item) => !(selected.has(item.value) && !item.disabled));
|
|
36
|
+
return [...picked, ...rest];
|
|
37
|
+
}
|
|
38
|
+
function moveSelectionBottom(items, selected) {
|
|
39
|
+
const picked = items.filter((item) => selected.has(item.value) && !item.disabled);
|
|
40
|
+
if (picked.length === 0)
|
|
41
|
+
return items;
|
|
42
|
+
const rest = items.filter((item) => !(selected.has(item.value) && !item.disabled));
|
|
43
|
+
return [...rest, ...picked];
|
|
44
|
+
}
|
|
45
|
+
function moveSelectionUp(items, selected) {
|
|
46
|
+
const next = [...items];
|
|
47
|
+
for (let index = 1; index < next.length; index += 1) {
|
|
48
|
+
const current = next[index];
|
|
49
|
+
const prev = next[index - 1];
|
|
50
|
+
if (!(selected.has(current.value) && !current.disabled))
|
|
51
|
+
continue;
|
|
52
|
+
if (selected.has(prev.value) && !prev.disabled)
|
|
53
|
+
continue;
|
|
54
|
+
next[index] = prev;
|
|
55
|
+
next[index - 1] = current;
|
|
56
|
+
}
|
|
57
|
+
return next;
|
|
58
|
+
}
|
|
59
|
+
function moveSelectionDown(items, selected) {
|
|
60
|
+
const next = [...items];
|
|
61
|
+
for (let index = next.length - 2; index >= 0; index -= 1) {
|
|
62
|
+
const current = next[index];
|
|
63
|
+
const nextItem = next[index + 1];
|
|
64
|
+
if (!(selected.has(current.value) && !current.disabled))
|
|
65
|
+
continue;
|
|
66
|
+
if (selected.has(nextItem.value) && !nextItem.disabled)
|
|
67
|
+
continue;
|
|
68
|
+
next[index] = nextItem;
|
|
69
|
+
next[index + 1] = current;
|
|
70
|
+
}
|
|
71
|
+
return next;
|
|
72
|
+
}
|
|
73
|
+
function resolveMessage(translated, key, fallback) {
|
|
74
|
+
return translated === key ? fallback : translated;
|
|
75
|
+
}
|
|
76
|
+
function matchFilter(label, query, mode) {
|
|
77
|
+
const text = label.toLowerCase();
|
|
78
|
+
const search = query.toLowerCase();
|
|
79
|
+
if (mode === "startsWith")
|
|
80
|
+
return text.startsWith(search);
|
|
81
|
+
if (mode === "endsWith")
|
|
82
|
+
return text.endsWith(search);
|
|
83
|
+
return text.includes(search);
|
|
84
|
+
}
|
|
85
|
+
function SgPickListBase(props, imperativeRef) {
|
|
86
|
+
const i18n = useComponentsI18n();
|
|
87
|
+
const { id, title, source, target, value: controlledValue, onChange, sourceSelection: controlledSourceSelection, targetSelection: controlledTargetSelection, onSourceSelectionChange, onTargetSelectionChange, selectionMode = "multiple", sourceHeader, targetHeader, showTransferControls = true, showSourceControls = true, showTargetControls = true, showSourceFilter = false, showTargetFilter = false, sourceFilterPlaceholder, targetFilterPlaceholder, filterMatchMode = "contains", draggable = true, disabled = false, readOnly = false, emptyMessage, itemTemplate, className = "", style, listClassName = "", itemClassName = "", groupBoxProps = {} } = props;
|
|
88
|
+
const [internalValue, setInternalValue] = React.useState(() => ({ source, target }));
|
|
89
|
+
const [internalSourceSelection, setInternalSourceSelection] = React.useState(() => uniqueValues(controlledSourceSelection ?? []));
|
|
90
|
+
const [internalTargetSelection, setInternalTargetSelection] = React.useState(() => uniqueValues(controlledTargetSelection ?? []));
|
|
91
|
+
const [sourceFilter, setSourceFilter] = React.useState("");
|
|
92
|
+
const [targetFilter, setTargetFilter] = React.useState("");
|
|
93
|
+
const [dragState, setDragState] = React.useState(null);
|
|
94
|
+
const isValueControlled = controlledValue !== undefined;
|
|
95
|
+
const isSourceSelectionControlled = controlledSourceSelection !== undefined;
|
|
96
|
+
const isTargetSelectionControlled = controlledTargetSelection !== undefined;
|
|
97
|
+
React.useEffect(() => {
|
|
98
|
+
if (isValueControlled)
|
|
99
|
+
return;
|
|
100
|
+
setInternalValue({ source, target });
|
|
101
|
+
}, [source, target, isValueControlled]);
|
|
102
|
+
const currentValue = isValueControlled ? controlledValue : internalValue;
|
|
103
|
+
const sourceItems = currentValue.source ?? [];
|
|
104
|
+
const targetItems = currentValue.target ?? [];
|
|
105
|
+
const sourceSelectionRaw = isSourceSelectionControlled ? (controlledSourceSelection ?? []) : internalSourceSelection;
|
|
106
|
+
const targetSelectionRaw = isTargetSelectionControlled ? (controlledTargetSelection ?? []) : internalTargetSelection;
|
|
107
|
+
const sourceSelection = uniqueValues(sourceSelectionRaw.filter((valueItem) => sourceItems.some((item) => item.value === valueItem)));
|
|
108
|
+
const targetSelection = uniqueValues(targetSelectionRaw.filter((valueItem) => targetItems.some((item) => item.value === valueItem)));
|
|
109
|
+
const sourceSelectedSet = new Set(sourceSelection);
|
|
110
|
+
const targetSelectedSet = new Set(targetSelection);
|
|
111
|
+
const canInteract = !disabled && !readOnly;
|
|
112
|
+
const commitValue = React.useCallback((nextValue, type) => {
|
|
113
|
+
if (!isValueControlled)
|
|
114
|
+
setInternalValue(nextValue);
|
|
115
|
+
onChange?.({ ...nextValue, type });
|
|
116
|
+
}, [isValueControlled, onChange]);
|
|
117
|
+
const commitSourceSelection = React.useCallback((values) => {
|
|
118
|
+
const normalized = uniqueValues(values);
|
|
119
|
+
if (!isSourceSelectionControlled)
|
|
120
|
+
setInternalSourceSelection(normalized);
|
|
121
|
+
onSourceSelectionChange?.(normalized);
|
|
122
|
+
}, [isSourceSelectionControlled, onSourceSelectionChange]);
|
|
123
|
+
const commitTargetSelection = React.useCallback((values) => {
|
|
124
|
+
const normalized = uniqueValues(values);
|
|
125
|
+
if (!isTargetSelectionControlled)
|
|
126
|
+
setInternalTargetSelection(normalized);
|
|
127
|
+
onTargetSelectionChange?.(normalized);
|
|
128
|
+
}, [isTargetSelectionControlled, onTargetSelectionChange]);
|
|
129
|
+
const clearSelection = React.useCallback(() => {
|
|
130
|
+
commitSourceSelection([]);
|
|
131
|
+
commitTargetSelection([]);
|
|
132
|
+
}, [commitSourceSelection, commitTargetSelection]);
|
|
133
|
+
const moveToTarget = React.useCallback(() => {
|
|
134
|
+
if (!canInteract)
|
|
135
|
+
return;
|
|
136
|
+
const picked = sourceItems.filter((item) => sourceSelectedSet.has(item.value) && !item.disabled);
|
|
137
|
+
if (picked.length === 0)
|
|
138
|
+
return;
|
|
139
|
+
const nextSource = sourceItems.filter((item) => !(sourceSelectedSet.has(item.value) && !item.disabled));
|
|
140
|
+
const nextTarget = [...targetItems, ...picked];
|
|
141
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveToTarget");
|
|
142
|
+
commitSourceSelection([]);
|
|
143
|
+
commitTargetSelection(picked.map((item) => item.value));
|
|
144
|
+
}, [canInteract, sourceItems, sourceSelectedSet, targetItems, commitValue, commitSourceSelection, commitTargetSelection]);
|
|
145
|
+
const moveAllToTarget = React.useCallback(() => {
|
|
146
|
+
if (!canInteract)
|
|
147
|
+
return;
|
|
148
|
+
const picked = sourceItems.filter((item) => !item.disabled);
|
|
149
|
+
if (picked.length === 0)
|
|
150
|
+
return;
|
|
151
|
+
const nextSource = sourceItems.filter((item) => item.disabled);
|
|
152
|
+
const nextTarget = [...targetItems, ...picked];
|
|
153
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveAllToTarget");
|
|
154
|
+
commitSourceSelection([]);
|
|
155
|
+
commitTargetSelection(picked.map((item) => item.value));
|
|
156
|
+
}, [canInteract, sourceItems, targetItems, commitValue, commitSourceSelection, commitTargetSelection]);
|
|
157
|
+
const moveToSource = React.useCallback(() => {
|
|
158
|
+
if (!canInteract)
|
|
159
|
+
return;
|
|
160
|
+
const picked = targetItems.filter((item) => targetSelectedSet.has(item.value) && !item.disabled);
|
|
161
|
+
if (picked.length === 0)
|
|
162
|
+
return;
|
|
163
|
+
const nextTarget = targetItems.filter((item) => !(targetSelectedSet.has(item.value) && !item.disabled));
|
|
164
|
+
const nextSource = [...sourceItems, ...picked];
|
|
165
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveToSource");
|
|
166
|
+
commitTargetSelection([]);
|
|
167
|
+
commitSourceSelection(picked.map((item) => item.value));
|
|
168
|
+
}, [canInteract, targetItems, targetSelectedSet, sourceItems, commitValue, commitTargetSelection, commitSourceSelection]);
|
|
169
|
+
const moveAllToSource = React.useCallback(() => {
|
|
170
|
+
if (!canInteract)
|
|
171
|
+
return;
|
|
172
|
+
const picked = targetItems.filter((item) => !item.disabled);
|
|
173
|
+
if (picked.length === 0)
|
|
174
|
+
return;
|
|
175
|
+
const nextTarget = targetItems.filter((item) => item.disabled);
|
|
176
|
+
const nextSource = [...sourceItems, ...picked];
|
|
177
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveAllToSource");
|
|
178
|
+
commitTargetSelection([]);
|
|
179
|
+
commitSourceSelection(picked.map((item) => item.value));
|
|
180
|
+
}, [canInteract, targetItems, sourceItems, commitValue, commitTargetSelection, commitSourceSelection]);
|
|
181
|
+
const moveSingleByDoubleClick = React.useCallback((from, fromIndex) => {
|
|
182
|
+
if (!canInteract)
|
|
183
|
+
return;
|
|
184
|
+
if (from === "source") {
|
|
185
|
+
const moving = sourceItems[fromIndex];
|
|
186
|
+
if (!moving || moving.disabled)
|
|
187
|
+
return;
|
|
188
|
+
const nextSource = sourceItems.filter((_, index) => index !== fromIndex);
|
|
189
|
+
const nextTarget = [...targetItems, moving];
|
|
190
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveToTarget");
|
|
191
|
+
commitSourceSelection(sourceSelection.filter((valueItem) => valueItem !== moving.value));
|
|
192
|
+
commitTargetSelection([moving.value]);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
const moving = targetItems[fromIndex];
|
|
196
|
+
if (!moving || moving.disabled)
|
|
197
|
+
return;
|
|
198
|
+
const nextTarget = targetItems.filter((_, index) => index !== fromIndex);
|
|
199
|
+
const nextSource = [...sourceItems, moving];
|
|
200
|
+
commitValue({ source: nextSource, target: nextTarget }, "moveToSource");
|
|
201
|
+
commitTargetSelection(targetSelection.filter((valueItem) => valueItem !== moving.value));
|
|
202
|
+
commitSourceSelection([moving.value]);
|
|
203
|
+
}, [
|
|
204
|
+
canInteract,
|
|
205
|
+
sourceItems,
|
|
206
|
+
targetItems,
|
|
207
|
+
sourceSelection,
|
|
208
|
+
targetSelection,
|
|
209
|
+
commitValue,
|
|
210
|
+
commitSourceSelection,
|
|
211
|
+
commitTargetSelection
|
|
212
|
+
]);
|
|
213
|
+
React.useImperativeHandle(imperativeRef, () => ({
|
|
214
|
+
getValue: () => ({ source: sourceItems, target: targetItems }),
|
|
215
|
+
setValue: (nextValue) => commitValue(nextValue, "dragdrop"),
|
|
216
|
+
moveToTarget,
|
|
217
|
+
moveAllToTarget,
|
|
218
|
+
moveToSource,
|
|
219
|
+
moveAllToSource,
|
|
220
|
+
clearSelection
|
|
221
|
+
}), [sourceItems, targetItems, commitValue, moveToTarget, moveAllToTarget, moveToSource, moveAllToSource, clearSelection]);
|
|
222
|
+
const applyReorder = (list, direction) => {
|
|
223
|
+
if (!canInteract)
|
|
224
|
+
return;
|
|
225
|
+
const items = list === "source" ? sourceItems : targetItems;
|
|
226
|
+
const selected = list === "source" ? sourceSelectedSet : targetSelectedSet;
|
|
227
|
+
if (selected.size === 0)
|
|
228
|
+
return;
|
|
229
|
+
let nextItems = items;
|
|
230
|
+
if (direction === "top")
|
|
231
|
+
nextItems = moveSelectionTop(items, selected);
|
|
232
|
+
if (direction === "up")
|
|
233
|
+
nextItems = moveSelectionUp(items, selected);
|
|
234
|
+
if (direction === "down")
|
|
235
|
+
nextItems = moveSelectionDown(items, selected);
|
|
236
|
+
if (direction === "bottom")
|
|
237
|
+
nextItems = moveSelectionBottom(items, selected);
|
|
238
|
+
if (list === "source")
|
|
239
|
+
commitValue({ source: nextItems, target: targetItems }, "reorderSource");
|
|
240
|
+
if (list === "target")
|
|
241
|
+
commitValue({ source: sourceItems, target: nextItems }, "reorderTarget");
|
|
242
|
+
};
|
|
243
|
+
const handleSelect = (list, item) => {
|
|
244
|
+
if (!canInteract || item.disabled)
|
|
245
|
+
return;
|
|
246
|
+
const selected = list === "source" ? sourceSelectedSet : targetSelectedSet;
|
|
247
|
+
const commit = list === "source" ? commitSourceSelection : commitTargetSelection;
|
|
248
|
+
const current = list === "source" ? sourceSelection : targetSelection;
|
|
249
|
+
if (selectionMode === "single") {
|
|
250
|
+
commit([item.value]);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (selected.has(item.value)) {
|
|
254
|
+
commit(current.filter((valueItem) => valueItem !== item.value));
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
commit([...current, item.value]);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
const dragEnabled = canInteract && draggable;
|
|
261
|
+
const handleDrop = (to, toIndex) => {
|
|
262
|
+
if (!dragEnabled || !dragState)
|
|
263
|
+
return;
|
|
264
|
+
if (dragState.from === to) {
|
|
265
|
+
const list = to === "source" ? sourceItems : targetItems;
|
|
266
|
+
const next = moveSingleItem(list, dragState.fromIndex, toIndex);
|
|
267
|
+
if (to === "source")
|
|
268
|
+
commitValue({ source: next, target: targetItems }, "reorderSource");
|
|
269
|
+
if (to === "target")
|
|
270
|
+
commitValue({ source: sourceItems, target: next }, "reorderTarget");
|
|
271
|
+
setDragState(null);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const fromList = dragState.from === "source" ? sourceItems : targetItems;
|
|
275
|
+
const toList = to === "source" ? sourceItems : targetItems;
|
|
276
|
+
const moving = fromList[dragState.fromIndex];
|
|
277
|
+
if (!moving || moving.disabled) {
|
|
278
|
+
setDragState(null);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
const nextFrom = fromList.filter((_, idx) => idx !== dragState.fromIndex);
|
|
282
|
+
const nextTo = [...toList];
|
|
283
|
+
const insertAt = Math.max(0, Math.min(toIndex, nextTo.length));
|
|
284
|
+
nextTo.splice(insertAt, 0, moving);
|
|
285
|
+
if (dragState.from === "source" && to === "target") {
|
|
286
|
+
commitValue({ source: nextFrom, target: nextTo }, "dragdrop");
|
|
287
|
+
commitSourceSelection(sourceSelection.filter((valueItem) => valueItem !== moving.value));
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
commitValue({ source: nextTo, target: nextFrom }, "dragdrop");
|
|
291
|
+
commitTargetSelection(targetSelection.filter((valueItem) => valueItem !== moving.value));
|
|
292
|
+
}
|
|
293
|
+
setDragState(null);
|
|
294
|
+
};
|
|
295
|
+
const moveTopLabel = resolveMessage(t(i18n, "components.orderlist.moveTop"), "components.orderlist.moveTop", "Move to top");
|
|
296
|
+
const moveUpLabel = resolveMessage(t(i18n, "components.orderlist.moveUp"), "components.orderlist.moveUp", "Move up");
|
|
297
|
+
const moveDownLabel = resolveMessage(t(i18n, "components.orderlist.moveDown"), "components.orderlist.moveDown", "Move down");
|
|
298
|
+
const moveBottomLabel = resolveMessage(t(i18n, "components.orderlist.moveBottom"), "components.orderlist.moveBottom", "Move to bottom");
|
|
299
|
+
const moveToTargetLabel = resolveMessage(t(i18n, "components.picklist.moveToTarget"), "components.picklist.moveToTarget", "Move selected to target");
|
|
300
|
+
const moveAllToTargetLabel = resolveMessage(t(i18n, "components.picklist.moveAllToTarget"), "components.picklist.moveAllToTarget", "Move all to target");
|
|
301
|
+
const moveToSourceLabel = resolveMessage(t(i18n, "components.picklist.moveToSource"), "components.picklist.moveToSource", "Move selected to source");
|
|
302
|
+
const moveAllToSourceLabel = resolveMessage(t(i18n, "components.picklist.moveAllToSource"), "components.picklist.moveAllToSource", "Move all to source");
|
|
303
|
+
const sourceHeaderLabel = sourceHeader ?? resolveMessage(t(i18n, "components.picklist.sourceHeader"), "components.picklist.sourceHeader", "Source");
|
|
304
|
+
const targetHeaderLabel = targetHeader ?? resolveMessage(t(i18n, "components.picklist.targetHeader"), "components.picklist.targetHeader", "Target");
|
|
305
|
+
const sourceFilterLabel = sourceFilterPlaceholder ?? resolveMessage(t(i18n, "components.picklist.sourceFilterPlaceholder"), "components.picklist.sourceFilterPlaceholder", "Search source");
|
|
306
|
+
const targetFilterLabel = targetFilterPlaceholder ?? resolveMessage(t(i18n, "components.picklist.targetFilterPlaceholder"), "components.picklist.targetFilterPlaceholder", "Search target");
|
|
307
|
+
const emptyLabel = emptyMessage ?? resolveMessage(t(i18n, "components.picklist.empty"), "components.picklist.empty", "No items available.");
|
|
308
|
+
const filteredSource = sourceItems
|
|
309
|
+
.map((item, index) => ({ item, index }))
|
|
310
|
+
.filter(({ item }) => !sourceFilter || matchFilter(item.label, sourceFilter, filterMatchMode));
|
|
311
|
+
const filteredTarget = targetItems
|
|
312
|
+
.map((item, index) => ({ item, index }))
|
|
313
|
+
.filter(({ item }) => !targetFilter || matchFilter(item.label, targetFilter, filterMatchMode));
|
|
314
|
+
const renderList = (list, items, selected) => (_jsx("ul", { id: id ? `${id}-${list}` : undefined, role: "listbox", "aria-multiselectable": selectionMode === "multiple" || undefined, className: cn("max-h-[22rem] min-w-0 w-full overflow-y-auto rounded-lg border border-[rgb(var(--sg-border))] bg-white p-1", listClassName), onDragOver: (event) => {
|
|
315
|
+
if (!dragEnabled)
|
|
316
|
+
return;
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
}, onDrop: (event) => {
|
|
319
|
+
if (!dragEnabled)
|
|
320
|
+
return;
|
|
321
|
+
event.preventDefault();
|
|
322
|
+
handleDrop(list, list === "source" ? sourceItems.length : targetItems.length);
|
|
323
|
+
}, children: items.length === 0 ? (_jsx("li", { className: "list-none px-3 py-4 text-sm text-[rgb(var(--sg-muted))]", children: emptyLabel })) : (items.map(({ item, index }) => {
|
|
324
|
+
const selectedItem = selected.has(item.value);
|
|
325
|
+
const itemDisabled = disabled || Boolean(item.disabled);
|
|
326
|
+
return (_jsx("li", { className: "list-none", children: _jsxs("button", { type: "button", role: "option", "aria-selected": selectedItem, disabled: itemDisabled, draggable: dragEnabled && !item.disabled, onClick: (event) => {
|
|
327
|
+
if (event.detail >= 2) {
|
|
328
|
+
moveSingleByDoubleClick(list, index);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
handleSelect(list, item);
|
|
332
|
+
}, onDragStart: (event) => {
|
|
333
|
+
setDragState({ from: list, fromIndex: index });
|
|
334
|
+
event.dataTransfer.effectAllowed = "move";
|
|
335
|
+
try {
|
|
336
|
+
event.dataTransfer.setData("text/plain", String(item.value));
|
|
337
|
+
}
|
|
338
|
+
catch {
|
|
339
|
+
// Ignore setData failures in restrictive browser contexts.
|
|
340
|
+
}
|
|
341
|
+
}, onDragOver: (event) => {
|
|
342
|
+
if (!dragEnabled)
|
|
343
|
+
return;
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
}, onDrop: (event) => {
|
|
346
|
+
if (!dragEnabled)
|
|
347
|
+
return;
|
|
348
|
+
event.preventDefault();
|
|
349
|
+
event.stopPropagation();
|
|
350
|
+
handleDrop(list, index);
|
|
351
|
+
}, onDragEnd: () => setDragState(null), className: cn("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm", selectedItem
|
|
352
|
+
? "bg-[rgb(var(--sg-primary-100))] ring-1 ring-[rgb(var(--sg-primary-300))]"
|
|
353
|
+
: "bg-white hover:bg-[rgb(var(--sg-primary-50))]", itemDisabled ? "cursor-not-allowed opacity-60" : "cursor-pointer", itemClassName), children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: itemTemplate
|
|
354
|
+
? itemTemplate(item, { index, selected: selectedItem, disabled: itemDisabled, list })
|
|
355
|
+
: (_jsxs("span", { className: "flex items-center gap-2", children: [item.icon ? _jsx("span", { className: "shrink-0", children: item.icon }) : null, _jsx("span", { className: "truncate", children: item.label })] })) }), dragEnabled && !item.disabled ? (_jsx("span", { "aria-hidden": "true", className: "shrink-0 text-xs text-[rgb(var(--sg-muted))]", children: "::" })) : null] }) }, `${item.value}-${index}`));
|
|
356
|
+
})) }));
|
|
357
|
+
const renderReorderControls = (list) => (_jsxs("div", { className: "flex shrink-0 flex-col gap-2", children: [_jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveTopLabel, title: moveTopLabel, onClick: () => applyReorder(list, "top"), children: "Top" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveUpLabel, title: moveUpLabel, onClick: () => applyReorder(list, "up"), children: "Up" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveDownLabel, title: moveDownLabel, onClick: () => applyReorder(list, "down"), children: "Down" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveBottomLabel, title: moveBottomLabel, onClick: () => applyReorder(list, "bottom"), children: "Bottom" })] }));
|
|
358
|
+
const transferControls = showTransferControls ? (_jsxs("div", { className: "flex shrink-0 flex-row gap-2 md:flex-col", children: [_jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveToTargetLabel, title: moveToTargetLabel, onClick: moveToTarget, children: ">" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveAllToTargetLabel, title: moveAllToTargetLabel, onClick: moveAllToTarget, children: ">>" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveToSourceLabel, title: moveToSourceLabel, onClick: moveToSource, children: "<" }), _jsx(SgButton, { size: "sm", appearance: "outline", disabled: !canInteract, "aria-label": moveAllToSourceLabel, title: moveAllToSourceLabel, onClick: moveAllToSource, children: "<<" })] })) : null;
|
|
359
|
+
const resolvedTitle = (groupBoxProps.title ?? title ?? "").trim() || " ";
|
|
360
|
+
return (_jsx("div", { className: className, style: style, children: _jsx(SgGroupBox, { ...groupBoxProps, title: resolvedTitle, children: _jsxs("div", { className: "grid gap-3 md:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] md:items-start", children: [_jsxs("div", { className: "min-w-0 space-y-2", children: [_jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]", children: sourceHeaderLabel }), showSourceFilter ? (_jsx("input", { value: sourceFilter, onChange: (event) => setSourceFilter(event.target.value), placeholder: sourceFilterLabel, className: "w-full rounded-md border border-[rgb(var(--sg-border))] bg-white px-2 py-1 text-sm outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]" })) : null, _jsxs("div", { className: "flex items-start gap-2", children: [showSourceControls ? renderReorderControls("source") : null, _jsx("div", { className: "min-w-0 flex-1", children: renderList("source", filteredSource, sourceSelectedSet) })] })] }), _jsx("div", { className: "flex justify-center md:pt-7", children: transferControls }), _jsxs("div", { className: "min-w-0 space-y-2", children: [_jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-[rgb(var(--sg-muted))]", children: targetHeaderLabel }), showTargetFilter ? (_jsx("input", { value: targetFilter, onChange: (event) => setTargetFilter(event.target.value), placeholder: targetFilterLabel, className: "w-full rounded-md border border-[rgb(var(--sg-border))] bg-white px-2 py-1 text-sm outline-none focus:ring-2 focus:ring-[rgb(var(--sg-ring))]" })) : null, _jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: renderList("target", filteredTarget, targetSelectedSet) }), showTargetControls ? renderReorderControls("target") : null] })] })] }) }) }));
|
|
361
|
+
}
|
|
362
|
+
export const SgPickList = React.forwardRef((props, ref) => SgPickListBase(props, ref));
|
|
@@ -17,8 +17,6 @@ export interface SgRadioGroupProps {
|
|
|
17
17
|
orientation?: SgRadioGroupOrientation;
|
|
18
18
|
selectionStyle?: SgRadioGroupSelectionStyle;
|
|
19
19
|
iconOnly?: boolean;
|
|
20
|
-
showCancel?: boolean;
|
|
21
|
-
cancelLabel?: string;
|
|
22
20
|
disabled?: boolean;
|
|
23
21
|
readOnly?: boolean;
|
|
24
22
|
required?: boolean;
|
|
@@ -28,6 +26,7 @@ export interface SgRadioGroupProps {
|
|
|
28
26
|
register?: UseFormRegister<FieldValues>;
|
|
29
27
|
error?: string;
|
|
30
28
|
className?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
31
30
|
optionClassName?: string;
|
|
32
31
|
groupBoxProps?: Omit<Partial<SgGroupBoxProps>, "children" | "title"> & {
|
|
33
32
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgRadioGroup.d.ts","sourceRoot":"","sources":["../../src/inputs/SgRadioGroup.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAc,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGxE,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG,UAAU,CAAC;AAChE,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,WAAW,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,cAAc,CAAC,EAAE,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AW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3F;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA8OpD"}
|
|
@@ -6,7 +6,7 @@ import { SgGroupBox } from "../layout/SgGroupBox";
|
|
|
6
6
|
import { t, useComponentsI18n } from "../i18n";
|
|
7
7
|
export function SgRadioGroup(props) {
|
|
8
8
|
const i18n = useComponentsI18n();
|
|
9
|
-
const { id, title, source, value: controlledValue, orientation = "vertical", selectionStyle = "radio", iconOnly = false,
|
|
9
|
+
const { id, title, source, value: controlledValue, orientation = "vertical", selectionStyle = "radio", iconOnly = false, disabled = false, readOnly = false, required = false, onChange, name, control, register, error, className = "", style, optionClassName = "", groupBoxProps = {} } = props;
|
|
10
10
|
const resolvedGroupBoxTitle = (() => {
|
|
11
11
|
const baseTitle = groupBoxProps.title ?? title ?? "";
|
|
12
12
|
if (!required || !baseTitle.trim())
|
|
@@ -71,54 +71,10 @@ export function SgRadioGroup(props) {
|
|
|
71
71
|
handleChange(option.value);
|
|
72
72
|
}, className: inputClassName }), option.icon && (_jsx("span", { className: "flex items-center justify-center", children: option.icon })), !iconOnly && (_jsx("span", { className: "text-sm text-[rgb(var(--sg-text))]", children: option.label }))] }, `${option.value}-${index}`));
|
|
73
73
|
};
|
|
74
|
-
const
|
|
75
|
-
if (!showCancel)
|
|
76
|
-
return null;
|
|
77
|
-
const isSelected = currentValue === null;
|
|
78
|
-
const inputClassName = isHighlightSelection
|
|
79
|
-
? "sr-only"
|
|
80
|
-
: "w-4 h-4 text-[rgb(var(--sg-primary-500))] border-[rgb(var(--sg-border))] focus:ring-[rgb(var(--sg-ring))] focus:ring-2 cursor-pointer disabled:cursor-not-allowed";
|
|
81
|
-
if (isHighlightSelection) {
|
|
82
|
-
return (_jsxs("label", { className: `
|
|
83
|
-
flex items-center gap-2 border px-3 py-2 transition-all duration-150 select-none
|
|
84
|
-
${orientation === "vertical" ? "w-full -mt-px rounded-none first:mt-0 first:rounded-t-md last:rounded-b-md" : "inline-flex rounded-md"}
|
|
85
|
-
${iconOnly ? "justify-center" : ""}
|
|
86
|
-
${isSelected
|
|
87
|
-
? "relative z-10 translate-y-px rounded-md border-[rgb(var(--sg-primary-300))] bg-[rgb(var(--sg-primary-100))] ring-1 ring-[rgb(var(--sg-primary-200))] shadow-[inset_0_2px_4px_rgba(15,23,42,0.18),inset_0_1px_0_rgba(255,255,255,0.75),0_1px_2px_rgba(15,23,42,0.08)]"
|
|
88
|
-
: "border-[rgb(var(--sg-primary-200))] bg-[rgb(var(--sg-primary-50))] shadow-[0_2px_0_rgba(148,163,184,0.32),0_6px_10px_rgba(15,23,42,0.07)]"}
|
|
89
|
-
${disabled
|
|
90
|
-
? "cursor-not-allowed opacity-50"
|
|
91
|
-
: readOnly
|
|
92
|
-
? "cursor-default"
|
|
93
|
-
: `cursor-pointer ${isSelected ? "hover:bg-[rgb(var(--sg-primary-200))]" : "hover:-translate-y-px hover:bg-[rgb(var(--sg-primary-100))] hover:shadow-[0_3px_0_rgba(148,163,184,0.32),0_10px_14px_rgba(15,23,42,0.1)]"}`}
|
|
94
|
-
focus-within:outline-none
|
|
95
|
-
focus-within:ring-2
|
|
96
|
-
focus-within:ring-[rgb(var(--sg-ring))]
|
|
97
|
-
${optionClassName}
|
|
98
|
-
`, children: [_jsx("input", { type: "radio", ...(registration ? registration : { name: name || id }), value: "", checked: isSelected, disabled: disabled || readOnly, onChange: (event) => {
|
|
99
|
-
if (registration)
|
|
100
|
-
registration.onChange(event);
|
|
101
|
-
handleChange(null);
|
|
102
|
-
}, className: inputClassName }), !iconOnly ? (_jsx("span", { className: `
|
|
103
|
-
text-[rgb(var(--sg-text))] transition-[font-size] duration-150
|
|
104
|
-
${isSelected ? "text-[15px] font-medium" : "text-sm"}
|
|
105
|
-
`, children: cancelLabel || t(i18n, "components.radiogroup.cancel") })) : null] }));
|
|
106
|
-
}
|
|
107
|
-
return (_jsxs("label", { className: `
|
|
108
|
-
inline-flex items-center gap-2 cursor-pointer select-none
|
|
109
|
-
${disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
110
|
-
${readOnly ? "cursor-default" : ""}
|
|
111
|
-
${optionClassName}
|
|
112
|
-
`, children: [_jsx("input", { type: "radio", ...(registration ? registration : { name: name || id }), value: "", checked: isSelected, disabled: disabled || readOnly, onChange: (event) => {
|
|
113
|
-
if (registration)
|
|
114
|
-
registration.onChange(event);
|
|
115
|
-
handleChange(null);
|
|
116
|
-
}, className: inputClassName }), !iconOnly && (_jsx("span", { className: "text-sm text-[rgb(var(--sg-text))]", children: cancelLabel || t(i18n, "components.radiogroup.cancel") }))] }));
|
|
117
|
-
};
|
|
118
|
-
const content = (_jsxs("div", { className: className, children: [_jsx(SgGroupBox, { ...groupBoxProps, title: resolvedGroupBoxTitle || " ", className: groupBoxProps.className || "", children: _jsxs("div", { className: `
|
|
74
|
+
const content = (_jsxs("div", { className: className, style: style, children: [_jsx(SgGroupBox, { ...groupBoxProps, title: resolvedGroupBoxTitle || " ", className: groupBoxProps.className || "", children: _jsx("div", { className: `
|
|
119
75
|
flex ${isHighlightSelection ? "gap-0" : "gap-4"}
|
|
120
76
|
${orientation === "vertical" ? "flex-col" : "flex-row flex-wrap"}
|
|
121
|
-
`, role: "radiogroup", "aria-disabled": disabled || undefined, "aria-readonly": readOnly || undefined, "aria-required": required || undefined, children:
|
|
77
|
+
`, role: "radiogroup", "aria-disabled": disabled || undefined, "aria-readonly": readOnly || undefined, "aria-required": required || undefined, children: source.map((option, index) => renderRadioOption(option, index)) }) }), error && (_jsx("div", { className: "mt-1 text-sm text-red-500", children: error }))] }));
|
|
122
78
|
// React Hook Form integration
|
|
123
79
|
if (control && name) {
|
|
124
80
|
return (_jsx(Controller, { name: name, control: control, rules: { required: required ? t(i18n, "components.inputs.required") : false }, render: ({ field, fieldState }) => (_jsx(SgRadioGroup, { ...props, value: field.value, onChange: (val) => {
|
|
@@ -130,10 +86,10 @@ export function SgRadioGroup(props) {
|
|
|
130
86
|
const registration = register(name, {
|
|
131
87
|
required: required ? t(i18n, "components.inputs.required") : false
|
|
132
88
|
});
|
|
133
|
-
return (_jsxs("div", { className: className, children: [_jsx(SgGroupBox, { ...groupBoxProps, title: resolvedGroupBoxTitle || " ", children:
|
|
89
|
+
return (_jsxs("div", { className: className, style: style, children: [_jsx(SgGroupBox, { ...groupBoxProps, title: resolvedGroupBoxTitle || " ", children: _jsx("div", { className: `
|
|
134
90
|
flex ${isHighlightSelection ? "gap-0" : "gap-4"}
|
|
135
91
|
${orientation === "vertical" ? "flex-col" : "flex-row flex-wrap"}
|
|
136
|
-
`, role: "radiogroup", "aria-disabled": disabled || undefined, "aria-readonly": readOnly || undefined, "aria-required": required || undefined, children:
|
|
92
|
+
`, role: "radiogroup", "aria-disabled": disabled || undefined, "aria-readonly": readOnly || undefined, "aria-required": required || undefined, children: source.map((option, index) => renderRadioOption(option, index, registration)) }) }), error && (_jsx("div", { className: "mt-1 text-sm text-red-500", children: error }))] }));
|
|
137
93
|
}
|
|
138
94
|
return content;
|
|
139
95
|
}
|
|
@@ -22,6 +22,8 @@ export interface SgRatingProps {
|
|
|
22
22
|
size?: SgRatingSize;
|
|
23
23
|
/** Custom class name */
|
|
24
24
|
className?: string;
|
|
25
|
+
/** Custom inline style */
|
|
26
|
+
style?: React.CSSProperties;
|
|
25
27
|
/** Custom icon for filled state */
|
|
26
28
|
onIcon?: React.ReactNode;
|
|
27
29
|
/** Custom icon for empty state */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgRating.d.ts","source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AAa,CAAC;IAC5B,mCAAmC;IACnC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,kCAAkC;IAClC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,oCAAoC;IACpC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,wCAAwC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACxC,iCAAiC;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AA+QD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,2CAkC5C"}
|
package/dist/inputs/SgRating.js
CHANGED
|
@@ -22,7 +22,7 @@ function ErrorText(props) {
|
|
|
22
22
|
}
|
|
23
23
|
function SgRatingBase(props) {
|
|
24
24
|
const i18n = useComponentsI18n();
|
|
25
|
-
const { id, label, value = 0, stars = 5, allowHalf = false, cancel = true, disabled = false, readOnly = false, size = "md", className = "", onIcon, offIcon, cancelIcon, color = "hsl(var(--primary))", emptyColor = "hsl(var(--muted-foreground))", showTooltip = false, onChange, onHover, error, required = false, requiredMessage } = props;
|
|
25
|
+
const { id, label, value = 0, stars = 5, allowHalf = false, cancel = true, disabled = false, readOnly = false, size = "md", className = "", style, onIcon, offIcon, cancelIcon, color = "hsl(var(--primary))", emptyColor = "hsl(var(--muted-foreground))", showTooltip = false, onChange, onHover, error, required = false, requiredMessage } = props;
|
|
26
26
|
const [hoverValue, setHoverValue] = React.useState(null);
|
|
27
27
|
const [internalValue, setInternalValue] = React.useState(value);
|
|
28
28
|
const [internalError, setInternalError] = React.useState(null);
|
|
@@ -80,7 +80,7 @@ function SgRatingBase(props) {
|
|
|
80
80
|
}
|
|
81
81
|
return 0;
|
|
82
82
|
};
|
|
83
|
-
return (_jsxs("div", { className: `sg-rating ${className}`, children: [label && (_jsxs("label", { htmlFor: id, className: "mb-2 block text-sm font-medium", children: [label, required && _jsx("span", { className: "ml-1 text-red-600", children: "*" })] })), _jsxs("div", { className: "flex items-center gap-1", onMouseLeave: handleMouseLeave, style: {
|
|
83
|
+
return (_jsxs("div", { className: `sg-rating ${className}`, style: style, children: [label && (_jsxs("label", { htmlFor: id, className: "mb-2 block text-sm font-medium", children: [label, required && _jsx("span", { className: "ml-1 text-red-600", children: "*" })] })), _jsxs("div", { className: "flex items-center gap-1", onMouseLeave: handleMouseLeave, style: {
|
|
84
84
|
opacity: disabled ? 0.5 : 1,
|
|
85
85
|
cursor: isInteractive ? "pointer" : "default"
|
|
86
86
|
}, children: [cancel && (_jsx("button", { type: "button", onClick: handleCancel, disabled: disabled || readOnly, className: "mr-1 transition-opacity hover:opacity-80", style: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
1
2
|
export type SgTextEditorSaveMeta = {
|
|
2
3
|
htmlDocument: string;
|
|
3
4
|
contentHtml: string;
|
|
@@ -20,6 +21,7 @@ export type SgTextEditorProps = {
|
|
|
20
21
|
showCssEditor?: boolean;
|
|
21
22
|
cssEditorLabel?: string;
|
|
22
23
|
className?: string;
|
|
24
|
+
style?: React.CSSProperties;
|
|
23
25
|
};
|
|
24
26
|
export declare function SgTextEditor(props: Readonly<SgTextEditorProps>): import("react/jsx-runtime").JSX.Element;
|
|
25
27
|
export declare namespace SgTextEditor {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgTextEditor.d.ts","sourceRoot":"","sources":["../../src/inputs/SgTextEditor.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SgTextEditor.d.ts","sourceRoot":"","sources":["../../src/inputs/SgTextEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAE1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAE9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AA2DF,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAsZ9D;yBAtZe,YAAY"}
|
|
@@ -68,7 +68,7 @@ function canRun(editor, fn) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
export function SgTextEditor(props) {
|
|
71
|
-
const { id, valueHtml, defaultValueHtml, onChangeHtml, cssText = "", onCssTextChange, fileName, onSave, onLoad, height = 320, placeholder = "Type here...", disabled, borderRadius, showCssEditor = false, cssEditorLabel = "Embedded CSS", className } = props;
|
|
71
|
+
const { id, valueHtml, defaultValueHtml, onChangeHtml, cssText = "", onCssTextChange, fileName, onSave, onLoad, height = 320, placeholder = "Type here...", disabled, borderRadius, showCssEditor = false, cssEditorLabel = "Embedded CSS", className, style } = props;
|
|
72
72
|
const resolvedBorderRadius = React.useMemo(() => {
|
|
73
73
|
if (borderRadius === undefined)
|
|
74
74
|
return undefined;
|
|
@@ -153,7 +153,7 @@ export function SgTextEditor(props) {
|
|
|
153
153
|
const cssTextareaStyle = resolvedBorderRadius
|
|
154
154
|
? { borderRadius: resolvedBorderRadius }
|
|
155
155
|
: undefined;
|
|
156
|
-
return (_jsxs("div", { className: cn("w-full", className), children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-t-lg border border-b-0 bg-background p-2", style: toolbarStyle, children: [_jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor || disabled, value: active("heading", { level: 1 })
|
|
156
|
+
return (_jsxs("div", { className: cn("w-full", className), style: style, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-t-lg border border-b-0 bg-background p-2", style: toolbarStyle, children: [_jsxs("select", { className: "h-9 rounded-md border px-2 text-sm bg-background", disabled: !editor || disabled, value: active("heading", { level: 1 })
|
|
157
157
|
? "h1"
|
|
158
158
|
: active("heading", { level: 2 })
|
|
159
159
|
? "h2"
|
package/dist/layout/SgCard.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type SgCardProps = Omit<React.HTMLAttributes<HTMLElement>, "title" | "onC
|
|
|
6
6
|
headerClassName?: string;
|
|
7
7
|
bodyClassName?: string;
|
|
8
8
|
footerClassName?: string;
|
|
9
|
-
|
|
9
|
+
cardStyle?: SgCardVariant;
|
|
10
10
|
size?: SgCardSize;
|
|
11
11
|
leading?: React.ReactNode;
|
|
12
12
|
trailing?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgCard.d.ts","sourceRoot":"","sources":["../../src/layout/SgCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,
|
|
1
|
+
{"version":3,"file":"SgCard.d.ts","sourceRoot":"","sources":["../../src/layout/SgCard.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,KA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AK,EAAE,QAAQ,CAAC,WAAW,CAAC,2CA4OlD;yBA5Oe,MAAM"}
|
package/dist/layout/SgCard.js
CHANGED
|
@@ -8,7 +8,7 @@ function DefaultCaret({ open }) {
|
|
|
8
8
|
return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", className: cn("shrink-0 transition-transform duration-200", open ? "rotate-90" : "rotate-0"), "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M9.29 6.71a1 1 0 0 0 0 1.41L13.17 12l-3.88 3.88a1 1 0 1 0 1.41 1.41l4.59-4.59a1 1 0 0 0 0-1.41L10.7 6.7a1 1 0 0 0-1.41.01Z" }) }));
|
|
9
9
|
}
|
|
10
10
|
export function SgCard(props) {
|
|
11
|
-
const { className, headerClassName, bodyClassName, footerClassName,
|
|
11
|
+
const { className, headerClassName, bodyClassName, footerClassName, cardStyle = "default", size = "md", leading, trailing, trailer, title, description, actions, header, footer, clickable = false, disabled = false, collapsible = false, defaultOpen = true, open: controlledOpen, onOpenChange, collapseIcon, collapseToggleAlign = "left", toggleOnHeaderClick = true, onClick, children, ...rest } = props;
|
|
12
12
|
const isInteractive = (clickable || typeof onClick === "function") && !collapsible;
|
|
13
13
|
const trailingNode = trailing ?? trailer;
|
|
14
14
|
const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);
|
|
@@ -47,11 +47,11 @@ export function SgCard(props) {
|
|
|
47
47
|
title: "text-sm",
|
|
48
48
|
desc: "text-xs"
|
|
49
49
|
};
|
|
50
|
-
const variantClasses =
|
|
50
|
+
const variantClasses = cardStyle === "flat"
|
|
51
51
|
? "bg-background border border-border/60 shadow-none"
|
|
52
|
-
:
|
|
52
|
+
: cardStyle === "outlined"
|
|
53
53
|
? "bg-background border border-border shadow-none"
|
|
54
|
-
:
|
|
54
|
+
: cardStyle === "elevated"
|
|
55
55
|
? "bg-background border border-border shadow-md"
|
|
56
56
|
: "bg-background border border-border shadow-sm";
|
|
57
57
|
const interactiveClasses = isInteractive
|
|
@@ -33,6 +33,8 @@ export interface SgCarouselProps {
|
|
|
33
33
|
gap?: number;
|
|
34
34
|
/** Callback when active index changes */
|
|
35
35
|
onIndexChange?: (index: number) => void;
|
|
36
|
+
/** Custom inline style for container */
|
|
37
|
+
style?: React.CSSProperties;
|
|
36
38
|
/** Custom render for navigation buttons */
|
|
37
39
|
customNavigators?: {
|
|
38
40
|
prev?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SgCarousel.d.ts","sourceRoot":"","sources":["../../src/layout/SgCarousel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACzB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,WAAW,CAAC,EAAE,qBAAqB,CAAC;IACpC,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8BAA8B;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6BAA6B;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,GAAG,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