@nulogy/components 6.1.3 → 6.1.7

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/main.js CHANGED
@@ -16588,9 +16588,12 @@
16588
16588
  var _useTranslation = useTranslation(),
16589
16589
  t = _useTranslation.t;
16590
16590
 
16591
- return /*#__PURE__*/React__default['default'].createElement(Box, null, /*#__PURE__*/React__default['default'].createElement(Link, {
16591
+ return /*#__PURE__*/React__default['default'].createElement(Flex, {
16592
+ ml: "x2"
16593
+ }, /*#__PURE__*/React__default['default'].createElement(Link, {
16592
16594
  as: "button",
16593
16595
  color: "darkGrey",
16596
+ lineHeight: "0",
16594
16597
  hover: "blue",
16595
16598
  onClick: onClick,
16596
16599
  "aria-label": ariaLabel || t("close")
@@ -16607,12 +16610,11 @@
16607
16610
  title = _a.title,
16608
16611
  _a$type = _a.type,
16609
16612
  type = _a$type === void 0 ? "informative" : _a$type,
16610
- className = _a.className,
16611
16613
  closeAriaLabel = _a.closeAriaLabel,
16612
16614
  onClose = _a.onClose,
16613
16615
  _a$controlled = _a.controlled,
16614
16616
  controlled = _a$controlled === void 0 ? false : _a$controlled,
16615
- props = __rest(_a, ["children", "isCloseable", "title", "type", "className", "closeAriaLabel", "onClose", "controlled"]);
16617
+ props = __rest(_a, ["children", "isCloseable", "title", "type", "closeAriaLabel", "onClose", "controlled"]);
16616
16618
 
16617
16619
  var _useState = React.useState(true),
16618
16620
  isVisible = _useState[0],
@@ -16633,8 +16635,7 @@
16633
16635
  borderLeftWidth: "4px",
16634
16636
  borderLeftColor: alertColours[type].borderColor,
16635
16637
  borderLeftStyle: "solid",
16636
- role: "alert",
16637
- className: className
16638
+ role: "alert"
16638
16639
  }, props), type === "danger" && /*#__PURE__*/React__default['default'].createElement(Icon, {
16639
16640
  icon: "error",
16640
16641
  mr: "x1",
@@ -27920,36 +27921,39 @@
27920
27921
  children = _this$props.children,
27921
27922
  onTabClick = _this$props.onTabClick;
27922
27923
  var selectedIndex = this.getSelectedIndex();
27923
- var tabs = React__default['default'].Children.map(children, function (tab, index) {
27924
- return /*#__PURE__*/React__default['default'].cloneElement(tab, {
27925
- onClick: function onClick(e) {
27926
- setFocusToTab(index);
27924
+ return React__default['default'].Children.map(children, function (tab, index) {
27925
+ if (tab) {
27926
+ return /*#__PURE__*/React__default['default'].cloneElement(tab, {
27927
+ onClick: function onClick(e) {
27928
+ var _a, _b;
27927
27929
 
27928
- if (tab.props.onClick) {
27929
- tab.props.onClick(e);
27930
- }
27930
+ setFocusToTab(index);
27931
27931
 
27932
- if (onTabClick) {
27933
- onTabClick(e, index);
27934
- } else {
27935
- _this2.handleTabClick(index);
27932
+ if ((_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.onClick) {
27933
+ (_b = tab === null || tab === void 0 ? void 0 : tab.props) === null || _b === void 0 ? void 0 : _b.onClick(e);
27934
+ }
27935
+
27936
+ if (onTabClick) {
27937
+ onTabClick(e, index);
27938
+ } else {
27939
+ _this2.handleTabClick(index);
27940
+ }
27941
+ },
27942
+ onFocus: function onFocus(e) {
27943
+ e.stopPropagation();
27944
+ },
27945
+ onKeyDown: handleArrowNavigation,
27946
+ index: index,
27947
+ tabIndex: index === focusedIndex ? 0 : -1,
27948
+ selected: index === selectedIndex,
27949
+ "aria-selected": index === selectedIndex,
27950
+ fullWidth: fitted,
27951
+ ref: function ref(_ref2) {
27952
+ _this2.tabRefs[index] = _ref2;
27936
27953
  }
27937
- },
27938
- onFocus: function onFocus(e) {
27939
- e.stopPropagation();
27940
- },
27941
- onKeyDown: handleArrowNavigation,
27942
- index: index,
27943
- tabIndex: index === focusedIndex ? 0 : -1,
27944
- selected: index === selectedIndex,
27945
- "aria-selected": index === selectedIndex,
27946
- fullWidth: fitted,
27947
- ref: function ref(_ref2) {
27948
- _this2.tabRefs[index] = _ref2;
27949
- }
27950
- });
27954
+ });
27955
+ }
27951
27956
  });
27952
- return tabs;
27953
27957
  };
27954
27958
 
27955
27959
  _proto.getTabContent = function getTabContent() {
@@ -27958,6 +27962,8 @@
27958
27962
  renderTabContentOnlyWhenSelected = _this$props2.renderTabContentOnlyWhenSelected;
27959
27963
  var selectedIndex = this.getSelectedIndex();
27960
27964
  var tabContent = React__default['default'].Children.map(children, function (tab, index) {
27965
+ var _a;
27966
+
27961
27967
  var selected = index === selectedIndex;
27962
27968
 
27963
27969
  if (renderTabContentOnlyWhenSelected && !selected) {
@@ -27967,7 +27973,7 @@
27967
27973
  "aria-hidden": !selected,
27968
27974
  hidden: !selected,
27969
27975
  selected: selected
27970
- }, tab.props.children);
27976
+ }, (_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.children);
27971
27977
  }
27972
27978
  });
27973
27979
  return tabContent;
@@ -44066,9 +44072,9 @@
44066
44072
  testId = _a["data-testid"],
44067
44073
  props = __rest(_a, ["children", "element", "indicator", "maxCharacters", "showTooltip", "tooltipProps", "data-testid"]);
44068
44074
 
44069
- var innerText = children;
44075
+ var innerText = children !== null && children !== void 0 ? children : "";
44070
44076
  var requiresTruncation = innerText.length > maxCharacters;
44071
- var truncatedText = requiresTruncation ? innerText.slice(0, maxCharacters) + indicator : children;
44077
+ var truncatedText = requiresTruncation ? innerText.slice(0, maxCharacters) + indicator : innerText;
44072
44078
  var hasTooltip = showTooltip && requiresTruncation;
44073
44079
  return /*#__PURE__*/React__default['default'].createElement(MaybeTooltip, Object.assign({
44074
44080
  showTooltip: hasTooltip,
@@ -52409,6 +52415,8 @@
52409
52415
  var transitionDuration = _ref.transitionDuration,
52410
52416
  top = _ref.top,
52411
52417
  transparent = _ref.transparent,
52418
+ _ref$zIndex = _ref.zIndex,
52419
+ zIndex = _ref$zIndex === void 0 ? 799 : _ref$zIndex,
52412
52420
  onClick = _ref.onClick;
52413
52421
  return /*#__PURE__*/React__default['default'].createElement(AnimatedBox, {
52414
52422
  position: "fixed",
@@ -52416,7 +52424,7 @@
52416
52424
  bottom: "0",
52417
52425
  left: "0",
52418
52426
  right: "0",
52419
- zIndex: "799",
52427
+ zIndex: zIndex,
52420
52428
  bg: !transparent && "rgba(18, 43, 71, 0.5)",
52421
52429
  initial: {
52422
52430
  opacity: 0
@@ -52463,7 +52471,8 @@
52463
52471
  disableScroll = _a$disableScroll === void 0 ? true : _a$disableScroll,
52464
52472
  _a$hideCloseButton = _a.hideCloseButton,
52465
52473
  hideCloseButton = _a$hideCloseButton === void 0 ? false : _a$hideCloseButton,
52466
- props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton"]);
52474
+ zIndex = _a.zIndex,
52475
+ props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex"]);
52467
52476
 
52468
52477
  var closeButton = React.useRef(null);
52469
52478
 
@@ -52528,6 +52537,7 @@
52528
52537
  top: top,
52529
52538
  transparent: !overlay,
52530
52539
  transitionDuration: duration,
52540
+ zIndex: zIndex,
52531
52541
  onClick: closeOnOutsideClick && isOpen && onClose
52532
52542
  })), /*#__PURE__*/React__default['default'].createElement(AnimatedBox, Object.assign({
52533
52543
  role: "dialog",
@@ -52549,7 +52559,7 @@
52549
52559
  default: "100%",
52550
52560
  small: width
52551
52561
  } : width,
52552
- zIndex: "sidebar",
52562
+ zIndex: zIndex || "sidebar",
52553
52563
  ref: sideBarRef
52554
52564
  }, props), /*#__PURE__*/React__default['default'].createElement(Flex, {
52555
52565
  p: p,
@@ -16562,9 +16562,12 @@ var CloseButton = function CloseButton(_ref3) {
16562
16562
  var _useTranslation = useTranslation(),
16563
16563
  t = _useTranslation.t;
16564
16564
 
16565
- return /*#__PURE__*/React__default.createElement(Box, null, /*#__PURE__*/React__default.createElement(Link, {
16565
+ return /*#__PURE__*/React__default.createElement(Flex, {
16566
+ ml: "x2"
16567
+ }, /*#__PURE__*/React__default.createElement(Link, {
16566
16568
  as: "button",
16567
16569
  color: "darkGrey",
16570
+ lineHeight: "0",
16568
16571
  hover: "blue",
16569
16572
  onClick: onClick,
16570
16573
  "aria-label": ariaLabel || t("close")
@@ -16581,12 +16584,11 @@ var Alert = styled(function (_a) {
16581
16584
  title = _a.title,
16582
16585
  _a$type = _a.type,
16583
16586
  type = _a$type === void 0 ? "informative" : _a$type,
16584
- className = _a.className,
16585
16587
  closeAriaLabel = _a.closeAriaLabel,
16586
16588
  onClose = _a.onClose,
16587
16589
  _a$controlled = _a.controlled,
16588
16590
  controlled = _a$controlled === void 0 ? false : _a$controlled,
16589
- props = __rest(_a, ["children", "isCloseable", "title", "type", "className", "closeAriaLabel", "onClose", "controlled"]);
16591
+ props = __rest(_a, ["children", "isCloseable", "title", "type", "closeAriaLabel", "onClose", "controlled"]);
16590
16592
 
16591
16593
  var _useState = useState(true),
16592
16594
  isVisible = _useState[0],
@@ -16607,8 +16609,7 @@ var Alert = styled(function (_a) {
16607
16609
  borderLeftWidth: "4px",
16608
16610
  borderLeftColor: alertColours[type].borderColor,
16609
16611
  borderLeftStyle: "solid",
16610
- role: "alert",
16611
- className: className
16612
+ role: "alert"
16612
16613
  }, props), type === "danger" && /*#__PURE__*/React__default.createElement(Icon, {
16613
16614
  icon: "error",
16614
16615
  mr: "x1",
@@ -27894,36 +27895,39 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27894
27895
  children = _this$props.children,
27895
27896
  onTabClick = _this$props.onTabClick;
27896
27897
  var selectedIndex = this.getSelectedIndex();
27897
- var tabs = React__default.Children.map(children, function (tab, index) {
27898
- return /*#__PURE__*/React__default.cloneElement(tab, {
27899
- onClick: function onClick(e) {
27900
- setFocusToTab(index);
27898
+ return React__default.Children.map(children, function (tab, index) {
27899
+ if (tab) {
27900
+ return /*#__PURE__*/React__default.cloneElement(tab, {
27901
+ onClick: function onClick(e) {
27902
+ var _a, _b;
27901
27903
 
27902
- if (tab.props.onClick) {
27903
- tab.props.onClick(e);
27904
- }
27904
+ setFocusToTab(index);
27905
27905
 
27906
- if (onTabClick) {
27907
- onTabClick(e, index);
27908
- } else {
27909
- _this2.handleTabClick(index);
27906
+ if ((_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.onClick) {
27907
+ (_b = tab === null || tab === void 0 ? void 0 : tab.props) === null || _b === void 0 ? void 0 : _b.onClick(e);
27908
+ }
27909
+
27910
+ if (onTabClick) {
27911
+ onTabClick(e, index);
27912
+ } else {
27913
+ _this2.handleTabClick(index);
27914
+ }
27915
+ },
27916
+ onFocus: function onFocus(e) {
27917
+ e.stopPropagation();
27918
+ },
27919
+ onKeyDown: handleArrowNavigation,
27920
+ index: index,
27921
+ tabIndex: index === focusedIndex ? 0 : -1,
27922
+ selected: index === selectedIndex,
27923
+ "aria-selected": index === selectedIndex,
27924
+ fullWidth: fitted,
27925
+ ref: function ref(_ref2) {
27926
+ _this2.tabRefs[index] = _ref2;
27910
27927
  }
27911
- },
27912
- onFocus: function onFocus(e) {
27913
- e.stopPropagation();
27914
- },
27915
- onKeyDown: handleArrowNavigation,
27916
- index: index,
27917
- tabIndex: index === focusedIndex ? 0 : -1,
27918
- selected: index === selectedIndex,
27919
- "aria-selected": index === selectedIndex,
27920
- fullWidth: fitted,
27921
- ref: function ref(_ref2) {
27922
- _this2.tabRefs[index] = _ref2;
27923
- }
27924
- });
27928
+ });
27929
+ }
27925
27930
  });
27926
- return tabs;
27927
27931
  };
27928
27932
 
27929
27933
  _proto.getTabContent = function getTabContent() {
@@ -27932,6 +27936,8 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27932
27936
  renderTabContentOnlyWhenSelected = _this$props2.renderTabContentOnlyWhenSelected;
27933
27937
  var selectedIndex = this.getSelectedIndex();
27934
27938
  var tabContent = React__default.Children.map(children, function (tab, index) {
27939
+ var _a;
27940
+
27935
27941
  var selected = index === selectedIndex;
27936
27942
 
27937
27943
  if (renderTabContentOnlyWhenSelected && !selected) {
@@ -27941,7 +27947,7 @@ var Tabs = /*#__PURE__*/function (_React$Component) {
27941
27947
  "aria-hidden": !selected,
27942
27948
  hidden: !selected,
27943
27949
  selected: selected
27944
- }, tab.props.children);
27950
+ }, (_a = tab === null || tab === void 0 ? void 0 : tab.props) === null || _a === void 0 ? void 0 : _a.children);
27945
27951
  }
27946
27952
  });
27947
27953
  return tabContent;
@@ -44040,9 +44046,9 @@ var TruncatedTextMaxCharacters = function TruncatedTextMaxCharacters(_a) {
44040
44046
  testId = _a["data-testid"],
44041
44047
  props = __rest(_a, ["children", "element", "indicator", "maxCharacters", "showTooltip", "tooltipProps", "data-testid"]);
44042
44048
 
44043
- var innerText = children;
44049
+ var innerText = children !== null && children !== void 0 ? children : "";
44044
44050
  var requiresTruncation = innerText.length > maxCharacters;
44045
- var truncatedText = requiresTruncation ? innerText.slice(0, maxCharacters) + indicator : children;
44051
+ var truncatedText = requiresTruncation ? innerText.slice(0, maxCharacters) + indicator : innerText;
44046
44052
  var hasTooltip = showTooltip && requiresTruncation;
44047
44053
  return /*#__PURE__*/React__default.createElement(MaybeTooltip, Object.assign({
44048
44054
  showTooltip: hasTooltip,
@@ -52383,6 +52389,8 @@ var SidebarOverlay = function SidebarOverlay(_ref) {
52383
52389
  var transitionDuration = _ref.transitionDuration,
52384
52390
  top = _ref.top,
52385
52391
  transparent = _ref.transparent,
52392
+ _ref$zIndex = _ref.zIndex,
52393
+ zIndex = _ref$zIndex === void 0 ? 799 : _ref$zIndex,
52386
52394
  onClick = _ref.onClick;
52387
52395
  return /*#__PURE__*/React__default.createElement(AnimatedBox, {
52388
52396
  position: "fixed",
@@ -52390,7 +52398,7 @@ var SidebarOverlay = function SidebarOverlay(_ref) {
52390
52398
  bottom: "0",
52391
52399
  left: "0",
52392
52400
  right: "0",
52393
- zIndex: "799",
52401
+ zIndex: zIndex,
52394
52402
  bg: !transparent && "rgba(18, 43, 71, 0.5)",
52395
52403
  initial: {
52396
52404
  opacity: 0
@@ -52437,7 +52445,8 @@ var Sidebar = function Sidebar(_a) {
52437
52445
  disableScroll = _a$disableScroll === void 0 ? true : _a$disableScroll,
52438
52446
  _a$hideCloseButton = _a.hideCloseButton,
52439
52447
  hideCloseButton = _a$hideCloseButton === void 0 ? false : _a$hideCloseButton,
52440
- props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton"]);
52448
+ zIndex = _a.zIndex,
52449
+ props = __rest(_a, ["p", "width", "children", "onClose", "title", "isOpen", "footer", "closeButtonTestId", "closeButtonAriaLabel", "offset", "triggerRef", "duration", "top", "closeOnOutsideClick", "overlay", "disableScroll", "hideCloseButton", "zIndex"]);
52441
52450
 
52442
52451
  var closeButton = useRef(null);
52443
52452
 
@@ -52502,6 +52511,7 @@ var Sidebar = function Sidebar(_a) {
52502
52511
  top: top,
52503
52512
  transparent: !overlay,
52504
52513
  transitionDuration: duration,
52514
+ zIndex: zIndex,
52505
52515
  onClick: closeOnOutsideClick && isOpen && onClose
52506
52516
  })), /*#__PURE__*/React__default.createElement(AnimatedBox, Object.assign({
52507
52517
  role: "dialog",
@@ -52523,7 +52533,7 @@ var Sidebar = function Sidebar(_a) {
52523
52533
  default: "100%",
52524
52534
  small: width
52525
52535
  } : width,
52526
- zIndex: "sidebar",
52536
+ zIndex: zIndex || "sidebar",
52527
52537
  ref: sideBarRef
52528
52538
  }, props), /*#__PURE__*/React__default.createElement(Flex, {
52529
52539
  p: p,
@@ -11,5 +11,5 @@ export declare type AlertProps = BoxProps & {
11
11
  controlled?: boolean;
12
12
  style?: React.CSSProperties;
13
13
  };
14
- declare const Alert: import("styled-components").StyledComponent<({ children, isCloseable, title, type, className, closeAriaLabel, onClose, controlled, ...props }: AlertProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
14
+ declare const Alert: import("styled-components").StyledComponent<({ children, isCloseable, title, type, closeAriaLabel, onClose, controlled, ...props }: AlertProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
15
15
  export default Alert;
@@ -16,5 +16,5 @@ declare type SidebarProps = AnimatedBoxProps & {
16
16
  disableScroll?: boolean;
17
17
  hideCloseButton?: boolean;
18
18
  };
19
- declare const Sidebar: ({ p, width, children, onClose, title, isOpen, footer, closeButtonTestId, closeButtonAriaLabel, offset, triggerRef, duration, top, closeOnOutsideClick, overlay, disableScroll, hideCloseButton, ...props }: SidebarProps) => JSX.Element;
19
+ declare const Sidebar: ({ p, width, children, onClose, title, isOpen, footer, closeButtonTestId, closeButtonAriaLabel, offset, triggerRef, duration, top, closeOnOutsideClick, overlay, disableScroll, hideCloseButton, zIndex, ...props }: SidebarProps) => JSX.Element;
20
20
  export default Sidebar;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { ColorProps, SpaceProps, LayoutProps } from "styled-system";
2
+ import { ColorProps, SpaceProps, LayoutProps, TypographyProps } from "styled-system";
3
3
  import { DefaultNDSThemeType } from "../theme.type";
4
- export declare type LinkProps = React.ComponentPropsWithRef<"a"> & ColorProps & SpaceProps & LayoutProps & {
4
+ export declare type LinkProps = React.ComponentPropsWithRef<"a"> & ColorProps & SpaceProps & LayoutProps & TypographyProps & {
5
5
  className?: string;
6
6
  underline?: boolean;
7
7
  hover?: string;
@@ -11,10 +11,6 @@ declare type TabScrollIndicatorsProps = {
11
11
  declare type TabScrollIndicatorsState = {
12
12
  contentHiddenLeft: boolean;
13
13
  contentHiddenRight: boolean;
14
- contentHiddenLeft: boolean;
15
- contentHiddenRight: boolean;
16
- contentHiddenLeft: boolean;
17
- contentHiddenRight: boolean;
18
14
  };
19
15
  declare class TabScrollIndicators extends React.Component<TabScrollIndicatorsProps, TabScrollIndicatorsState> {
20
16
  constructor(props: any);
@@ -9,7 +9,6 @@ export declare type TabsProps = {
9
9
  };
10
10
  export declare type TabsState = {
11
11
  selectedIndex: any;
12
- selectedIndex: any;
13
12
  };
14
13
  declare class Tabs extends React.Component<TabsProps, TabsState> {
15
14
  constructor(props: any);
@@ -51,3 +51,9 @@ export declare const WithContentLoadedOnSelection: {
51
51
  name: string;
52
52
  };
53
53
  };
54
+ export declare const WithConditionallyRenderedTabs: {
55
+ (): JSX.Element;
56
+ story: {
57
+ name: string;
58
+ };
59
+ };
@@ -22,6 +22,12 @@ export declare const WithCloseButton: {
22
22
  name: string;
23
23
  };
24
24
  };
25
+ export declare const CloseableWithMultiLineMessage: {
26
+ (): JSX.Element;
27
+ story: {
28
+ name: string;
29
+ };
30
+ };
25
31
  export declare const MultipleCloseableToastsExample: {
26
32
  (): JSX.Element;
27
33
  story: {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import PropTypes from "prop-types";
3
- import { TooltipProps } from '../Tooltip/Tooltip';
3
+ import { TooltipProps } from "../Tooltip/Tooltip";
4
4
  declare type TruncatedTextProps = {
5
5
  children?: string;
6
6
  indicator?: string;
@@ -45,3 +45,9 @@ export declare const FullWidth: {
45
45
  name: string;
46
46
  };
47
47
  };
48
+ export declare const WithoutChildren: {
49
+ (): JSX.Element;
50
+ story: {
51
+ name: string;
52
+ };
53
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "6.1.3",
3
+ "version": "6.1.7",
4
4
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
5
5
  "private": false,
6
6
  "publishConfig": {