@nulogy/components 15.4.1 → 16.0.0

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.
@@ -44,7 +44,7 @@ const Sheet = styled(motion(ReachDialogContent)).withConfig({
44
44
  background: "white",
45
45
  boxShadow: theme.shadows.large,
46
46
  }), compose(...styleFns));
47
- const ContentContainer = styled.div((_) => ({
47
+ const ContentContainer = styled.div(() => ({
48
48
  overflowY: "auto",
49
49
  flex: 1,
50
50
  WebkitOverflowScrolling: "touch",
@@ -17,9 +17,7 @@ const MenuTrigger = ({ menuData, name, color, hoverColor, hoverBackground, "aria
17
17
  name,
18
18
  "aria-label": ariaLabel,
19
19
  };
20
- return (
21
- // @ts-ignore
22
- React.createElement(NavBarDropdownMenu, { ...props, placement: "bottom-start", modifiers: {
20
+ return (React.createElement(NavBarDropdownMenu, { ...props, placement: "bottom-start", modifiers: {
23
21
  flip: { behavior: ["bottom"] },
24
22
  setPopperWidth: {
25
23
  enabled: true,
@@ -11,7 +11,7 @@ type MenuData = {
11
11
  type BaseMobileMenuProps = {
12
12
  menuData: MenuData;
13
13
  subtext?: string;
14
- closeMenu?: Function;
14
+ closeMenu?: React.MouseEventHandler<HTMLElement>;
15
15
  themeColorObject?: ThemeColorObject;
16
16
  showNulogyLogo?: boolean;
17
17
  };
@@ -16,7 +16,6 @@ const BrandingWrap = styled.div(({ theme }) => ({
16
16
  color: theme.colors.white,
17
17
  marginBottom: theme.space.x1,
18
18
  }));
19
- // eslint-disable-next-line no-mixed-operators
20
19
  const getPaddingLeft = (layer) => `${24 * layer + 24}px`;
21
20
  const getSharedStyles = (theme) => ({
22
21
  display: "flex",
@@ -67,7 +66,6 @@ const renderMenuLink = (menuItem, linkOnClick, themeColorObject, layer) => {
67
66
  href: menuItem.href,
68
67
  as: menuItem.as,
69
68
  to: menuItem.to,
70
- // eslint-disable-next-line no-mixed-operators
71
69
  pl: layer === 0 ? getPaddingLeft(layer) : `${24 * layer + 20}px`,
72
70
  mb: "x1",
73
71
  target: menuItem.openInNew ? "_blank" : undefined,
@@ -4,7 +4,6 @@ import { DetectOutsideClick, withMenuState, PopperArrow } from "../utils";
4
4
  import DropdownMenuContainer from "../DropdownMenu/DropdownMenuContainer";
5
5
  class StatelessNavBarDropdownMenuClass extends React.Component {
6
6
  }
7
- /* eslint-disable react/destructuring-assignment */
8
7
  class StatelessNavBarDropdownMenu extends StatelessNavBarDropdownMenuClass {
9
8
  constructor(props) {
10
9
  super(props);
@@ -60,29 +59,33 @@ class StatelessNavBarDropdownMenu extends StatelessNavBarDropdownMenuClass {
60
59
  this.setTriggerRef(node);
61
60
  },
62
61
  })),
63
- isOpen && (React.createElement(Popper, { placement: placement, modifiers: modifiers }, (popperProps) => (React.createElement(React.Fragment, null,
64
- React.createElement(DropdownMenuContainer, { ...popperProps, placement: placement, showArrow: showArrow, ...this.menuEventHandlers(), ref: (node) => {
65
- if (typeof popperProps.ref === "function") {
66
- popperProps.ref(node);
67
- }
68
- this.setMenuRef(node);
69
- }, onMouseDown: (e) => {
70
- e.preventDefault();
71
- e.target.focus();
72
- }, ...dropdownMenuContainerEventHandlers({
73
- openMenu,
74
- closeMenu,
75
- }) },
76
- React.createElement(PopperArrow, { ...popperProps.arrowProps, placement: placement, ref: popperProps.arrowProps.ref, backgroundColor: "white", borderColor: "white" }),
77
- React.createElement(DetectOutsideClick, { onClick: this.handleOutsideClick, clickRef: [this.menuRef, this.triggerRef] }),
78
- childrenFnc({
79
- closeMenu,
80
- openMenu,
81
- }))))))));
62
+ isOpen && (React.createElement(Popper, { placement: placement, modifiers: modifiers }, (popperProps) => {
63
+ const { ref: popperRef, style, placement: popperPlacement } = popperProps;
64
+ return (React.createElement(React.Fragment, null,
65
+ React.createElement(DropdownMenuContainer, { dataPlacement: popperPlacement, style: style, placement: placement, showArrow: showArrow, ...this.menuEventHandlers(), ...{
66
+ ref: (node) => {
67
+ if (typeof popperRef === "function") {
68
+ popperRef(node);
69
+ }
70
+ this.setMenuRef(node);
71
+ },
72
+ }, onMouseDown: (e) => {
73
+ e.preventDefault();
74
+ e.target.focus();
75
+ }, ...dropdownMenuContainerEventHandlers({
76
+ openMenu,
77
+ closeMenu,
78
+ }) },
79
+ React.createElement(PopperArrow, { ...popperProps.arrowProps, placement: placement, ref: popperProps.arrowProps.ref, backgroundColor: "white", borderColor: "white" }),
80
+ React.createElement(DetectOutsideClick, { onClick: this.handleOutsideClick, clickRef: [this.menuRef, this.triggerRef] }),
81
+ childrenFnc({
82
+ closeMenu,
83
+ openMenu,
84
+ }))));
85
+ }))));
82
86
  }
83
87
  }
84
- /* eslint-enable react/destructuring-assignment */
85
- // @ts-ignore
88
+ // @ts-expect-error - defaultProps is not recognized on functional components in newer React types
86
89
  StatelessNavBarDropdownMenu.defaultProps = {
87
90
  showArrow: true,
88
91
  placement: "bottom-start",
@@ -91,7 +94,7 @@ StatelessNavBarDropdownMenu.defaultProps = {
91
94
  dropdownMenuContainerEventHandlers: () => { },
92
95
  };
93
96
  const NavBarDropdownMenu = withMenuState(StatelessNavBarDropdownMenu);
94
- // @ts-ignore
97
+ // @ts-expect-error - defaultProps is not recognized on functional components in newer React types
95
98
  NavBarDropdownMenu.defaultProps = {
96
99
  showDelay: "0",
97
100
  hideDelay: "100",
@@ -47,7 +47,6 @@ const MenuIcon = ({ isOpen }) => {
47
47
  const title = isOpen ? t("close menu") : t("open menu");
48
48
  return React.createElement(Icon, { icon: icon, title: title });
49
49
  };
50
- /* eslint-disable react/destructuring-assignment */
51
50
  const SmallNavBarNoState = ({ menuData, menuState: { isOpen, toggleMenu, closeMenu }, subtext, environment, showNulogyLogo, breakpointLower = "small", themeColorObject, navBarHeight, logo, renderMenuButton, ...props }) => {
52
51
  const navRef = React.useRef(null);
53
52
  useEffect(() => {
@@ -74,7 +73,6 @@ const SmallNavBarNoState = ({ menuData, menuState: { isOpen, toggleMenu, closeMe
74
73
  React.createElement(MenuIcon, { isOpen: isOpen })))))),
75
74
  isOpen && (React.createElement(MobileMenu, { themeColorObject: themeColorObject, subtext: subtext, menuData: menuData, closeMenu: closeMenu, showNulogyLogo: showNulogyLogo }))));
76
75
  };
77
- /* eslint-enable react/destructuring-assignment */
78
76
  const SmallNavBar = withMenuState(SmallNavBarNoState);
79
77
  /** @deprecated The BrandedNavBar component is deprecated. Use the Navigation component instead. */
80
78
  export default SmallNavBar;
@@ -69,10 +69,14 @@ export const SetToDisabled = () => (React.createElement(DropdownMenu, { disabled
69
69
  SetToDisabled.story = {
70
70
  name: "Set to disabled",
71
71
  };
72
- export const WithConditionallyRenderedMenuItems = () => (React.createElement(DropdownMenu, null,
73
- React.createElement(DropdownButton, { onClick: () => { } }, "Item A"),
74
- false && React.createElement(DropdownButton, { onClick: () => { } }, "Conditional Item B"),
75
- true && React.createElement(DropdownButton, { onClick: () => { } }, "Conditional Item C")));
72
+ export const WithConditionallyRenderedMenuItems = () => {
73
+ const showItemB = false;
74
+ const showItemC = true;
75
+ return (React.createElement(DropdownMenu, null,
76
+ React.createElement(DropdownButton, { onClick: () => { } }, "Item A"),
77
+ showItemB && React.createElement(DropdownButton, { onClick: () => { } }, "Conditional Item B"),
78
+ showItemC && React.createElement(DropdownButton, { onClick: () => { } }, "Conditional Item C")));
79
+ };
76
80
  export const WithRenderProps = () => (React.createElement(DropdownMenu, null, ({ closeMenu, openMenu }) => (React.createElement(React.Fragment, null,
77
81
  React.createElement(DropdownButton, { onClick: (e) => closeMenu(e) }, "Close menu"),
78
82
  React.createElement(DropdownButton, { onClick: (e) => openMenu(e) }, "Open menu")))));
@@ -56,7 +56,11 @@ export const NavigationMenuSubList = styled(RadixNavigationMenu.List) `
56
56
  display: none;
57
57
  }
58
58
  `;
59
- const Button = React.forwardRef(({ onPointerEnter: _, onPointerLeave: __, onPointerMove: ___, ...props }, forwardedRef) => {
59
+ const Button = React.forwardRef(({ onPointerEnter, onPointerLeave, onPointerMove, ...props }, forwardedRef) => {
60
+ // These props are intentionally ignored to prevent pointer events from interfering with keyboard navigation
61
+ void onPointerEnter;
62
+ void onPointerLeave;
63
+ void onPointerMove;
60
64
  return React.createElement("button", { ...props, ref: forwardedRef });
61
65
  });
62
66
  Button.displayName = "Button";
@@ -89,7 +89,6 @@ const Popper = React.forwardRef(({ id, trigger, children, backgroundColor, borde
89
89
  },
90
90
  });
91
91
  return React.cloneElement(transformedElement, {
92
- // eslint-disable-next-line react/no-array-index-key
93
92
  key: i,
94
93
  });
95
94
  });
@@ -19,8 +19,6 @@ const RangeContainer = ({ startComponent, endComponent, errorMessages = [], labe
19
19
  React.createElement(Flex, { px: "half", alignItems: "flex-end", alignSelf: "flex-end" },
20
20
  React.createElement(Text, { lineHeight: variant === "touch" ? "56px" : "38px" }, "-")),
21
21
  React.createElement(Flex, null, endComponent)),
22
- errorMessages.map((errorMessage, i) => (
23
- // eslint-disable-next-line react/no-array-index-key
24
- React.createElement(InlineValidation, { key: i, errorMessage: errorMessage })))));
22
+ errorMessages.map((errorMessage, i) => (React.createElement(InlineValidation, { key: i, errorMessage: errorMessage })))));
25
23
  };
26
24
  export default RangeContainer;
@@ -52,4 +52,3 @@ export declare const WithContentLoadedOnSelection: {
52
52
  name: string;
53
53
  };
54
54
  };
55
- export declare const WithConditionallyRenderedTabs: () => React.JSX.Element;
@@ -102,8 +102,3 @@ export const WithContentLoadedOnSelection = () => (React.createElement(Tabs, { r
102
102
  WithContentLoadedOnSelection.story = {
103
103
  name: "with content loaded on selection",
104
104
  };
105
- export const WithConditionallyRenderedTabs = () => (React.createElement(Tabs, null,
106
- false && React.createElement(Tab, { label: "Hidden 2" }, "Hidden tab 1"),
107
- true && React.createElement(Tab, { label: "Shown 1" }, "Shown tab 1"),
108
- false && React.createElement(Tab, { label: "Hidden 2" }, "Hidden tab 2"),
109
- true && React.createElement(Tab, { label: "Shown 2" }, "Shown tab 2")));
@@ -4,9 +4,13 @@ import { ComponentVariant } from "../NDSProvider/ComponentVariantContext";
4
4
  declare const TimeRange: React.ForwardRefExoticComponent<Omit<SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & {
5
5
  variant?: ComponentVariant;
6
6
  timeFormat?: string;
7
- onRangeChange?: Function;
8
- onStartTimeChange?: Function;
9
- onEndTimeChange?: Function;
7
+ onRangeChange?: (range: {
8
+ startTime?: string;
9
+ endTime?: string;
10
+ error?: string;
11
+ }) => void;
12
+ onStartTimeChange?: (label: string) => void;
13
+ onEndTimeChange?: (label: string) => void;
10
14
  ref?: React.MutableRefObject<unknown>;
11
15
  errorMessage?: string;
12
16
  defaultStartTime?: string;
@@ -22,7 +22,7 @@ const TimeRange = forwardRef(({ timeFormat, onRangeChange, onStartTimeChange, on
22
22
  ...inputRef1,
23
23
  focus: () => {
24
24
  if (inputRef1.current) {
25
- // @ts-ignore
25
+ // @ts-expect-error - focus method exists on input elements but type may not be narrowed correctly
26
26
  inputRef1.current.focus();
27
27
  }
28
28
  },
@@ -31,7 +31,7 @@ const TimeRange = forwardRef(({ timeFormat, onRangeChange, onStartTimeChange, on
31
31
  ...inputRef2,
32
32
  focus: () => {
33
33
  if (inputRef2.current) {
34
- // @ts-ignore
34
+ // @ts-expect-error - focus method exists on input elements but type may not be narrowed correctly
35
35
  inputRef2.current.focus();
36
36
  }
37
37
  },
@@ -73,9 +73,7 @@ export const Toast = ({ triggered = false, isCloseable = false, showDuration = T
73
73
  const handleCloseButtonClick = () => {
74
74
  hideToast(0);
75
75
  };
76
- return (React.createElement(AnimatePresence, { initial: false }, visible && (React.createElement(AnimatedBox, { onMouseEnter: onMouseIn,
77
- /* @ts-ignore */
78
- onFocus: onMouseIn, onMouseLeave: onMouseOut, onBlur: onMouseOut, position: "fixed", bottom: "0", left: "0", right: "0", marginLeft: "auto", marginRight: "auto", width: "fit-content", zIndex: zIndex, boxShadow: "medium", layout: true, ...toastAnimationConfig },
76
+ return (React.createElement(AnimatePresence, { initial: false }, visible && (React.createElement(AnimatedBox, { onMouseEnter: onMouseIn, onFocus: onMouseIn, onMouseLeave: onMouseOut, onBlur: onMouseOut, position: "fixed", bottom: "0", left: "0", right: "0", marginLeft: "auto", marginRight: "auto", width: "fit-content", zIndex: zIndex, boxShadow: "medium", layout: true, ...toastAnimationConfig },
79
77
  React.createElement(Alert, { minWidth: "200px", maxWidth: "600px", isCloseable: isCloseable, onClose: handleCloseButtonClick, controlled: true, ...props }, children)))));
80
78
  };
81
79
  export default Toast;
@@ -1,5 +1,3 @@
1
- // @ts-nocheck
2
- // typescript turned off because of {toast.type} not being a string
3
1
  import React, { useState } from "react";
4
2
  import { Button, DangerButton, IconicButton, Modal, PrimaryButton, Flex, Toast } from "../index";
5
3
  export default {
@@ -21,7 +21,6 @@ const Toggle = React.forwardRef(({ checked, variant, className, labelText, requi
21
21
  if (onClick) {
22
22
  console.warn("onClick is deprecated. Use onChange instead.");
23
23
  }
24
- // eslint-disable-next-line react-hooks/exhaustive-deps
25
24
  }, []);
26
25
  const _checked = checked ?? defaultToggled ?? toggled;
27
26
  const _onChange = useCallback((e) => {
@@ -36,7 +35,6 @@ const Toggle = React.forwardRef(({ checked, variant, className, labelText, requi
36
35
  if (_checked !== undefined && !(onChange || onClick)) {
37
36
  console.warn("onChange or onClick is required when checked is set.");
38
37
  }
39
- // eslint-disable-next-line react-hooks/exhaustive-deps
40
38
  }, []);
41
39
  return (React.createElement(Field, { className: className, alignItems: "flex-start", py: "half", ...spaceProps },
42
40
  React.createElement(FieldLabel, { htmlFor: id, labelText: labelText, requirementText: requirementText, helpText: helpText, hint: hint, disabled: disabled, variant: componentVariant, "data-testid": dataTestId },
package/dist/src/i18n.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import i18n from "i18next";
2
- /* eslint-disable */
3
2
  import de_DE from "../locales/de_DE.json";
4
3
  import en_US from "../locales/en_US.json";
5
4
  import es_ES from "../locales/es_ES.json";
@@ -10,7 +9,6 @@ import pl_PL from "../locales/pl_PL.json";
10
9
  import pt_BR from "../locales/pt_BR.json";
11
10
  import ro_RO from "../locales/ro_RO.json";
12
11
  import zh_CN from "../locales/zh_CN.json";
13
- /* eslint-enable */
14
12
  const resources = {
15
13
  de_DE: {
16
14
  nds: de_DE,
@@ -1,6 +1,6 @@
1
1
  import { styled } from "styled-components";
2
2
  const getThemeColor = (color, theme) => (theme.colors[color] ? theme.colors[color] : color);
3
- const positionArrow = (placement, theme) => {
3
+ const positionArrow = (placement) => {
4
4
  const location = String(placement).split("-")[0];
5
5
  switch (location) {
6
6
  case "top":
@@ -130,7 +130,7 @@ const PopperArrow = styled.div(({ theme }) => ({
130
130
  },
131
131
  }), ({ placement = "bottom", borderColor = "grey", backgroundColor = "white", theme }) => ({
132
132
  ...drawArrow(placement, borderColor, backgroundColor, theme),
133
- }), ({ placement = "bottom", theme }) => ({
134
- ...positionArrow(placement, theme),
133
+ }), ({ placement = "bottom" }) => ({
134
+ ...positionArrow(placement),
135
135
  }));
136
136
  export default PopperArrow;
@@ -2,6 +2,4 @@
2
2
  * No operation function that does nothing and returns nothing.
3
3
  * Useful as a default callback or placeholder.
4
4
  */
5
- export function noop() {
6
- // eslint-disable-next-line @typescript-eslint/no-empty-function
7
- }
5
+ export function noop() { }
@@ -5,8 +5,8 @@ type Reference = {
5
5
  };
6
6
  type ChildrenHandlers = {
7
7
  focusedIndex: number;
8
- handleArrowNavigation: Function;
9
- setFocusedIndex: Function;
8
+ handleArrowNavigation: (e: React.KeyboardEvent) => void;
9
+ setFocusedIndex: React.Dispatch<React.SetStateAction<number>>;
10
10
  };
11
11
  type FocusManagerProps = {
12
12
  refs?: Array<Reference>;
@@ -75,7 +75,6 @@ export function useScrollLock(options = {}) {
75
75
  return () => {
76
76
  unlock();
77
77
  };
78
- // eslint-disable-next-line react-hooks/exhaustive-deps
79
78
  }, [autoLock, lockTarget, widthReflow]);
80
79
  return { isLocked, lock, unlock };
81
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nulogy/components",
3
- "version": "15.4.1",
3
+ "version": "16.0.0",
4
4
  "type": "module",
5
5
  "description": "Component library for the Nulogy Design System - http://nulogy.design",
6
6
  "private": false,
@@ -21,7 +21,7 @@
21
21
  "warn:prepush": "echo \"Make sure you also run all the other CI steps before pushing by running 'pnpm ci'\"",
22
22
  "check": "pnpm warn:prepush && pnpm check:types && pnpm check:lint && pnpm check:format",
23
23
  "check:types": "tsc && cd cypress && tsc --noEmit",
24
- "check:lint": "eslint --config ./.eslintrc .'*/**/*.{js,ts,tsx}'",
24
+ "check:lint": "eslint '**/*.{js,ts,jsx,tsx}'",
25
25
  "check:format": "prettier -c .",
26
26
  "fix": "pnpm fix:lint && pnpm fix:format",
27
27
  "fix:lint": "pnpm check:lint --fix",
@@ -70,6 +70,7 @@
70
70
  },
71
71
  "devDependencies": {
72
72
  "@apollo/client": "^3.11.8",
73
+ "@eslint/js": "^9.0.0",
73
74
  "@nulogy/eslint-config-nulogy": "^1.0.0",
74
75
  "@nulogy/icons": "^4.37.2",
75
76
  "@semantic-release/changelog": "^6.0.2",
@@ -95,8 +96,9 @@
95
96
  "@types/react": "^17.0.39",
96
97
  "@types/react-dom": "^17.0.20",
97
98
  "@types/react-router-dom": "5.3.0",
98
- "@typescript-eslint/eslint-plugin": "^4.0.0",
99
- "@typescript-eslint/parser": "^5.30.5",
99
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
100
+ "@typescript-eslint/parser": "^8.0.0",
101
+ "typescript-eslint": "^8.0.0",
100
102
  "@vitejs/plugin-react": "^4.7.0",
101
103
  "chromatic": "^13.3.3",
102
104
  "concurrently": "^9.2.0",
@@ -105,8 +107,12 @@
105
107
  "cypress-enter-plugin": "^1.0.1",
106
108
  "cypress-plugin-tab": "^1.0.1",
107
109
  "cypress-real-events": "^1.14.0",
108
- "eslint": "6.8.0",
109
- "eslint-plugin-prettier": "^3.1.4",
110
+ "eslint": "^9.0.0",
111
+ "eslint-plugin-jsx-a11y": "^6.10.0",
112
+ "eslint-plugin-prettier": "^5.2.0",
113
+ "eslint-plugin-react": "^7.37.0",
114
+ "eslint-plugin-react-hooks": "^5.1.0",
115
+ "globals": "^15.0.0",
110
116
  "graphql": "15.8.0",
111
117
  "http-server": "^14.0.0",
112
118
  "husky": "^9.1.7",