nntc-ui 0.0.35 → 0.0.36
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/index.d.ts +3 -0
- package/index.js +60 -35
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ interface Props$e {
|
|
|
139
139
|
selected: string[] | null;
|
|
140
140
|
titleType?: TitleVariant;
|
|
141
141
|
enableSearch?: boolean;
|
|
142
|
+
popoverInComponent?: boolean;
|
|
142
143
|
}
|
|
143
144
|
declare function MultiSelect(props: UiProps<Props$e> & DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>): react_jsx_runtime.JSX.Element;
|
|
144
145
|
|
|
@@ -353,6 +354,8 @@ interface Props$4 {
|
|
|
353
354
|
wrapTrigger?: boolean;
|
|
354
355
|
containerOffset?: number;
|
|
355
356
|
root?: HTMLElement | MutableRefObject<HTMLElement | null> | null;
|
|
357
|
+
open?: boolean;
|
|
358
|
+
onOpenChange?: (open: boolean) => void;
|
|
356
359
|
}
|
|
357
360
|
declare function Popover(props: PropsWithChildren<UiProps<Props$4>>): string | number | true | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null;
|
|
358
361
|
|
package/index.js
CHANGED
|
@@ -417,7 +417,19 @@ var PopoverTrigger = forwardRef4(
|
|
|
417
417
|
// src/components/view/Popover/Popover.tsx
|
|
418
418
|
import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
419
419
|
function Popover(props) {
|
|
420
|
-
const {
|
|
420
|
+
const {
|
|
421
|
+
description,
|
|
422
|
+
clickable,
|
|
423
|
+
initialOpen,
|
|
424
|
+
placement,
|
|
425
|
+
wrapTrigger,
|
|
426
|
+
containerOffset,
|
|
427
|
+
root: root22,
|
|
428
|
+
open,
|
|
429
|
+
onOpenChange,
|
|
430
|
+
children: children2,
|
|
431
|
+
classes
|
|
432
|
+
} = props;
|
|
421
433
|
const [showTooltip, setShowTooltip] = useState2(false);
|
|
422
434
|
if (!children2) {
|
|
423
435
|
return null;
|
|
@@ -430,8 +442,8 @@ function Popover(props) {
|
|
|
430
442
|
{
|
|
431
443
|
placement,
|
|
432
444
|
initialOpen,
|
|
433
|
-
open: clickable ? showTooltip : void 0,
|
|
434
|
-
onOpenChange: clickable ? setShowTooltip : void 0,
|
|
445
|
+
open: open !== void 0 ? open : clickable ? showTooltip : void 0,
|
|
446
|
+
onOpenChange: onOpenChange !== void 0 ? onOpenChange : clickable ? setShowTooltip : void 0,
|
|
435
447
|
containerOffset,
|
|
436
448
|
root: root22,
|
|
437
449
|
children: [
|
|
@@ -1553,7 +1565,12 @@ var WrapForLabel = (props) => {
|
|
|
1553
1565
|
|
|
1554
1566
|
// src/components/common/MultiSelect/MultiSelect.tsx
|
|
1555
1567
|
import classnames11 from "classnames";
|
|
1556
|
-
import {
|
|
1568
|
+
import {
|
|
1569
|
+
useCallback as useCallback6,
|
|
1570
|
+
useMemo as useMemo3,
|
|
1571
|
+
useRef as useRef7,
|
|
1572
|
+
useState as useState8
|
|
1573
|
+
} from "react";
|
|
1557
1574
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
1558
1575
|
import { mergeRefs as mergeRefs7 } from "react-merge-refs";
|
|
1559
1576
|
import { v4 as uuidv45 } from "uuid";
|
|
@@ -1713,19 +1730,23 @@ function MultiSelect(props) {
|
|
|
1713
1730
|
id,
|
|
1714
1731
|
titleType = "allValue",
|
|
1715
1732
|
enableSearch = false,
|
|
1733
|
+
popoverInComponent = false,
|
|
1716
1734
|
...inputProps
|
|
1717
1735
|
} = props;
|
|
1718
1736
|
const { t } = useTranslation2();
|
|
1737
|
+
const wrapperRef = useRef7(null);
|
|
1719
1738
|
const inputRef = useRef7(null);
|
|
1720
1739
|
const popoverTargetRef = useRef7(null);
|
|
1740
|
+
const [isPopoverOpen, setIsPopoverOpen] = useState8(false);
|
|
1721
1741
|
const activeItems = useMemo3(() => items2.filter((i) => selected5?.includes(i.value)), [selected5, items2]);
|
|
1722
1742
|
const inputClickHandler = useCallback6(
|
|
1723
1743
|
(e) => {
|
|
1724
1744
|
e.preventDefault();
|
|
1725
|
-
if (!disabled2)
|
|
1726
|
-
|
|
1745
|
+
if (!disabled2) {
|
|
1746
|
+
setIsPopoverOpen((prev) => !prev);
|
|
1747
|
+
}
|
|
1727
1748
|
},
|
|
1728
|
-
[
|
|
1749
|
+
[disabled2]
|
|
1729
1750
|
);
|
|
1730
1751
|
const changeSelectedItem = (item3) => {
|
|
1731
1752
|
const newValue = selected5 ?? [];
|
|
@@ -1766,6 +1787,7 @@ function MultiSelect(props) {
|
|
|
1766
1787
|
/* @__PURE__ */ jsxs12(
|
|
1767
1788
|
"div",
|
|
1768
1789
|
{
|
|
1790
|
+
ref: wrapperRef,
|
|
1769
1791
|
className: classnames11(
|
|
1770
1792
|
wrapper4,
|
|
1771
1793
|
multiSelect_exports[variant],
|
|
@@ -1794,11 +1816,14 @@ function MultiSelect(props) {
|
|
|
1794
1816
|
Popover,
|
|
1795
1817
|
{
|
|
1796
1818
|
placement: "bottom-start",
|
|
1819
|
+
open: isPopoverOpen,
|
|
1820
|
+
onOpenChange: setIsPopoverOpen,
|
|
1797
1821
|
classes: {
|
|
1798
1822
|
content: classnames11(popoverContent3, classes?.popoverContent),
|
|
1799
1823
|
...classes?.popover
|
|
1800
1824
|
},
|
|
1801
1825
|
containerOffset: 4,
|
|
1826
|
+
root: popoverInComponent ? wrapperRef.current : void 0,
|
|
1802
1827
|
description: /* @__PURE__ */ jsx20(
|
|
1803
1828
|
SelectPopover2,
|
|
1804
1829
|
{
|
|
@@ -1830,7 +1855,7 @@ function MultiSelect(props) {
|
|
|
1830
1855
|
|
|
1831
1856
|
// src/components/common/Checklist/Checklist.tsx
|
|
1832
1857
|
import classnames12 from "classnames";
|
|
1833
|
-
import { useState as
|
|
1858
|
+
import { useState as useState9 } from "react";
|
|
1834
1859
|
|
|
1835
1860
|
// src/components/common/Checklist/checklist.module.css
|
|
1836
1861
|
var root13 = "checklist_root";
|
|
@@ -1856,8 +1881,8 @@ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-r
|
|
|
1856
1881
|
function Checklist(props) {
|
|
1857
1882
|
const { items: items2, selected: selected5, disableSearch, isDisabled, actionWithSelected, onChangeItem, classes } = props;
|
|
1858
1883
|
const { t } = useTranslation();
|
|
1859
|
-
const [filterSubstring, setFilterSubstring] =
|
|
1860
|
-
const [selectedItems, setSelectedItems] =
|
|
1884
|
+
const [filterSubstring, setFilterSubstring] = useState9("");
|
|
1885
|
+
const [selectedItems, setSelectedItems] = useState9(selected5);
|
|
1861
1886
|
const filteredItems = filterItems2(items2, filterSubstring, selectedItems);
|
|
1862
1887
|
const handleClick = (item3) => {
|
|
1863
1888
|
const value = !selected5[item3.value];
|
|
@@ -1999,11 +2024,11 @@ function Layout(props) {
|
|
|
1999
2024
|
|
|
2000
2025
|
// src/components/navigation/Tabs/Tabs.tsx
|
|
2001
2026
|
import classnames17 from "classnames";
|
|
2002
|
-
import { useEffect as useEffect5, useState as
|
|
2027
|
+
import { useEffect as useEffect5, useState as useState12 } from "react";
|
|
2003
2028
|
|
|
2004
2029
|
// src/components/view/Tooltip/Tooltip.tsx
|
|
2005
2030
|
import classnames16 from "classnames";
|
|
2006
|
-
import { useRef as useRef8, useState as
|
|
2031
|
+
import { useRef as useRef8, useState as useState11 } from "react";
|
|
2007
2032
|
|
|
2008
2033
|
// src/components/view/Tooltip/tooltip.module.css
|
|
2009
2034
|
var tooltip_exports = {};
|
|
@@ -2141,7 +2166,7 @@ import {
|
|
|
2141
2166
|
useInteractions as useInteractions2,
|
|
2142
2167
|
useRole as useRole2
|
|
2143
2168
|
} from "@floating-ui/react";
|
|
2144
|
-
import { useMemo as useMemo4, useState as
|
|
2169
|
+
import { useMemo as useMemo4, useState as useState10 } from "react";
|
|
2145
2170
|
function useTooltip(props = {}) {
|
|
2146
2171
|
const {
|
|
2147
2172
|
initialOpen = false,
|
|
@@ -2152,7 +2177,7 @@ function useTooltip(props = {}) {
|
|
|
2152
2177
|
arrowRef,
|
|
2153
2178
|
root: root22
|
|
2154
2179
|
} = props;
|
|
2155
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
2180
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState10(initialOpen);
|
|
2156
2181
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
2157
2182
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
2158
2183
|
const data = useFloating2({
|
|
@@ -2246,7 +2271,7 @@ function Tooltip(props) {
|
|
|
2246
2271
|
children: children2,
|
|
2247
2272
|
classes
|
|
2248
2273
|
} = props;
|
|
2249
|
-
const [showTooltip, setShowTooltip] =
|
|
2274
|
+
const [showTooltip, setShowTooltip] = useState11(false);
|
|
2250
2275
|
const arrowRef = useRef8(null);
|
|
2251
2276
|
if (!label7) {
|
|
2252
2277
|
return children2;
|
|
@@ -2363,8 +2388,8 @@ function Tabs(props) {
|
|
|
2363
2388
|
value,
|
|
2364
2389
|
classes
|
|
2365
2390
|
} = props;
|
|
2366
|
-
const [isMounted, setIsMounted] =
|
|
2367
|
-
const [selectedTab, setSelectedTab] =
|
|
2391
|
+
const [isMounted, setIsMounted] = useState12(false);
|
|
2392
|
+
const [selectedTab, setSelectedTab] = useState12(defaultSelected);
|
|
2368
2393
|
const currentValue = useExternalState ? value : selectedTab;
|
|
2369
2394
|
const handleClick = (item3) => () => {
|
|
2370
2395
|
if (item3.isDisabled) {
|
|
@@ -2472,7 +2497,7 @@ import { flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-tabl
|
|
|
2472
2497
|
import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
|
|
2473
2498
|
import classnames22 from "classnames";
|
|
2474
2499
|
import dayjs4 from "dayjs";
|
|
2475
|
-
import { Fragment as Fragment8, useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef11, useState as
|
|
2500
|
+
import { Fragment as Fragment8, useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef11, useState as useState16 } from "react";
|
|
2476
2501
|
|
|
2477
2502
|
// src/utils/toFirstLetterUpperCase.ts
|
|
2478
2503
|
var toFirstLetterUpperCase = (name) => {
|
|
@@ -2484,7 +2509,7 @@ var defaultRowHeight = 32;
|
|
|
2484
2509
|
|
|
2485
2510
|
// src/components/view/VirtualTable/ui/DefaultColumn/DefaultColumn.tsx
|
|
2486
2511
|
import classnames18 from "classnames";
|
|
2487
|
-
import { useEffect as useEffect6, useRef as useRef10, useState as
|
|
2512
|
+
import { useEffect as useEffect6, useRef as useRef10, useState as useState13 } from "react";
|
|
2488
2513
|
|
|
2489
2514
|
// src/components/view/Modal/Modal.tsx
|
|
2490
2515
|
import { forwardRef as forwardRef7, useRef as useRef9 } from "react";
|
|
@@ -2651,9 +2676,9 @@ var DefaultColumn = {
|
|
|
2651
2676
|
const initialValue = getValue();
|
|
2652
2677
|
const { meta } = columnDef;
|
|
2653
2678
|
const tableMeta = table2.options.meta;
|
|
2654
|
-
const [value, setValue] =
|
|
2655
|
-
const [isEdit, setIsEdit] =
|
|
2656
|
-
const [showModal, setShowModal] =
|
|
2679
|
+
const [value, setValue] = useState13(initialValue);
|
|
2680
|
+
const [isEdit, setIsEdit] = useState13(false);
|
|
2681
|
+
const [showModal, setShowModal] = useState13(false);
|
|
2657
2682
|
const closeModalRef = useRef10();
|
|
2658
2683
|
closeModalRef.current = () => {
|
|
2659
2684
|
setShowModal(false);
|
|
@@ -2707,7 +2732,7 @@ var checklistWrap = "headerDropdown_checklistWrap";
|
|
|
2707
2732
|
|
|
2708
2733
|
// src/components/view/VirtualTable/ui/DateFiltration/DateFiltration.tsx
|
|
2709
2734
|
import classnames19 from "classnames";
|
|
2710
|
-
import { useEffect as useEffect7, useState as
|
|
2735
|
+
import { useEffect as useEffect7, useState as useState14 } from "react";
|
|
2711
2736
|
|
|
2712
2737
|
// src/components/view/VirtualTable/ui/DateFiltration/dateFiltration.module.css
|
|
2713
2738
|
var root19 = "dateFiltration_root";
|
|
@@ -2716,7 +2741,7 @@ var root19 = "dateFiltration_root";
|
|
|
2716
2741
|
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
2717
2742
|
function DateFiltration(props) {
|
|
2718
2743
|
const { defaultValues = [void 0, void 0], actionWithSelected } = props;
|
|
2719
|
-
const [values, setValues] =
|
|
2744
|
+
const [values, setValues] = useState14(defaultValues);
|
|
2720
2745
|
const handleChangeDates = (newValues) => {
|
|
2721
2746
|
setValues(newValues);
|
|
2722
2747
|
};
|
|
@@ -2738,7 +2763,7 @@ function DateFiltration(props) {
|
|
|
2738
2763
|
|
|
2739
2764
|
// src/components/view/VirtualTable/ui/NumberFiltration/NumberFiltration.tsx
|
|
2740
2765
|
import classnames20 from "classnames";
|
|
2741
|
-
import { useState as
|
|
2766
|
+
import { useState as useState15 } from "react";
|
|
2742
2767
|
|
|
2743
2768
|
// src/components/view/VirtualTable/ui/NumberFiltration/numberFiltration.module.css
|
|
2744
2769
|
var root20 = "numberFiltration_root";
|
|
@@ -2756,10 +2781,10 @@ var items = [
|
|
|
2756
2781
|
];
|
|
2757
2782
|
function NumberFiltration(props) {
|
|
2758
2783
|
const { defaultValues = [-Infinity, Infinity], actionWithSelected } = props;
|
|
2759
|
-
const [selectedItem, setSelectedItem] =
|
|
2784
|
+
const [selectedItem, setSelectedItem] = useState15(
|
|
2760
2785
|
defaultValues[0] === -Infinity && defaultValues[1] === Infinity ? items[0] : defaultValues[0] === defaultValues[1] ? items[3] : defaultValues[0] === -Infinity ? items[2] : defaultValues[1] === Infinity ? items[1] : items[0]
|
|
2761
2786
|
);
|
|
2762
|
-
const [values, setValues] =
|
|
2787
|
+
const [values, setValues] = useState15(defaultValues);
|
|
2763
2788
|
const handleSelect = (item3) => {
|
|
2764
2789
|
if (!!item3) {
|
|
2765
2790
|
const newValues = [...values];
|
|
@@ -3171,8 +3196,8 @@ function VirtualTable(props) {
|
|
|
3171
3196
|
showUniqueValuesCount = false
|
|
3172
3197
|
// globalFilters,
|
|
3173
3198
|
} = props;
|
|
3174
|
-
const [filterBy, setFilterBy] =
|
|
3175
|
-
const [sortBy, setSortBy] =
|
|
3199
|
+
const [filterBy, setFilterBy] = useState16([]);
|
|
3200
|
+
const [sortBy, setSortBy] = useState16([{ columnName: "isNew", direction: "desc" }]);
|
|
3176
3201
|
const tableContainerRef = useRef11(null);
|
|
3177
3202
|
const memoizedColumns = useMemo6(() => getColumns(columns), [columns]);
|
|
3178
3203
|
const memoizedData = useMemo6(() => {
|
|
@@ -3567,14 +3592,14 @@ function VirtualTable(props) {
|
|
|
3567
3592
|
}
|
|
3568
3593
|
|
|
3569
3594
|
// src/components/view/TreeView/TreeView.tsx
|
|
3570
|
-
import { memo as memo2, useCallback as useCallback8, useMemo as useMemo7, useState as
|
|
3595
|
+
import { memo as memo2, useCallback as useCallback8, useMemo as useMemo7, useState as useState18 } from "react";
|
|
3571
3596
|
|
|
3572
3597
|
// src/components/view/TreeView/treeView.module.css
|
|
3573
3598
|
var search = "treeView_search";
|
|
3574
3599
|
|
|
3575
3600
|
// src/components/view/TreeView/ui/TreeViewItem/TreeViewItem.tsx
|
|
3576
3601
|
import classNames5 from "classnames";
|
|
3577
|
-
import { memo, useEffect as useEffect9, useState as
|
|
3602
|
+
import { memo, useEffect as useEffect9, useState as useState17 } from "react";
|
|
3578
3603
|
|
|
3579
3604
|
// src/components/view/TreeView/ui/TreeViewItem/treeViewItem.module.css
|
|
3580
3605
|
var item2 = "treeViewItem_item";
|
|
@@ -3597,7 +3622,7 @@ var TreeViewItem_default = memo(function TreeViewItem({
|
|
|
3597
3622
|
startIcons,
|
|
3598
3623
|
children: children2
|
|
3599
3624
|
}) {
|
|
3600
|
-
const [isOpen, setIsOpen] =
|
|
3625
|
+
const [isOpen, setIsOpen] = useState17(false);
|
|
3601
3626
|
useEffect9(() => {
|
|
3602
3627
|
setIsOpen(!!searchValue);
|
|
3603
3628
|
}, [searchValue]);
|
|
@@ -3659,7 +3684,7 @@ var getFilteredTree = (tree, search2) => {
|
|
|
3659
3684
|
// src/components/view/TreeView/TreeView.tsx
|
|
3660
3685
|
import { Fragment as Fragment10, jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3661
3686
|
var TreeView_default = memo2(function TreeView({ data, selected: selected5, startIcons, onSelect, withSearch = false }) {
|
|
3662
|
-
const [searchValue, setSearchValue] =
|
|
3687
|
+
const [searchValue, setSearchValue] = useState18("");
|
|
3663
3688
|
const onChangeSearchValue = useCallback8((e) => setSearchValue(e.target.value), []);
|
|
3664
3689
|
const selectedValues = useMemo7(
|
|
3665
3690
|
() => selected5.reduce(
|
|
@@ -3715,11 +3740,11 @@ var valuesWithBorders = "pairs_valuesWithBorders";
|
|
|
3715
3740
|
var dimTypography = "pairs_dimTypography";
|
|
3716
3741
|
|
|
3717
3742
|
// src/components/view/Pairs/ui/TypographyWithTooltip.tsx
|
|
3718
|
-
import { useState as
|
|
3743
|
+
import { useState as useState19 } from "react";
|
|
3719
3744
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3720
3745
|
function TypographyWithTooltip(props) {
|
|
3721
3746
|
const { label: label7 } = props;
|
|
3722
|
-
const [tooltip, setTooltip] =
|
|
3747
|
+
const [tooltip, setTooltip] = useState19(label7);
|
|
3723
3748
|
return /* @__PURE__ */ jsx37(Tooltip, { label: tooltip, children: /* @__PURE__ */ jsx37(
|
|
3724
3749
|
Typography,
|
|
3725
3750
|
{
|