sellmate-design-system-react 9.0.0-beta.26 → 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/SChipFilter/README.md +10 -5
- package/dist/components/SChipFilter/SChipFilter.d.ts +8 -3
- package/dist/components/SGhostButton/README.md +0 -2
- 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/SSearchInput/README.md +2 -0
- package/dist/components/SSelect/README.md +1 -1
- package/dist/components/SSelect/SSelect.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 +294 -160
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +294 -160
- package/dist/index.js.map +1 -1
- package/dist/lib/floating-height.d.ts +15 -0
- package/dist/llms-full.txt +21 -7
- package/dist/llms.txt +1 -0
- package/dist/styles.css +50 -94
- 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
|
}
|
|
@@ -10416,6 +10479,14 @@ var SStepper = /* @__PURE__ */ forwardRef(function SStepper2({
|
|
|
10416
10479
|
}
|
|
10417
10480
|
);
|
|
10418
10481
|
});
|
|
10482
|
+
|
|
10483
|
+
// src/lib/floating-height.ts
|
|
10484
|
+
var POPOVER_AVAILABLE_HEIGHT = "var(--radix-popover-content-available-height)";
|
|
10485
|
+
function clampToAvailableHeight(value, availableHeight) {
|
|
10486
|
+
if (value == null || value === "") return availableHeight;
|
|
10487
|
+
const css = typeof value === "number" ? `${value}px` : value;
|
|
10488
|
+
return `min(${css}, ${availableHeight})`;
|
|
10489
|
+
}
|
|
10419
10490
|
function runRules(value, rules) {
|
|
10420
10491
|
if (!rules || rules.length === 0) return "";
|
|
10421
10492
|
for (const rule of rules) {
|
|
@@ -10813,7 +10884,7 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
10813
10884
|
error = false,
|
|
10814
10885
|
rules,
|
|
10815
10886
|
labelTooltipProps,
|
|
10816
|
-
dropdownHeight = "
|
|
10887
|
+
dropdownHeight = "640px",
|
|
10817
10888
|
dropdownWidth,
|
|
10818
10889
|
maxDropdownWidth = "640px",
|
|
10819
10890
|
label,
|
|
@@ -11174,6 +11245,7 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
11174
11245
|
placement: "bottom",
|
|
11175
11246
|
align: "start",
|
|
11176
11247
|
offset: 4,
|
|
11248
|
+
viewportPadding: 24,
|
|
11177
11249
|
fit: !dropdownWidth,
|
|
11178
11250
|
onOpenAutoFocus: (event) => {
|
|
11179
11251
|
if (!showSearch) {
|
|
@@ -11206,7 +11278,7 @@ var SSelectImpl = /* @__PURE__ */ forwardRef(function SSelect({
|
|
|
11206
11278
|
SCROLLBAR_TRACK_BG_CLASS,
|
|
11207
11279
|
SCROLLBAR_TRACK_BORDER_CLASS
|
|
11208
11280
|
),
|
|
11209
|
-
style: { maxHeight: dropdownHeight },
|
|
11281
|
+
style: { maxHeight: clampToAvailableHeight(dropdownHeight, POPOVER_AVAILABLE_HEIGHT) },
|
|
11210
11282
|
onMouseLeave: () => setFocusedIndex(-1),
|
|
11211
11283
|
children: [
|
|
11212
11284
|
showSearch && /* @__PURE__ */ jsx(
|
|
@@ -15298,6 +15370,11 @@ var SForm = /* @__PURE__ */ forwardRef(function SForm2({ formClass, onSubmit, on
|
|
|
15298
15370
|
}
|
|
15299
15371
|
) });
|
|
15300
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
|
+
};
|
|
15301
15378
|
function SRadioButton({
|
|
15302
15379
|
options = [],
|
|
15303
15380
|
value,
|
|
@@ -15308,6 +15385,7 @@ function SRadioButton({
|
|
|
15308
15385
|
className,
|
|
15309
15386
|
style
|
|
15310
15387
|
}) {
|
|
15388
|
+
const s = SIZE_CONFIG2[size];
|
|
15311
15389
|
return /* @__PURE__ */ jsx(
|
|
15312
15390
|
"div",
|
|
15313
15391
|
{
|
|
@@ -15318,6 +15396,8 @@ function SRadioButton({
|
|
|
15318
15396
|
children: options.map((o, i) => {
|
|
15319
15397
|
const selected = o.value === value;
|
|
15320
15398
|
const od = disabled || o.disabled;
|
|
15399
|
+
const first = i === 0;
|
|
15400
|
+
const last = i === options.length - 1;
|
|
15321
15401
|
return /* @__PURE__ */ jsx(
|
|
15322
15402
|
"button",
|
|
15323
15403
|
{
|
|
@@ -15328,9 +15408,8 @@ function SRadioButton({
|
|
|
15328
15408
|
disabled: od,
|
|
15329
15409
|
onClick: () => !od && !selected && onValueChange?.(o.value),
|
|
15330
15410
|
className: cn(
|
|
15331
|
-
"relative box-border grow inline-flex items-center justify-center whitespace-nowrap border border-solid
|
|
15332
|
-
|
|
15333
|
-
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",
|
|
15334
15413
|
selected ? "z-10" : "",
|
|
15335
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",
|
|
15336
15415
|
od ? "cursor-not-allowed" : "cursor-pointer"
|
|
@@ -15338,6 +15417,14 @@ function SRadioButton({
|
|
|
15338
15417
|
style: {
|
|
15339
15418
|
height: `var(--cmp-radioButton-${size}-height)`,
|
|
15340
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(" "),
|
|
15341
15428
|
background: od ? "var(--cmp-radioButton-bg-disabled)" : "var(--cmp-radioButton-bg-default)",
|
|
15342
15429
|
borderColor: od ? "var(--cmp-radioButton-border-disabled)" : selected ? "var(--cmp-radioButton-border-select)" : "var(--cmp-radioButton-border-default)",
|
|
15343
15430
|
color: od ? "var(--cmp-radioButton-content-disabled)" : selected ? "var(--cmp-radioButton-content-select)" : "var(--cmp-radioButton-content-default)"
|
|
@@ -17359,6 +17446,8 @@ var SEditor = /* @__PURE__ */ forwardRef(function SEditor2({
|
|
|
17359
17446
|
});
|
|
17360
17447
|
var CHIPFILTER_LISTBOX_WIDTH = 240;
|
|
17361
17448
|
var CHIPFILTER_DATE_PRESET_LISTBOX_WIDTH = 246;
|
|
17449
|
+
var EDITOR_LISTBOX_MAX_HEIGHT = "min(640px, var(--radix-popover-content-available-height))";
|
|
17450
|
+
var EDITOR_POPOVER_VIEWPORT_PADDING = 24;
|
|
17362
17451
|
var CHIPFILTER = {
|
|
17363
17452
|
barBg: "var(--cmp-chipFilter-bar-bg)",
|
|
17364
17453
|
barBorder: "var(--cmp-chipFilter-bar-border)",
|
|
@@ -17398,6 +17487,7 @@ var CHIPFILTER = {
|
|
|
17398
17487
|
itemTextDefault: "var(--cmp-chipFilter-item-text-default)",
|
|
17399
17488
|
itemTextSelected: "var(--cmp-chipFilter-item-text-selected)"
|
|
17400
17489
|
};
|
|
17490
|
+
var DEFAULT_CUSTOM_MAX_RANGE = 90;
|
|
17401
17491
|
var DEFAULT_PERIOD_PRESETS = [
|
|
17402
17492
|
{ value: "day", label: "\uC77C\uBCC4" },
|
|
17403
17493
|
{ value: "month", label: "\uC6D4\uBCC4" },
|
|
@@ -17406,6 +17496,20 @@ var DEFAULT_PERIOD_PRESETS = [
|
|
|
17406
17496
|
{ value: "year", label: "\uC5F0\uB3C4\uBCC4" },
|
|
17407
17497
|
{ value: "custom", label: "\uC0AC\uC6A9\uC790 \uC9C0\uC815", custom: true }
|
|
17408
17498
|
];
|
|
17499
|
+
var DEFAULT_DATE_RANGE_PRESETS = [
|
|
17500
|
+
{ value: "today", label: "\uC624\uB298", resolve: () => todayIso() },
|
|
17501
|
+
{
|
|
17502
|
+
value: "last7",
|
|
17503
|
+
label: "\uC9C0\uB09C 7\uC77C",
|
|
17504
|
+
resolve: () => [addDaysIso(todayIso(), -7), todayIso()]
|
|
17505
|
+
},
|
|
17506
|
+
{
|
|
17507
|
+
value: "last30",
|
|
17508
|
+
label: "\uC9C0\uB09C 30\uC77C",
|
|
17509
|
+
resolve: () => [addDaysIso(todayIso(), -30), todayIso()]
|
|
17510
|
+
},
|
|
17511
|
+
{ value: "custom", label: "\uC0AC\uC6A9\uC790 \uC9C0\uC815", custom: true }
|
|
17512
|
+
];
|
|
17409
17513
|
var isKeywordValue = (value) => typeof value === "object" && value != null && !Array.isArray(value) && "keywords" in value;
|
|
17410
17514
|
var isPeriodValue = (value) => typeof value === "object" && value != null && !Array.isArray(value) && "unit" in value;
|
|
17411
17515
|
var keywordEntries = (value) => {
|
|
@@ -17430,23 +17534,39 @@ var todayIso = () => {
|
|
|
17430
17534
|
const pad = (n) => String(n).padStart(2, "0");
|
|
17431
17535
|
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
17432
17536
|
};
|
|
17537
|
+
var addDaysIso = (iso, n) => {
|
|
17538
|
+
const d = /* @__PURE__ */ new Date(`${iso}T00:00:00`);
|
|
17539
|
+
d.setDate(d.getDate() + n);
|
|
17540
|
+
const pad = (v) => String(v).padStart(2, "0");
|
|
17541
|
+
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
|
17542
|
+
};
|
|
17433
17543
|
var isInlineDateField = (field) => field.type === "datepicker-range" && field.radioButton === true && (field.presets?.length ?? 0) > 0;
|
|
17434
17544
|
var getFieldPresets = (field) => {
|
|
17435
17545
|
if (field.type === "datepicker-statistics") return field.presets ?? DEFAULT_PERIOD_PRESETS;
|
|
17436
|
-
return field.presets ??
|
|
17546
|
+
return field.presets ?? DEFAULT_DATE_RANGE_PRESETS;
|
|
17547
|
+
};
|
|
17548
|
+
var getEffectiveMaxRange = (field) => {
|
|
17549
|
+
if (field.maxRange !== void 0) return field.maxRange;
|
|
17550
|
+
const hasCustomPreset = getFieldPresets(field).some((preset) => preset.custom);
|
|
17551
|
+
return hasCustomPreset ? DEFAULT_CUSTOM_MAX_RANGE : void 0;
|
|
17437
17552
|
};
|
|
17438
|
-
var
|
|
17553
|
+
var getPresetLabel = (preset, maxRange) => {
|
|
17554
|
+
if (!preset.custom || !maxRange || preset.label.includes("\uCD5C\uB300")) return preset.label;
|
|
17555
|
+
return `${preset.label} (\uCD5C\uB300 ${maxRange}\uC77C\uC529)`;
|
|
17556
|
+
};
|
|
17557
|
+
var getDefaultPeriodInputValue = (unit, maxRange) => {
|
|
17439
17558
|
const today = todayIso();
|
|
17440
17559
|
if (unit === "day") return today;
|
|
17441
17560
|
if (unit === "month") return today.slice(0, 7);
|
|
17442
17561
|
if (unit === "quarter") return 1;
|
|
17443
17562
|
if (unit === "half") return "first";
|
|
17444
17563
|
if (unit === "year") return today.slice(0, 4);
|
|
17445
|
-
|
|
17564
|
+
const days = maxRange && maxRange > 0 ? maxRange : DEFAULT_CUSTOM_MAX_RANGE;
|
|
17565
|
+
return [addDaysIso(today, -days), today];
|
|
17446
17566
|
};
|
|
17447
|
-
var createPeriodValue = (unit) => ({
|
|
17567
|
+
var createPeriodValue = (unit, maxRange) => ({
|
|
17448
17568
|
unit,
|
|
17449
|
-
value: getDefaultPeriodInputValue(unit)
|
|
17569
|
+
value: getDefaultPeriodInputValue(unit, maxRange)
|
|
17450
17570
|
});
|
|
17451
17571
|
var resolveFieldDefault = (field) => {
|
|
17452
17572
|
if (field.defaultValue !== void 0 && isFixedField(field)) return field.defaultValue;
|
|
@@ -17995,6 +18115,7 @@ var SChipFilter = /* @__PURE__ */ forwardRef(function SChipFilter2({
|
|
|
17995
18115
|
side: "bottom",
|
|
17996
18116
|
align: "start",
|
|
17997
18117
|
sideOffset: 4,
|
|
18118
|
+
collisionPadding: EDITOR_POPOVER_VIEWPORT_PADDING,
|
|
17998
18119
|
onOpenAutoFocus: (event) => event.preventDefault(),
|
|
17999
18120
|
className: cn("z-50", FLOATING_SLIDE_ANIM),
|
|
18000
18121
|
style: editorPopoverStyle,
|
|
@@ -18160,6 +18281,7 @@ function EditorPanel({
|
|
|
18160
18281
|
onClose
|
|
18161
18282
|
}) {
|
|
18162
18283
|
const wrapsInPaddedTop = field.type === "datepicker-day" || field.type === "datepicker-range" || field.type === "datepicker-statistics";
|
|
18284
|
+
const isScrollableListField = field.type === "select" || field.type === "select-multi" || field.type === "keyword";
|
|
18163
18285
|
const isMulti = field.type === "select-multi";
|
|
18164
18286
|
const selectableValues = isMulti ? (field.options ?? []).filter((option) => !option.disabled).map((option) => option.value) : [];
|
|
18165
18287
|
const selectedValues = isMulti ? toArrayValue(value) : [];
|
|
@@ -18169,7 +18291,7 @@ function EditorPanel({
|
|
|
18169
18291
|
allSelected ? selectedValues.filter((v) => !selectableValues.includes(v)) : [...selectedValues, ...selectableValues.filter((v) => !selectedValues.includes(v))]
|
|
18170
18292
|
);
|
|
18171
18293
|
};
|
|
18172
|
-
return /* @__PURE__ */ jsxs(ListBox, { children: [
|
|
18294
|
+
return /* @__PURE__ */ jsxs(ListBox, { maxHeight: isScrollableListField ? EDITOR_LISTBOX_MAX_HEIGHT : void 0, children: [
|
|
18173
18295
|
wrapsInPaddedTop ? /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-[var(--cmp-chipFilter-listbox-top-gap)] px-[var(--cmp-chipFilter-listbox-top-paddingX)] py-[var(--cmp-chipFilter-listbox-top-paddingY)]", children: /* @__PURE__ */ jsx(
|
|
18174
18296
|
FilterEditor,
|
|
18175
18297
|
{
|
|
@@ -18192,7 +18314,7 @@ function EditorPanel({
|
|
|
18192
18314
|
/* @__PURE__ */ jsxs(
|
|
18193
18315
|
"div",
|
|
18194
18316
|
{
|
|
18195
|
-
className: "flex items-center justify-end gap-[var(--cmp-chipFilter-listbox-bottom-gap)] border-t border-solid px-[var(--cmp-chipFilter-listbox-bottom-paddingX)] py-[var(--cmp-chipFilter-listbox-bottom-paddingY)]",
|
|
18317
|
+
className: "flex shrink-0 items-center justify-end gap-[var(--cmp-chipFilter-listbox-bottom-gap)] border-t border-solid px-[var(--cmp-chipFilter-listbox-bottom-paddingX)] py-[var(--cmp-chipFilter-listbox-bottom-paddingY)]",
|
|
18196
18318
|
style: { borderColor: CHIPFILTER.listboxBorder },
|
|
18197
18319
|
children: [
|
|
18198
18320
|
isMulti && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -18307,6 +18429,7 @@ function DatePresetEditor({
|
|
|
18307
18429
|
onValueChange
|
|
18308
18430
|
}) {
|
|
18309
18431
|
const presets = getFieldPresets(field);
|
|
18432
|
+
const maxRange = getEffectiveMaxRange(field);
|
|
18310
18433
|
const [selectedId, setSelectedId] = useState(() => matchPresetId(presets, value));
|
|
18311
18434
|
const syncedInitialValueRef = useRef(!isEmptyValue(value));
|
|
18312
18435
|
useEffect(() => {
|
|
@@ -18317,7 +18440,13 @@ function DatePresetEditor({
|
|
|
18317
18440
|
const selectedPreset = presets.find((preset) => preset.value === selectedId);
|
|
18318
18441
|
const selectPreset = (preset) => {
|
|
18319
18442
|
setSelectedId(preset.value);
|
|
18320
|
-
if (!preset.custom)
|
|
18443
|
+
if (!preset.custom) {
|
|
18444
|
+
onValueChange(preset.resolve ? preset.resolve() : preset.value);
|
|
18445
|
+
return;
|
|
18446
|
+
}
|
|
18447
|
+
const today = todayIso();
|
|
18448
|
+
const days = maxRange && maxRange > 0 ? maxRange : DEFAULT_CUSTOM_MAX_RANGE;
|
|
18449
|
+
onValueChange([addDaysIso(today, -days), today]);
|
|
18321
18450
|
};
|
|
18322
18451
|
if (presets.length === 0) {
|
|
18323
18452
|
return /* @__PURE__ */ jsx(
|
|
@@ -18326,7 +18455,7 @@ function DatePresetEditor({
|
|
|
18326
18455
|
value: Array.isArray(value) && value.length === 2 ? value : null,
|
|
18327
18456
|
onValueChange,
|
|
18328
18457
|
selectable: field.selectable,
|
|
18329
|
-
maxRange
|
|
18458
|
+
maxRange,
|
|
18330
18459
|
disabled,
|
|
18331
18460
|
width: "100%"
|
|
18332
18461
|
}
|
|
@@ -18338,7 +18467,7 @@ function DatePresetEditor({
|
|
|
18338
18467
|
{
|
|
18339
18468
|
val: preset.value,
|
|
18340
18469
|
value: selectedId,
|
|
18341
|
-
label: preset
|
|
18470
|
+
label: getPresetLabel(preset, maxRange),
|
|
18342
18471
|
disabled,
|
|
18343
18472
|
onValueChange: () => selectPreset(preset)
|
|
18344
18473
|
},
|
|
@@ -18350,7 +18479,7 @@ function DatePresetEditor({
|
|
|
18350
18479
|
value: Array.isArray(value) && value.length === 2 ? value : null,
|
|
18351
18480
|
onValueChange,
|
|
18352
18481
|
selectable: field.selectable,
|
|
18353
|
-
maxRange
|
|
18482
|
+
maxRange,
|
|
18354
18483
|
disabled
|
|
18355
18484
|
}
|
|
18356
18485
|
)
|
|
@@ -18363,9 +18492,10 @@ function PeriodPresetEditor({
|
|
|
18363
18492
|
onValueChange
|
|
18364
18493
|
}) {
|
|
18365
18494
|
const presets = getFieldPresets(field);
|
|
18495
|
+
const maxRange = getEffectiveMaxRange(field);
|
|
18366
18496
|
const firstUnit = presets.find((preset) => !preset.custom)?.value ?? "day";
|
|
18367
18497
|
const [selectedId, setSelectedId] = useState(() => matchPresetId(presets, value) ?? firstUnit);
|
|
18368
|
-
const periodValue = isPeriodValue(value) ? value : createPeriodValue(selectedId ?? firstUnit);
|
|
18498
|
+
const periodValue = isPeriodValue(value) ? value : createPeriodValue(selectedId ?? firstUnit, maxRange);
|
|
18369
18499
|
const selectedUnit = selectedId ?? periodValue.unit;
|
|
18370
18500
|
useEffect(() => {
|
|
18371
18501
|
if (isEmptyValue(value)) return;
|
|
@@ -18374,7 +18504,7 @@ function PeriodPresetEditor({
|
|
|
18374
18504
|
const selectPreset = (preset) => {
|
|
18375
18505
|
const nextUnit = preset.value;
|
|
18376
18506
|
setSelectedId(nextUnit);
|
|
18377
|
-
onValueChange(createPeriodValue(nextUnit));
|
|
18507
|
+
onValueChange(createPeriodValue(nextUnit, maxRange));
|
|
18378
18508
|
};
|
|
18379
18509
|
const updateInputValue = (nextValue) => {
|
|
18380
18510
|
onValueChange({ unit: selectedUnit, value: nextValue });
|
|
@@ -18457,7 +18587,7 @@ function PeriodPresetEditor({
|
|
|
18457
18587
|
value: Array.isArray(periodValue.value) && periodValue.value.length === 2 ? periodValue.value : null,
|
|
18458
18588
|
onValueChange: updateInputValue,
|
|
18459
18589
|
selectable: field.selectable,
|
|
18460
|
-
maxRange
|
|
18590
|
+
maxRange,
|
|
18461
18591
|
disabled,
|
|
18462
18592
|
width: "100%"
|
|
18463
18593
|
}
|
|
@@ -18469,7 +18599,7 @@ function PeriodPresetEditor({
|
|
|
18469
18599
|
{
|
|
18470
18600
|
val: preset.value,
|
|
18471
18601
|
value: selectedId,
|
|
18472
|
-
label: preset
|
|
18602
|
+
label: getPresetLabel(preset, maxRange),
|
|
18473
18603
|
disabled,
|
|
18474
18604
|
onValueChange: () => selectPreset(preset)
|
|
18475
18605
|
},
|
|
@@ -18681,7 +18811,7 @@ function KeywordEditor({
|
|
|
18681
18811
|
}
|
|
18682
18812
|
};
|
|
18683
18813
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
18684
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-[var(--cmp-chipFilter-listbox-top-gap)] px-[var(--cmp-chipFilter-listbox-top-paddingX)] py-[var(--cmp-chipFilter-listbox-top-paddingY)]", children: [
|
|
18814
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col gap-[var(--cmp-chipFilter-listbox-top-gap)] px-[var(--cmp-chipFilter-listbox-top-paddingX)] py-[var(--cmp-chipFilter-listbox-top-paddingY)]", children: [
|
|
18685
18815
|
field.matchModes && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
18686
18816
|
/* @__PURE__ */ jsx(
|
|
18687
18817
|
"span",
|
|
@@ -18723,7 +18853,7 @@ function KeywordEditor({
|
|
|
18723
18853
|
entries3.length > 0 && /* @__PURE__ */ jsx(
|
|
18724
18854
|
"div",
|
|
18725
18855
|
{
|
|
18726
|
-
className: "
|
|
18856
|
+
className: "min-h-0 flex-1 overflow-auto border-t border-solid py-[var(--cmp-chipFilter-listbox-list-paddingY)]",
|
|
18727
18857
|
style: { borderColor: CHIPFILTER.listboxBorder },
|
|
18728
18858
|
children: entries3.map((entry) => /* @__PURE__ */ jsx(
|
|
18729
18859
|
KeywordEntryRow,
|
|
@@ -18781,6 +18911,7 @@ function OptionList({
|
|
|
18781
18911
|
const selected = multiple ? toArrayValue(value) : [];
|
|
18782
18912
|
const singleValue = !multiple && (typeof value === "string" || typeof value === "number") ? value : null;
|
|
18783
18913
|
const [search, setSearch] = useState("");
|
|
18914
|
+
const searchInputRef = useRef(null);
|
|
18784
18915
|
const options = field.options ?? [];
|
|
18785
18916
|
const showSearch = options.length >= OPTION_SEARCH_THRESHOLD;
|
|
18786
18917
|
const filteredOptions = useMemo(() => {
|
|
@@ -18788,74 +18919,70 @@ function OptionList({
|
|
|
18788
18919
|
const query = search.trim().toLowerCase();
|
|
18789
18920
|
return options.filter((option) => option.label.toLowerCase().includes(query));
|
|
18790
18921
|
}, [options, search, showSearch]);
|
|
18922
|
+
useEffect(() => {
|
|
18923
|
+
if (!showSearch || disabled) return;
|
|
18924
|
+
searchInputRef.current?.focus();
|
|
18925
|
+
}, [showSearch, disabled]);
|
|
18791
18926
|
if (options.length === 0) return /* @__PURE__ */ jsx(EmptyItem, { children: "\uD45C\uC2DC\uD560 \uD56D\uBAA9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4." });
|
|
18792
|
-
return /* @__PURE__ */ jsxs(
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
"
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
children: [
|
|
18801
|
-
showSearch && /* @__PURE__ */ jsx(
|
|
18802
|
-
"div",
|
|
18927
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
18928
|
+
showSearch && /* @__PURE__ */ jsx(
|
|
18929
|
+
"div",
|
|
18930
|
+
{
|
|
18931
|
+
className: "shrink-0 border-b border-solid px-[8px] pb-[4px] pt-[var(--cmp-chipFilter-listbox-list-paddingY)]",
|
|
18932
|
+
style: { borderColor: CHIPFILTER.listboxBorder },
|
|
18933
|
+
children: /* @__PURE__ */ jsx(
|
|
18934
|
+
SSearchInput,
|
|
18803
18935
|
{
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
disabled,
|
|
18813
|
-
placeholder: "\uAC80\uC0C9",
|
|
18814
|
-
onChange: (event) => setSearch(event.target.value),
|
|
18815
|
-
className: "min-w-0 flex-1 border-none bg-transparent text-[12px] leading-[20px] text-[color:var(--sys-color-field-text-default)] outline-none placeholder:text-[color:var(--sys-color-field-text-placeholder)] disabled:cursor-not-allowed"
|
|
18816
|
-
}
|
|
18817
|
-
),
|
|
18818
|
-
search !== "" && !disabled && /* @__PURE__ */ jsx(
|
|
18819
|
-
SGhostButton,
|
|
18820
|
-
{
|
|
18821
|
-
icon: "close",
|
|
18822
|
-
size: "xxs",
|
|
18823
|
-
ariaLabel: "\uAC80\uC0C9\uC5B4 \uC9C0\uC6B0\uAE30",
|
|
18824
|
-
className: "flex-shrink-0",
|
|
18825
|
-
onClick: () => setSearch("")
|
|
18826
|
-
}
|
|
18827
|
-
)
|
|
18828
|
-
] })
|
|
18936
|
+
ref: searchInputRef,
|
|
18937
|
+
size: "sm",
|
|
18938
|
+
value: search,
|
|
18939
|
+
onValueChange: setSearch,
|
|
18940
|
+
disabled,
|
|
18941
|
+
placeholder: "\uAC80\uC0C9",
|
|
18942
|
+
clearable: true,
|
|
18943
|
+
width: "100%"
|
|
18829
18944
|
}
|
|
18945
|
+
)
|
|
18946
|
+
}
|
|
18947
|
+
),
|
|
18948
|
+
/* @__PURE__ */ jsxs(
|
|
18949
|
+
"div",
|
|
18950
|
+
{
|
|
18951
|
+
className: cn(
|
|
18952
|
+
"min-h-0 flex-1 overflow-auto",
|
|
18953
|
+
!showSearch && "pt-[var(--cmp-chipFilter-listbox-list-paddingY)]",
|
|
18954
|
+
"pb-[var(--cmp-chipFilter-listbox-list-paddingY)]"
|
|
18830
18955
|
),
|
|
18831
|
-
|
|
18832
|
-
|
|
18833
|
-
|
|
18834
|
-
|
|
18835
|
-
|
|
18836
|
-
|
|
18837
|
-
|
|
18838
|
-
|
|
18839
|
-
|
|
18840
|
-
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
|
|
18845
|
-
|
|
18846
|
-
|
|
18956
|
+
children: [
|
|
18957
|
+
showSearch && filteredOptions.length === 0 && /* @__PURE__ */ jsx(EmptyItem, { children: "\uAC80\uC0C9 \uACB0\uACFC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4." }),
|
|
18958
|
+
filteredOptions.map((option) => {
|
|
18959
|
+
const checked = multiple ? selected.includes(option.value) : singleValue === option.value;
|
|
18960
|
+
return /* @__PURE__ */ jsxs(
|
|
18961
|
+
MenuItem,
|
|
18962
|
+
{
|
|
18963
|
+
selected: checked,
|
|
18964
|
+
disabled: disabled || option.disabled,
|
|
18965
|
+
multi: multiple,
|
|
18966
|
+
onClick: () => {
|
|
18967
|
+
if (multiple) {
|
|
18968
|
+
const next = checked ? selected.filter((v) => v !== option.value) : [...selected, option.value];
|
|
18969
|
+
onValueChange(next);
|
|
18970
|
+
} else {
|
|
18971
|
+
onValueChange(option.value);
|
|
18972
|
+
}
|
|
18973
|
+
},
|
|
18974
|
+
children: [
|
|
18975
|
+
multiple && /* @__PURE__ */ jsx(OptionCheckbox, { checked }),
|
|
18976
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
|
|
18977
|
+
]
|
|
18847
18978
|
},
|
|
18848
|
-
|
|
18849
|
-
|
|
18850
|
-
|
|
18851
|
-
|
|
18852
|
-
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
})
|
|
18856
|
-
]
|
|
18857
|
-
}
|
|
18858
|
-
);
|
|
18979
|
+
String(option.value)
|
|
18980
|
+
);
|
|
18981
|
+
})
|
|
18982
|
+
]
|
|
18983
|
+
}
|
|
18984
|
+
)
|
|
18985
|
+
] });
|
|
18859
18986
|
}
|
|
18860
18987
|
function OptionCheckbox({ checked }) {
|
|
18861
18988
|
return /* @__PURE__ */ jsx(
|
|
@@ -18869,15 +18996,22 @@ function OptionCheckbox({ checked }) {
|
|
|
18869
18996
|
}
|
|
18870
18997
|
);
|
|
18871
18998
|
}
|
|
18872
|
-
function ListBox({
|
|
18999
|
+
function ListBox({
|
|
19000
|
+
children,
|
|
19001
|
+
maxHeight
|
|
19002
|
+
}) {
|
|
18873
19003
|
return /* @__PURE__ */ jsx(
|
|
18874
19004
|
"div",
|
|
18875
19005
|
{
|
|
18876
|
-
className:
|
|
19006
|
+
className: cn(
|
|
19007
|
+
"overflow-hidden border border-solid shadow-[var(--shadow-overlay)]",
|
|
19008
|
+
maxHeight && "flex flex-col"
|
|
19009
|
+
),
|
|
18877
19010
|
style: {
|
|
18878
19011
|
borderRadius: CHIPFILTER.listboxRadius,
|
|
18879
19012
|
background: CHIPFILTER.listboxBg,
|
|
18880
|
-
borderColor: CHIPFILTER.listboxBorder
|
|
19013
|
+
borderColor: CHIPFILTER.listboxBorder,
|
|
19014
|
+
maxHeight
|
|
18881
19015
|
},
|
|
18882
19016
|
children
|
|
18883
19017
|
}
|