nntc-ui 0.0.12 → 0.0.13

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 (4) hide show
  1. package/index.css +23 -23
  2. package/index.d.ts +9 -1
  3. package/index.js +63 -36
  4. package/package.json +1 -1
package/index.css CHANGED
@@ -514,6 +514,29 @@ button[disabled] {
514
514
  overflow: auto scroll;
515
515
  }
516
516
 
517
+ /* src/components/common/ButtonsGroup/buttonsGroup.module.css */
518
+ .buttonsGroup_root {
519
+ display: flex;
520
+ align-items: center;
521
+ }
522
+ .buttonsGroup_fillEvenly > * {
523
+ flex-grow: 1;
524
+ width: 0;
525
+ }
526
+ .buttonsGroup_root > *:nth-child(n+1) {
527
+ border-top-right-radius: 0;
528
+ border-bottom-right-radius: 0;
529
+ }
530
+ .buttonsGroup_root > *:nth-child(n+2) {
531
+ margin-left: 1px;
532
+ border-top-left-radius: 0;
533
+ border-bottom-left-radius: 0;
534
+ }
535
+ .buttonsGroup_root > *:last-child {
536
+ border-top-right-radius: 4px;
537
+ border-bottom-right-radius: 4px;
538
+ }
539
+
517
540
  /* src/components/navigation/Menu/menu.module.css */
518
541
  .menu_root {
519
542
  display: flex;
@@ -692,29 +715,6 @@ button[disabled] {
692
715
  height: 0;
693
716
  }
694
717
 
695
- /* src/components/common/ButtonsGroup/buttonsGroup.module.css */
696
- .buttonsGroup_root {
697
- display: flex;
698
- align-items: center;
699
- }
700
- .buttonsGroup_fillEvenly > * {
701
- flex-grow: 1;
702
- width: 0;
703
- }
704
- .buttonsGroup_root > *:nth-child(n+1) {
705
- border-top-right-radius: 0;
706
- border-bottom-right-radius: 0;
707
- }
708
- .buttonsGroup_root > *:nth-child(n+2) {
709
- margin-left: 1px;
710
- border-top-left-radius: 0;
711
- border-bottom-left-radius: 0;
712
- }
713
- .buttonsGroup_root > *:last-child {
714
- border-top-right-radius: 4px;
715
- border-bottom-right-radius: 4px;
716
- }
717
-
718
718
  /* src/components/common/DateTime/ui/CalendarPopover/calendarPopover.module.css */
719
719
  .calendarPopover_root {
720
720
  display: flex;
package/index.d.ts CHANGED
@@ -181,11 +181,19 @@ interface Divider {
181
181
  name?: string;
182
182
  }
183
183
 
184
+ type SubButtonVariant = 'filled' | 'outlined' | 'text' | 'elevated' | 'tonal' | 'link';
184
185
  interface Item$2 {
185
186
  type: 'item';
186
187
  name: string;
187
188
  icon?: ReactNode;
188
- description?: ReactNode;
189
+ description?: string | number;
190
+ subButtons?: {
191
+ variant?: SubButtonVariant;
192
+ icon?: ReactNode;
193
+ textSecondary?: boolean;
194
+ isActive?: boolean;
195
+ onClick?: () => void;
196
+ }[];
189
197
  onClick?: () => void;
190
198
  selected?: boolean;
191
199
  disabled?: boolean;
package/index.js CHANGED
@@ -413,6 +413,22 @@ import { useContext as useContext4 } from "react";
413
413
  import classnames5 from "classnames";
414
414
  import { useCallback } from "react";
415
415
 
416
+ // src/components/common/ButtonsGroup/ButtonsGroup.tsx
417
+ import classNames from "classnames";
418
+
419
+ // src/components/common/ButtonsGroup/buttonsGroup.module.css
420
+ var buttonsGroup_default = {
421
+ root: "buttonsGroup_root",
422
+ fillEvenly: "buttonsGroup_fillEvenly"
423
+ };
424
+
425
+ // src/components/common/ButtonsGroup/ButtonsGroup.tsx
426
+ import { jsx as jsx9 } from "react/jsx-runtime";
427
+ var ButtonsGroup = (props) => {
428
+ const { children, fillEvenly, classes } = props;
429
+ return /* @__PURE__ */ jsx9("div", { className: classNames(buttonsGroup_default.root, fillEvenly && buttonsGroup_default.fillEvenly, classes?.root), children });
430
+ };
431
+
416
432
  // src/components/navigation/Menu/menu.module.css
417
433
  var menu_default = {
418
434
  root: "menu_root",
@@ -429,7 +445,7 @@ var menu_default = {
429
445
  };
430
446
 
431
447
  // src/components/navigation/Menu/Menu.tsx
432
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
448
+ import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
433
449
  function Menu(props) {
434
450
  const { items: items2, size = "medium", classes } = props;
435
451
  const handleClick = useCallback(
@@ -439,9 +455,10 @@ function Menu(props) {
439
455
  },
440
456
  []
441
457
  );
442
- return /* @__PURE__ */ jsx9("div", { className: classnames5(menu_default.root, menu_default[size], classes?.root), children: items2.map(
443
- (item, index) => item.type === "item" ? /* @__PURE__ */ jsx9(
444
- "button",
458
+ return /* @__PURE__ */ jsx10("div", { className: classnames5(menu_default.root, menu_default[size], classes?.root), children: items2.map((item, index) => {
459
+ const Component = item.type === "item" && item.subButtons?.length ? "div" : "button";
460
+ return item.type === "item" ? /* @__PURE__ */ jsx10(
461
+ Component,
445
462
  {
446
463
  tabIndex: -10,
447
464
  className: classnames5(
@@ -455,7 +472,7 @@ function Menu(props) {
455
472
  onClick: !item.disabled ? handleClick(item) : void 0,
456
473
  title: item.name,
457
474
  children: /* @__PURE__ */ jsxs4("span", { className: classnames5(menu_default.stateLayer), children: [
458
- !!item.icon && /* @__PURE__ */ jsx9(
475
+ !!item.icon && /* @__PURE__ */ jsx10(
459
476
  "span",
460
477
  {
461
478
  className: classnames5(
@@ -467,7 +484,7 @@ function Menu(props) {
467
484
  children: item.icon
468
485
  }
469
486
  ),
470
- /* @__PURE__ */ jsx9(
487
+ /* @__PURE__ */ jsx10(
471
488
  "span",
472
489
  {
473
490
  className: classnames5(
@@ -479,7 +496,7 @@ function Menu(props) {
479
496
  children: item.name
480
497
  }
481
498
  ),
482
- !!item.description && /* @__PURE__ */ jsx9(
499
+ !!item.description && /* @__PURE__ */ jsx10(
483
500
  "span",
484
501
  {
485
502
  className: classnames5(
@@ -490,20 +507,46 @@ function Menu(props) {
490
507
  ),
491
508
  children: item.description
492
509
  }
510
+ ),
511
+ !!item.subButtons?.length && /* @__PURE__ */ jsx10(
512
+ "div",
513
+ {
514
+ className: classnames5(
515
+ menu_default.itemDescription,
516
+ classes?.itemDescription,
517
+ item.selected ? classes?.itemSelectedDescription : void 0,
518
+ item.disabled ? classes?.itemDisabledDescription : void 0
519
+ ),
520
+ children: /* @__PURE__ */ jsx10(ButtonsGroup, { children: item.subButtons.map((sb, sbIndex) => /* @__PURE__ */ jsx10(
521
+ Button,
522
+ {
523
+ variant: sb.variant,
524
+ size,
525
+ textSecondary: sb.textSecondary,
526
+ isActive: sb.isActive,
527
+ icon: sb.icon,
528
+ onClick: (e) => {
529
+ e.stopPropagation();
530
+ sb.onClick?.();
531
+ }
532
+ },
533
+ `subButton-${sbIndex}`
534
+ )) })
535
+ }
493
536
  )
494
537
  ] })
495
538
  },
496
539
  `menu-item-${item.name}-${index}`
497
- ) : /* @__PURE__ */ jsx9("div", { className: classnames5(menu_default.divider, classes?.divider), children: item.name }, `menu-divider-${item.name}-${index}`)
498
- ) });
540
+ ) : /* @__PURE__ */ jsx10("div", { className: classnames5(menu_default.divider, classes?.divider), children: item.name }, `menu-divider-${item.name}-${index}`);
541
+ }) });
499
542
  }
500
543
 
501
544
  // src/components/common/Select/ui/SelectPopover/SelectPopover.tsx
502
- import { jsx as jsx10 } from "react/jsx-runtime";
545
+ import { jsx as jsx11 } from "react/jsx-runtime";
503
546
  function SelectPopover(props) {
504
547
  const { items: items2, componentSize, selectedValue, changeSelectedItem, classes } = props;
505
548
  const popoverContext = useContext4(PopoverContext);
506
- return /* @__PURE__ */ jsx10(
549
+ return /* @__PURE__ */ jsx11(
507
550
  Menu,
508
551
  {
509
552
  size: componentSize,
@@ -529,7 +572,7 @@ function SelectPopover(props) {
529
572
  }
530
573
 
531
574
  // src/components/common/Select/Select.tsx
532
- import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
575
+ import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
533
576
  function Select(props) {
534
577
  const {
535
578
  variant = "filled",
@@ -584,7 +627,7 @@ function Select(props) {
584
627
  maxWidth: fullWidth ? "100%" : void 0
585
628
  },
586
629
  children: [
587
- !!label && /* @__PURE__ */ jsx11(
630
+ !!label && /* @__PURE__ */ jsx12(
588
631
  Typography,
589
632
  {
590
633
  className: classnames6(select_default.label, classes?.label),
@@ -606,7 +649,7 @@ function Select(props) {
606
649
  classes?.wrapper
607
650
  ),
608
651
  children: [
609
- /* @__PURE__ */ jsx11(
652
+ /* @__PURE__ */ jsx12(
610
653
  "input",
611
654
  {
612
655
  ref: mergeRefs2([inputRef, ref]),
@@ -621,10 +664,10 @@ function Select(props) {
621
664
  disabled
622
665
  }
623
666
  ),
624
- !!icon && /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.icon, classes?.icon), children: icon }),
625
- !!selectedItem?.icon && /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.itemIcon, classes?.itemIcon), children: selectedItem?.icon }),
626
- /* @__PURE__ */ jsx11("span", { onClick: inputClickHandler, className: classnames6(select_default.arrow, classes?.arrow), children: /* @__PURE__ */ jsx11(Arrow, {}) }),
627
- /* @__PURE__ */ jsx11(
667
+ !!icon && /* @__PURE__ */ jsx12("span", { onClick: inputClickHandler, className: classnames6(select_default.icon, classes?.icon), children: icon }),
668
+ !!selectedItem?.icon && /* @__PURE__ */ jsx12("span", { onClick: inputClickHandler, className: classnames6(select_default.itemIcon, classes?.itemIcon), children: selectedItem?.icon }),
669
+ /* @__PURE__ */ jsx12("span", { onClick: inputClickHandler, className: classnames6(select_default.arrow, classes?.arrow), children: /* @__PURE__ */ jsx12(Arrow, {}) }),
670
+ /* @__PURE__ */ jsx12(
628
671
  Popover,
629
672
  {
630
673
  placement: "bottom-start",
@@ -633,7 +676,7 @@ function Select(props) {
633
676
  ...classes?.popover
634
677
  },
635
678
  containerOffset: 4,
636
- description: /* @__PURE__ */ jsx11(
679
+ description: /* @__PURE__ */ jsx12(
637
680
  SelectPopover,
638
681
  {
639
682
  items: items2,
@@ -643,7 +686,7 @@ function Select(props) {
643
686
  changeSelectedItem
644
687
  }
645
688
  ),
646
- children: /* @__PURE__ */ jsx11("div", { ref: popoverTargetRef, className: classnames6(select_default.popoverTarget) })
689
+ children: /* @__PURE__ */ jsx12("div", { ref: popoverTargetRef, className: classnames6(select_default.popoverTarget) })
647
690
  }
648
691
  )
649
692
  ]
@@ -677,22 +720,6 @@ import classNames2 from "classnames";
677
720
  import dayjs from "dayjs";
678
721
  import { useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useState as useState4 } from "react";
679
722
 
680
- // src/components/common/ButtonsGroup/ButtonsGroup.tsx
681
- import classNames from "classnames";
682
-
683
- // src/components/common/ButtonsGroup/buttonsGroup.module.css
684
- var buttonsGroup_default = {
685
- root: "buttonsGroup_root",
686
- fillEvenly: "buttonsGroup_fillEvenly"
687
- };
688
-
689
- // src/components/common/ButtonsGroup/ButtonsGroup.tsx
690
- import { jsx as jsx12 } from "react/jsx-runtime";
691
- var ButtonsGroup = (props) => {
692
- const { children, fillEvenly, classes } = props;
693
- return /* @__PURE__ */ jsx12("div", { className: classNames(buttonsGroup_default.root, fillEvenly && buttonsGroup_default.fillEvenly, classes?.root), children });
694
- };
695
-
696
723
  // src/components/common/DateTime/ui/CalendarPopover/calendarPopover.module.css
697
724
  var calendarPopover_default = {
698
725
  root: "calendarPopover_root",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nntc-ui",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "React UI-kit for NNTC",
5
5
  "type": "module",
6
6
  "exports": {