nntc-ui 0.0.35 → 0.0.37

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.
Files changed (3) hide show
  1. package/index.d.ts +3 -0
  2. package/index.js +62 -36
  3. 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 { description, clickable, initialOpen, placement, wrapTrigger, containerOffset, root: root22, children: children2, classes } = props;
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 { useCallback as useCallback6, useMemo as useMemo3, useRef as useRef7 } from "react";
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
- popoverTargetRef?.current?.click();
1745
+ if (!disabled2) {
1746
+ setIsPopoverOpen((prev) => !prev);
1747
+ }
1727
1748
  },
1728
- [popoverTargetRef]
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],
@@ -1784,7 +1806,8 @@ function MultiSelect(props) {
1784
1806
  value: title2,
1785
1807
  onClick: inputClickHandler,
1786
1808
  disabled: disabled2,
1787
- title: activeItems.map((i) => i.name).join(", ")
1809
+ title: activeItems.map((i) => i.name).join(", "),
1810
+ autoComplete: "off"
1788
1811
  }
1789
1812
  ),
1790
1813
  !!icon6 && /* @__PURE__ */ jsx20("span", { onClick: inputClickHandler, className: classnames11(icon5, classes?.icon), children: icon6 }),
@@ -1794,11 +1817,14 @@ function MultiSelect(props) {
1794
1817
  Popover,
1795
1818
  {
1796
1819
  placement: "bottom-start",
1820
+ open: isPopoverOpen,
1821
+ onOpenChange: setIsPopoverOpen,
1797
1822
  classes: {
1798
1823
  content: classnames11(popoverContent3, classes?.popoverContent),
1799
1824
  ...classes?.popover
1800
1825
  },
1801
1826
  containerOffset: 4,
1827
+ root: popoverInComponent ? wrapperRef.current : void 0,
1802
1828
  description: /* @__PURE__ */ jsx20(
1803
1829
  SelectPopover2,
1804
1830
  {
@@ -1830,7 +1856,7 @@ function MultiSelect(props) {
1830
1856
 
1831
1857
  // src/components/common/Checklist/Checklist.tsx
1832
1858
  import classnames12 from "classnames";
1833
- import { useState as useState8 } from "react";
1859
+ import { useState as useState9 } from "react";
1834
1860
 
1835
1861
  // src/components/common/Checklist/checklist.module.css
1836
1862
  var root13 = "checklist_root";
@@ -1856,8 +1882,8 @@ import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-r
1856
1882
  function Checklist(props) {
1857
1883
  const { items: items2, selected: selected5, disableSearch, isDisabled, actionWithSelected, onChangeItem, classes } = props;
1858
1884
  const { t } = useTranslation();
1859
- const [filterSubstring, setFilterSubstring] = useState8("");
1860
- const [selectedItems, setSelectedItems] = useState8(selected5);
1885
+ const [filterSubstring, setFilterSubstring] = useState9("");
1886
+ const [selectedItems, setSelectedItems] = useState9(selected5);
1861
1887
  const filteredItems = filterItems2(items2, filterSubstring, selectedItems);
1862
1888
  const handleClick = (item3) => {
1863
1889
  const value = !selected5[item3.value];
@@ -1999,11 +2025,11 @@ function Layout(props) {
1999
2025
 
2000
2026
  // src/components/navigation/Tabs/Tabs.tsx
2001
2027
  import classnames17 from "classnames";
2002
- import { useEffect as useEffect5, useState as useState11 } from "react";
2028
+ import { useEffect as useEffect5, useState as useState12 } from "react";
2003
2029
 
2004
2030
  // src/components/view/Tooltip/Tooltip.tsx
2005
2031
  import classnames16 from "classnames";
2006
- import { useRef as useRef8, useState as useState10 } from "react";
2032
+ import { useRef as useRef8, useState as useState11 } from "react";
2007
2033
 
2008
2034
  // src/components/view/Tooltip/tooltip.module.css
2009
2035
  var tooltip_exports = {};
@@ -2141,7 +2167,7 @@ import {
2141
2167
  useInteractions as useInteractions2,
2142
2168
  useRole as useRole2
2143
2169
  } from "@floating-ui/react";
2144
- import { useMemo as useMemo4, useState as useState9 } from "react";
2170
+ import { useMemo as useMemo4, useState as useState10 } from "react";
2145
2171
  function useTooltip(props = {}) {
2146
2172
  const {
2147
2173
  initialOpen = false,
@@ -2152,7 +2178,7 @@ function useTooltip(props = {}) {
2152
2178
  arrowRef,
2153
2179
  root: root22
2154
2180
  } = props;
2155
- const [uncontrolledOpen, setUncontrolledOpen] = useState9(initialOpen);
2181
+ const [uncontrolledOpen, setUncontrolledOpen] = useState10(initialOpen);
2156
2182
  const open = controlledOpen ?? uncontrolledOpen;
2157
2183
  const setOpen = setControlledOpen ?? setUncontrolledOpen;
2158
2184
  const data = useFloating2({
@@ -2246,7 +2272,7 @@ function Tooltip(props) {
2246
2272
  children: children2,
2247
2273
  classes
2248
2274
  } = props;
2249
- const [showTooltip, setShowTooltip] = useState10(false);
2275
+ const [showTooltip, setShowTooltip] = useState11(false);
2250
2276
  const arrowRef = useRef8(null);
2251
2277
  if (!label7) {
2252
2278
  return children2;
@@ -2363,8 +2389,8 @@ function Tabs(props) {
2363
2389
  value,
2364
2390
  classes
2365
2391
  } = props;
2366
- const [isMounted, setIsMounted] = useState11(false);
2367
- const [selectedTab, setSelectedTab] = useState11(defaultSelected);
2392
+ const [isMounted, setIsMounted] = useState12(false);
2393
+ const [selectedTab, setSelectedTab] = useState12(defaultSelected);
2368
2394
  const currentValue = useExternalState ? value : selectedTab;
2369
2395
  const handleClick = (item3) => () => {
2370
2396
  if (item3.isDisabled) {
@@ -2472,7 +2498,7 @@ import { flexRender, getCoreRowModel, useReactTable } from "@tanstack/react-tabl
2472
2498
  import { defaultRangeExtractor, useVirtualizer } from "@tanstack/react-virtual";
2473
2499
  import classnames22 from "classnames";
2474
2500
  import dayjs4 from "dayjs";
2475
- import { Fragment as Fragment8, useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef11, useState as useState15 } from "react";
2501
+ import { Fragment as Fragment8, useCallback as useCallback7, useEffect as useEffect8, useMemo as useMemo6, useRef as useRef11, useState as useState16 } from "react";
2476
2502
 
2477
2503
  // src/utils/toFirstLetterUpperCase.ts
2478
2504
  var toFirstLetterUpperCase = (name) => {
@@ -2484,7 +2510,7 @@ var defaultRowHeight = 32;
2484
2510
 
2485
2511
  // src/components/view/VirtualTable/ui/DefaultColumn/DefaultColumn.tsx
2486
2512
  import classnames18 from "classnames";
2487
- import { useEffect as useEffect6, useRef as useRef10, useState as useState12 } from "react";
2513
+ import { useEffect as useEffect6, useRef as useRef10, useState as useState13 } from "react";
2488
2514
 
2489
2515
  // src/components/view/Modal/Modal.tsx
2490
2516
  import { forwardRef as forwardRef7, useRef as useRef9 } from "react";
@@ -2651,9 +2677,9 @@ var DefaultColumn = {
2651
2677
  const initialValue = getValue();
2652
2678
  const { meta } = columnDef;
2653
2679
  const tableMeta = table2.options.meta;
2654
- const [value, setValue] = useState12(initialValue);
2655
- const [isEdit, setIsEdit] = useState12(false);
2656
- const [showModal, setShowModal] = useState12(false);
2680
+ const [value, setValue] = useState13(initialValue);
2681
+ const [isEdit, setIsEdit] = useState13(false);
2682
+ const [showModal, setShowModal] = useState13(false);
2657
2683
  const closeModalRef = useRef10();
2658
2684
  closeModalRef.current = () => {
2659
2685
  setShowModal(false);
@@ -2707,7 +2733,7 @@ var checklistWrap = "headerDropdown_checklistWrap";
2707
2733
 
2708
2734
  // src/components/view/VirtualTable/ui/DateFiltration/DateFiltration.tsx
2709
2735
  import classnames19 from "classnames";
2710
- import { useEffect as useEffect7, useState as useState13 } from "react";
2736
+ import { useEffect as useEffect7, useState as useState14 } from "react";
2711
2737
 
2712
2738
  // src/components/view/VirtualTable/ui/DateFiltration/dateFiltration.module.css
2713
2739
  var root19 = "dateFiltration_root";
@@ -2716,7 +2742,7 @@ var root19 = "dateFiltration_root";
2716
2742
  import { jsx as jsx31 } from "react/jsx-runtime";
2717
2743
  function DateFiltration(props) {
2718
2744
  const { defaultValues = [void 0, void 0], actionWithSelected } = props;
2719
- const [values, setValues] = useState13(defaultValues);
2745
+ const [values, setValues] = useState14(defaultValues);
2720
2746
  const handleChangeDates = (newValues) => {
2721
2747
  setValues(newValues);
2722
2748
  };
@@ -2738,7 +2764,7 @@ function DateFiltration(props) {
2738
2764
 
2739
2765
  // src/components/view/VirtualTable/ui/NumberFiltration/NumberFiltration.tsx
2740
2766
  import classnames20 from "classnames";
2741
- import { useState as useState14 } from "react";
2767
+ import { useState as useState15 } from "react";
2742
2768
 
2743
2769
  // src/components/view/VirtualTable/ui/NumberFiltration/numberFiltration.module.css
2744
2770
  var root20 = "numberFiltration_root";
@@ -2756,10 +2782,10 @@ var items = [
2756
2782
  ];
2757
2783
  function NumberFiltration(props) {
2758
2784
  const { defaultValues = [-Infinity, Infinity], actionWithSelected } = props;
2759
- const [selectedItem, setSelectedItem] = useState14(
2785
+ const [selectedItem, setSelectedItem] = useState15(
2760
2786
  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
2787
  );
2762
- const [values, setValues] = useState14(defaultValues);
2788
+ const [values, setValues] = useState15(defaultValues);
2763
2789
  const handleSelect = (item3) => {
2764
2790
  if (!!item3) {
2765
2791
  const newValues = [...values];
@@ -3171,8 +3197,8 @@ function VirtualTable(props) {
3171
3197
  showUniqueValuesCount = false
3172
3198
  // globalFilters,
3173
3199
  } = props;
3174
- const [filterBy, setFilterBy] = useState15([]);
3175
- const [sortBy, setSortBy] = useState15([{ columnName: "isNew", direction: "desc" }]);
3200
+ const [filterBy, setFilterBy] = useState16([]);
3201
+ const [sortBy, setSortBy] = useState16([{ columnName: "isNew", direction: "desc" }]);
3176
3202
  const tableContainerRef = useRef11(null);
3177
3203
  const memoizedColumns = useMemo6(() => getColumns(columns), [columns]);
3178
3204
  const memoizedData = useMemo6(() => {
@@ -3567,14 +3593,14 @@ function VirtualTable(props) {
3567
3593
  }
3568
3594
 
3569
3595
  // src/components/view/TreeView/TreeView.tsx
3570
- import { memo as memo2, useCallback as useCallback8, useMemo as useMemo7, useState as useState17 } from "react";
3596
+ import { memo as memo2, useCallback as useCallback8, useMemo as useMemo7, useState as useState18 } from "react";
3571
3597
 
3572
3598
  // src/components/view/TreeView/treeView.module.css
3573
3599
  var search = "treeView_search";
3574
3600
 
3575
3601
  // src/components/view/TreeView/ui/TreeViewItem/TreeViewItem.tsx
3576
3602
  import classNames5 from "classnames";
3577
- import { memo, useEffect as useEffect9, useState as useState16 } from "react";
3603
+ import { memo, useEffect as useEffect9, useState as useState17 } from "react";
3578
3604
 
3579
3605
  // src/components/view/TreeView/ui/TreeViewItem/treeViewItem.module.css
3580
3606
  var item2 = "treeViewItem_item";
@@ -3597,7 +3623,7 @@ var TreeViewItem_default = memo(function TreeViewItem({
3597
3623
  startIcons,
3598
3624
  children: children2
3599
3625
  }) {
3600
- const [isOpen, setIsOpen] = useState16(false);
3626
+ const [isOpen, setIsOpen] = useState17(false);
3601
3627
  useEffect9(() => {
3602
3628
  setIsOpen(!!searchValue);
3603
3629
  }, [searchValue]);
@@ -3659,7 +3685,7 @@ var getFilteredTree = (tree, search2) => {
3659
3685
  // src/components/view/TreeView/TreeView.tsx
3660
3686
  import { Fragment as Fragment10, jsx as jsx36, jsxs as jsxs22 } from "react/jsx-runtime";
3661
3687
  var TreeView_default = memo2(function TreeView({ data, selected: selected5, startIcons, onSelect, withSearch = false }) {
3662
- const [searchValue, setSearchValue] = useState17("");
3688
+ const [searchValue, setSearchValue] = useState18("");
3663
3689
  const onChangeSearchValue = useCallback8((e) => setSearchValue(e.target.value), []);
3664
3690
  const selectedValues = useMemo7(
3665
3691
  () => selected5.reduce(
@@ -3715,11 +3741,11 @@ var valuesWithBorders = "pairs_valuesWithBorders";
3715
3741
  var dimTypography = "pairs_dimTypography";
3716
3742
 
3717
3743
  // src/components/view/Pairs/ui/TypographyWithTooltip.tsx
3718
- import { useState as useState18 } from "react";
3744
+ import { useState as useState19 } from "react";
3719
3745
  import { jsx as jsx37 } from "react/jsx-runtime";
3720
3746
  function TypographyWithTooltip(props) {
3721
3747
  const { label: label7 } = props;
3722
- const [tooltip, setTooltip] = useState18(label7);
3748
+ const [tooltip, setTooltip] = useState19(label7);
3723
3749
  return /* @__PURE__ */ jsx37(Tooltip, { label: tooltip, children: /* @__PURE__ */ jsx37(
3724
3750
  Typography,
3725
3751
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nntc-ui",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "author": "NNTC",
5
5
  "description": "React UI-kit for NNTC",
6
6
  "type": "module",