@ndlib/component-library 0.0.45 → 0.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/NavMenu/demo.js +0 -1
- package/dist/components/composites/NavMenu/index.js +0 -1
- package/dist/components/elements/Alerts/Alerts.test.js +0 -1
- package/dist/components/elements/Alerts/index.d.ts +0 -1
- package/dist/components/elements/ArrowLink/index.d.ts +0 -1
- package/dist/components/elements/Button/index.d.ts +0 -1
- package/dist/components/elements/Button/index.js +0 -2
- package/dist/components/elements/Fields/Checkbox/index.d.ts +0 -1
- package/dist/components/elements/Fields/CheckboxGroup/index.js +0 -1
- package/dist/components/elements/Fields/DatePicker/index.js +0 -2
- package/dist/components/elements/Fields/Radio/index.d.ts +0 -1
- package/dist/components/elements/Fields/Select/index.d.ts +0 -1
- package/dist/components/elements/Fields/Select/index.js +3 -11
- package/dist/components/elements/Fields/TextInput/index.d.ts +0 -1
- package/dist/components/elements/Fields/TextInput/index.js +0 -1
- package/dist/components/elements/Group/index.d.ts +0 -1
- package/dist/components/elements/Group/index.js +0 -1
- package/dist/components/elements/Icon/index.d.ts +0 -1
- package/dist/components/elements/Icon/index.js +0 -1
- package/dist/components/elements/Link/index.d.ts +0 -1
- package/dist/components/elements/List/index.d.ts +0 -1
- package/dist/components/elements/List/index.js +0 -1
- package/dist/components/elements/ListBox/index.d.ts +0 -1
- package/dist/components/elements/ListBox/index.js +0 -1
- package/dist/components/elements/Markdown/index.js +0 -1
- package/dist/components/elements/Pill/index.d.ts +0 -1
- package/dist/components/elements/Pill/index.js +0 -1
- package/dist/components/elements/Spinner/Spinner.stories.js +0 -3
- package/dist/components/elements/Spinner/index.js +0 -1
- package/dist/components/elements/layout/Box.d.ts +0 -1
- package/dist/components/elements/layout/Column.d.ts +0 -1
- package/dist/components/elements/layout/Row.d.ts +0 -1
- package/dist/components/elements/layout/Row.js +0 -1
- package/dist/components/elements/text/Heading/Heading.stories.js +0 -1
- package/dist/components/elements/text/Heading/index.d.ts +0 -1
- package/dist/components/elements/text/Heading/index.js +0 -2
- package/dist/components/elements/text/Inline/Inline.stories.js +0 -1
- package/dist/components/elements/text/Inline/index.d.ts +0 -1
- package/dist/components/elements/text/Label/index.d.ts +0 -1
- package/dist/components/elements/text/Paragraph/Paragraph.stories.js +0 -1
- package/dist/components/elements/text/Paragraph/index.d.ts +0 -1
- package/dist/components/elements/text/ReadMore/ReadMore.stories.js +0 -1
- package/dist/components/elements/text/ReadMore/index.d.ts +0 -1
- package/dist/components/elements/text/ReadMore/index.js +0 -9
- package/dist/components/providers/componentConfig.js +1 -2
- package/dist/components/providers/media.js +1 -1
- package/dist/components/providers/menu.js +0 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/theme/Typography.stories.d.ts +0 -1
- package/dist/theme/custom.js +0 -1
- package/dist/theme/typography.js +0 -4
- package/dist/utils/misc.js +0 -9
- package/package.json +1 -1
|
@@ -85,5 +85,4 @@ const demoMenu = {
|
|
|
85
85
|
},
|
|
86
86
|
],
|
|
87
87
|
};
|
|
88
|
-
// This is needed because NavMenu doesn't control rendering of top-level menu items
|
|
89
88
|
export const DemoMenuImplementation = () => (_jsx(MenuProvider, Object.assign({ menu: demoMenu }, { children: ({ menu, getMenuProps, getMenuItemProps }) => (_jsxs(_Fragment, { children: [_jsx(Row, Object.assign({}, getMenuProps(), { children: menu.items.map((menuItem) => (_createElement(Button, Object.assign({}, getMenuItemProps([menuItem.id]), { sx: { m: 1 }, key: menuItem.id }), menuItem.label))) })), _jsx(NavMenu, {})] })) })));
|
|
@@ -9,7 +9,6 @@ import { Link } from '../../elements/Link';
|
|
|
9
9
|
import { LINE_HEIGHT } from '../../../theme/typography';
|
|
10
10
|
import { COLOR } from '../../../theme/colors';
|
|
11
11
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
12
|
-
// import { Column, HEADING_SIZE, Heading, LINE_HEIGHT, Link, Row } from "../../.."
|
|
13
12
|
const ChevronRightIcon = importedDefaultComponentShim(_ChevronRightIcon);
|
|
14
13
|
export const NavMenu = (props) => {
|
|
15
14
|
const { isOpen, activePath, getMenuItem, getMenuItemProps, getMenuProps } = useMenu();
|
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
// import { fireEvent } from '@testing-library/react'
|
|
12
11
|
import { vi } from 'vitest';
|
|
13
12
|
import { render } from '../../../utils/test';
|
|
14
13
|
import { useAlerts } from '../../providers/alerts';
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import { useTheme } from '../../../theme';
|
|
16
15
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -49,7 +48,6 @@ export var BUTTON_TYPE;
|
|
|
49
48
|
BUTTON_TYPE["DEFAULT"] = "default";
|
|
50
49
|
BUTTON_TYPE["TEXT"] = "text";
|
|
51
50
|
BUTTON_TYPE["OUTLINE"] = "outline";
|
|
52
|
-
// ARROW
|
|
53
51
|
})(BUTTON_TYPE || (BUTTON_TYPE = {}));
|
|
54
52
|
export const Button = React.forwardRef((_a, ref) => {
|
|
55
53
|
var { size: sizeParam, type: typeParam, color, customColor, textColor: textColorParam, primaryIcon, leftIcon, rightIcon, disabled: disabledParam, children, sx, loading, disableFocusStyles } = _a, rest = __rest(_a, ["size", "type", "color", "customColor", "textColor", "primaryIcon", "leftIcon", "rightIcon", "disabled", "children", "sx", "loading", "disableFocusStyles"]);
|
|
@@ -22,7 +22,6 @@ export const CheckboxGroup = (_a) => {
|
|
|
22
22
|
var { options, checkedOptions, columns: columnsProp, columnStyles, onChange } = _a, rest = __rest(_a, ["options", "checkedOptions", "columns", "columnStyles", "onChange"]);
|
|
23
23
|
const columns = columnsProp || 1;
|
|
24
24
|
const optionsByColumn = useMemo(() => {
|
|
25
|
-
// place first i/n items into first column, next i/n items into second column, etc.
|
|
26
25
|
const optionsByColumn = [];
|
|
27
26
|
for (let i = 0; i < options.length; i++) {
|
|
28
27
|
const maxPerColumn = Math.ceil(options.length / columns);
|
|
@@ -19,8 +19,6 @@ import { Box } from '../../layout/Box';
|
|
|
19
19
|
import { importedDefaultComponentShim } from '../../../../utils/misc';
|
|
20
20
|
const CalendarIcon = importedDefaultComponentShim(_CalendarIcon);
|
|
21
21
|
const ReactDatePicker = importedDefaultComponentShim(_ReactDatePicker);
|
|
22
|
-
// Need to do this to allow passing props to TextInput
|
|
23
|
-
// react-datepicker will overwrite all props passed to customInput
|
|
24
22
|
export const InputWrapper = React.forwardRef(({ onChange, value, children, onClick }, ref) => {
|
|
25
23
|
return React.cloneElement(children, {
|
|
26
24
|
value: value,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource theme-ui */
|
|
3
2
|
import { useMemo, useState } from 'react';
|
|
4
3
|
import _ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
5
4
|
import { useFloating, size as sizeMiddleware, offset, autoPlacement, } from '@floating-ui/react';
|
|
@@ -159,23 +158,16 @@ export function Select({ size: sizeParam, placeholder, leftIcon, value, label, o
|
|
|
159
158
|
color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.PRIMARY,
|
|
160
159
|
px: 1,
|
|
161
160
|
top: labelOffsetMap[size],
|
|
162
|
-
} }, { children: label })), _jsx(Button, Object.assign({ ref: refs.setReference, disableFocusStyles: true,
|
|
163
|
-
// A11y attributes
|
|
164
|
-
role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
|
|
161
|
+
} }, { children: label })), _jsx(Button, Object.assign({ ref: refs.setReference, disableFocusStyles: true, role: "combobox", "aria-controls": listboxId, "aria-expanded": isOpen, "aria-autocomplete": "none", "aria-activedescendant": isOpen && stagedOptionValue
|
|
165
162
|
? getOptionId(stagedOptionValue)
|
|
166
|
-
: undefined,
|
|
167
|
-
// Style config
|
|
168
|
-
type: BUTTON_TYPE.OUTLINE, size: buttonSize, onBlur: () => close(), onFocus: () => open(), onKeyDown: onKeyDown, onMouseDown: () => {
|
|
163
|
+
: undefined, type: BUTTON_TYPE.OUTLINE, size: buttonSize, onBlur: () => close(), onFocus: () => open(), onKeyDown: onKeyDown, onMouseDown: () => {
|
|
169
164
|
if (!isOpen) {
|
|
170
165
|
open();
|
|
171
166
|
}
|
|
172
167
|
else {
|
|
173
168
|
close();
|
|
174
169
|
}
|
|
175
|
-
}, color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px',
|
|
176
|
-
// borderColor: COLOR.GRAY,
|
|
177
|
-
// borderRadius: '4px',
|
|
178
|
-
flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: theme.zIndex.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon }, { children: currentOption ? renderOptionLabel(currentOption) : placeholder })), isOpen && (_jsx(ListBox, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
|
|
170
|
+
}, color: inverted ? COLOR.EXTRA_LIGHT_GRAY : COLOR.TEXT, sx: Object.assign({ height, width: '100%', border: 'solid 0px', flexDirection: 'row', alignItems: 'center', position: 'relative', zIndex: theme.zIndex.NORMAL, background: 'none' }, typographyStyles), leftIcon: leftIcon, rightIcon: ArrowDropDownIcon }, { children: currentOption ? renderOptionLabel(currentOption) : placeholder })), isOpen && (_jsx(ListBox, { id: listboxId, options: options, selected: value, focused: stagedOptionValue, selectOption: (option) => {
|
|
179
171
|
onSelectOption && onSelectOption(option.value);
|
|
180
172
|
close();
|
|
181
173
|
}, ref: refs.setFloating, renderOption: renderOption, sx: {
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import { TYPOGRAPHY_TYPE, getIconSize, getTypographyStyles, } from '../../../../theme/typography';
|
|
16
15
|
import { useTheme } from '../../../../theme';
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
15
14
|
import { useEnvironment } from '../../providers/env';
|
|
16
15
|
export var GROUP_TYPE;
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import { COLOR, colors } from '../../../theme/colors';
|
|
16
15
|
import { useEnvironment } from '../../providers/env';
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import _CircleIcon from '@mui/icons-material/Circle';
|
|
16
15
|
import _CircleOutlinedIcon from '@mui/icons-material/CircleOutlined';
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React from 'react';
|
|
15
14
|
import { COLOR } from '../../..';
|
|
16
15
|
import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
|
|
@@ -63,7 +63,6 @@ export const Markdown = (_a) => {
|
|
|
63
63
|
h6: (props) => (_jsx(Heading, Object.assign({ size: HEADING_SIZE.SM }, props, { standalone: true, sx: headingStyles, "aria-level": 6 }))),
|
|
64
64
|
ol: (props) => _jsx(List, Object.assign({}, props, { ordered: true, sx: { mt: 4 } })),
|
|
65
65
|
ul: (props) => _jsx(List, Object.assign({}, props, { sx: { mt: 4 } })),
|
|
66
|
-
// eslint-disable-next-line
|
|
67
66
|
li: (_a) => {
|
|
68
67
|
var { index, ordered } = _a, props = __rest(_a, ["index", "ordered"]);
|
|
69
68
|
return (_jsx(ListItem, Object.assign({ index: index }, props)));
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React, { useState } from 'react';
|
|
15
14
|
import { useTheme } from '../../../theme';
|
|
16
15
|
import { COLOR, colors } from '../../../theme/colors';
|
|
@@ -3,12 +3,9 @@ import { Column, Group, HEADING_SIZE, Heading } from '../../..';
|
|
|
3
3
|
import { SPINNER_SIZE, Spinner } from '.';
|
|
4
4
|
import { GROUP_TYPE } from '../Group';
|
|
5
5
|
import { COLOR } from '../../../theme/colors';
|
|
6
|
-
// import { HEADING_SIZE, Heading } from '.'
|
|
7
|
-
// import { COLOR } from '../../../../theme/colors'
|
|
8
6
|
const meta = {
|
|
9
7
|
title: 'Elements/Spinner',
|
|
10
8
|
component: Spinner,
|
|
11
|
-
//👇 Enables auto-generated documentation for the component story
|
|
12
9
|
tags: ['autodocs'],
|
|
13
10
|
};
|
|
14
11
|
export default meta;
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import { keyframes } from '@emotion/react';
|
|
15
14
|
import { useTheme } from '../../../theme';
|
|
16
15
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/** @jsxImportSource theme-ui */
|
|
3
2
|
import { CSSProperties, ThemeUICSSProperties } from 'theme-ui';
|
|
4
3
|
import { StyledElementProps } from '../../../theme';
|
|
5
4
|
export declare const convertFlexHelperProps: (props: FlexHelperProps) => ThemeUICSSProperties;
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
// Putting shared utils and types here so autodocs can pick them up
|
|
14
13
|
export const convertFlexHelperProps = (props) => {
|
|
15
14
|
const styleObject = {};
|
|
16
15
|
if (props.grow) {
|
|
@@ -10,7 +10,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import { useEffect } from 'react';
|
|
15
14
|
import { getTypographyStyles, TYPOGRAPHY_TYPE, } from '../../../../theme/typography';
|
|
16
15
|
import { GROUP_TYPE, useGroup } from '../../Group';
|
|
@@ -41,7 +40,6 @@ export const Heading = (_a) => {
|
|
|
41
40
|
var { sx, size, standalone, underline, underlineColor, typography: typographyProp, level: levelParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "underline", "underlineColor", "typography", "level"]);
|
|
42
41
|
const { level: groupLevel, labelId, type, trackHeadingRendered } = useGroup();
|
|
43
42
|
const { flagInDevelopment } = useEnvironment();
|
|
44
|
-
// should prioritize explicitly passed level, eg if coming from markdown
|
|
45
43
|
const level = levelParam || groupLevel;
|
|
46
44
|
useEffect(() => {
|
|
47
45
|
trackHeadingRendered();
|
|
@@ -10,14 +10,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
-
/** @jsxImportSource theme-ui */
|
|
14
13
|
import React, { useState } from 'react';
|
|
15
14
|
import { useTheme } from '../../../../theme';
|
|
16
15
|
import { COLOR, colors } from '../../../../theme/colors';
|
|
17
16
|
import { getTypographyStyles, } from '../../../../theme/typography';
|
|
18
17
|
import { useMediaQuery } from '../../../providers/media';
|
|
19
18
|
const ReadMoreLink = (props) => {
|
|
20
|
-
// const theme = useTheme()
|
|
21
19
|
const bg = colors[props.bg || COLOR.BACKGROUND];
|
|
22
20
|
const color = colors[props.color || COLOR.ND_BLUE_LIGHT];
|
|
23
21
|
return (_jsx("div", Object.assign({ css: {
|
|
@@ -38,16 +36,10 @@ export const useLinesHeight = (args) => {
|
|
|
38
36
|
const styles = getTypographyStyles(args.typography);
|
|
39
37
|
const fontSize = styles.fontSize;
|
|
40
38
|
const fontSizeRem = theme.fontSizes[fontSize];
|
|
41
|
-
// slice of the 'rem' from end of fontSize string and convert to number
|
|
42
39
|
const fontSizeNumber = Number(fontSizeRem.slice(0, fontSizeRem.length - 3));
|
|
43
|
-
// Multiply the fontSize by the lineHeight ratio and the number of lines
|
|
44
40
|
const linesHeight = fontSizeNumber * theme.lineHeights[styles.lineHeight] * args.lines;
|
|
45
41
|
return `${linesHeight}rem`;
|
|
46
42
|
};
|
|
47
|
-
// A react component that accepts text content and truncates it 3 lines. If the content
|
|
48
|
-
// exceeds the alloted space, an ellipsis will be placed at the end of the last line.
|
|
49
|
-
// This component does not use the css property `text-overflow: ellipsis`
|
|
50
|
-
// because it does not work with multiple lines of text.
|
|
51
43
|
export const ReadMore = (_a) => {
|
|
52
44
|
var { typography, sx, role, lines, fixedHeight, children } = _a, rest = __rest(_a, ["typography", "sx", "role", "lines", "fixedHeight", "children"]);
|
|
53
45
|
const ref = React.useRef(null);
|
|
@@ -57,7 +49,6 @@ export const ReadMore = (_a) => {
|
|
|
57
49
|
const { color, bg } = sx || {};
|
|
58
50
|
React.useEffect(() => {
|
|
59
51
|
if (ref.current) {
|
|
60
|
-
// Check if the content exceeds the alloted space
|
|
61
52
|
if (fixedHeight) {
|
|
62
53
|
ref.current.style.height = wrapperHeight;
|
|
63
54
|
}
|
|
@@ -32,7 +32,6 @@ const defaultComponentConfig = {
|
|
|
32
32
|
export const ComponentConfigContext = createContext(defaultComponentConfig);
|
|
33
33
|
export const useComponentConfig = () => useContext(ComponentConfigContext);
|
|
34
34
|
export const ComponentConfigProvider = ({ config: configParam, children }) => {
|
|
35
|
-
const config = useMemo(() => (Object.assign(Object.assign(Object.assign({}, defaultComponentConfig), configParam), { link: Object.assign(Object.assign({}, defaultComponentConfig.link), configParam.link) })), []
|
|
36
|
-
);
|
|
35
|
+
const config = useMemo(() => (Object.assign(Object.assign(Object.assign({}, defaultComponentConfig), configParam), { link: Object.assign(Object.assign({}, defaultComponentConfig.link), configParam.link) })), []);
|
|
37
36
|
return (_jsx(ComponentConfigContext.Provider, Object.assign({ value: config }, { children: children })));
|
|
38
37
|
};
|
|
@@ -23,7 +23,7 @@ export const MediaSizeProvider = ({ children, }) => {
|
|
|
23
23
|
screenSize,
|
|
24
24
|
breakpoint,
|
|
25
25
|
};
|
|
26
|
-
}, [renderCount, breakpoints]);
|
|
26
|
+
}, [renderCount, breakpoints]);
|
|
27
27
|
useEffect(() => {
|
|
28
28
|
if (typeof window === 'undefined')
|
|
29
29
|
return;
|
|
@@ -232,17 +232,12 @@ export const MenuProvider = ({ menu, children, }) => {
|
|
|
232
232
|
const isTopLevel = path.length === 1;
|
|
233
233
|
const isActivePath = equals(path, activePath);
|
|
234
234
|
return Object.assign(Object.assign({}, checkMidclickProps), { role: 'menuitem', 'aria-roledescription': getAriaRoleDescription(activeParentMenu.orientation), id: getItemId(path), onKeyDown: equals(path, activePath) ? onKeyDown : undefined, tabIndex: -1, onFocus: () => {
|
|
235
|
-
// Screen readers will send focus to buttons without firing keydown or click
|
|
236
|
-
// Call setActivePath to sync
|
|
237
235
|
if (!isMidClick) {
|
|
238
236
|
setActivePath(path);
|
|
239
237
|
}
|
|
240
238
|
}, onMouseDown: () => {
|
|
241
239
|
checkMidclickProps.onMouseDown();
|
|
242
240
|
const menuItem = getMenuItem(path);
|
|
243
|
-
// Because blurring will close the dropdown menu, link navigation should be
|
|
244
|
-
// triggered before that happened. Mousedown is used instead of click because
|
|
245
|
-
// it is triggered before blur event
|
|
246
241
|
if ((menuItem === null || menuItem === void 0 ? void 0 : menuItem.action.type) === MENU_ACTION_TYPE.LINK) {
|
|
247
242
|
window.location.href = menuItem.action.to;
|
|
248
243
|
}
|
|
@@ -250,25 +245,18 @@ export const MenuProvider = ({ menu, children, }) => {
|
|
|
250
245
|
const menuItem = getMenuItem(path);
|
|
251
246
|
const isSubmenu = (menuItem === null || menuItem === void 0 ? void 0 : menuItem.action.type) === MENU_ACTION_TYPE.SUBMENU;
|
|
252
247
|
if (!isSubmenu) {
|
|
253
|
-
// Link menu items should not trigger navigation because that is handled by mousedown listener
|
|
254
248
|
e.preventDefault();
|
|
255
249
|
}
|
|
256
|
-
// If user is using a mouse, clicking the top level menu that is open
|
|
257
|
-
// should close the menu
|
|
258
250
|
if (isSubmenu &&
|
|
259
251
|
isActivePath &&
|
|
260
252
|
isTopLevel &&
|
|
261
253
|
!usingKeyboard &&
|
|
262
254
|
isOpen) {
|
|
263
255
|
close();
|
|
264
|
-
// Clicking a top level menu that is closed or not the active menu should
|
|
265
|
-
// open that menu
|
|
266
256
|
}
|
|
267
257
|
else if (isSubmenu && isTopLevel && !usingKeyboard && !isOpen) {
|
|
268
258
|
setActivePath(path);
|
|
269
259
|
open();
|
|
270
|
-
// If user is using a mouse, or if the menu is a link, handle the same way
|
|
271
|
-
// as enter key press
|
|
272
260
|
}
|
|
273
261
|
else {
|
|
274
262
|
onKeyDown({
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export { Button, BUTTON_SIZE, BUTTON_TYPE, LinkButton, } from './components/elem
|
|
|
9
9
|
export { Heading, HEADING_SIZE } from './components/elements/text/Heading';
|
|
10
10
|
export { Label, LABEL_SIZE } from './components/elements/text/Label';
|
|
11
11
|
export { Paragraph, PARAGRAPH_SIZE } from './components/elements/text/Paragraph';
|
|
12
|
-
export { Group, useGroup } from './components/elements/Group';
|
|
12
|
+
export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
|
|
13
13
|
export { Markdown } from './components/elements/Markdown';
|
|
14
14
|
export { Box } from './components/elements/layout/Box';
|
|
15
15
|
export { Column } from './components/elements/layout/Column';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { Button, BUTTON_SIZE, BUTTON_TYPE, LinkButton, } from './components/elem
|
|
|
9
9
|
export { Heading, HEADING_SIZE } from './components/elements/text/Heading';
|
|
10
10
|
export { Label, LABEL_SIZE } from './components/elements/text/Label';
|
|
11
11
|
export { Paragraph, PARAGRAPH_SIZE } from './components/elements/text/Paragraph';
|
|
12
|
-
export { Group, useGroup } from './components/elements/Group';
|
|
12
|
+
export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
|
|
13
13
|
export { Markdown } from './components/elements/Markdown';
|
|
14
14
|
export { Box } from './components/elements/layout/Box';
|
|
15
15
|
export { Column } from './components/elements/layout/Column';
|
package/dist/theme/custom.js
CHANGED
package/dist/theme/typography.js
CHANGED
|
@@ -69,10 +69,6 @@ export const fontStyles = {
|
|
|
69
69
|
[FONT_WEIGHT.HEADING]: 600,
|
|
70
70
|
[FONT_WEIGHT.BOLD]: 700,
|
|
71
71
|
},
|
|
72
|
-
// letterSpacings: {
|
|
73
|
-
// [LETTER_SPACING.NORMAL]: 'none',
|
|
74
|
-
// [LETTER_SPACING.EXTRA]: '0.5px'
|
|
75
|
-
// }
|
|
76
72
|
};
|
|
77
73
|
export var TYPOGRAPHY_TYPE;
|
|
78
74
|
(function (TYPOGRAPHY_TYPE) {
|
package/dist/utils/misc.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// :first-child can cause problems with emotion because styles tags are sometimes added before
|
|
2
|
-
// nodes, which can throw off :first-child selector. Not sure if this will actually be an issue
|
|
3
|
-
// for us, but it does create noisy warnings.
|
|
4
|
-
//
|
|
5
|
-
// This work-around mimics :first-child behavior in a way that plays nice with emotion
|
|
6
1
|
export const firstChildAltSelector = ':first-of-type:not(style):not(:first-of-type ~ *),style + *';
|
|
7
2
|
export var KEY_CODES;
|
|
8
3
|
(function (KEY_CODES) {
|
|
@@ -14,10 +9,6 @@ export var KEY_CODES;
|
|
|
14
9
|
KEY_CODES["ESCAPE"] = "Escape";
|
|
15
10
|
})(KEY_CODES || (KEY_CODES = {}));
|
|
16
11
|
export const equals = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
17
|
-
// @mui/material-icons and react-datepicker dependencies exports
|
|
18
|
-
// their modules as { default: Component } with is causing problems
|
|
19
|
-
// when included in downstream apps. This shim prevents issues by
|
|
20
|
-
// resolving ambiguity on how to handle the imports explicitly
|
|
21
12
|
export function importedDefaultComponentShim(component) {
|
|
22
13
|
if (component && typeof component === 'object' && 'default' in component) {
|
|
23
14
|
return component.default;
|