sellmate-design-system-react 9.0.0-beta.27 → 9.0.0-beta.28
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/SLinearProgress/README.md +7 -0
- package/dist/components/SLinearProgress/SLinearProgress.d.ts +3 -0
- package/dist/components/SLinearProgress/index.d.ts +1 -1
- package/dist/components/SRadioButton/README.md +1 -1
- package/dist/components/SRadioButton/SRadioButton.d.ts +1 -1
- package/dist/components/STag/README.md +1 -0
- package/dist/components/STag/STag.d.ts +3 -1
- package/dist/index.cjs +153 -75
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +153 -75
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +10 -1
- package/dist/llms.txt +1 -0
- package/dist/styles.css +50 -88
- package/dist/theme.css +45 -9
- package/eslint/scale.gen.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3742,7 +3742,7 @@ var SDraggableItemView = /* @__PURE__ */ forwardRef(
|
|
|
3742
3742
|
"rounded-(--cmp-listDraggableItem-radius-bordered) border border-(--cmp-listDraggableItem-border-default)",
|
|
3743
3743
|
!disabled && !selected && !dragging && "hover:border-(--cmp-listDraggableItem-bordered-border-hover)",
|
|
3744
3744
|
!disabled && selected && !dragging && "border-(--cmp-listDraggableItem-bordered-border-selected) bg-(--cmp-listDraggableItem-bordered-bg-selected)",
|
|
3745
|
-
!disabled && selected && dragging && "border-
|
|
3745
|
+
!disabled && selected && dragging && "border-(--cmp-listDraggableItem-bordered-dragging-border-color) bg-(--cmp-listDraggableItem-bordered-dragging-bg)"
|
|
3746
3746
|
),
|
|
3747
3747
|
disabled && "cursor-not-allowed",
|
|
3748
3748
|
className
|
|
@@ -4122,10 +4122,12 @@ function SDraggableProviderInternal({
|
|
|
4122
4122
|
if (movedItem !== void 0) {
|
|
4123
4123
|
if (source === target) {
|
|
4124
4124
|
const toIndex = dropRef.current.index > dragging.index ? dropRef.current.index - 1 : dropRef.current.index;
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4125
|
+
if (toIndex !== dragging.index) {
|
|
4126
|
+
const nextItems = [...source.items];
|
|
4127
|
+
nextItems.splice(dragging.index, 1);
|
|
4128
|
+
nextItems.splice(toIndex, 0, movedItem);
|
|
4129
|
+
source.onChange?.(nextItems);
|
|
4130
|
+
}
|
|
4129
4131
|
} else {
|
|
4130
4132
|
const nextSourceItems = source.items.filter((_, index) => index !== dragging.index);
|
|
4131
4133
|
const nextTargetItems = [...target.items];
|
|
@@ -4186,6 +4188,13 @@ function reorder(items, fromIndex, toIndex) {
|
|
|
4186
4188
|
function clampDepth(depth, maxDepth) {
|
|
4187
4189
|
return Math.max(1, Math.min(maxDepth, Math.floor(depth)));
|
|
4188
4190
|
}
|
|
4191
|
+
function getDepthOffset(depth) {
|
|
4192
|
+
return (Math.max(1, Math.floor(depth)) - 1) * 20;
|
|
4193
|
+
}
|
|
4194
|
+
function getIndicatorOffset(depth) {
|
|
4195
|
+
const depthOffset = getDepthOffset(depth);
|
|
4196
|
+
return depthOffset === 0 ? 0 : `calc(var(--cmp-listDraggableItem-paddingX) + ${depthOffset}px)`;
|
|
4197
|
+
}
|
|
4189
4198
|
function getSubtreeEnd(items, startIndex, getDepth) {
|
|
4190
4199
|
const startDepth = getDepth(items[startIndex], startIndex);
|
|
4191
4200
|
let endIndex = startIndex + 1;
|
|
@@ -4253,6 +4262,7 @@ function SDraggableListInner({
|
|
|
4253
4262
|
const fromIndexRef = useRef(null);
|
|
4254
4263
|
const currentSelectedKey = selectedKey ?? internalSelectedKey;
|
|
4255
4264
|
const usesDepth = getDepth != null;
|
|
4265
|
+
const depthEnabled = usesDepth && !useGap;
|
|
4256
4266
|
const groupDragging = dragContext?.dragging;
|
|
4257
4267
|
const draggedSubtreeStart = dragContext ? groupDragging?.listId === listId ? groupDragging?.index ?? null : null : draggingIndex;
|
|
4258
4268
|
const startDrag = useCallback((event, index) => {
|
|
@@ -4273,19 +4283,14 @@ function SDraggableListInner({
|
|
|
4273
4283
|
);
|
|
4274
4284
|
if (!itemElements) return;
|
|
4275
4285
|
let nextDropTarget = items.length === 0 ? { index: 0, intent: "before" } : { index: items.length - 1, intent: "after" };
|
|
4276
|
-
const draggingEndIndex =
|
|
4277
|
-
let previousDropIndex = null;
|
|
4286
|
+
const draggingEndIndex = depthEnabled && draggingIndex != null ? getSubtreeEnd(items, draggingIndex, readDepth) : draggingIndex + 1;
|
|
4278
4287
|
for (let index = 0; index < itemElements.length; index += 1) {
|
|
4279
4288
|
const itemElement = itemElements[index];
|
|
4280
4289
|
const rect = itemElement.getBoundingClientRect();
|
|
4281
4290
|
if (index >= draggingIndex && index < draggingEndIndex) {
|
|
4282
|
-
if (event.clientY <= rect.bottom) {
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
} else {
|
|
4286
|
-
nextDropTarget = { index: draggingIndex, intent: "before" };
|
|
4287
|
-
}
|
|
4288
|
-
break;
|
|
4291
|
+
if (event.clientY >= rect.top && event.clientY <= rect.bottom) {
|
|
4292
|
+
setDropTarget(null);
|
|
4293
|
+
return;
|
|
4289
4294
|
}
|
|
4290
4295
|
continue;
|
|
4291
4296
|
}
|
|
@@ -4294,12 +4299,11 @@ function SDraggableListInner({
|
|
|
4294
4299
|
break;
|
|
4295
4300
|
}
|
|
4296
4301
|
if (event.clientY > rect.bottom) {
|
|
4297
|
-
previousDropIndex = index;
|
|
4298
4302
|
nextDropTarget = { index, intent: "after" };
|
|
4299
4303
|
continue;
|
|
4300
4304
|
}
|
|
4301
4305
|
const ratio = (event.clientY - rect.top) / rect.height;
|
|
4302
|
-
if (!
|
|
4306
|
+
if (!depthEnabled) {
|
|
4303
4307
|
nextDropTarget = ratio < 0.5 ? { index, intent: "before" } : { index, intent: "after" };
|
|
4304
4308
|
break;
|
|
4305
4309
|
}
|
|
@@ -4316,27 +4320,35 @@ function SDraggableListInner({
|
|
|
4316
4320
|
}
|
|
4317
4321
|
setDropTarget(nextDropTarget);
|
|
4318
4322
|
};
|
|
4323
|
+
const cancelDrag = () => {
|
|
4324
|
+
fromIndexRef.current = null;
|
|
4325
|
+
setDraggingIndex(null);
|
|
4326
|
+
setDropTarget(null);
|
|
4327
|
+
};
|
|
4319
4328
|
const handleMouseUp = () => {
|
|
4320
4329
|
const fromIndex = fromIndexRef.current;
|
|
4321
4330
|
const nextDropTarget = dropTarget;
|
|
4322
4331
|
if (fromIndex != null && nextDropTarget != null && items[nextDropTarget.index]) {
|
|
4323
4332
|
const insertionIndex = getInsertionIndex(items, nextDropTarget, () => 1);
|
|
4324
|
-
const nextItems =
|
|
4333
|
+
const nextItems = depthEnabled ? moveWithDepth(items, fromIndex, nextDropTarget, readDepth, setDepth, maxDepth) : reorder(
|
|
4325
4334
|
items,
|
|
4326
4335
|
fromIndex,
|
|
4327
4336
|
insertionIndex > fromIndex ? insertionIndex - 1 : insertionIndex
|
|
4328
4337
|
);
|
|
4329
4338
|
if (nextItems !== items) onChange?.(nextItems);
|
|
4330
4339
|
}
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4340
|
+
cancelDrag();
|
|
4341
|
+
};
|
|
4342
|
+
const handleKeyDown = (event) => {
|
|
4343
|
+
if (event.key === "Escape") cancelDrag();
|
|
4334
4344
|
};
|
|
4335
4345
|
window.addEventListener("mousemove", handleMouseMove);
|
|
4336
4346
|
window.addEventListener("mouseup", handleMouseUp);
|
|
4347
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
4337
4348
|
return () => {
|
|
4338
4349
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
4339
4350
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
4351
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
4340
4352
|
};
|
|
4341
4353
|
}, [
|
|
4342
4354
|
draggingIndex,
|
|
@@ -4345,7 +4357,7 @@ function SDraggableListInner({
|
|
|
4345
4357
|
onChange,
|
|
4346
4358
|
dragContext,
|
|
4347
4359
|
getDepth,
|
|
4348
|
-
|
|
4360
|
+
depthEnabled,
|
|
4349
4361
|
readDepth,
|
|
4350
4362
|
setDepth,
|
|
4351
4363
|
maxDepth,
|
|
@@ -4359,8 +4371,18 @@ function SDraggableListInner({
|
|
|
4359
4371
|
const currentDropIntent = dragContext ? void 0 : dropTarget?.intent;
|
|
4360
4372
|
const isDropTarget = dragContext ? groupDrop?.group === dragGroup && groupDrop?.listId === listId : draggingIndex != null;
|
|
4361
4373
|
const showEmptyDrop = Boolean(dragContext && isDropTarget && items.length === 0);
|
|
4362
|
-
const
|
|
4363
|
-
|
|
4374
|
+
const beforeIndicatorStyle = (depth) => ({
|
|
4375
|
+
borderTop: "2px solid var(--sys-color-fg-accentLight)",
|
|
4376
|
+
left: getIndicatorOffset(depth),
|
|
4377
|
+
right: 0,
|
|
4378
|
+
top: useGap ? -5 : 0
|
|
4379
|
+
});
|
|
4380
|
+
const afterIndicatorStyle = (depth) => ({
|
|
4381
|
+
borderTop: "2px solid var(--sys-color-fg-accentLight)",
|
|
4382
|
+
bottom: useGap ? -5 : -1,
|
|
4383
|
+
left: getIndicatorOffset(depth),
|
|
4384
|
+
right: 0
|
|
4385
|
+
});
|
|
4364
4386
|
const setListRef = (node) => {
|
|
4365
4387
|
listRef.current = node;
|
|
4366
4388
|
if (dragContext && dragGroup && listId) {
|
|
@@ -4381,15 +4403,15 @@ function SDraggableListInner({
|
|
|
4381
4403
|
ref: setListRef,
|
|
4382
4404
|
...rest,
|
|
4383
4405
|
useGap,
|
|
4384
|
-
className: `${className ?? ""} ${dragContext ? "min-h-[40px]" : ""} ${showEmptyDrop ? "relative before:absolute before:left-0 before:right-0 before:top-0 before:z-10 before:h-[2px] before:bg-(--sys-color-
|
|
4406
|
+
className: `${className ?? ""} ${dragContext ? "min-h-[40px]" : ""} ${showEmptyDrop ? "relative before:absolute before:left-0 before:right-0 before:top-0 before:z-10 before:h-[2px] before:bg-(--sys-color-fg-accentLight) before:content-['']" : ""}`,
|
|
4385
4407
|
"data-draggable-group": dragContext ? dragGroup : void 0,
|
|
4386
4408
|
"data-draggable-list-id": dragContext ? listId : void 0,
|
|
4387
4409
|
children: items.map((item2, index) => {
|
|
4388
4410
|
const itemKey = getKey(item2, index);
|
|
4389
|
-
const disabled = (getDisabled?.(item2, index) ?? false) || isDescendant(items, index, draggedSubtreeStart,
|
|
4390
|
-
const depth = readDepth(item2, index);
|
|
4411
|
+
const disabled = (getDisabled?.(item2, index) ?? false) || isDescendant(items, index, draggedSubtreeStart, depthEnabled ? readDepth : void 0);
|
|
4412
|
+
const depth = depthEnabled ? readDepth(item2, index) : 1;
|
|
4391
4413
|
const showBefore = isDropTarget && currentDropIndex === index && (dragContext || currentDropIntent === "before");
|
|
4392
|
-
const showInside = isDropTarget && currentDropIndex === index && !dragContext &&
|
|
4414
|
+
const showInside = isDropTarget && currentDropIndex === index && !dragContext && depthEnabled && currentDropIntent === "inside";
|
|
4393
4415
|
const showAfter = isDropTarget && (dragContext ? currentDropIndex === items.length && index === items.length - 1 : currentDropIndex === index && currentDropIntent === "after");
|
|
4394
4416
|
const selectItem = () => {
|
|
4395
4417
|
if (disabled) return;
|
|
@@ -4401,7 +4423,7 @@ function SDraggableListInner({
|
|
|
4401
4423
|
event.preventDefault();
|
|
4402
4424
|
selectItem();
|
|
4403
4425
|
};
|
|
4404
|
-
return /* @__PURE__ */
|
|
4426
|
+
return /* @__PURE__ */ jsxs(
|
|
4405
4427
|
"div",
|
|
4406
4428
|
{
|
|
4407
4429
|
"data-draggable-list-item": true,
|
|
@@ -4410,18 +4432,49 @@ function SDraggableListInner({
|
|
|
4410
4432
|
"aria-disabled": disabled || void 0,
|
|
4411
4433
|
onClick: selectItem,
|
|
4412
4434
|
onKeyDown: handleItemKeyDown,
|
|
4413
|
-
className:
|
|
4414
|
-
children:
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4435
|
+
className: "relative",
|
|
4436
|
+
children: [
|
|
4437
|
+
showBefore && /* @__PURE__ */ jsx(
|
|
4438
|
+
"span",
|
|
4439
|
+
{
|
|
4440
|
+
"aria-hidden": "true",
|
|
4441
|
+
"data-draggable-drop-indicator": "before",
|
|
4442
|
+
className: "pointer-events-none absolute z-10",
|
|
4443
|
+
style: beforeIndicatorStyle(depth)
|
|
4444
|
+
}
|
|
4445
|
+
),
|
|
4446
|
+
showAfter && /* @__PURE__ */ jsx(
|
|
4447
|
+
"span",
|
|
4448
|
+
{
|
|
4449
|
+
"aria-hidden": "true",
|
|
4450
|
+
"data-draggable-drop-indicator": "after",
|
|
4451
|
+
className: "pointer-events-none absolute z-10",
|
|
4452
|
+
style: afterIndicatorStyle(depth)
|
|
4453
|
+
}
|
|
4454
|
+
),
|
|
4455
|
+
showInside && /* @__PURE__ */ jsx(
|
|
4456
|
+
"span",
|
|
4457
|
+
{
|
|
4458
|
+
"aria-hidden": "true",
|
|
4459
|
+
"data-draggable-drop-indicator": "inside",
|
|
4460
|
+
className: "pointer-events-none absolute inset-0 z-10",
|
|
4461
|
+
style: {
|
|
4462
|
+
border: "2px solid var(--sys-color-fg-accentLight)"
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
),
|
|
4466
|
+
renderItem(item2, index, {
|
|
4467
|
+
onDragHandleMouseDown: (event) => {
|
|
4468
|
+
if (disabled) return;
|
|
4469
|
+
if (dragContext && dragGroup && listId) {
|
|
4470
|
+
dragContext.startDrag(event, dragGroup, listId, index, itemKey);
|
|
4471
|
+
} else startDrag(event, index);
|
|
4472
|
+
},
|
|
4473
|
+
selected: currentSelectedKey === itemKey,
|
|
4474
|
+
disabled,
|
|
4475
|
+
depth
|
|
4476
|
+
})
|
|
4477
|
+
]
|
|
4425
4478
|
},
|
|
4426
4479
|
itemKey
|
|
4427
4480
|
);
|
|
@@ -4894,6 +4947,7 @@ var STag = /* @__PURE__ */ forwardRef(function STag2({
|
|
|
4894
4947
|
shape = "square",
|
|
4895
4948
|
size = "sm",
|
|
4896
4949
|
color = "grey",
|
|
4950
|
+
deep = false,
|
|
4897
4951
|
label = "",
|
|
4898
4952
|
icon,
|
|
4899
4953
|
iconLeft = true,
|
|
@@ -4903,7 +4957,8 @@ var STag = /* @__PURE__ */ forwardRef(function STag2({
|
|
|
4903
4957
|
...rest
|
|
4904
4958
|
}, ref) {
|
|
4905
4959
|
const s = TAG_SIZE_CONFIG[size];
|
|
4906
|
-
const contentColor = `var(--cmp-tag-${color}-content)`;
|
|
4960
|
+
const contentColor = deep ? `var(--cmp-tag-${color}-deep-content, var(--cmp-tag-deep-content))` : `var(--cmp-tag-${color}-content)`;
|
|
4961
|
+
const bgColor = deep ? `var(--cmp-tag-${color}-deep-bg)` : `var(--cmp-tag-${color}-bg)`;
|
|
4907
4962
|
const iconNode = icon ? /* @__PURE__ */ jsx(SIcon, { name: icon, size: s.iconSize, color: contentColor }) : null;
|
|
4908
4963
|
const resolvedWidth = typeof width === "number" ? `${width}px` : width;
|
|
4909
4964
|
return /* @__PURE__ */ jsxs(
|
|
@@ -4923,7 +4978,7 @@ var STag = /* @__PURE__ */ forwardRef(function STag2({
|
|
|
4923
4978
|
fontSize: s.fontSize,
|
|
4924
4979
|
fontWeight: s.fontWeight,
|
|
4925
4980
|
lineHeight: `${s.lineHeight}px`,
|
|
4926
|
-
background:
|
|
4981
|
+
background: bgColor,
|
|
4927
4982
|
color: contentColor,
|
|
4928
4983
|
...resolvedWidth != null ? { width: resolvedWidth } : {},
|
|
4929
4984
|
...style
|
|
@@ -6174,11 +6229,12 @@ var FILL_COLOR = {
|
|
|
6174
6229
|
};
|
|
6175
6230
|
var clamp2 = (v) => Number.isFinite(v) ? Math.max(0, Math.min(100, v)) : 0;
|
|
6176
6231
|
var SLinearProgress = /* @__PURE__ */ forwardRef(
|
|
6177
|
-
function SLinearProgress2({ value = 0, type = "primary", indeterminate = false, label, className, style }, ref) {
|
|
6232
|
+
function SLinearProgress2({ value = 0, type = "primary", size = "sm", indeterminate = false, label, className, style }, ref) {
|
|
6178
6233
|
const v = clamp2(value);
|
|
6179
6234
|
const fill = FILL_COLOR[type];
|
|
6180
6235
|
const valueColor = v === 0 ? "var(--sys-color-fg-tertiary, #888888)" : fill;
|
|
6181
6236
|
const valueText = `${Math.round(v)}%`;
|
|
6237
|
+
const showValue = !indeterminate && size !== "xs";
|
|
6182
6238
|
return /* @__PURE__ */ jsxs(
|
|
6183
6239
|
"div",
|
|
6184
6240
|
{
|
|
@@ -6186,36 +6242,43 @@ var SLinearProgress = /* @__PURE__ */ forwardRef(
|
|
|
6186
6242
|
className: cn("flex w-full flex-col gap-[12px]", className),
|
|
6187
6243
|
style,
|
|
6188
6244
|
children: [
|
|
6189
|
-
/* @__PURE__ */ jsxs(
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6245
|
+
/* @__PURE__ */ jsxs(
|
|
6246
|
+
"div",
|
|
6247
|
+
{
|
|
6248
|
+
className: "relative w-full overflow-hidden rounded-full bg-[var(--cmp-progress-color-track)]",
|
|
6249
|
+
style: { height: `var(--cmp-progress-linear-height-${size})` },
|
|
6250
|
+
children: [
|
|
6251
|
+
/* @__PURE__ */ jsx(
|
|
6252
|
+
"div",
|
|
6253
|
+
{
|
|
6254
|
+
className: cn(
|
|
6255
|
+
"absolute inset-y-0 left-0 h-full rounded-[inherit]",
|
|
6256
|
+
indeterminate ? "w-full origin-left animate-linear-indeterminate" : "transition-[width] duration-[400ms] ease-linear"
|
|
6257
|
+
),
|
|
6258
|
+
style: { background: fill, width: indeterminate ? void 0 : `${v}%` }
|
|
6259
|
+
}
|
|
6196
6260
|
),
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
] }),
|
|
6261
|
+
showValue && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6262
|
+
/* @__PURE__ */ jsx(
|
|
6263
|
+
"span",
|
|
6264
|
+
{
|
|
6265
|
+
className: "pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2 select-none text-center text-[12px] font-bold leading-[20px]",
|
|
6266
|
+
style: { color: valueColor },
|
|
6267
|
+
children: valueText
|
|
6268
|
+
}
|
|
6269
|
+
),
|
|
6270
|
+
/* @__PURE__ */ jsx(
|
|
6271
|
+
"span",
|
|
6272
|
+
{
|
|
6273
|
+
className: "pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2 select-none text-center text-[12px] font-bold leading-[20px] text-[color:var(--cmp-progress-bar-text)]",
|
|
6274
|
+
style: { clipPath: `inset(0 ${100 - v}% 0 0)` },
|
|
6275
|
+
children: valueText
|
|
6276
|
+
}
|
|
6277
|
+
)
|
|
6278
|
+
] })
|
|
6279
|
+
]
|
|
6280
|
+
}
|
|
6281
|
+
),
|
|
6219
6282
|
label && /* @__PURE__ */ jsx("span", { className: "text-center text-[12px] font-normal leading-[20px] text-[color:var(--cmp-progress-color-label)]", children: label })
|
|
6220
6283
|
]
|
|
6221
6284
|
}
|
|
@@ -15307,6 +15370,11 @@ var SForm = /* @__PURE__ */ forwardRef(function SForm2({ formClass, onSubmit, on
|
|
|
15307
15370
|
}
|
|
15308
15371
|
) });
|
|
15309
15372
|
});
|
|
15373
|
+
var SIZE_CONFIG2 = {
|
|
15374
|
+
xs: { fontSize: 12, lineHeight: 20, radius: "var(--cmp-radioButton-radius-sm)" },
|
|
15375
|
+
sm: { fontSize: 12, lineHeight: 20, radius: "var(--cmp-radioButton-radius-sm)" },
|
|
15376
|
+
md: { fontSize: 16, lineHeight: 26, radius: "var(--cmp-radioButton-radius-md)" }
|
|
15377
|
+
};
|
|
15310
15378
|
function SRadioButton({
|
|
15311
15379
|
options = [],
|
|
15312
15380
|
value,
|
|
@@ -15317,6 +15385,7 @@ function SRadioButton({
|
|
|
15317
15385
|
className,
|
|
15318
15386
|
style
|
|
15319
15387
|
}) {
|
|
15388
|
+
const s = SIZE_CONFIG2[size];
|
|
15320
15389
|
return /* @__PURE__ */ jsx(
|
|
15321
15390
|
"div",
|
|
15322
15391
|
{
|
|
@@ -15327,6 +15396,8 @@ function SRadioButton({
|
|
|
15327
15396
|
children: options.map((o, i) => {
|
|
15328
15397
|
const selected = o.value === value;
|
|
15329
15398
|
const od = disabled || o.disabled;
|
|
15399
|
+
const first = i === 0;
|
|
15400
|
+
const last = i === options.length - 1;
|
|
15330
15401
|
return /* @__PURE__ */ jsx(
|
|
15331
15402
|
"button",
|
|
15332
15403
|
{
|
|
@@ -15337,9 +15408,8 @@ function SRadioButton({
|
|
|
15337
15408
|
disabled: od,
|
|
15338
15409
|
onClick: () => !od && !selected && onValueChange?.(o.value),
|
|
15339
15410
|
className: cn(
|
|
15340
|
-
"relative box-border grow inline-flex items-center justify-center whitespace-nowrap border border-solid
|
|
15341
|
-
|
|
15342
|
-
i === options.length - 1 ? "rounded-r-[var(--cmp-radioButton-radius)]" : "",
|
|
15411
|
+
"relative box-border grow inline-flex items-center justify-center whitespace-nowrap border border-solid font-medium transition-colors",
|
|
15412
|
+
first ? "" : "-ml-px",
|
|
15343
15413
|
selected ? "z-10" : "",
|
|
15344
15414
|
!od && !selected && "hover:!bg-[var(--cmp-radioButton-bg-hover)] hover:!text-[color:var(--cmp-radioButton-content-hover)] hover:!border-[color:var(--cmp-radioButton-bg-hover)] hover:z-10",
|
|
15345
15415
|
od ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -15347,6 +15417,14 @@ function SRadioButton({
|
|
|
15347
15417
|
style: {
|
|
15348
15418
|
height: `var(--cmp-radioButton-${size}-height)`,
|
|
15349
15419
|
padding: `0 var(--cmp-radioButton-${size}-paddingX)`,
|
|
15420
|
+
fontSize: `${s.fontSize}px`,
|
|
15421
|
+
lineHeight: `${s.lineHeight}px`,
|
|
15422
|
+
borderRadius: [
|
|
15423
|
+
first ? s.radius : "0",
|
|
15424
|
+
last ? s.radius : "0",
|
|
15425
|
+
last ? s.radius : "0",
|
|
15426
|
+
first ? s.radius : "0"
|
|
15427
|
+
].join(" "),
|
|
15350
15428
|
background: od ? "var(--cmp-radioButton-bg-disabled)" : "var(--cmp-radioButton-bg-default)",
|
|
15351
15429
|
borderColor: od ? "var(--cmp-radioButton-border-disabled)" : selected ? "var(--cmp-radioButton-border-select)" : "var(--cmp-radioButton-border-default)",
|
|
15352
15430
|
color: od ? "var(--cmp-radioButton-content-disabled)" : selected ? "var(--cmp-radioButton-content-select)" : "var(--cmp-radioButton-content-default)"
|