@dragunio/fe-libs 0.1.10 → 0.1.12
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/README.md +25 -5
- package/dist/{chunk-BAZJ5UJ5.mjs → chunk-Y2EURBYU.mjs} +29 -14
- package/dist/icons.d.mts +4 -1
- package/dist/icons.d.ts +4 -1
- package/dist/icons.js +24 -6
- package/dist/icons.mjs +7 -1
- package/dist/index.d.mts +62 -8
- package/dist/index.d.ts +62 -8
- package/dist/index.js +270 -22
- package/dist/index.mjs +253 -17
- package/dist/styles.css +127 -25
- package/package.json +22 -2
package/dist/index.mjs
CHANGED
|
@@ -22,12 +22,15 @@ import {
|
|
|
22
22
|
lock_unlocked,
|
|
23
23
|
log_out,
|
|
24
24
|
minus_square,
|
|
25
|
+
pin_02,
|
|
25
26
|
plus,
|
|
26
27
|
plus_square,
|
|
27
28
|
search,
|
|
29
|
+
settings,
|
|
28
30
|
trash,
|
|
31
|
+
unpin_02,
|
|
29
32
|
x_close
|
|
30
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-Y2EURBYU.mjs";
|
|
31
34
|
|
|
32
35
|
// packages/button/src/index.tsx
|
|
33
36
|
import { forwardRef } from "react";
|
|
@@ -502,9 +505,17 @@ function Pagination({
|
|
|
502
505
|
|
|
503
506
|
// packages/table/src/index.tsx
|
|
504
507
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
505
|
-
var TableContext = createContext({ striped: false });
|
|
506
508
|
var MIN_COLUMN_WIDTH = 96;
|
|
507
509
|
var MAX_COLUMN_WIDTH = 1200;
|
|
510
|
+
var TableContext = createContext({
|
|
511
|
+
striped: false,
|
|
512
|
+
columnsById: /* @__PURE__ */ new Map(),
|
|
513
|
+
columnWidths: {},
|
|
514
|
+
fixedColumnIds: /* @__PURE__ */ new Set(),
|
|
515
|
+
frozenColumnLefts: /* @__PURE__ */ new Map(),
|
|
516
|
+
minColumnWidth: MIN_COLUMN_WIDTH,
|
|
517
|
+
maxColumnWidth: MAX_COLUMN_WIDTH
|
|
518
|
+
});
|
|
508
519
|
function getColumnCount(headers, data) {
|
|
509
520
|
return Math.max(headers.length, ...data.map((row) => row.length), 0);
|
|
510
521
|
}
|
|
@@ -528,6 +539,17 @@ function getInitialColumnSizes(headers, data, sizes2, minColumnWidth = MIN_COLUM
|
|
|
528
539
|
function sameSizes(left, right) {
|
|
529
540
|
return left.length === right.length && left.every((size, index) => size === right[index]);
|
|
530
541
|
}
|
|
542
|
+
function clampColumnWidth(column, width, minColumnWidth, maxColumnWidth) {
|
|
543
|
+
const min = Math.max(1, column.minWidth ?? minColumnWidth);
|
|
544
|
+
const max = Math.max(min, column.maxWidth ?? maxColumnWidth);
|
|
545
|
+
return Math.min(max, Math.max(min, Math.round(width)));
|
|
546
|
+
}
|
|
547
|
+
function getColumnWidths(columns, widths, minColumnWidth, maxColumnWidth) {
|
|
548
|
+
return Object.fromEntries(columns.map((column) => [
|
|
549
|
+
column.id,
|
|
550
|
+
clampColumnWidth(column, widths?.[column.id] ?? column.width ?? minColumnWidth, minColumnWidth, maxColumnWidth)
|
|
551
|
+
]));
|
|
552
|
+
}
|
|
531
553
|
function DataTable({
|
|
532
554
|
headers,
|
|
533
555
|
data,
|
|
@@ -542,6 +564,12 @@ function DataTable({
|
|
|
542
564
|
defaultPage = 1,
|
|
543
565
|
onPageChange,
|
|
544
566
|
paginationPosition = "bottom-right",
|
|
567
|
+
columns: _columns,
|
|
568
|
+
columnWidths: _columnWidths,
|
|
569
|
+
fixedColumnIds: _fixedColumnIds,
|
|
570
|
+
onResize: _onResize,
|
|
571
|
+
onResizeEnd: _onResizeEnd,
|
|
572
|
+
maxColumnWidth: _maxColumnWidth,
|
|
545
573
|
className,
|
|
546
574
|
...props
|
|
547
575
|
}) {
|
|
@@ -637,9 +665,7 @@ function DataTable({
|
|
|
637
665
|
resolvedPaginationPosition !== "top-right" && paginationControl
|
|
638
666
|
] });
|
|
639
667
|
}
|
|
640
|
-
function
|
|
641
|
-
headers,
|
|
642
|
-
data,
|
|
668
|
+
function ComposableTable({
|
|
643
669
|
striped,
|
|
644
670
|
children,
|
|
645
671
|
pagination,
|
|
@@ -648,10 +674,140 @@ function Table({
|
|
|
648
674
|
defaultPage,
|
|
649
675
|
onPageChange,
|
|
650
676
|
paginationPosition,
|
|
677
|
+
columns,
|
|
678
|
+
columnWidths,
|
|
679
|
+
fixedColumnIds,
|
|
680
|
+
onResize,
|
|
681
|
+
onResizeEnd,
|
|
682
|
+
minColumnWidth = MIN_COLUMN_WIDTH,
|
|
683
|
+
maxColumnWidth = MAX_COLUMN_WIDTH,
|
|
684
|
+
className,
|
|
685
|
+
style,
|
|
651
686
|
...props
|
|
652
687
|
}) {
|
|
653
|
-
|
|
654
|
-
|
|
688
|
+
const safeMinColumnWidth = Math.max(1, minColumnWidth);
|
|
689
|
+
const safeMaxColumnWidth = Math.max(safeMinColumnWidth, maxColumnWidth);
|
|
690
|
+
const columnSignature = columns?.map((column) => [
|
|
691
|
+
column.id,
|
|
692
|
+
column.width,
|
|
693
|
+
column.minWidth,
|
|
694
|
+
column.maxWidth,
|
|
695
|
+
column.resizable
|
|
696
|
+
].join(":")).join("|") ?? "";
|
|
697
|
+
const [uncontrolledColumnWidths, setUncontrolledColumnWidths] = useState4(() => getColumnWidths(columns ?? [], void 0, safeMinColumnWidth, safeMaxColumnWidth));
|
|
698
|
+
const [resizingColumnId, setResizingColumnId] = useState4();
|
|
699
|
+
const resizeState = useRef3();
|
|
700
|
+
const resolvedColumns = useMemo2(() => columns ?? [], [columns]);
|
|
701
|
+
const columnsById = useMemo2(() => new Map(resolvedColumns.map((column) => [column.id, column])), [resolvedColumns]);
|
|
702
|
+
const resolvedColumnWidths = useMemo2(() => getColumnWidths(
|
|
703
|
+
resolvedColumns,
|
|
704
|
+
columnWidths ?? uncontrolledColumnWidths,
|
|
705
|
+
safeMinColumnWidth,
|
|
706
|
+
safeMaxColumnWidth
|
|
707
|
+
), [columnSignature, columnWidths, uncontrolledColumnWidths, resolvedColumns, safeMinColumnWidth, safeMaxColumnWidth]);
|
|
708
|
+
const resolvedFixedColumnIds = useMemo2(() => new Set(
|
|
709
|
+
(fixedColumnIds ?? []).filter((columnId) => columnsById.has(columnId))
|
|
710
|
+
), [columnsById, fixedColumnIds]);
|
|
711
|
+
const frozenColumnLefts = useMemo2(() => {
|
|
712
|
+
let left = 0;
|
|
713
|
+
const offsets = /* @__PURE__ */ new Map();
|
|
714
|
+
resolvedColumns.forEach((column) => {
|
|
715
|
+
if (!resolvedFixedColumnIds.has(column.id)) return;
|
|
716
|
+
offsets.set(column.id, left);
|
|
717
|
+
left += resolvedColumnWidths[column.id] ?? 0;
|
|
718
|
+
});
|
|
719
|
+
return offsets;
|
|
720
|
+
}, [resolvedColumnWidths, resolvedColumns, resolvedFixedColumnIds]);
|
|
721
|
+
const lastFrozenColumnId = useMemo2(() => [...resolvedColumns].reverse().find((column) => resolvedFixedColumnIds.has(column.id))?.id, [resolvedColumns, resolvedFixedColumnIds]);
|
|
722
|
+
const tableWidth = resolvedColumns.reduce((total, column) => total + (resolvedColumnWidths[column.id] ?? 0), 0);
|
|
723
|
+
useEffect3(() => {
|
|
724
|
+
if (columnWidths) return;
|
|
725
|
+
setUncontrolledColumnWidths((currentWidths) => ({
|
|
726
|
+
...getColumnWidths(resolvedColumns, void 0, safeMinColumnWidth, safeMaxColumnWidth),
|
|
727
|
+
...currentWidths
|
|
728
|
+
}));
|
|
729
|
+
}, [columnSignature, columnWidths, resolvedColumns, safeMinColumnWidth, safeMaxColumnWidth]);
|
|
730
|
+
const updateColumnWidth = useCallback2((columnId, nextWidth, isComplete = false) => {
|
|
731
|
+
const column = columnsById.get(columnId);
|
|
732
|
+
if (!column) return;
|
|
733
|
+
const width = clampColumnWidth(column, nextWidth, safeMinColumnWidth, safeMaxColumnWidth);
|
|
734
|
+
const nextColumnWidths = { ...resolvedColumnWidths, [columnId]: width };
|
|
735
|
+
if (!columnWidths) setUncontrolledColumnWidths(nextColumnWidths);
|
|
736
|
+
onResize?.(columnId, width, nextColumnWidths);
|
|
737
|
+
if (isComplete) onResizeEnd?.(columnId, width, nextColumnWidths);
|
|
738
|
+
}, [columnWidths, columnsById, onResize, onResizeEnd, resolvedColumnWidths, safeMinColumnWidth, safeMaxColumnWidth]);
|
|
739
|
+
const startColumnResize = useCallback2((event, columnId) => {
|
|
740
|
+
const column = columnsById.get(columnId);
|
|
741
|
+
const width = resolvedColumnWidths[columnId];
|
|
742
|
+
if (!column || column.resizable === false || typeof width !== "number") return;
|
|
743
|
+
event.preventDefault();
|
|
744
|
+
resizeState.current = { columnId, startX: event.clientX, startWidth: width, width };
|
|
745
|
+
setResizingColumnId(columnId);
|
|
746
|
+
}, [columnsById, resolvedColumnWidths]);
|
|
747
|
+
const resizeColumnWithKeyboard = useCallback2((event, columnId) => {
|
|
748
|
+
if (!["ArrowLeft", "ArrowRight"].includes(event.key)) return;
|
|
749
|
+
const width = resolvedColumnWidths[columnId];
|
|
750
|
+
if (typeof width !== "number") return;
|
|
751
|
+
event.preventDefault();
|
|
752
|
+
updateColumnWidth(columnId, width + (event.key === "ArrowLeft" ? -16 : 16), true);
|
|
753
|
+
}, [resolvedColumnWidths, updateColumnWidth]);
|
|
754
|
+
useEffect3(() => {
|
|
755
|
+
if (!resizingColumnId) return void 0;
|
|
756
|
+
const onPointerMove = (event) => {
|
|
757
|
+
const activeResize = resizeState.current;
|
|
758
|
+
if (!activeResize) return;
|
|
759
|
+
const width = activeResize.startWidth + event.clientX - activeResize.startX;
|
|
760
|
+
activeResize.width = width;
|
|
761
|
+
updateColumnWidth(activeResize.columnId, width);
|
|
762
|
+
};
|
|
763
|
+
const stopResizing = () => {
|
|
764
|
+
const activeResize = resizeState.current;
|
|
765
|
+
resizeState.current = void 0;
|
|
766
|
+
setResizingColumnId(void 0);
|
|
767
|
+
if (activeResize) updateColumnWidth(activeResize.columnId, activeResize.width, true);
|
|
768
|
+
};
|
|
769
|
+
window.addEventListener("pointermove", onPointerMove);
|
|
770
|
+
window.addEventListener("pointerup", stopResizing);
|
|
771
|
+
window.addEventListener("pointercancel", stopResizing);
|
|
772
|
+
return () => {
|
|
773
|
+
window.removeEventListener("pointermove", onPointerMove);
|
|
774
|
+
window.removeEventListener("pointerup", stopResizing);
|
|
775
|
+
window.removeEventListener("pointercancel", stopResizing);
|
|
776
|
+
};
|
|
777
|
+
}, [resizingColumnId, updateColumnWidth]);
|
|
778
|
+
const tableContext = useMemo2(() => ({
|
|
779
|
+
striped: striped ?? false,
|
|
780
|
+
columnsById,
|
|
781
|
+
columnWidths: resolvedColumnWidths,
|
|
782
|
+
fixedColumnIds: resolvedFixedColumnIds,
|
|
783
|
+
frozenColumnLefts,
|
|
784
|
+
minColumnWidth: safeMinColumnWidth,
|
|
785
|
+
maxColumnWidth: safeMaxColumnWidth,
|
|
786
|
+
lastFrozenColumnId,
|
|
787
|
+
resizingColumnId,
|
|
788
|
+
startColumnResize,
|
|
789
|
+
resizeColumnWithKeyboard
|
|
790
|
+
}), [columnsById, frozenColumnLefts, lastFrozenColumnId, resizingColumnId, resizeColumnWithKeyboard, resolvedColumnWidths, resolvedFixedColumnIds, startColumnResize, striped]);
|
|
791
|
+
const tableStyle = resolvedColumns.length ? { ...style, width: tableWidth, minWidth: tableWidth } : style ?? {};
|
|
792
|
+
return /* @__PURE__ */ jsx5(TableContext.Provider, { value: tableContext, children: /* @__PURE__ */ jsxs5(
|
|
793
|
+
"table",
|
|
794
|
+
{
|
|
795
|
+
className,
|
|
796
|
+
"data-fe-table": true,
|
|
797
|
+
"data-striped": striped || void 0,
|
|
798
|
+
"data-resizing": resizingColumnId || void 0,
|
|
799
|
+
style: tableStyle,
|
|
800
|
+
...props,
|
|
801
|
+
children: [
|
|
802
|
+
resolvedColumns.length > 0 && /* @__PURE__ */ jsx5("colgroup", { children: resolvedColumns.map((column) => /* @__PURE__ */ jsx5("col", { style: { width: `${resolvedColumnWidths[column.id]}px` } }, column.id)) }),
|
|
803
|
+
children
|
|
804
|
+
]
|
|
805
|
+
}
|
|
806
|
+
) });
|
|
807
|
+
}
|
|
808
|
+
function Table({ headers, data, ...props }) {
|
|
809
|
+
if (headers || data) return /* @__PURE__ */ jsx5(DataTable, { headers: headers ?? [], data: data ?? [], ...props });
|
|
810
|
+
return /* @__PURE__ */ jsx5(ComposableTable, { ...props });
|
|
655
811
|
}
|
|
656
812
|
function TableHead(props) {
|
|
657
813
|
return /* @__PURE__ */ jsx5("thead", { ...props });
|
|
@@ -663,11 +819,50 @@ function TableRow({ children, ...props }) {
|
|
|
663
819
|
const { striped } = useContext(TableContext);
|
|
664
820
|
return /* @__PURE__ */ jsx5("tr", { "data-striped": striped || void 0, ...props, children });
|
|
665
821
|
}
|
|
666
|
-
function
|
|
667
|
-
|
|
822
|
+
function getFrozenProps(columnId, context, className, style) {
|
|
823
|
+
if (!columnId || !context.fixedColumnIds.has(columnId)) return { className, style };
|
|
824
|
+
const frozenClassNames = [
|
|
825
|
+
className,
|
|
826
|
+
"fe-table__frozen",
|
|
827
|
+
context.lastFrozenColumnId === columnId && "fe-table__frozen--last"
|
|
828
|
+
].filter(Boolean).join(" ");
|
|
829
|
+
return {
|
|
830
|
+
className: frozenClassNames,
|
|
831
|
+
style: { ...style, left: context.frozenColumnLefts.get(columnId) ?? 0 }
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
function TableCell({ children, columnId, className, style, ...props }) {
|
|
835
|
+
const context = useContext(TableContext);
|
|
836
|
+
const frozenProps = getFrozenProps(columnId, context, className, style);
|
|
837
|
+
return /* @__PURE__ */ jsx5("td", { "data-fe-table-column-id": columnId, ...props, ...frozenProps, children });
|
|
668
838
|
}
|
|
669
|
-
function TableHeader({ children, ...props }) {
|
|
670
|
-
|
|
839
|
+
function TableHeader({ children, columnId, className, style, ...props }) {
|
|
840
|
+
const context = useContext(TableContext);
|
|
841
|
+
const column = columnId ? context.columnsById.get(columnId) : void 0;
|
|
842
|
+
const minWidth = Math.max(1, column?.minWidth ?? context.minColumnWidth);
|
|
843
|
+
const maxWidth = Math.max(minWidth, column?.maxWidth ?? context.maxColumnWidth);
|
|
844
|
+
const frozenProps = getFrozenProps(columnId, context, className, style);
|
|
845
|
+
const isResizable = Boolean(column && column.resizable !== false && context.startColumnResize);
|
|
846
|
+
return /* @__PURE__ */ jsxs5("th", { scope: "col", "data-fe-table-column-id": columnId, ...props, ...frozenProps, children: [
|
|
847
|
+
/* @__PURE__ */ jsx5("span", { className: "fe-table__header-content", children }),
|
|
848
|
+
isResizable && columnId && /* @__PURE__ */ jsx5(
|
|
849
|
+
"span",
|
|
850
|
+
{
|
|
851
|
+
className: "fe-table__resize-handle",
|
|
852
|
+
role: "separator",
|
|
853
|
+
"aria-label": `Resize ${getText(children) || "column"}`,
|
|
854
|
+
"aria-orientation": "vertical",
|
|
855
|
+
"aria-valuemin": minWidth,
|
|
856
|
+
"aria-valuemax": maxWidth,
|
|
857
|
+
"aria-valuenow": context.columnWidths[columnId],
|
|
858
|
+
tabIndex: 0,
|
|
859
|
+
title: "Drag to resize column",
|
|
860
|
+
"data-resizing": context.resizingColumnId === columnId || void 0,
|
|
861
|
+
onPointerDown: (event) => context.startColumnResize?.(event, columnId),
|
|
862
|
+
onKeyDown: (event) => context.resizeColumnWithKeyboard?.(event, columnId)
|
|
863
|
+
}
|
|
864
|
+
)
|
|
865
|
+
] });
|
|
671
866
|
}
|
|
672
867
|
function TableCaption(props) {
|
|
673
868
|
return /* @__PURE__ */ jsx5("caption", { ...props });
|
|
@@ -1626,6 +1821,9 @@ var Selection = forwardRef9(
|
|
|
1626
1821
|
disabled = false,
|
|
1627
1822
|
name,
|
|
1628
1823
|
onKeyDown,
|
|
1824
|
+
maxWidth,
|
|
1825
|
+
overflow = "ellipsis",
|
|
1826
|
+
style,
|
|
1629
1827
|
"aria-label": ariaLabel,
|
|
1630
1828
|
"aria-describedby": ariaDescribedBy,
|
|
1631
1829
|
"aria-labelledby": ariaLabelledBy,
|
|
@@ -1636,6 +1834,7 @@ var Selection = forwardRef9(
|
|
|
1636
1834
|
const listboxId = triggerId + "-listbox";
|
|
1637
1835
|
const labelId = generatedId + "-label";
|
|
1638
1836
|
const messageId2 = generatedId + "-message";
|
|
1837
|
+
const tooltipId = generatedId + "-tooltip";
|
|
1639
1838
|
const fieldError = getFieldError(error, errorMessage);
|
|
1640
1839
|
const hasError = fieldError !== void 0 && fieldError !== false && fieldError !== null;
|
|
1641
1840
|
const resolvedDescription = description ?? helperText;
|
|
@@ -1662,6 +1861,26 @@ var Selection = forwardRef9(
|
|
|
1662
1861
|
const [activeIndex, setActiveIndex] = useState11(0);
|
|
1663
1862
|
const rootRef = useRef7(null);
|
|
1664
1863
|
const menuRef = useRef7(null);
|
|
1864
|
+
const valueRef = useRef7(null);
|
|
1865
|
+
const [truncated, setTruncated] = useState11(false);
|
|
1866
|
+
const [hovered, setHovered] = useState11(false);
|
|
1867
|
+
const [focused, setFocused] = useState11(false);
|
|
1868
|
+
const showsTags = tag && multiple && selectedOptions.length > 0;
|
|
1869
|
+
const canTruncate = overflow === "ellipsis" && !showsTags && selectedOptions.length > 0;
|
|
1870
|
+
const selectedKey = selectedOptions.map((option) => String(option.value)).join("|");
|
|
1871
|
+
useLayoutEffect3(() => {
|
|
1872
|
+
const node = valueRef.current;
|
|
1873
|
+
if (!canTruncate || !node) {
|
|
1874
|
+
setTruncated(false);
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
const measure = () => setTruncated(node.scrollWidth > node.clientWidth + 1);
|
|
1878
|
+
measure();
|
|
1879
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
1880
|
+
const observer = new ResizeObserver(measure);
|
|
1881
|
+
observer.observe(node);
|
|
1882
|
+
return () => observer.disconnect();
|
|
1883
|
+
}, [canTruncate, selectedKey]);
|
|
1665
1884
|
const [menuPosition, setMenuPosition] = useState11(null);
|
|
1666
1885
|
useEffect5(() => {
|
|
1667
1886
|
const close = (event) => {
|
|
@@ -1726,6 +1945,12 @@ var Selection = forwardRef9(
|
|
|
1726
1945
|
setQuery("");
|
|
1727
1946
|
};
|
|
1728
1947
|
const displayLabel = selectedOptions.length ? selectedOptions.map((option) => option.label) : null;
|
|
1948
|
+
const showTooltip = truncated && (hovered || focused) && !open;
|
|
1949
|
+
const renderLabels = () => displayLabel?.map((item, index) => /* @__PURE__ */ jsxs12("span", { children: [
|
|
1950
|
+
item,
|
|
1951
|
+
index < displayLabel.length - 1 ? ", " : ""
|
|
1952
|
+
] }, index));
|
|
1953
|
+
const toPx = (length) => typeof length === "number" ? length + "px" : length;
|
|
1729
1954
|
const onTriggerKeyDown = (event) => {
|
|
1730
1955
|
onKeyDown?.(event);
|
|
1731
1956
|
if (disabled) return;
|
|
@@ -1757,12 +1982,14 @@ var Selection = forwardRef9(
|
|
|
1757
1982
|
className: [
|
|
1758
1983
|
"fe-selection",
|
|
1759
1984
|
"fe-selection--" + size,
|
|
1985
|
+
"fe-selection--" + overflow,
|
|
1760
1986
|
open && "fe-selection--open",
|
|
1761
1987
|
clearable && selectedOptions.length > 0 && "fe-selection--clearable",
|
|
1762
1988
|
hasError && "fe-selection--error",
|
|
1763
1989
|
disabled && "fe-selection--disabled",
|
|
1764
1990
|
className
|
|
1765
1991
|
].filter(Boolean).join(" "),
|
|
1992
|
+
style: maxWidth === void 0 ? style : { ...style, maxWidth: toPx(maxWidth) },
|
|
1766
1993
|
...props,
|
|
1767
1994
|
children: [
|
|
1768
1995
|
/* @__PURE__ */ jsx15(
|
|
@@ -1796,16 +2023,24 @@ var Selection = forwardRef9(
|
|
|
1796
2023
|
"aria-invalid": hasError || void 0,
|
|
1797
2024
|
"aria-required": isRequired || void 0,
|
|
1798
2025
|
"aria-labelledby": labelledBy,
|
|
1799
|
-
"aria-describedby":
|
|
2026
|
+
"aria-describedby": getDescribedBy(
|
|
2027
|
+
describedBy,
|
|
2028
|
+
showTooltip ? tooltipId : void 0
|
|
2029
|
+
),
|
|
1800
2030
|
"aria-haspopup": "listbox",
|
|
1801
2031
|
"aria-expanded": open,
|
|
1802
2032
|
"aria-controls": listboxId,
|
|
1803
2033
|
onClick: () => setOpen((current) => !current),
|
|
1804
2034
|
onKeyDown: onTriggerKeyDown,
|
|
2035
|
+
onMouseEnter: () => setHovered(true),
|
|
2036
|
+
onMouseLeave: () => setHovered(false),
|
|
2037
|
+
onFocus: () => setFocused(true),
|
|
2038
|
+
onBlur: () => setFocused(false),
|
|
1805
2039
|
children: [
|
|
1806
2040
|
/* @__PURE__ */ jsx15(
|
|
1807
2041
|
"span",
|
|
1808
2042
|
{
|
|
2043
|
+
ref: valueRef,
|
|
1809
2044
|
className: [
|
|
1810
2045
|
"fe-selection__value",
|
|
1811
2046
|
!selectedOptions.length && "is-placeholder",
|
|
@@ -1821,10 +2056,7 @@ var Selection = forwardRef9(
|
|
|
1821
2056
|
]
|
|
1822
2057
|
},
|
|
1823
2058
|
String(option.value)
|
|
1824
|
-
)) :
|
|
1825
|
-
item,
|
|
1826
|
-
index < displayLabel.length - 1 ? ", " : ""
|
|
1827
|
-
] }, index)) : /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
2059
|
+
)) : renderLabels() : /* @__PURE__ */ jsxs12(Fragment2, { children: [
|
|
1828
2060
|
/* @__PURE__ */ jsx15("span", { children: placeholder }),
|
|
1829
2061
|
isRequired && /* @__PURE__ */ jsx15("span", { className: "fe-field__required", "aria-hidden": "true", children: "*" })
|
|
1830
2062
|
] })
|
|
@@ -1843,6 +2075,7 @@ var Selection = forwardRef9(
|
|
|
1843
2075
|
onClick: clear
|
|
1844
2076
|
}
|
|
1845
2077
|
),
|
|
2078
|
+
showTooltip && /* @__PURE__ */ jsx15("span", { id: tooltipId, role: "tooltip", className: "fe-selection__tooltip", children: renderLabels() }),
|
|
1846
2079
|
open && menuPosition && createPortal2(
|
|
1847
2080
|
/* @__PURE__ */ jsxs12(
|
|
1848
2081
|
"div",
|
|
@@ -1894,7 +2127,7 @@ var Selection = forwardRef9(
|
|
|
1894
2127
|
onMouseMove: () => setActiveIndex(index),
|
|
1895
2128
|
onClick: () => choose(option),
|
|
1896
2129
|
children: [
|
|
1897
|
-
/* @__PURE__ */ jsx15("span", { children: option.label }),
|
|
2130
|
+
/* @__PURE__ */ jsx15("span", { className: "fe-selection__option-label", children: option.label }),
|
|
1898
2131
|
isSelected && /* @__PURE__ */ jsx15(
|
|
1899
2132
|
"span",
|
|
1900
2133
|
{
|
|
@@ -5637,10 +5870,13 @@ export {
|
|
|
5637
5870
|
message,
|
|
5638
5871
|
minus_square,
|
|
5639
5872
|
normalizePhoneNumber,
|
|
5873
|
+
pin_02,
|
|
5640
5874
|
plus,
|
|
5641
5875
|
plus_square,
|
|
5642
5876
|
search,
|
|
5877
|
+
settings,
|
|
5643
5878
|
trash,
|
|
5879
|
+
unpin_02,
|
|
5644
5880
|
validateEmail,
|
|
5645
5881
|
validatePassword,
|
|
5646
5882
|
validatePhoneNumber,
|
package/dist/styles.css
CHANGED
|
@@ -182,6 +182,8 @@
|
|
|
182
182
|
color: #a36200;
|
|
183
183
|
}
|
|
184
184
|
.fe-button--icon-only {
|
|
185
|
+
align-self: center;
|
|
186
|
+
aspect-ratio: 1 / 1;
|
|
185
187
|
min-width: 24px;
|
|
186
188
|
min-height: 24px;
|
|
187
189
|
padding: 4px;
|
|
@@ -366,22 +368,45 @@
|
|
|
366
368
|
background: var(--fe-tabs-accent);
|
|
367
369
|
}
|
|
368
370
|
.fe-tabs--segment .fe-tabs__list {
|
|
369
|
-
|
|
370
|
-
min-width:
|
|
371
|
+
width: 100%;
|
|
372
|
+
min-width: 100%;
|
|
371
373
|
padding: 4px;
|
|
372
|
-
border:
|
|
373
|
-
border-radius:
|
|
374
|
-
background:
|
|
374
|
+
border: 0;
|
|
375
|
+
border-radius: 999px;
|
|
376
|
+
background: #f1f2f4;
|
|
375
377
|
}
|
|
376
378
|
.fe-tabs--segment .fe-tabs__tab {
|
|
377
379
|
min-height: 34px;
|
|
380
|
+
flex: 1 1 0;
|
|
378
381
|
padding: 7px 12px;
|
|
379
|
-
border-radius:
|
|
382
|
+
border-radius: 999px;
|
|
383
|
+
color: #9ba0aa;
|
|
384
|
+
font-weight: 500;
|
|
385
|
+
}
|
|
386
|
+
.fe-tabs--segment .fe-tabs__tab + .fe-tabs__tab::before {
|
|
387
|
+
position: absolute;
|
|
388
|
+
top: 10px;
|
|
389
|
+
bottom: 10px;
|
|
390
|
+
left: 0;
|
|
391
|
+
width: 1px;
|
|
392
|
+
background: #e4e6eb;
|
|
393
|
+
content: "";
|
|
394
|
+
}
|
|
395
|
+
.fe-tabs--segment .fe-tabs__tab[aria-selected=true]::before,
|
|
396
|
+
.fe-tabs--segment .fe-tabs__tab[aria-selected=true] + .fe-tabs__tab::before {
|
|
397
|
+
display: none;
|
|
380
398
|
}
|
|
381
399
|
.fe-tabs--segment .fe-tabs__tab[aria-selected=true] {
|
|
382
|
-
color: var(--fe-tabs-
|
|
400
|
+
color: var(--fe-tabs-text);
|
|
383
401
|
background: #fff;
|
|
384
|
-
box-shadow:
|
|
402
|
+
box-shadow: none;
|
|
403
|
+
font-weight: 700;
|
|
404
|
+
}
|
|
405
|
+
.fe-tabs--segment .fe-tabs__tab:not(:disabled):hover {
|
|
406
|
+
color: var(--fe-tabs-text);
|
|
407
|
+
}
|
|
408
|
+
.fe-tabs--segment .fe-tabs__tab:disabled {
|
|
409
|
+
color: #c5c9d1;
|
|
385
410
|
}
|
|
386
411
|
.fe-tabs__panel {
|
|
387
412
|
padding-top: 20px;
|
|
@@ -465,6 +490,41 @@ table[data-fe-table][data-striped] tbody tr:nth-child(even) {
|
|
|
465
490
|
table[data-fe-table] tbody tr:hover {
|
|
466
491
|
background: var(--fe-table-hover-background, #edf5ff);
|
|
467
492
|
}
|
|
493
|
+
.fe-table__frozen {
|
|
494
|
+
position: sticky;
|
|
495
|
+
z-index: 10;
|
|
496
|
+
background: var(--fe-table-background, #fff);
|
|
497
|
+
}
|
|
498
|
+
.fe-table__table thead .fe-table__frozen,
|
|
499
|
+
table[data-fe-table] thead .fe-table__frozen {
|
|
500
|
+
position: sticky;
|
|
501
|
+
z-index: 12;
|
|
502
|
+
background: var(--fe-table-header-background, #f8fafc);
|
|
503
|
+
}
|
|
504
|
+
.fe-table__table[data-striped] tbody tr:nth-child(even) > .fe-table__frozen,
|
|
505
|
+
table[data-fe-table][data-striped] tbody tr:nth-child(even) > .fe-table__frozen {
|
|
506
|
+
background: var(--fe-table-stripe-background, #f8fafc);
|
|
507
|
+
}
|
|
508
|
+
.fe-table__table tbody tr:hover > .fe-table__frozen,
|
|
509
|
+
table[data-fe-table] tbody tr:hover > .fe-table__frozen {
|
|
510
|
+
background: var(--fe-table-hover-background, #edf5ff);
|
|
511
|
+
}
|
|
512
|
+
.fe-table__frozen--last {
|
|
513
|
+
box-shadow: 10px 0 16px -12px rgba(15, 23, 42, .42);
|
|
514
|
+
}
|
|
515
|
+
.fe-table__table tbody td:has(.fe-tooltip:hover),
|
|
516
|
+
.fe-table__table tbody td:has(.fe-tooltip:focus-within),
|
|
517
|
+
table[data-fe-table] tbody td:has(.fe-tooltip:hover),
|
|
518
|
+
table[data-fe-table] tbody td:has(.fe-tooltip:focus-within) {
|
|
519
|
+
position: relative;
|
|
520
|
+
z-index: 13;
|
|
521
|
+
}
|
|
522
|
+
.fe-table__table tbody td.fe-table__frozen:has(.fe-tooltip:hover),
|
|
523
|
+
.fe-table__table tbody td.fe-table__frozen:has(.fe-tooltip:focus-within),
|
|
524
|
+
table[data-fe-table] tbody td.fe-table__frozen:has(.fe-tooltip:hover),
|
|
525
|
+
table[data-fe-table] tbody td.fe-table__frozen:has(.fe-tooltip:focus-within) {
|
|
526
|
+
position: sticky;
|
|
527
|
+
}
|
|
468
528
|
.fe-table__header-content {
|
|
469
529
|
display: block;
|
|
470
530
|
padding-right: 16px;
|
|
@@ -472,32 +532,40 @@ table[data-fe-table] tbody tr:hover {
|
|
|
472
532
|
.fe-table__resize-handle {
|
|
473
533
|
position: absolute;
|
|
474
534
|
z-index: 1;
|
|
475
|
-
top:
|
|
476
|
-
right:
|
|
477
|
-
width:
|
|
478
|
-
height:
|
|
535
|
+
top: 0;
|
|
536
|
+
right: -6px;
|
|
537
|
+
width: 12px;
|
|
538
|
+
height: 100%;
|
|
479
539
|
border-radius: 4px;
|
|
480
|
-
background:
|
|
540
|
+
background: transparent;
|
|
481
541
|
cursor: col-resize;
|
|
482
542
|
touch-action: none;
|
|
483
543
|
outline: none;
|
|
484
544
|
}
|
|
485
545
|
.fe-table__resize-handle::after {
|
|
546
|
+
position: absolute;
|
|
547
|
+
top: 10px;
|
|
548
|
+
left: 5px;
|
|
549
|
+
width: 3px;
|
|
550
|
+
height: calc(100% - 20px);
|
|
551
|
+
border-radius: 2px;
|
|
552
|
+
background: transparent;
|
|
553
|
+
content: "";
|
|
554
|
+
transition: background-color 150ms ease;
|
|
486
555
|
}
|
|
487
|
-
.fe-table__resize-handle
|
|
488
|
-
.fe-table__resize-handle
|
|
489
|
-
.fe-table[data-resizing] .fe-table__resize-handle {
|
|
490
|
-
background: var(--fe-table-resize-handle-active-background, #bfdbfe);
|
|
491
|
-
}
|
|
492
|
-
.fe-table__resize-handle:hover::after,
|
|
556
|
+
.fe-table__table th:hover .fe-table__resize-handle::after,
|
|
557
|
+
table[data-fe-table] th:hover .fe-table__resize-handle::after,
|
|
493
558
|
.fe-table__resize-handle:focus-visible::after,
|
|
494
|
-
.fe-
|
|
559
|
+
.fe-table__resize-handle[data-resizing]::after {
|
|
495
560
|
background: var(--fe-table-resize-handle, #1d4ed8);
|
|
496
|
-
box-shadow: -3px 0 var(--fe-table-resize-handle, #1d4ed8), 3px 0 var(--fe-table-resize-handle, #1d4ed8);
|
|
497
561
|
}
|
|
498
562
|
.fe-table__resize-handle:focus-visible {
|
|
499
563
|
box-shadow: 0 0 0 2px var(--fe-table-focus-ring, #2563eb);
|
|
500
564
|
}
|
|
565
|
+
table[data-fe-table][data-resizing] {
|
|
566
|
+
cursor: col-resize;
|
|
567
|
+
user-select: none;
|
|
568
|
+
}
|
|
501
569
|
|
|
502
570
|
/* packages/toggle/src/styles.css */
|
|
503
571
|
.fe-toggle {
|
|
@@ -818,8 +886,9 @@ table[data-fe-table] tbody tr:hover {
|
|
|
818
886
|
display: flex;
|
|
819
887
|
align-items: center;
|
|
820
888
|
width: 100%;
|
|
889
|
+
min-width: 0;
|
|
821
890
|
min-height: 40px;
|
|
822
|
-
padding: 0 13px;
|
|
891
|
+
padding: 0 40px 0 13px;
|
|
823
892
|
border: 1px solid #d4d8e0;
|
|
824
893
|
border-radius: 12px;
|
|
825
894
|
outline: 0;
|
|
@@ -834,7 +903,11 @@ table[data-fe-table] tbody tr:hover {
|
|
|
834
903
|
background 0.15s;
|
|
835
904
|
}
|
|
836
905
|
.fe-selection--clearable .fe-selection__trigger {
|
|
837
|
-
padding-right:
|
|
906
|
+
padding-right: 72px;
|
|
907
|
+
}
|
|
908
|
+
.fe-selection--wrap .fe-selection__trigger {
|
|
909
|
+
padding-top: 8px;
|
|
910
|
+
padding-bottom: 8px;
|
|
838
911
|
}
|
|
839
912
|
.fe-selection--small .fe-selection__trigger {
|
|
840
913
|
min-height: 34px;
|
|
@@ -854,19 +927,24 @@ table[data-fe-table] tbody tr:hover {
|
|
|
854
927
|
box-shadow: 0 0 0 3px rgba(40, 120, 240, 0.12);
|
|
855
928
|
}
|
|
856
929
|
.fe-selection__value {
|
|
857
|
-
display:
|
|
930
|
+
display: block;
|
|
858
931
|
width: 100%;
|
|
859
932
|
min-width: 0;
|
|
860
933
|
flex: 1 1 auto;
|
|
861
|
-
align-items: center;
|
|
862
934
|
overflow: hidden;
|
|
863
935
|
text-overflow: ellipsis;
|
|
864
936
|
white-space: nowrap;
|
|
865
937
|
}
|
|
938
|
+
.fe-selection--wrap .fe-selection__value {
|
|
939
|
+
line-height: 1.4;
|
|
940
|
+
overflow-wrap: anywhere;
|
|
941
|
+
white-space: normal;
|
|
942
|
+
}
|
|
866
943
|
.fe-selection__value.is-placeholder {
|
|
867
944
|
color: #8b94a4;
|
|
868
945
|
}
|
|
869
946
|
.fe-selection__value.is-tags {
|
|
947
|
+
display: flex;
|
|
870
948
|
flex-wrap: wrap;
|
|
871
949
|
align-content: center;
|
|
872
950
|
gap: 5px;
|
|
@@ -945,6 +1023,24 @@ table[data-fe-table] tbody tr:hover {
|
|
|
945
1023
|
outline: 2px solid #2878f0;
|
|
946
1024
|
outline-offset: 1px;
|
|
947
1025
|
}
|
|
1026
|
+
.fe-selection__tooltip {
|
|
1027
|
+
position: absolute;
|
|
1028
|
+
z-index: 50;
|
|
1029
|
+
bottom: calc(100% + 8px);
|
|
1030
|
+
left: 0;
|
|
1031
|
+
width: max-content;
|
|
1032
|
+
max-width: min(320px, calc(100vw - 32px));
|
|
1033
|
+
padding: 7px 9px;
|
|
1034
|
+
border-radius: 7px;
|
|
1035
|
+
background: #20242c;
|
|
1036
|
+
color: #fff;
|
|
1037
|
+
font-size: 12px;
|
|
1038
|
+
font-weight: 500;
|
|
1039
|
+
line-height: 1.35;
|
|
1040
|
+
overflow-wrap: anywhere;
|
|
1041
|
+
box-shadow: 0 5px 18px rgba(0, 0, 0, 0.22);
|
|
1042
|
+
pointer-events: none;
|
|
1043
|
+
}
|
|
948
1044
|
.fe-selection__chevron {
|
|
949
1045
|
position: absolute;
|
|
950
1046
|
top: 2px;
|
|
@@ -1005,6 +1101,7 @@ table[data-fe-table] tbody tr:hover {
|
|
|
1005
1101
|
display: flex;
|
|
1006
1102
|
align-items: center;
|
|
1007
1103
|
justify-content: space-between;
|
|
1104
|
+
gap: 8px;
|
|
1008
1105
|
width: 100%;
|
|
1009
1106
|
min-height: 37px;
|
|
1010
1107
|
padding: 8px 10px;
|
|
@@ -1030,7 +1127,12 @@ table[data-fe-table] tbody tr:hover {
|
|
|
1030
1127
|
opacity: 0.45;
|
|
1031
1128
|
cursor: not-allowed;
|
|
1032
1129
|
}
|
|
1130
|
+
.fe-selection__option-label {
|
|
1131
|
+
min-width: 0;
|
|
1132
|
+
overflow-wrap: anywhere;
|
|
1133
|
+
}
|
|
1033
1134
|
.fe-selection__check {
|
|
1135
|
+
flex: none;
|
|
1034
1136
|
font-weight: 800;
|
|
1035
1137
|
}
|
|
1036
1138
|
.fe-selection__empty {
|