@elliemae/ds-menu-items-single 3.80.0-next.72 → 3.80.0-next.75

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.
@@ -62,26 +62,27 @@ const DSMenuItemsSingle = (props) => {
62
62
  readOnly
63
63
  } = propsWithDefault;
64
64
  const { getOwnerProps } = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault);
65
- const onMouseDownHandler = import_react.default.useCallback(
65
+ const locked = (0, import_ds_props_helpers.isLocked)({ disabled, applyAriaDisabled, readOnly });
66
+ const handleOnMouseDown = import_react.default.useCallback(
66
67
  (e) => {
67
- if (disabled) return;
68
+ if (locked) return;
68
69
  onMouseDown?.(e);
69
70
  },
70
- [disabled, onMouseDown]
71
+ [locked, onMouseDown]
71
72
  );
72
73
  const handleOnClick = import_react.default.useCallback(
73
74
  (e) => {
74
- if (disabled || applyAriaDisabled || readOnly) return;
75
+ if (locked) return;
75
76
  onClick?.(e);
76
77
  },
77
- [disabled, applyAriaDisabled, readOnly, onClick]
78
+ [locked, onClick]
78
79
  );
79
80
  const handleOnKeyDown = import_react.default.useCallback(
80
81
  (e) => {
81
- if ((applyAriaDisabled || readOnly) && (e.code === "Space" || e.code === "Enter")) return;
82
+ if (locked && (0, import_ds_props_helpers.isActivationKey)(e)) return;
82
83
  onKeyDown?.(e);
83
84
  },
84
- [applyAriaDisabled, readOnly, onKeyDown]
85
+ [locked, onKeyDown]
85
86
  );
86
87
  const gridLayout = import_react.default.useMemo(() => {
87
88
  const cols = {
@@ -94,7 +95,7 @@ const DSMenuItemsSingle = (props) => {
94
95
  }
95
96
  return cols;
96
97
  }, [secondaryLabel]);
97
- const checkmarkColor = applyAriaDisabled ? ["neutral", "400"] : ["brand-primary", "600"];
98
+ const checkmarkColor = locked ? ["neutral", "400"] : ["brand-primary", "600"];
98
99
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
100
  import_ds_menu_items_commons.StyledGlobalMenuItemWrapper,
100
101
  {
@@ -104,16 +105,16 @@ const DSMenuItemsSingle = (props) => {
104
105
  isActive,
105
106
  isSelected,
106
107
  innerRef,
107
- onMouseDown: onMouseDownHandler,
108
+ onMouseDown: handleOnMouseDown,
108
109
  onMouseEnter,
109
110
  onMouseLeave,
110
111
  className: isActive ? "ds-list-item-active" : "",
111
112
  style: wrapperStyles,
112
113
  "data-testid": dataTestid,
113
- disabled,
114
+ $disabled: disabled,
114
115
  "data-type": "single",
115
- "aria-disabled": applyAriaDisabled || disabled || readOnly,
116
- ...globalProps,
116
+ ...(0, import_ds_props_helpers.omitLockedHandlers)((0, import_ds_props_helpers.omitLockAttributes)(globalProps), locked),
117
+ "aria-disabled": (0, import_ds_props_helpers.resolveAriaDisabled)({ softLocked: locked, consumerValue: globalProps["aria-disabled"] }),
117
118
  onClick: handleOnClick,
118
119
  onKeyDown: handleOnKeyDown,
119
120
  getOwnerProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DSMenuItemsSingle.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React from 'react';\nimport { describe, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { Checkmark, type SvgIconT } from '@elliemae/ds-icons';\nimport { type DSMenuItemsSingleT, DSMenuItemsSinglePropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsSingle } from './config/useMenuItemsSingle.js';\n\nconst DSMenuItemsSingle: React.ComponentType<DSMenuItemsSingleT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useMenuItemsSingle(props);\n const {\n dsId,\n label,\n secondaryLabel,\n isSelected,\n onClick,\n onKeyDown,\n isActive,\n innerRef,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n wrapperStyles,\n render: Render,\n dataTestid,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n\n const { getOwnerProps } = useOwnerProps(propsWithDefault);\n\n const onMouseDownHandler = React.useCallback(\n (e: React.MouseEvent) => {\n if (disabled) return;\n onMouseDown?.(e);\n },\n [disabled, onMouseDown],\n );\n\n const handleOnClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (disabled || applyAriaDisabled || readOnly) return;\n onClick?.(e);\n },\n [disabled, applyAriaDisabled, readOnly, onClick],\n );\n\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if ((applyAriaDisabled || readOnly) && (e.code === 'Space' || e.code === 'Enter')) return;\n onKeyDown?.(e);\n },\n [applyAriaDisabled, readOnly, onKeyDown],\n );\n\n const gridLayout = React.useMemo(() => {\n const cols = {\n small: ['1rem', 'auto'],\n medium: ['1.2308rem', 'auto'],\n };\n if (secondaryLabel) {\n cols.small.push('min-content');\n cols.medium.push('min-content');\n }\n return cols;\n }, [secondaryLabel]);\n\n const checkmarkColor: SvgIconT.OptionalProps['color'] = applyAriaDisabled\n ? ['neutral', '400']\n : ['brand-primary', '600'];\n\n return (\n <StyledGlobalMenuItemWrapper\n aria-selected={isSelected}\n id={dsId}\n role=\"option\"\n isActive={isActive}\n isSelected={isSelected}\n innerRef={innerRef}\n onMouseDown={onMouseDownHandler}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={isActive ? 'ds-list-item-active' : ''}\n style={wrapperStyles}\n data-testid={dataTestid}\n disabled={disabled}\n data-type=\"single\"\n aria-disabled={applyAriaDisabled || disabled || readOnly}\n {...globalProps}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n getOwnerProps={getOwnerProps}\n {...xstyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n >\n <div>{isSelected && <Checkmark size=\"s\" color={checkmarkColor} />}</div>\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} variant=\"b2\" component=\"span\">\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel getOwnerProps={getOwnerProps}>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSSingleMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsSingle.displayName = 'DSSingleMenuItem';\nconst DSMenuItemsSingleWithSchema = describe(DSMenuItemsSingle);\nDSMenuItemsSingleWithSchema.propTypes = DSMenuItemsSinglePropTypesSchema;\n\nexport { DSMenuItemsSingle, DSMenuItemsSingleWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoGf;AApGR,mBAAkB;AAClB,8BAAwC;AACxC,mCAKO;AACP,sBAAyC;AACzC,mCAA0E;AAC1E,gCAAmC;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,aAAa,QAAI,8CAAmB,KAAK;AAChF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,cAAc,QAAI,uCAAc,gBAAgB;AAExD,QAAM,qBAAqB,aAAAA,QAAM;AAAA,IAC/B,CAAC,MAAwB;AACvB,UAAI,SAAU;AACd,oBAAc,CAAC;AAAA,IACjB;AAAA,IACA,CAAC,UAAU,WAAW;AAAA,EACxB;AAEA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AAA,UACP,YAAW;AAAA,UACX;AAAA,UAEA;AAAA,wDAAC,SAAK,wBAAc,4CAAC,6BAAU,MAAK,KAAI,OAAO,gBAAgB,GAAG;AAAA,YAClE,4CAAC,mDAAmB,eAA8B,SAAQ,MAAK,WAAU,QACtE,iBACH;AAAA,YACC,mBAAmB,UAClB,4CAAC,4DAA4B,eAA+B,0BAAe;AAAA;AAAA;AAAA,MAE/E;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
4
+ "sourcesContent": ["import React from 'react';\nimport {\n describe,\n isActivationKey,\n isLocked,\n omitLockAttributes,\n omitLockedHandlers,\n useOwnerProps,\n resolveAriaDisabled,\n} from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { Checkmark, type SvgIconT } from '@elliemae/ds-icons';\nimport { type DSMenuItemsSingleT, DSMenuItemsSinglePropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsSingle } from './config/useMenuItemsSingle.js';\n\nconst DSMenuItemsSingle: React.ComponentType<DSMenuItemsSingleT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useMenuItemsSingle(props);\n const {\n dsId,\n label,\n secondaryLabel,\n isSelected,\n onClick,\n onKeyDown,\n isActive,\n innerRef,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n wrapperStyles,\n render: Render,\n dataTestid,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n\n const { getOwnerProps } = useOwnerProps(propsWithDefault);\n\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n // an enabled item keeps the `onMouseDown` passed directly even when `original` feeds the global attributes\n const handleOnMouseDown = React.useCallback(\n (e: React.MouseEvent) => {\n if (locked) return;\n onMouseDown?.(e);\n },\n [locked, onMouseDown],\n );\n\n const handleOnClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (locked) return;\n onClick?.(e);\n },\n [locked, onClick],\n );\n\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (locked && isActivationKey(e)) return;\n onKeyDown?.(e);\n },\n [locked, onKeyDown],\n );\n\n const gridLayout = React.useMemo(() => {\n const cols = {\n small: ['1rem', 'auto'],\n medium: ['1.2308rem', 'auto'],\n };\n if (secondaryLabel) {\n cols.small.push('min-content');\n cols.medium.push('min-content');\n }\n return cols;\n }, [secondaryLabel]);\n\n // a locked item (disabled, or the soft lock applyAriaDisabled / readOnly, which are the same) is not brand blue\n const checkmarkColor: SvgIconT.OptionalProps['color'] = locked ? ['neutral', '400'] : ['brand-primary', '600'];\n\n return (\n <StyledGlobalMenuItemWrapper\n aria-selected={isSelected}\n id={dsId}\n role=\"option\"\n isActive={isActive}\n isSelected={isSelected}\n innerRef={innerRef}\n onMouseDown={handleOnMouseDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={isActive ? 'ds-list-item-active' : ''}\n style={wrapperStyles}\n data-testid={dataTestid}\n $disabled={disabled}\n data-type=\"single\"\n {...omitLockedHandlers(omitLockAttributes(globalProps), locked)}\n // after the spread: a locked item prints \"true\" whatever the consumer passes; an unlocked item keeps the\n // consumer's own value (inversion of control)\n aria-disabled={resolveAriaDisabled({ softLocked: locked, consumerValue: globalProps['aria-disabled'] })}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n getOwnerProps={getOwnerProps}\n {...xstyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n >\n <div>{isSelected && <Checkmark size=\"s\" color={checkmarkColor} />}</div>\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} variant=\"b2\" component=\"span\">\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel getOwnerProps={getOwnerProps}>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSSingleMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsSingle.displayName = 'DSSingleMenuItem';\nconst DSMenuItemsSingleWithSchema = describe(DSMenuItemsSingle);\nDSMenuItemsSingleWithSchema.propTypes = DSMenuItemsSinglePropTypesSchema;\n\nexport { DSMenuItemsSingle, DSMenuItemsSingleWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADgHf;AAhHR,mBAAkB;AAClB,8BAQO;AACP,mCAKO;AACP,sBAAyC;AACzC,mCAA0E;AAC1E,gCAAmC;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,aAAa,QAAI,8CAAmB,KAAK;AAChF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,cAAc,QAAI,uCAAc,gBAAgB;AAExD,QAAM,aAAS,kCAAS,EAAE,UAAU,mBAAmB,SAAS,CAAC;AAGjE,QAAM,oBAAoB,aAAAA,QAAM;AAAA,IAC9B,CAAC,MAAwB;AACvB,UAAI,OAAQ;AACZ,oBAAc,CAAC;AAAA,IACjB;AAAA,IACA,CAAC,QAAQ,WAAW;AAAA,EACtB;AAEA,QAAM,gBAA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UACV,QAAO;AAAA,UACP,YAAW;AAAA,UACX;AAAA,UAEA;AAAA,wDAAC,SAAK,wBAAc,4CAAC,6BAAU,MAAK,KAAI,OAAO,gBAAgB,GAAG;AAAA,YAClE,4CAAC,mDAAmB,eAA8B,SAAQ,MAAK,WAAU,QACtE,iBACH;AAAA,YACC,mBAAmB,UAClB,4CAAC,4DAA4B,eAA+B,0BAAe;AAAA;AAAA;AAAA,MAE/E;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,kCAA8B,kCAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -54,7 +54,6 @@ const defaultProps = {
54
54
  },
55
55
  dataTestid: "ds-menu-item",
56
56
  // in legacy code for some reasons this was explicitly set in the defaultProps...
57
- tabIndex: 0,
58
57
  applyAriaDisabled: false
59
58
  };
60
59
  const { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = import_ds_props_helpers.globalAttributesPropTypes;
@@ -67,7 +66,7 @@ const DSMenuItemsSinglePropTypes = {
67
66
  // TODO - add support to PropTypes.oneOf for typeof number
68
67
  // currently PropTypes.oneOf([0, -1]) is not supported
69
68
  tabIndex: import_ds_props_helpers.PropTypes.oneOfType([import_ds_props_helpers.PropTypes.number, import_ds_props_helpers.PropTypes.string]).description(
70
- "The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed."
69
+ "The tab index of the menu item. The item sets none by default: the host that composes it decides. For WCAG 2.1 AA compliance only -1 and 0 are allowed."
71
70
  ),
72
71
  label: import_ds_props_helpers.PropTypes.string.description("The label of the menu item."),
73
72
  value: import_ds_props_helpers.PropTypes.any.description("The value of the menu item."),
@@ -78,7 +77,7 @@ const DSMenuItemsSinglePropTypes = {
78
77
  dataTestid: import_ds_props_helpers.PropTypes.string.description("A custom data-testid for your e2e testing"),
79
78
  // in legacy code for some reasons this was explicitly set in the defaultProps...
80
79
  applyAriaDisabled: import_ds_props_helpers.PropTypes.bool.description(
81
- "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
80
+ "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM."
82
81
  ).defaultValue(false)
83
82
  };
84
83
  const DSMenuItemsSinglePropTypesSchema = DSMenuItemsSinglePropTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/react-desc-prop-types.ts", "../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\n\nexport declare namespace DSMenuItemsSingleT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n isActive: boolean;\n disabled: boolean;\n isSelected: boolean;\n onClick: React.MouseEventHandler;\n onMouseDown: React.MouseEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n dataTestid: string;\n tabIndex: number;\n applyAriaDisabled: boolean;\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsSingleT.InternalProps> & {\n secondaryLabel?: string;\n value?: unknown; // for some reason, legacy code says this is optional...\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsSingleT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: () => {},\n onMouseDown: () => {},\n onMouseEnter: () => {},\n onMouseLeave: () => {},\n onKeyDown: () => {},\n dataTestid: 'ds-menu-item', // in legacy code for some reasons this was explicitly set in the defaultProps...\n tabIndex: 0,\n applyAriaDisabled: false,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsSinglePropTypes: DSPropTypesSchema<DSMenuItemsSingleT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenCommonPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n disabled: PropTypes.bool.description('Whether the menu item is disabled.'),\n isSelected: PropTypes.bool.description('Whether the menu item is selected.'),\n dataTestid: PropTypes.string.description('A custom data-testid for your e2e testing'), // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n\nexport const DSMenuItemsSinglePropTypesSchema =\n DSMenuItemsSinglePropTypes as unknown as ValidationMap<DSMenuItemsSingleT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAAuE;AACvE,mCAIO;AAoDA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,YAAY;AAAA;AAAA,EACZ,UAAU;AAAA,EACV,mBAAmB;AACrB;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAGH,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,kCAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,kCAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,kCAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,gBAAgB,kCAAU,OAAO,YAAY,uCAAuC;AAAA,EACpF,UAAU,kCAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,YAAY,kCAAU,KAAK,YAAY,oCAAoC;AAAA,EAC3E,YAAY,kCAAU,OAAO,YAAY,2CAA2C;AAAA;AAAA,EACpF,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
4
+ "sourcesContent": ["/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\n\nexport declare namespace DSMenuItemsSingleT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n isActive: boolean;\n disabled: boolean;\n isSelected: boolean;\n onClick: React.MouseEventHandler;\n onMouseDown: React.MouseEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n dataTestid: string;\n applyAriaDisabled: boolean;\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsSingleT.InternalProps> & {\n secondaryLabel?: string;\n value?: unknown; // for some reason, legacy code says this is optional...\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsSingleT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: () => {},\n onMouseDown: () => {},\n onMouseEnter: () => {},\n onMouseLeave: () => {},\n onKeyDown: () => {},\n dataTestid: 'ds-menu-item', // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: false,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsSinglePropTypes: DSPropTypesSchema<DSMenuItemsSingleT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenCommonPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. The item sets none by default: the host that composes it decides. For WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n disabled: PropTypes.bool.description('Whether the menu item is disabled.'),\n isSelected: PropTypes.bool.description('Whether the menu item is selected.'),\n dataTestid: PropTypes.string.description('A custom data-testid for your e2e testing'), // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM.',\n )\n .defaultValue(false),\n};\n\nexport const DSMenuItemsSinglePropTypesSchema =\n DSMenuItemsSinglePropTypes as unknown as ValidationMap<DSMenuItemsSingleT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,8BAAuE;AACvE,mCAIO;AAmDA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,YAAY;AAAA;AAAA,EACZ,mBAAmB;AACrB;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAGH,UAAU,kCAAU,UAAU,CAAC,kCAAU,QAAQ,kCAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,kCAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,kCAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,kCAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,gBAAgB,kCAAU,OAAO,YAAY,uCAAuC;AAAA,EACpF,UAAU,kCAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,YAAY,kCAAU,KAAK,YAAY,oCAAoC;AAAA,EAC3E,YAAY,kCAAU,OAAO,YAAY,2CAA2C;AAAA;AAAA,EACpF,mBAAmB,kCAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,15 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import React2 from "react";
4
- import { describe, useOwnerProps } from "@elliemae/ds-props-helpers";
4
+ import {
5
+ describe,
6
+ isActivationKey,
7
+ isLocked,
8
+ omitLockAttributes,
9
+ omitLockedHandlers,
10
+ useOwnerProps,
11
+ resolveAriaDisabled
12
+ } from "@elliemae/ds-props-helpers";
5
13
  import {
6
14
  StyledGlobalMenuItemWrapper,
7
15
  StyledContentWrapper,
@@ -33,26 +41,27 @@ const DSMenuItemsSingle = (props) => {
33
41
  readOnly
34
42
  } = propsWithDefault;
35
43
  const { getOwnerProps } = useOwnerProps(propsWithDefault);
36
- const onMouseDownHandler = React2.useCallback(
44
+ const locked = isLocked({ disabled, applyAriaDisabled, readOnly });
45
+ const handleOnMouseDown = React2.useCallback(
37
46
  (e) => {
38
- if (disabled) return;
47
+ if (locked) return;
39
48
  onMouseDown?.(e);
40
49
  },
41
- [disabled, onMouseDown]
50
+ [locked, onMouseDown]
42
51
  );
43
52
  const handleOnClick = React2.useCallback(
44
53
  (e) => {
45
- if (disabled || applyAriaDisabled || readOnly) return;
54
+ if (locked) return;
46
55
  onClick?.(e);
47
56
  },
48
- [disabled, applyAriaDisabled, readOnly, onClick]
57
+ [locked, onClick]
49
58
  );
50
59
  const handleOnKeyDown = React2.useCallback(
51
60
  (e) => {
52
- if ((applyAriaDisabled || readOnly) && (e.code === "Space" || e.code === "Enter")) return;
61
+ if (locked && isActivationKey(e)) return;
53
62
  onKeyDown?.(e);
54
63
  },
55
- [applyAriaDisabled, readOnly, onKeyDown]
64
+ [locked, onKeyDown]
56
65
  );
57
66
  const gridLayout = React2.useMemo(() => {
58
67
  const cols = {
@@ -65,7 +74,7 @@ const DSMenuItemsSingle = (props) => {
65
74
  }
66
75
  return cols;
67
76
  }, [secondaryLabel]);
68
- const checkmarkColor = applyAriaDisabled ? ["neutral", "400"] : ["brand-primary", "600"];
77
+ const checkmarkColor = locked ? ["neutral", "400"] : ["brand-primary", "600"];
69
78
  return /* @__PURE__ */ jsx(
70
79
  StyledGlobalMenuItemWrapper,
71
80
  {
@@ -75,16 +84,16 @@ const DSMenuItemsSingle = (props) => {
75
84
  isActive,
76
85
  isSelected,
77
86
  innerRef,
78
- onMouseDown: onMouseDownHandler,
87
+ onMouseDown: handleOnMouseDown,
79
88
  onMouseEnter,
80
89
  onMouseLeave,
81
90
  className: isActive ? "ds-list-item-active" : "",
82
91
  style: wrapperStyles,
83
92
  "data-testid": dataTestid,
84
- disabled,
93
+ $disabled: disabled,
85
94
  "data-type": "single",
86
- "aria-disabled": applyAriaDisabled || disabled || readOnly,
87
- ...globalProps,
95
+ ...omitLockedHandlers(omitLockAttributes(globalProps), locked),
96
+ "aria-disabled": resolveAriaDisabled({ softLocked: locked, consumerValue: globalProps["aria-disabled"] }),
88
97
  onClick: handleOnClick,
89
98
  onKeyDown: handleOnKeyDown,
90
99
  getOwnerProps,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSMenuItemsSingle.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe, useOwnerProps } from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { Checkmark, type SvgIconT } from '@elliemae/ds-icons';\nimport { type DSMenuItemsSingleT, DSMenuItemsSinglePropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsSingle } from './config/useMenuItemsSingle.js';\n\nconst DSMenuItemsSingle: React.ComponentType<DSMenuItemsSingleT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useMenuItemsSingle(props);\n const {\n dsId,\n label,\n secondaryLabel,\n isSelected,\n onClick,\n onKeyDown,\n isActive,\n innerRef,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n wrapperStyles,\n render: Render,\n dataTestid,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n\n const { getOwnerProps } = useOwnerProps(propsWithDefault);\n\n const onMouseDownHandler = React.useCallback(\n (e: React.MouseEvent) => {\n if (disabled) return;\n onMouseDown?.(e);\n },\n [disabled, onMouseDown],\n );\n\n const handleOnClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (disabled || applyAriaDisabled || readOnly) return;\n onClick?.(e);\n },\n [disabled, applyAriaDisabled, readOnly, onClick],\n );\n\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if ((applyAriaDisabled || readOnly) && (e.code === 'Space' || e.code === 'Enter')) return;\n onKeyDown?.(e);\n },\n [applyAriaDisabled, readOnly, onKeyDown],\n );\n\n const gridLayout = React.useMemo(() => {\n const cols = {\n small: ['1rem', 'auto'],\n medium: ['1.2308rem', 'auto'],\n };\n if (secondaryLabel) {\n cols.small.push('min-content');\n cols.medium.push('min-content');\n }\n return cols;\n }, [secondaryLabel]);\n\n const checkmarkColor: SvgIconT.OptionalProps['color'] = applyAriaDisabled\n ? ['neutral', '400']\n : ['brand-primary', '600'];\n\n return (\n <StyledGlobalMenuItemWrapper\n aria-selected={isSelected}\n id={dsId}\n role=\"option\"\n isActive={isActive}\n isSelected={isSelected}\n innerRef={innerRef}\n onMouseDown={onMouseDownHandler}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={isActive ? 'ds-list-item-active' : ''}\n style={wrapperStyles}\n data-testid={dataTestid}\n disabled={disabled}\n data-type=\"single\"\n aria-disabled={applyAriaDisabled || disabled || readOnly}\n {...globalProps}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n getOwnerProps={getOwnerProps}\n {...xstyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n >\n <div>{isSelected && <Checkmark size=\"s\" color={checkmarkColor} />}</div>\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} variant=\"b2\" component=\"span\">\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel getOwnerProps={getOwnerProps}>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSSingleMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsSingle.displayName = 'DSSingleMenuItem';\nconst DSMenuItemsSingleWithSchema = describe(DSMenuItemsSingle);\nDSMenuItemsSingleWithSchema.propTypes = DSMenuItemsSinglePropTypesSchema;\n\nexport { DSMenuItemsSingle, DSMenuItemsSingleWithSchema };\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACoGf,cAEA,YAFA;AApGR,OAAOA,YAAW;AAClB,SAAS,UAAU,qBAAqB;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAgC;AACzC,SAAkC,wCAAwC;AAC1E,SAAS,0BAA0B;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,aAAa,IAAI,mBAAmB,KAAK;AAChF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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,OAAO;AAAA,MACP,eAAa;AAAA,MACb;AAAA,MACA,aAAU;AAAA,MACV,iBAAe,qBAAqB,YAAY;AAAA,MAC/C,GAAG;AAAA,MACJ,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACC,GAAG;AAAA,MAEH,qBAAW,SACV,oBAAC,UAAQ,GAAG,kBAAkB,IAE9B;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,WAAU;AAAA,UACV,QAAO;AAAA,UACP,YAAW;AAAA,UACX;AAAA,UAEA;AAAA,gCAAC,SAAK,wBAAc,oBAAC,aAAU,MAAK,KAAI,OAAO,gBAAgB,GAAG;AAAA,YAClE,oBAAC,sBAAmB,eAA8B,SAAQ,MAAK,WAAU,QACtE,iBACH;AAAA,YACC,mBAAmB,UAClB,oBAAC,+BAA4B,eAA+B,0BAAe;AAAA;AAAA;AAAA,MAE/E;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport {\n describe,\n isActivationKey,\n isLocked,\n omitLockAttributes,\n omitLockedHandlers,\n useOwnerProps,\n resolveAriaDisabled,\n} from '@elliemae/ds-props-helpers';\nimport {\n StyledGlobalMenuItemWrapper,\n StyledContentWrapper,\n StyleMenuItemLabel,\n StyleMenuItemSecondaryLabel,\n} from '@elliemae/ds-menu-items-commons';\nimport { Checkmark, type SvgIconT } from '@elliemae/ds-icons';\nimport { type DSMenuItemsSingleT, DSMenuItemsSinglePropTypesSchema } from './react-desc-prop-types.js';\nimport { useMenuItemsSingle } from './config/useMenuItemsSingle.js';\n\nconst DSMenuItemsSingle: React.ComponentType<DSMenuItemsSingleT.Props> = (props) => {\n const { propsWithDefault, globalProps, xstyledProps } = useMenuItemsSingle(props);\n const {\n dsId,\n label,\n secondaryLabel,\n isSelected,\n onClick,\n onKeyDown,\n isActive,\n innerRef,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n wrapperStyles,\n render: Render,\n dataTestid,\n disabled,\n applyAriaDisabled,\n readOnly,\n } = propsWithDefault;\n\n const { getOwnerProps } = useOwnerProps(propsWithDefault);\n\n const locked = isLocked({ disabled, applyAriaDisabled, readOnly });\n\n // an enabled item keeps the `onMouseDown` passed directly even when `original` feeds the global attributes\n const handleOnMouseDown = React.useCallback(\n (e: React.MouseEvent) => {\n if (locked) return;\n onMouseDown?.(e);\n },\n [locked, onMouseDown],\n );\n\n const handleOnClick = React.useCallback(\n (e: React.MouseEvent) => {\n if (locked) return;\n onClick?.(e);\n },\n [locked, onClick],\n );\n\n const handleOnKeyDown = React.useCallback(\n (e: React.KeyboardEvent) => {\n if (locked && isActivationKey(e)) return;\n onKeyDown?.(e);\n },\n [locked, onKeyDown],\n );\n\n const gridLayout = React.useMemo(() => {\n const cols = {\n small: ['1rem', 'auto'],\n medium: ['1.2308rem', 'auto'],\n };\n if (secondaryLabel) {\n cols.small.push('min-content');\n cols.medium.push('min-content');\n }\n return cols;\n }, [secondaryLabel]);\n\n // a locked item (disabled, or the soft lock applyAriaDisabled / readOnly, which are the same) is not brand blue\n const checkmarkColor: SvgIconT.OptionalProps['color'] = locked ? ['neutral', '400'] : ['brand-primary', '600'];\n\n return (\n <StyledGlobalMenuItemWrapper\n aria-selected={isSelected}\n id={dsId}\n role=\"option\"\n isActive={isActive}\n isSelected={isSelected}\n innerRef={innerRef}\n onMouseDown={handleOnMouseDown}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n className={isActive ? 'ds-list-item-active' : ''}\n style={wrapperStyles}\n data-testid={dataTestid}\n $disabled={disabled}\n data-type=\"single\"\n {...omitLockedHandlers(omitLockAttributes(globalProps), locked)}\n // after the spread: a locked item prints \"true\" whatever the consumer passes; an unlocked item keeps the\n // consumer's own value (inversion of control)\n aria-disabled={resolveAriaDisabled({ softLocked: locked, consumerValue: globalProps['aria-disabled'] })}\n onClick={handleOnClick}\n onKeyDown={handleOnKeyDown}\n getOwnerProps={getOwnerProps}\n {...xstyledProps}\n >\n {Render !== undefined ? (\n <Render {...propsWithDefault} />\n ) : (\n <StyledContentWrapper\n cols={gridLayout}\n minHeight=\"16px\"\n gutter=\"xxs\"\n alignItems=\"center\"\n getOwnerProps={getOwnerProps}\n >\n <div>{isSelected && <Checkmark size=\"s\" color={checkmarkColor} />}</div>\n <StyleMenuItemLabel getOwnerProps={getOwnerProps} variant=\"b2\" component=\"span\">\n {label}\n </StyleMenuItemLabel>\n {secondaryLabel !== undefined && (\n <StyleMenuItemSecondaryLabel getOwnerProps={getOwnerProps}>{secondaryLabel}</StyleMenuItemSecondaryLabel>\n )}\n </StyledContentWrapper>\n )}\n </StyledGlobalMenuItemWrapper>\n );\n};\n\n// this is `'DSSingleMenuItem'` for legacy reasons, when moving to inheritance pattern this has been kept as it was to avoid complications\nDSMenuItemsSingle.displayName = 'DSSingleMenuItem';\nconst DSMenuItemsSingleWithSchema = describe(DSMenuItemsSingle);\nDSMenuItemsSingleWithSchema.propTypes = DSMenuItemsSinglePropTypesSchema;\n\nexport { DSMenuItemsSingle, DSMenuItemsSingleWithSchema };\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACgHf,cAEA,YAFA;AAhHR,OAAOA,YAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAgC;AACzC,SAAkC,wCAAwC;AAC1E,SAAS,0BAA0B;AAEnC,MAAM,oBAAmE,CAAC,UAAU;AAClF,QAAM,EAAE,kBAAkB,aAAa,aAAa,IAAI,mBAAmB,KAAK;AAChF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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AO;AAAA,MACP,eAAa;AAAA,MACb,WAAW;AAAA,MACX,aAAU;AAAA,MACT,GAAG,mBAAmB,mBAAmB,WAAW,GAAG,MAAM;AAAA,MAG9D,iBAAe,oBAAoB,EAAE,YAAY,QAAQ,eAAe,YAAY,eAAe,EAAE,CAAC;AAAA,MACtG,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACC,GAAG;AAAA,MAEH,qBAAW,SACV,oBAAC,UAAQ,GAAG,kBAAkB,IAE9B;AAAA,QAAC;AAAA;AAAA,UACC,MAAM;AAAA,UACN,WAAU;AAAA,UACV,QAAO;AAAA,UACP,YAAW;AAAA,UACX;AAAA,UAEA;AAAA,gCAAC,SAAK,wBAAc,oBAAC,aAAU,MAAK,KAAI,OAAO,gBAAgB,GAAG;AAAA,YAClE,oBAAC,sBAAmB,eAA8B,SAAQ,MAAK,WAAU,QACtE,iBACH;AAAA,YACC,mBAAmB,UAClB,oBAAC,+BAA4B,eAA+B,0BAAe;AAAA;AAAA;AAAA,MAE/E;AAAA;AAAA,EAEJ;AAEJ;AAGA,kBAAkB,cAAc;AAChC,MAAM,8BAA8B,SAAS,iBAAiB;AAC9D,4BAA4B,YAAY;",
6
6
  "names": ["React"]
7
7
  }
@@ -22,7 +22,6 @@ const defaultProps = {
22
22
  },
23
23
  dataTestid: "ds-menu-item",
24
24
  // in legacy code for some reasons this was explicitly set in the defaultProps...
25
- tabIndex: 0,
26
25
  applyAriaDisabled: false
27
26
  };
28
27
  const { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = globalAttributesPropTypes;
@@ -35,7 +34,7 @@ const DSMenuItemsSinglePropTypes = {
35
34
  // TODO - add support to PropTypes.oneOf for typeof number
36
35
  // currently PropTypes.oneOf([0, -1]) is not supported
37
36
  tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(
38
- "The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed."
37
+ "The tab index of the menu item. The item sets none by default: the host that composes it decides. For WCAG 2.1 AA compliance only -1 and 0 are allowed."
39
38
  ),
40
39
  label: PropTypes.string.description("The label of the menu item."),
41
40
  value: PropTypes.any.description("The value of the menu item."),
@@ -46,7 +45,7 @@ const DSMenuItemsSinglePropTypes = {
46
45
  dataTestid: PropTypes.string.description("A custom data-testid for your e2e testing"),
47
46
  // in legacy code for some reasons this was explicitly set in the defaultProps...
48
47
  applyAriaDisabled: PropTypes.bool.description(
49
- "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION."
48
+ "Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM."
50
49
  ).defaultValue(false)
51
50
  };
52
51
  const DSMenuItemsSinglePropTypesSchema = DSMenuItemsSinglePropTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\n\nexport declare namespace DSMenuItemsSingleT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n isActive: boolean;\n disabled: boolean;\n isSelected: boolean;\n onClick: React.MouseEventHandler;\n onMouseDown: React.MouseEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n dataTestid: string;\n tabIndex: number;\n applyAriaDisabled: boolean;\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsSingleT.InternalProps> & {\n secondaryLabel?: string;\n value?: unknown; // for some reason, legacy code says this is optional...\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsSingleT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: () => {},\n onMouseDown: () => {},\n onMouseEnter: () => {},\n onMouseLeave: () => {},\n onKeyDown: () => {},\n dataTestid: 'ds-menu-item', // in legacy code for some reasons this was explicitly set in the defaultProps...\n tabIndex: 0,\n applyAriaDisabled: false,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsSinglePropTypes: DSPropTypesSchema<DSMenuItemsSingleT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenCommonPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. for WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n disabled: PropTypes.bool.description('Whether the menu item is disabled.'),\n isSelected: PropTypes.bool.description('Whether the menu item is selected.'),\n dataTestid: PropTypes.string.description('A custom data-testid for your e2e testing'), // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. PREVENTS ONLY MAIN ACTION.',\n )\n .defaultValue(false),\n};\n\nexport const DSMenuItemsSinglePropTypesSchema =\n DSMenuItemsSinglePropTypes as unknown as ValidationMap<DSMenuItemsSingleT.Props>;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAoDA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,YAAY;AAAA;AAAA,EACZ,UAAU;AAAA,EACV,mBAAmB;AACrB;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAGH,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,UAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,UAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,gBAAgB,UAAU,OAAO,YAAY,uCAAuC;AAAA,EACpF,UAAU,UAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,YAAY,UAAU,KAAK,YAAY,oCAAoC;AAAA,EAC3E,YAAY,UAAU,OAAO,YAAY,2CAA2C;AAAA;AAAA,EACpF,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-duplicate-type-constituents */\n\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\nimport {\n type DSMenuItemsCommonsT,\n DSMenuItemsCommonsPropTypes,\n DSMenuItemsCommonsDefaultProps,\n} from '@elliemae/ds-menu-items-commons';\nimport type React from 'react';\n\nexport declare namespace DSMenuItemsSingleT {\n // typescript inheritance has no syntax support for \"interfaces\", we have to use union types instead...\n export type RequiredProps = DSMenuItemsCommonsT.RequiredProps;\n\n export type DefaultProps = DSMenuItemsCommonsT.DefaultProps & {\n label: string;\n isActive: boolean;\n disabled: boolean;\n isSelected: boolean;\n onClick: React.MouseEventHandler;\n onMouseDown: React.MouseEventHandler;\n onMouseEnter: React.MouseEventHandler;\n onMouseLeave: React.MouseEventHandler;\n onKeyDown: React.KeyboardEventHandler;\n dataTestid: string;\n applyAriaDisabled: boolean;\n };\n\n export type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsSingleT.InternalProps> & {\n secondaryLabel?: string;\n value?: unknown; // for some reason, legacy code says this is optional...\n };\n\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n export interface Props\n extends\n Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends\n DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLButtonElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSMenuItemsSingleT.DefaultProps = {\n ...DSMenuItemsCommonsDefaultProps,\n label: '',\n isActive: false,\n disabled: false,\n isSelected: false,\n onClick: () => {},\n onMouseDown: () => {},\n onMouseEnter: () => {},\n onMouseLeave: () => {},\n onKeyDown: () => {},\n dataTestid: 'ds-menu-item', // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: false,\n};\n\n// we are removing some keys from the global attributes because they are overridden by the action props\n// eslint-disable-next-line no-unused-vars\nconst { tabIndex, label, value, ...notOvverriddenCommonPropsTypes } = globalAttributesPropTypes;\n\nexport const DSMenuItemsSinglePropTypes: DSPropTypesSchema<DSMenuItemsSingleT.InternalProps> = {\n // each single menu-item is in charge of spreading the GlobalAttributesT & XstyledProps\n // they are NOT inherited from a common element from ds-menu-items-commons\n ...notOvverriddenCommonPropsTypes,\n ...xstyledPropTypes,\n ...DSMenuItemsCommonsPropTypes,\n // TODO - add support to PropTypes.oneOf for typeof number\n // currently PropTypes.oneOf([0, -1]) is not supported\n tabIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).description(\n 'The tab index of the menu item. The item sets none by default: the host that composes it decides. For WCAG 2.1 AA compliance only -1 and 0 are allowed.',\n ),\n label: PropTypes.string.description('The label of the menu item.'),\n value: PropTypes.any.description('The value of the menu item.'),\n isActive: PropTypes.bool.description('Whether the menu item is active.'),\n secondaryLabel: PropTypes.string.description('The secondary label of the menu item.'),\n disabled: PropTypes.bool.description('Whether the menu item is disabled.'),\n isSelected: PropTypes.bool.description('Whether the menu item is selected.'),\n dataTestid: PropTypes.string.description('A custom data-testid for your e2e testing'), // in legacy code for some reasons this was explicitly set in the defaultProps...\n applyAriaDisabled: PropTypes.bool\n .description(\n 'Whether to apply disabled styling and announce as disabled in SR. CAN STILL RECEIVE FOCUS. IGNORES EVERY ACTION (click, Enter, Space) AND THE CONSUMER HANDLERS FOR THEM.',\n )\n .defaultValue(false),\n};\n\nexport const DSMenuItemsSinglePropTypesSchema =\n DSMenuItemsSinglePropTypes as unknown as ValidationMap<DSMenuItemsSingleT.Props>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,WAAW,2BAA2B,wBAAwB;AACvE;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AAmDA,MAAM,eAAgD;AAAA,EAC3D,GAAG;AAAA,EACH,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS,MAAM;AAAA,EAAC;AAAA,EAChB,aAAa,MAAM;AAAA,EAAC;AAAA,EACpB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,WAAW,MAAM;AAAA,EAAC;AAAA,EAClB,YAAY;AAAA;AAAA,EACZ,mBAAmB;AACrB;AAIA,MAAM,EAAE,UAAU,OAAO,OAAO,GAAG,+BAA+B,IAAI;AAE/D,MAAM,6BAAkF;AAAA;AAAA;AAAA,EAG7F,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA;AAAA;AAAA,EAGH,UAAU,UAAU,UAAU,CAAC,UAAU,QAAQ,UAAU,MAAM,CAAC,EAAE;AAAA,IAClE;AAAA,EACF;AAAA,EACA,OAAO,UAAU,OAAO,YAAY,6BAA6B;AAAA,EACjE,OAAO,UAAU,IAAI,YAAY,6BAA6B;AAAA,EAC9D,UAAU,UAAU,KAAK,YAAY,kCAAkC;AAAA,EACvE,gBAAgB,UAAU,OAAO,YAAY,uCAAuC;AAAA,EACpF,UAAU,UAAU,KAAK,YAAY,oCAAoC;AAAA,EACzE,YAAY,UAAU,KAAK,YAAY,oCAAoC;AAAA,EAC3E,YAAY,UAAU,OAAO,YAAY,2CAA2C;AAAA;AAAA,EACpF,mBAAmB,UAAU,KAC1B;AAAA,IACC;AAAA,EACF,EACC,aAAa,KAAK;AACvB;AAEO,MAAM,mCACX;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,7 @@ export interface MenuItemsSingleCTX {
8
8
  }
9
9
  export declare const useMenuItemsSingle: (propsFromUser: DSMenuItemsSingleT.Props) => {
10
10
  propsWithDefault: DSMenuItemsSingleT.InternalProps;
11
- globalProps: Partial<Pick<object, "label" | "disabled" | "onClick" | "onMouseDown" | "onMouseEnter" | "onMouseLeave" | "onKeyDown" | "tabIndex" | "form" | "list" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDownCapture" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "title" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap"> & Omit<{
11
+ globalProps: Partial<Pick<object, "label" | "disabled" | "onClick" | "onMouseDown" | "onMouseEnter" | "onMouseLeave" | "onKeyDown" | "form" | "list" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDownCapture" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "default" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "noValidate" | "open" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "start" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap"> & Omit<{
12
12
  label?: string | undefined | undefined;
13
13
  disabled?: boolean | undefined | undefined;
14
14
  onClick?: React.MouseEventHandler<HTMLLIElement> | undefined;
@@ -16,7 +16,6 @@ export declare const useMenuItemsSingle: (propsFromUser: DSMenuItemsSingleT.Prop
16
16
  onMouseEnter?: React.MouseEventHandler<HTMLLIElement> | undefined;
17
17
  onMouseLeave?: React.MouseEventHandler<HTMLLIElement> | undefined;
18
18
  onKeyDown?: React.KeyboardEventHandler<HTMLLIElement> | undefined;
19
- tabIndex?: 0 | -1 | undefined;
20
19
  form?: string | undefined | undefined;
21
20
  list?: string | undefined | undefined;
22
21
  "aria-activedescendant"?: string | undefined | undefined;
@@ -246,6 +245,7 @@ export declare const useMenuItemsSingle: (propsFromUser: DSMenuItemsSingleT.Prop
246
245
  slot?: string | undefined | undefined;
247
246
  spellCheck?: (boolean | "true" | "false") | undefined;
248
247
  style?: React.CSSProperties | undefined;
248
+ tabIndex?: 0 | -1 | undefined;
249
249
  title?: string | undefined | undefined;
250
250
  translate?: "yes" | "no" | undefined | undefined;
251
251
  radioGroup?: string | undefined | undefined;
@@ -14,7 +14,6 @@ export declare namespace DSMenuItemsSingleT {
14
14
  onMouseLeave: React.MouseEventHandler;
15
15
  onKeyDown: React.KeyboardEventHandler;
16
16
  dataTestid: string;
17
- tabIndex: number;
18
17
  applyAriaDisabled: boolean;
19
18
  };
20
19
  type OptionalProps = DSMenuItemsCommonsT.OptionalProps<DSMenuItemsSingleT.InternalProps> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-menu-items-single",
3
- "version": "3.80.0-next.72",
3
+ "version": "3.80.0-next.75",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Menu Items Single",
6
6
  "files": [
@@ -36,13 +36,13 @@
36
36
  "indent": 4
37
37
  },
38
38
  "dependencies": {
39
- "@elliemae/ds-icons": "3.80.0-next.72",
40
- "@elliemae/ds-menu-items-commons": "3.80.0-next.72",
41
- "@elliemae/ds-props-helpers": "3.80.0-next.72"
39
+ "@elliemae/ds-icons": "3.80.0-next.75",
40
+ "@elliemae/ds-menu-items-commons": "3.80.0-next.75",
41
+ "@elliemae/ds-props-helpers": "3.80.0-next.75"
42
42
  },
43
43
  "devDependencies": {
44
- "@elliemae/ds-monorepo-devops": "3.80.0-next.72",
45
- "@elliemae/ds-test-utils": "3.80.0-next.72",
44
+ "@elliemae/ds-monorepo-devops": "3.80.0-next.75",
45
+ "@elliemae/ds-test-utils": "3.80.0-next.75",
46
46
  "jest": "^30.0.0",
47
47
  "lodash-es": "^4.18.1",
48
48
  "styled-components": "~5.3.11"