@mezzanine-ui/react 0.14.4 → 0.14.5

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/Select/Select.js CHANGED
@@ -44,7 +44,6 @@ const Select = forwardRef(function Select(props, ref) {
44
44
  });
45
45
  const nodeRef = useRef(null);
46
46
  const controlRef = useRef(null);
47
- const popperRef = useRef(null);
48
47
  const composedRef = useComposeRefs([ref, controlRef]);
49
48
  function getPlaceholder() {
50
49
  if (typeof renderValue === 'function') {
@@ -100,6 +99,7 @@ const Select = forwardRef(function Select(props, ref) {
100
99
  };
101
100
  /** menu onScroll listener */
102
101
  const onMenuScrollCallback = useCallback(async (evt) => {
102
+ evt.stopPropagation();
103
103
  if (onMenuScroll) {
104
104
  const target = evt.target;
105
105
  const maxScrollTop = target.scrollHeight - target.getBoundingClientRect().height;
@@ -121,7 +121,7 @@ const Select = forwardRef(function Select(props, ref) {
121
121
  onChange,
122
122
  value,
123
123
  }), [onChange, value]);
124
- return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, fullWidth && selectClasses.hostFullWidth), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, onClick: onClickTextField, onKeyDown: onKeyDownTextField, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value }), jsx(InputTriggerPopper, { ref: popperRef, anchor: controlRef, className: selectClasses.popper, disablePortal: disablePortal, open: open, options: popperOptions, sameWidth: true, children: jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? (_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '' : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, onScroll: onMenuScrollCallback, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
124
+ return (jsx(SelectControlContext.Provider, { value: context, children: jsxs("div", { ref: nodeRef, className: cx(selectClasses.host, fullWidth && selectClasses.hostFullWidth), children: [jsx(SelectTrigger, { ref: composedRef, active: open, className: className, clearable: clearable, disabled: disabled, error: error, fullWidth: fullWidth, inputRef: inputRef, mode: mode, onTagClose: onChange, onClear: onClear, onClick: onClickTextField, onKeyDown: onKeyDownTextField, prefix: prefix, readOnly: true, renderValue: renderValue, required: required, inputProps: resolvedInputProps, size: size, suffixActionIcon: suffixActionIcon, value: value }), jsx(InputTriggerPopper, { anchor: controlRef, className: selectClasses.popper, disablePortal: disablePortal, open: open, options: popperOptions, sameWidth: true, children: jsx(Menu, { id: MENU_ID, "aria-activedescendant": Array.isArray(value) ? (_b = (_a = value === null || value === void 0 ? void 0 : value[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '' : value === null || value === void 0 ? void 0 : value.id, itemsInView: itemsInView, maxHeight: menuMaxHeight, onScroll: onMenuScrollCallback, role: menuRole, size: menuSize, style: { border: 0 }, children: children }) })] }) }));
125
125
  });
126
126
  var Select$1 = Select;
127
127
 
@@ -1,5 +1,5 @@
1
1
  import { JSXElementConstructor } from 'react';
2
- import { TypographyAlign, TypographyColor, TypographyDisplay, TypographyVariant } from '@mezzanine-ui/core/typography';
2
+ import { TypographyAlign, TypographyColor, TypographyDisplay, TypographyVariant, TypographyWeight } from '@mezzanine-ui/core/typography';
3
3
  import { ComponentOverridableForwardRefComponentPropsFactory } from '../utils/jsx-types';
4
4
  export type TypographyComponent = `h${1 | 2 | 3 | 4 | 5 | 6}` | 'p' | 'span' | 'label' | 'div' | 'caption' | 'a' | JSXElementConstructor<any>;
5
5
  interface TypographyPropsBase {
@@ -32,6 +32,10 @@ interface TypographyPropsBase {
32
32
  * @default 'body1'
33
33
  */
34
34
  variant?: TypographyVariant;
35
+ /**
36
+ * The css variable for customizing `font-weight`.
37
+ */
38
+ weight?: TypographyWeight;
35
39
  }
36
40
  export type TypographyProps<C extends TypographyComponent = 'p'> = ComponentOverridableForwardRefComponentPropsFactory<TypographyComponent, C, TypographyPropsBase>;
37
41
  /**
@@ -16,9 +16,14 @@ function getComponentFromVariant(variant) {
16
16
  * The react component for `mezzanine` typography.
17
17
  */
18
18
  const Typography = forwardRef(function Typography(props, ref) {
19
- const { align, children, className, color, component, display, ellipsis = false, noWrap = false, variant = 'body1', style: styleProp, ...rest } = props;
19
+ const { align, children, className, color, component, display, ellipsis = false, noWrap = false, variant = 'body1', style: styleProp, weight, ...rest } = props;
20
20
  const Component = component || getComponentFromVariant(variant);
21
- const cssVars = toTypographyCssVars({ align, color, display });
21
+ const cssVars = toTypographyCssVars({
22
+ align,
23
+ color,
24
+ display,
25
+ weight,
26
+ });
22
27
  const style = {
23
28
  ...cssVars,
24
29
  ...styleProp,
@@ -32,6 +37,7 @@ const Typography = forwardRef(function Typography(props, ref) {
32
37
  [typographyClasses.display]: display,
33
38
  [typographyClasses.ellipsis]: ellipsis,
34
39
  [typographyClasses.noWrap]: noWrap,
40
+ [typographyClasses.weight]: weight,
35
41
  }, className), style: style, title: title, children: children }));
36
42
  });
37
43
  var Typography$1 = Typography;
@@ -1,6 +1,6 @@
1
1
  import { ElementRef, PropsWithoutRef, ReactElement, RefAttributes } from 'react';
2
2
  import { TypographyComponent, TypographyProps } from './Typography';
3
- export type { TypographyAlign, TypographyColor, TypographyDisplay, TypographyVariant, } from '@mezzanine-ui/core/typography';
3
+ export type { TypographyAlign, TypographyColor, TypographyDisplay, TypographyVariant, TypographyWeight, } from '@mezzanine-ui/core/typography';
4
4
  export type { TypographyComponent, TypographyProps, };
5
5
  /**
6
6
  * @remark
@@ -25,7 +25,9 @@ const InputTriggerPopper = forwardRef(function InputTriggerPopper(props, ref) {
25
25
  reassignState.elements.popper.style.minWidth = `${state.elements.reference.getBoundingClientRect().width}px`;
26
26
  },
27
27
  };
28
- return (jsx(Fade, { ...fadeProps, in: open, ref: ref, children: jsx(Popper, { ...restPopperProps, open: true, anchor: anchor, className: cx(inputTriggerPopperClasses.host, className), options: {
28
+ return (jsx(Fade, { ...fadeProps, in: open, ref: ref, children: jsx(Popper, { ...restPopperProps, open: true, anchor: anchor, className: cx(inputTriggerPopperClasses.host, className),
29
+ /** Prevent event bubble (Because popper may use portal, then click away function would be buggy) */
30
+ onClick: (e) => e.stopPropagation(), onTouchStart: (e) => e.stopPropagation(), onTouchMove: (e) => e.stopPropagation(), onTouchEnd: (e) => e.stopPropagation(), options: {
29
31
  placement: 'bottom-start',
30
32
  ...restPopperOptions,
31
33
  modifiers: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezzanine-ui/react",
3
- "version": "0.14.4",
3
+ "version": "0.14.5",
4
4
  "description": "React components for mezzanine-ui",
5
5
  "author": "Mezzanine",
6
6
  "repository": {
@@ -28,9 +28,9 @@
28
28
  "react-dom": "^18.2.0"
29
29
  },
30
30
  "dependencies": {
31
- "@mezzanine-ui/core": "^0.14.4",
32
- "@mezzanine-ui/icons": "^0.14.4",
33
- "@mezzanine-ui/system": "^0.14.4",
31
+ "@mezzanine-ui/core": "^0.14.5",
32
+ "@mezzanine-ui/icons": "^0.14.5",
33
+ "@mezzanine-ui/system": "^0.14.5",
34
34
  "@popperjs/core": "^2.11.6",
35
35
  "@types/react-transition-group": "^4.4.8",
36
36
  "clsx": "^2.0.0",