@flytedan/flytebot-design-system 0.51.0 → 0.51.1
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/index.cjs +138 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +138 -138
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components.css +10 -1
package/dist/index.d.cts
CHANGED
|
@@ -1366,7 +1366,7 @@ interface FilterBarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "on
|
|
|
1366
1366
|
* drop below the chips on a row of their own, still right-aligned, when the bar is too
|
|
1367
1367
|
* narrow to hold them all on one line. */
|
|
1368
1368
|
actions?: React.ReactNode;
|
|
1369
|
-
/** Shows a "Clear all" button,
|
|
1369
|
+
/** Shows a "Clear all" button, right after the Filter button (under it on a bar too narrow to hold both), while any filter is applied; it never
|
|
1370
1370
|
* shows without one. Fires once, with no arguments: the host clears every filter in a
|
|
1371
1371
|
* single update (applied synchronously, like onFilterChange/onFilterRemove), so FilterBar
|
|
1372
1372
|
* never fans one click out into a removal per filter. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1366,7 +1366,7 @@ interface FilterBarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "on
|
|
|
1366
1366
|
* drop below the chips on a row of their own, still right-aligned, when the bar is too
|
|
1367
1367
|
* narrow to hold them all on one line. */
|
|
1368
1368
|
actions?: React.ReactNode;
|
|
1369
|
-
/** Shows a "Clear all" button,
|
|
1369
|
+
/** Shows a "Clear all" button, right after the Filter button (under it on a bar too narrow to hold both), while any filter is applied; it never
|
|
1370
1370
|
* shows without one. Fires once, with no arguments: the host clears every filter in a
|
|
1371
1371
|
* single update (applied synchronously, like onFilterChange/onFilterRemove), so FilterBar
|
|
1372
1372
|
* never fans one click out into a removal per filter. */
|
package/dist/index.js
CHANGED
|
@@ -4374,14 +4374,16 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
|
|
|
4374
4374
|
const activeCount = activeFilterCount(fields, filters);
|
|
4375
4375
|
const canAdd = addableFields.length > 0;
|
|
4376
4376
|
const showCount = showActiveCount && activeCount > 0;
|
|
4377
|
+
const clearAll = activeCount > 0 ? onClearAll : void 0;
|
|
4378
|
+
const showClear = clearAll !== void 0;
|
|
4377
4379
|
const addMenuItems = [
|
|
4378
4380
|
{ kind: "section", label: "Add filter" },
|
|
4379
4381
|
...addableFields.map((f) => ({ id: f.key, label: f.label, onSelect: () => startEditing(f.key) }))
|
|
4380
4382
|
];
|
|
4381
4383
|
return /* @__PURE__ */ jsxs41("span", { className: ["fd-filterbar", className].filter(Boolean).join(" "), ...rest, children: [
|
|
4382
4384
|
/* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-main", children: [
|
|
4383
|
-
canAdd || showCount ? /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-trigger", children: [
|
|
4384
|
-
/* @__PURE__ */ jsx49("span", { ref: addAnchorRef, children: /* @__PURE__ */ jsxs41(
|
|
4385
|
+
canAdd || showCount || showClear ? /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-trigger", children: [
|
|
4386
|
+
canAdd || showCount ? /* @__PURE__ */ jsx49("span", { ref: addAnchorRef, children: /* @__PURE__ */ jsxs41(
|
|
4385
4387
|
Button,
|
|
4386
4388
|
{
|
|
4387
4389
|
size: "md",
|
|
@@ -4404,7 +4406,8 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
|
|
|
4404
4406
|
] }) : null
|
|
4405
4407
|
]
|
|
4406
4408
|
}
|
|
4407
|
-
) }),
|
|
4409
|
+
) }) : null,
|
|
4410
|
+
clearAll ? /* @__PURE__ */ jsx49(Button, { size: "sm", variant: "ghost", onClick: () => clearAll(), children: "Clear all" }) : null,
|
|
4408
4411
|
canAdd ? /* @__PURE__ */ jsx49(
|
|
4409
4412
|
Popover,
|
|
4410
4413
|
{
|
|
@@ -4419,144 +4422,141 @@ function FilterBar({ fields = [], filters, onFilterChange, onFilterRemove, align
|
|
|
4419
4422
|
}
|
|
4420
4423
|
) : null
|
|
4421
4424
|
] }) : null,
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
if (e.key === "Enter") setPanel(null);
|
|
4440
|
-
else if (e.key === "Escape") {
|
|
4441
|
-
e.stopPropagation();
|
|
4442
|
-
setPanel(null);
|
|
4443
|
-
}
|
|
4444
|
-
},
|
|
4445
|
-
onBlur: () => setPanel(null)
|
|
4446
|
-
}
|
|
4447
|
-
),
|
|
4448
|
-
isSet(value) ? /* @__PURE__ */ jsx49(
|
|
4449
|
-
"span",
|
|
4450
|
-
{
|
|
4451
|
-
className: "fd-tag-remove",
|
|
4452
|
-
role: "button",
|
|
4453
|
-
"aria-label": "Remove " + field.label,
|
|
4454
|
-
onClick: (e) => {
|
|
4425
|
+
/* @__PURE__ */ jsx49("span", { className: "fd-filterbar-chips", children: fields.map((field) => {
|
|
4426
|
+
const value = filters[field.key];
|
|
4427
|
+
const editing = panel?.kind === "edit" && panel.key === field.key;
|
|
4428
|
+
if (editing && field.type === "text") {
|
|
4429
|
+
return /* @__PURE__ */ jsxs41("span", { className: ["fd-tag", "fd-filterbar-text"].join(" "), children: [
|
|
4430
|
+
/* @__PURE__ */ jsx49(
|
|
4431
|
+
"input",
|
|
4432
|
+
{
|
|
4433
|
+
ref: textInputRef,
|
|
4434
|
+
className: "fd-filterbar-text-input",
|
|
4435
|
+
value: value ?? "",
|
|
4436
|
+
placeholder: field.placeholder || field.label,
|
|
4437
|
+
"aria-label": field.label,
|
|
4438
|
+
onChange: (e) => commit(field, e.target.value),
|
|
4439
|
+
onKeyDown: (e) => {
|
|
4440
|
+
if (e.key === "Enter") setPanel(null);
|
|
4441
|
+
else if (e.key === "Escape") {
|
|
4455
4442
|
e.stopPropagation();
|
|
4456
|
-
removeField(field);
|
|
4457
4443
|
setPanel(null);
|
|
4458
|
-
}
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4444
|
+
}
|
|
4445
|
+
},
|
|
4446
|
+
onBlur: () => setPanel(null)
|
|
4447
|
+
}
|
|
4448
|
+
),
|
|
4449
|
+
isSet(value) ? /* @__PURE__ */ jsx49(
|
|
4450
|
+
"span",
|
|
4451
|
+
{
|
|
4452
|
+
className: "fd-tag-remove",
|
|
4453
|
+
role: "button",
|
|
4454
|
+
"aria-label": "Remove " + field.label,
|
|
4455
|
+
onClick: (e) => {
|
|
4456
|
+
e.stopPropagation();
|
|
4457
|
+
removeField(field);
|
|
4458
|
+
setPanel(null);
|
|
4459
|
+
},
|
|
4460
|
+
children: /* @__PURE__ */ jsx49("i", { className: "ph ph-x", "aria-hidden": "true" })
|
|
4461
|
+
}
|
|
4462
|
+
) : null
|
|
4463
|
+
] }, field.key);
|
|
4464
|
+
}
|
|
4465
|
+
const set = isFieldSet(field, value);
|
|
4466
|
+
if (!editing && !set) return null;
|
|
4467
|
+
const chipRef = editing ? editAnchorRef : void 0;
|
|
4468
|
+
const toggleOrClose = () => editing ? closeEditing() : startEditing(field.key);
|
|
4469
|
+
const remove = () => {
|
|
4470
|
+
removeField(field);
|
|
4471
|
+
closeEditing();
|
|
4472
|
+
};
|
|
4473
|
+
const chipText = field.label + (set ? ": " + chipLabel(field, value) : "");
|
|
4474
|
+
const chip = /* @__PURE__ */ jsx49(Tag, { icon: field.icon, selected: true, onClick: toggleOrClose, onRemove: remove, title: chipText, "aria-label": chipText, children: /* @__PURE__ */ jsx49(MiddleEllipsis, { text: chipText }) });
|
|
4475
|
+
if (field.type === "text") {
|
|
4476
|
+
return /* @__PURE__ */ jsx49("span", { className: "fd-filterbar-chip", children: chip }, field.key);
|
|
4477
|
+
}
|
|
4478
|
+
if (field.type === "select") {
|
|
4479
|
+
return /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-chip", children: [
|
|
4480
|
+
/* @__PURE__ */ jsx49("span", { ref: chipRef, children: chip }),
|
|
4481
|
+
editing ? /* @__PURE__ */ jsx49(
|
|
4482
|
+
Popover,
|
|
4483
|
+
{
|
|
4484
|
+
open: true,
|
|
4485
|
+
anchorRef: editAnchorRef,
|
|
4486
|
+
onClose: closeEditing,
|
|
4487
|
+
placement: align === "right" ? "bottom-end" : "bottom-start",
|
|
4488
|
+
offset: 6,
|
|
4489
|
+
minWidth: 200,
|
|
4490
|
+
label: field.label,
|
|
4491
|
+
children: /* @__PURE__ */ jsx49("span", { role: "listbox", "aria-label": field.label, ref: optionsRef, className: "fd-pop-list", children: field.options.map((o) => {
|
|
4492
|
+
const on = o.value === value;
|
|
4493
|
+
return /* @__PURE__ */ jsx49(
|
|
4494
|
+
"button",
|
|
4495
|
+
{
|
|
4496
|
+
type: "button",
|
|
4497
|
+
role: "option",
|
|
4498
|
+
"aria-selected": on,
|
|
4499
|
+
className: ["fd-opt", on ? "is-selected" : ""].filter(Boolean).join(" "),
|
|
4500
|
+
onClick: () => {
|
|
4501
|
+
commit(field, o.value);
|
|
4502
|
+
setPanel(null);
|
|
4504
4503
|
},
|
|
4505
|
-
o.
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
}
|
|
4559
|
-
|
|
4504
|
+
children: /* @__PURE__ */ jsx49("span", { className: "fd-opt-label", children: o.label })
|
|
4505
|
+
},
|
|
4506
|
+
o.value
|
|
4507
|
+
);
|
|
4508
|
+
}) })
|
|
4509
|
+
}
|
|
4510
|
+
) : null
|
|
4511
|
+
] }, field.key);
|
|
4512
|
+
}
|
|
4513
|
+
if (field.type === "multiSelect") {
|
|
4514
|
+
return /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-chip", children: [
|
|
4515
|
+
/* @__PURE__ */ jsx49("span", { ref: chipRef, children: chip }),
|
|
4516
|
+
editing ? /* @__PURE__ */ jsx49(
|
|
4517
|
+
MultiSelectPanel,
|
|
4518
|
+
{
|
|
4519
|
+
field,
|
|
4520
|
+
value,
|
|
4521
|
+
anchorRef: editAnchorRef,
|
|
4522
|
+
onCommit: (v) => commit(field, v),
|
|
4523
|
+
onClose: closeEditing
|
|
4524
|
+
}
|
|
4525
|
+
) : null
|
|
4526
|
+
] }, field.key);
|
|
4527
|
+
}
|
|
4528
|
+
if (field.type === "range") {
|
|
4529
|
+
return /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-chip", children: [
|
|
4530
|
+
/* @__PURE__ */ jsx49("span", { ref: chipRef, children: chip }),
|
|
4531
|
+
editing ? /* @__PURE__ */ jsx49(
|
|
4532
|
+
RangePanel,
|
|
4533
|
+
{
|
|
4534
|
+
field,
|
|
4535
|
+
value,
|
|
4536
|
+
anchorRef: editAnchorRef,
|
|
4537
|
+
onCommit: (v) => commit(field, v),
|
|
4538
|
+
onClose: closeEditing
|
|
4539
|
+
}
|
|
4540
|
+
) : null
|
|
4541
|
+
] }, field.key);
|
|
4542
|
+
}
|
|
4543
|
+
if (field.type === "date") {
|
|
4544
|
+
return /* @__PURE__ */ jsxs41("span", { className: "fd-filterbar-chip", children: [
|
|
4545
|
+
/* @__PURE__ */ jsx49("span", { ref: chipRef, children: chip }),
|
|
4546
|
+
editing ? /* @__PURE__ */ jsx49(
|
|
4547
|
+
DatePanel,
|
|
4548
|
+
{
|
|
4549
|
+
field,
|
|
4550
|
+
value,
|
|
4551
|
+
anchorRef: editAnchorRef,
|
|
4552
|
+
onCommit: (v) => commit(field, v),
|
|
4553
|
+
onClose: closeEditing
|
|
4554
|
+
}
|
|
4555
|
+
) : null
|
|
4556
|
+
] }, field.key);
|
|
4557
|
+
}
|
|
4558
|
+
return null;
|
|
4559
|
+
}) })
|
|
4560
4560
|
] }),
|
|
4561
4561
|
actions ? /* @__PURE__ */ jsx49("span", { className: "fd-filterbar-actions", children: actions }) : null
|
|
4562
4562
|
] });
|