@ndlib/component-library 1.0.22 → 1.0.24
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/CardV2/index.d.ts +1 -0
- package/dist/components/composites/CardV2/index.js +7 -5
- package/dist/components/composites/ModalV2/index.js +1 -1
- package/dist/components/elements/{layoutV2 → BoxV2}/BoxV2.stories.d.ts +1 -1
- package/dist/components/elements/{layoutV2 → BoxV2}/BoxV2.stories.js +1 -1
- package/dist/components/elements/ButtonV2/ButtonV2.stories.js +2 -2
- package/dist/components/elements/ButtonV2/index.d.ts +2 -0
- package/dist/components/elements/ButtonV2/index.js +3 -2
- package/dist/components/elements/CheckboxGroupV2/CheckboxGroupV2.stories.js +1 -1
- package/dist/components/elements/CheckboxGroupV2/index.js +2 -2
- package/dist/components/elements/CheckboxV2/CheckboxV2.stories.js +1 -1
- package/dist/components/elements/CheckboxV2/index.d.ts +1 -0
- package/dist/components/elements/CheckboxV2/index.js +3 -2
- package/dist/components/elements/{layoutV2/ColumnV2.d.ts → ColumnV2/index.d.ts} +1 -1
- package/dist/components/elements/{layoutV2/ColumnV2.js → ColumnV2/index.js} +1 -1
- package/dist/components/elements/HeadingV2/HeadingV2.stories.js +1 -1
- package/dist/components/elements/HeadingV2/index.d.ts +1 -0
- package/dist/components/elements/HeadingV2/index.js +9 -8
- package/dist/components/elements/IconV2/IconV2.stories.js +1 -1
- package/dist/components/elements/IconV2/index.d.ts +1 -0
- package/dist/components/elements/IconV2/index.js +3 -2
- package/dist/components/elements/LabelV2/LabelV2.stories.js +1 -1
- package/dist/components/elements/ListBoxV2/index.d.ts +2 -0
- package/dist/components/elements/ListBoxV2/index.js +3 -2
- package/dist/components/elements/ParagraphV2/ParagraphV2.stories.js +1 -1
- package/dist/components/elements/ReadMoreV2/ReadMoreV2.stories.js +1 -1
- package/dist/components/elements/ReadMoreV2/index.d.ts +1 -0
- package/dist/components/elements/ReadMoreV2/index.js +3 -2
- package/dist/components/elements/RowV2/RowV2.module.css +47 -0
- package/dist/components/elements/{layoutV2/RowV2.d.ts → RowV2/index.d.ts} +1 -0
- package/dist/components/elements/{layoutV2/RowV2.js → RowV2/index.js} +12 -10
- package/dist/components/elements/SelectV2/SelectV2.stories.js +1 -1
- package/dist/components/elements/SelectV2/index.d.ts +2 -1
- package/dist/components/elements/SelectV2/index.js +3 -3
- package/dist/components/elements/SpinnerV2/SpinnerV2.stories.js +1 -1
- package/dist/components/elements/SpinnerV2/index.d.ts +1 -0
- package/dist/components/elements/SpinnerV2/index.js +3 -2
- package/dist/components/elements/TextInputV2/TextInputV2.stories.js +1 -1
- package/dist/components/elements/TextInputV2/index.d.ts +2 -0
- package/dist/components/elements/TextInputV2/index.js +3 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/theme/typography.js +1 -1
- package/dist/utils/processSx.js +2 -37
- package/package.json +2 -1
- /package/dist/components/elements/{layoutV2/BoxV2.d.ts → BoxV2/index.d.ts} +0 -0
- /package/dist/components/elements/{layoutV2/BoxV2.js → BoxV2/index.js} +0 -0
|
@@ -35,6 +35,7 @@ export type CardV2Props = StyledElementPropsV2<HTMLDivElement, {
|
|
|
35
35
|
containImage?: boolean;
|
|
36
36
|
backgroundColor?: COLOR;
|
|
37
37
|
shouldShowHoverStyle?: boolean;
|
|
38
|
+
className?: string;
|
|
38
39
|
leftBadge?: React.ReactNode;
|
|
39
40
|
rightBadge?: React.ReactNode;
|
|
40
41
|
}, CardChildren>;
|
|
@@ -3,12 +3,13 @@ import React, { useEffect, useState } from 'react';
|
|
|
3
3
|
import { HEADINGV2_SIZE, HeadingV2 } from '../../elements/HeadingV2';
|
|
4
4
|
import { BOX_SHADOW } from '../../../theme';
|
|
5
5
|
import { GROUPV2_TYPE, GroupV2 } from '../../elements/GroupV2';
|
|
6
|
-
import { BoxV2 } from '../../elements/
|
|
6
|
+
import { BoxV2 } from '../../elements/BoxV2';
|
|
7
7
|
import { IconV2 } from '../../elements/IconV2';
|
|
8
8
|
import { ColumnV2, FONT, FONT_SIZE, RowV2, TYPOGRAPHY_TYPE } from '../../..';
|
|
9
9
|
import { COLOR } from '../../../theme/colors';
|
|
10
10
|
import { KEY_CODES } from '../../../utils/misc';
|
|
11
11
|
import * as styles from './CardV2.module.css';
|
|
12
|
+
import clsx from 'clsx';
|
|
12
13
|
export var CARDV2_LAYOUT;
|
|
13
14
|
(function (CARDV2_LAYOUT) {
|
|
14
15
|
CARDV2_LAYOUT["VERTICAL"] = "vertical";
|
|
@@ -49,7 +50,7 @@ const DateDisplay = ({ date: dateString }) => {
|
|
|
49
50
|
marginTop: '0.25rem',
|
|
50
51
|
} }, { children: MONTH_LABELS[date.getMonth()] }))] })));
|
|
51
52
|
};
|
|
52
|
-
export const CardV2 = ({ size, displayDate, headline, image, alt, layout, onClick, raised, truncateHeadlineAfter, heading, headlineStyles, headingStyles, headingIcon, headingAction, backgroundColor, leftBadge, rightBadge, shouldShowHoverStyle, imageHeight: imageHeightProp, imageWidth: imageWidthProp, containImage, containerWidth, containerHeight, inlineStyles, children, }) => {
|
|
53
|
+
export const CardV2 = ({ size, displayDate, headline, image, alt, layout, onClick, raised, truncateHeadlineAfter, heading, headlineStyles, headingStyles, headingIcon, headingAction, backgroundColor, leftBadge, rightBadge, className, shouldShowHoverStyle, imageHeight: imageHeightProp, imageWidth: imageWidthProp, containImage, containerWidth, containerHeight, inlineStyles, children, }) => {
|
|
53
54
|
const contentPaddingX = size === CARDV2_SIZE.SM ? 3 : 4;
|
|
54
55
|
const isVertical = !layout || layout === CARDV2_LAYOUT.VERTICAL;
|
|
55
56
|
const [objectFit, setObjectFit] = useState('scale-down');
|
|
@@ -73,13 +74,14 @@ export const CardV2 = ({ size, displayDate, headline, image, alt, layout, onClic
|
|
|
73
74
|
const typography = size === CARDV2_SIZE.SM
|
|
74
75
|
? TYPOGRAPHY_TYPE.HEADLINE_SMALL
|
|
75
76
|
: TYPOGRAPHY_TYPE.HEADLINE_MEDIUM;
|
|
77
|
+
const baseCardClass = onClick || shouldShowHoverStyle
|
|
78
|
+
? typeSafeStyles.groupCardWrapperWithHover
|
|
79
|
+
: typeSafeStyles.groupCardWrapper;
|
|
76
80
|
return (_jsxs(GroupV2, Object.assign({ type: headline || heading ? GROUPV2_TYPE.REGION : GROUPV2_TYPE.GROUP, role: onClick ? 'button' : 'group', onClick: onClick, onKeyDown: (e) => {
|
|
77
81
|
if (onClick && e.key === KEY_CODES.ENTER) {
|
|
78
82
|
onClick();
|
|
79
83
|
}
|
|
80
|
-
}, tabIndex: onClick ? 0 : undefined, className:
|
|
81
|
-
? typeSafeStyles.groupCardWrapperWithHover
|
|
82
|
-
: typeSafeStyles.groupCardWrapper, sx: Object.assign({ boxShadow: raised || heading ? BOX_SHADOW.NORMAL : undefined, width: !isVertical && '100%', backgroundColor: backgroundColor ? backgroundColor : '', flexDirection: layout === CARDV2_LAYOUT.HORIZONTAL ? 'row' : 'column' }, inlineStyles) }, { children: [leftBadge && (_jsx(BoxV2, Object.assign({ className: typeSafeStyles.leftBadge }, { children: leftBadge }))), rightBadge && (_jsx(BoxV2, Object.assign({ className: typeSafeStyles.rightBadge }, { children: rightBadge }))), image && !containImage && (_jsx("img", { src: image, alt: alt, style: {
|
|
84
|
+
}, tabIndex: onClick ? 0 : undefined, className: clsx(baseCardClass, className), sx: Object.assign({ boxShadow: raised || heading ? BOX_SHADOW.NORMAL : undefined, width: !isVertical && '100%', backgroundColor: backgroundColor ? backgroundColor : '', flexDirection: layout === CARDV2_LAYOUT.HORIZONTAL ? 'row' : 'column' }, inlineStyles) }, { children: [leftBadge && (_jsx(BoxV2, Object.assign({ className: typeSafeStyles.leftBadge }, { children: leftBadge }))), rightBadge && (_jsx(BoxV2, Object.assign({ className: typeSafeStyles.rightBadge }, { children: rightBadge }))), image && !containImage && (_jsx("img", { src: image, alt: alt, style: {
|
|
83
85
|
width: imageWidth,
|
|
84
86
|
height: imageHeight,
|
|
85
87
|
} })), image && containImage && (_jsx(BoxV2, Object.assign({ className: typeSafeStyles.containImageContainer, sx: {
|
|
@@ -14,7 +14,7 @@ import _ReactModal from 'react-modal';
|
|
|
14
14
|
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
15
15
|
import { Z_INDEX } from '../../../theme';
|
|
16
16
|
import { GROUPV2_TYPE, GroupV2 } from '../../elements/GroupV2';
|
|
17
|
-
import { RowV2 } from '../../elements/
|
|
17
|
+
import { RowV2 } from '../../elements/RowV2';
|
|
18
18
|
import { HEADINGV2_SIZE, HeadingV2 } from '../../elements/HeadingV2';
|
|
19
19
|
import { BUTTONV2_TYPE, ButtonV2 } from '../../elements/ButtonV2';
|
|
20
20
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { BoxV2 as BoxV2Component } from '
|
|
2
|
+
import { BoxV2 as BoxV2Component } from '.';
|
|
3
3
|
declare const meta: Meta<typeof BoxV2Component>;
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof BoxV2Component>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BoxV2 as BoxV2Component } from '
|
|
2
|
+
import { BoxV2 as BoxV2Component } from '.';
|
|
3
3
|
import { COLOR } from '../../../theme/colors';
|
|
4
4
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
5
5
|
const meta = {
|
|
@@ -5,8 +5,8 @@ import SettingsIcon from '@mui/icons-material/Settings';
|
|
|
5
5
|
import { BUTTONV2_SIZE, BUTTONV2_TYPE, ButtonV2, LinkButtonV2 } from '.';
|
|
6
6
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
7
7
|
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
8
|
-
import { ColumnV2 } from '../
|
|
9
|
-
import { RowV2 } from '../
|
|
8
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
9
|
+
import { RowV2 } from '../RowV2';
|
|
10
10
|
import { ParagraphV2 } from '../ParagraphV2';
|
|
11
11
|
import { COLOR } from '../../../theme/colors';
|
|
12
12
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
@@ -24,6 +24,7 @@ export type ButtonV2Props = StyledElementPropsV2<HTMLButtonElement, {
|
|
|
24
24
|
loading?: boolean;
|
|
25
25
|
disabled?: boolean;
|
|
26
26
|
disableFocusStyles?: boolean;
|
|
27
|
+
className?: string;
|
|
27
28
|
}>;
|
|
28
29
|
export declare const ButtonV2: React.ForwardRefExoticComponent<{
|
|
29
30
|
sx?: import("../../../theme").StylesPropV2 | undefined;
|
|
@@ -41,6 +42,7 @@ export declare const ButtonV2: React.ForwardRefExoticComponent<{
|
|
|
41
42
|
loading?: boolean | undefined;
|
|
42
43
|
disabled?: boolean | undefined;
|
|
43
44
|
disableFocusStyles?: boolean | undefined;
|
|
45
|
+
className?: string | undefined;
|
|
44
46
|
} & {
|
|
45
47
|
htmlFor?: string | undefined;
|
|
46
48
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -21,6 +21,7 @@ import { processSx } from '../../../utils/processSx';
|
|
|
21
21
|
import { useHover } from '../../../utils/hooks/useHover';
|
|
22
22
|
import { useFocus } from '../../../utils/hooks/useFocus';
|
|
23
23
|
import * as styles from './ButtonV2.module.css';
|
|
24
|
+
import clsx from 'clsx';
|
|
24
25
|
export var BUTTONV2_SIZE;
|
|
25
26
|
(function (BUTTONV2_SIZE) {
|
|
26
27
|
BUTTONV2_SIZE["SM"] = "sm";
|
|
@@ -55,7 +56,7 @@ export var BUTTONV2_TYPE;
|
|
|
55
56
|
})(BUTTONV2_TYPE || (BUTTONV2_TYPE = {}));
|
|
56
57
|
const typeSafeStyles = styles;
|
|
57
58
|
export const ButtonV2 = React.forwardRef((_a, ref) => {
|
|
58
|
-
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"]);
|
|
59
|
+
var { size: sizeParam, type: typeParam, color, customColor, textColor: textColorParam, primaryIcon, leftIcon, rightIcon, disabled: disabledParam, children, sx, loading, disableFocusStyles, className } = _a, rest = __rest(_a, ["size", "type", "color", "customColor", "textColor", "primaryIcon", "leftIcon", "rightIcon", "disabled", "children", "sx", "loading", "disableFocusStyles", "className"]);
|
|
59
60
|
const disabled = disabledParam || loading;
|
|
60
61
|
const { flagInDevelopment } = useEnvironment();
|
|
61
62
|
const { isHovered, anchorElementProps } = useHover();
|
|
@@ -126,7 +127,7 @@ export const ButtonV2 = React.forwardRef((_a, ref) => {
|
|
|
126
127
|
: undefined;
|
|
127
128
|
const appliedHoverStyles = !disableFocusStyles && isHovered ? hoverStyles : {};
|
|
128
129
|
const appliedFocusStyles = !disableFocusStyles && isFocused ? hoverStyles : {};
|
|
129
|
-
return (_jsxs("button", Object.assign({}, anchorElementProps, { ref: ref, tabIndex: disabled ? -1 : 0, disabled: disabled, className: typeSafeStyles.button, style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ cursor }, processSx({
|
|
130
|
+
return (_jsxs("button", Object.assign({}, anchorElementProps, { ref: ref, tabIndex: disabled ? -1 : 0, disabled: disabled, className: clsx(typeSafeStyles.button, className), style: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ cursor }, processSx({
|
|
130
131
|
color: textColor,
|
|
131
132
|
borderColor,
|
|
132
133
|
})), { paddingLeft: paddingX, paddingRight: paddingX, width: width, height: height }), appliedHoverStyles), appliedFocusStyles), processedStyles) }, rest, { children: [leftIcon && (_jsx(IconV2, { icon: leftIcon, size: typographyStyles.fontSize, sx: { mr: iconMargin[size] }, color: textColor })), _jsx("div", Object.assign({ className: typeSafeStyles.bodyWrapper }, { children: body })), rightIcon && (_jsx(IconV2, { icon: rightIcon, size: typographyStyles.fontSize, sx: { ml: iconMargin[size] }, color: textColor }))] })));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CheckboxGroupV2 } from './index';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { RowV2 } from '../
|
|
4
|
+
import { RowV2 } from '../RowV2';
|
|
5
5
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Elements/Fields/CheckboxGroupV2',
|
|
@@ -11,12 +11,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useMemo } from 'react';
|
|
14
|
-
import { RowV2 } from '../
|
|
14
|
+
import { RowV2 } from '../RowV2';
|
|
15
15
|
import { CheckboxV2 } from '../CheckboxV2';
|
|
16
16
|
import { LabelV2 } from '../LabelV2';
|
|
17
17
|
import { GroupV2 } from '../GroupV2';
|
|
18
18
|
import { GROUPV2_TYPE } from '../GroupV2';
|
|
19
|
-
import { ColumnV2 } from '../
|
|
19
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
20
20
|
import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
|
|
21
21
|
import { COLOR } from '../../../theme/colors';
|
|
22
22
|
export function CheckboxGroupV2(_a) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { CheckboxV2 } from '.';
|
|
3
3
|
import { useState } from 'react';
|
|
4
|
-
import { RowV2 } from '../
|
|
4
|
+
import { RowV2 } from '../RowV2';
|
|
5
5
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Elements/Fields/CheckboxV2',
|
|
@@ -12,11 +12,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { processSx } from '../../../utils/processSx';
|
|
14
14
|
import * as styles from './CheckboxV2.module.css';
|
|
15
|
+
import clsx from 'clsx';
|
|
15
16
|
const typeSafeStyles = styles;
|
|
16
17
|
export const CheckboxV2 = (_a) => {
|
|
17
|
-
var { checked, onChange, disabled, sx } = _a, rest = __rest(_a, ["checked", "onChange", "disabled", "sx"]);
|
|
18
|
+
var { checked, onChange, disabled, className, sx } = _a, rest = __rest(_a, ["checked", "onChange", "disabled", "className", "sx"]);
|
|
18
19
|
const processedStyles = processSx(sx);
|
|
19
20
|
return (_jsx("input", Object.assign({ type: "checkbox", onChange: (e) => {
|
|
20
21
|
onChange(e.target.checked);
|
|
21
|
-
}, checked: checked, className: typeSafeStyles.checkbox, style: Object.assign({ cursor: disabled ? 'not-allowed' : 'pointer' }, processedStyles), disabled: disabled }, rest)));
|
|
22
|
+
}, checked: checked, className: clsx(typeSafeStyles.checkbox, className), style: Object.assign({ cursor: disabled ? 'not-allowed' : 'pointer' }, processedStyles), disabled: disabled }, rest)));
|
|
22
23
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FlexHelperPropsV2 } from '
|
|
2
|
+
import { FlexHelperPropsV2 } from '../RowV2';
|
|
3
3
|
export declare const ColumnV2: React.ForwardRefExoticComponent<{
|
|
4
4
|
sx?: import("../../../theme").StylesPropV2 | undefined;
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -11,7 +11,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import React from 'react';
|
|
14
|
-
import { convertFlexHelperPropsV2 } from '
|
|
14
|
+
import { convertFlexHelperPropsV2 } from '../RowV2';
|
|
15
15
|
import { processSx } from '../../../utils/processSx';
|
|
16
16
|
export const ColumnV2 = React.forwardRef((_a, ref) => {
|
|
17
17
|
var { sx, children } = _a, rest = __rest(_a, ["sx", "children"]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
3
3
|
import { HEADINGV2_SIZE, HeadingV2 } from '.';
|
|
4
|
-
import { ColumnV2 } from '../
|
|
4
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
5
5
|
import { COLOR } from '../../../theme/colors';
|
|
6
6
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
7
7
|
const meta = {
|
|
@@ -17,6 +17,7 @@ import { useEnvironment } from '../../providers/env';
|
|
|
17
17
|
import { multiplyRemSize } from '../../../utils/misc';
|
|
18
18
|
import { processSx } from '../../../utils/processSx';
|
|
19
19
|
import * as styles from './HeadingV2.module.css';
|
|
20
|
+
import clsx from 'clsx';
|
|
20
21
|
export var HEADINGV2_SIZE;
|
|
21
22
|
(function (HEADINGV2_SIZE) {
|
|
22
23
|
HEADINGV2_SIZE["SM"] = "sm";
|
|
@@ -39,7 +40,7 @@ const LEVEL_TYPOGRAPHY_MAP = {
|
|
|
39
40
|
6: TYPOGRAPHY_TYPE.HEADING_SMALL,
|
|
40
41
|
};
|
|
41
42
|
export const HeadingV2 = (_a) => {
|
|
42
|
-
var { sx, size, standalone, id, underline, underlineColor, typography: typographyProp, level: levelParam } = _a, rest = __rest(_a, ["sx", "size", "standalone", "id", "underline", "underlineColor", "typography", "level"]);
|
|
43
|
+
var { sx, size, standalone, id, underline, underlineColor, typography: typographyProp, level: levelParam, className } = _a, rest = __rest(_a, ["sx", "size", "standalone", "id", "underline", "underlineColor", "typography", "level", "className"]);
|
|
43
44
|
const { level: groupLevel, type, trackHeadingRendered } = useGroupV2();
|
|
44
45
|
const { flagInDevelopment } = useEnvironment();
|
|
45
46
|
const level = levelParam || groupLevel;
|
|
@@ -83,18 +84,18 @@ export const HeadingV2 = (_a) => {
|
|
|
83
84
|
const headerProps = Object.assign({ id: id, role: 'heading', 'aria-level': level, style: Object.assign(Object.assign({ borderBottomWidth: underline ? '2px' : 0, borderBottomColor: underlineColor ? underlineColor : '', marginTop: topMargin }, processedTypography), processedStyles) }, rest);
|
|
84
85
|
switch (level) {
|
|
85
86
|
case 1:
|
|
86
|
-
return _jsx("h1", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
87
|
+
return (_jsx("h1", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
87
88
|
case 2:
|
|
88
|
-
return _jsx("h2", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
89
|
+
return (_jsx("h2", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
89
90
|
case 3:
|
|
90
|
-
return _jsx("h3", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
91
|
+
return (_jsx("h3", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
91
92
|
case 4:
|
|
92
|
-
return _jsx("h4", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
93
|
+
return (_jsx("h4", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
93
94
|
case 5:
|
|
94
|
-
return _jsx("h5", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
95
|
+
return (_jsx("h5", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
95
96
|
case 6:
|
|
96
|
-
return _jsx("h6", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
97
|
+
return (_jsx("h6", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
97
98
|
default:
|
|
98
|
-
return _jsx("h6", Object.assign({ className: typeSafeStyles.heading }, headerProps));
|
|
99
|
+
return (_jsx("h6", Object.assign({ className: clsx(typeSafeStyles.heading, className) }, headerProps)));
|
|
99
100
|
}
|
|
100
101
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
3
3
|
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
4
|
-
import { ColumnV2 } from '../
|
|
4
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
5
5
|
import { IconV2 } from '.';
|
|
6
6
|
import AccessAlarmIcon from '@mui/icons-material/AccessAlarm';
|
|
7
7
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -15,16 +15,17 @@ import { COLOR, colors } from '../../../theme/colors';
|
|
|
15
15
|
import { useEnvironment } from '../../providers/env';
|
|
16
16
|
import { processSx } from '../../../utils/processSx';
|
|
17
17
|
import * as styles from './IconV2.module.css';
|
|
18
|
+
import clsx from 'clsx';
|
|
18
19
|
const typeSafeStyles = styles;
|
|
19
20
|
export const IconV2 = (_a) => {
|
|
20
|
-
var { icon, size, color, sx, onClick } = _a, rest = __rest(_a, ["icon", "size", "color", "sx", "onClick"]);
|
|
21
|
+
var { icon, size, color, className, sx, onClick } = _a, rest = __rest(_a, ["icon", "size", "color", "className", "sx", "onClick"]);
|
|
21
22
|
const InnerComponent = icon;
|
|
22
23
|
const processedStyles = processSx(Object.assign({ fontSize: size }, sx));
|
|
23
24
|
const { flagInDevelopment } = useEnvironment();
|
|
24
25
|
if (onClick && !rest['aria-label']) {
|
|
25
26
|
flagInDevelopment('Icon component with onClick should have an aria-label and tabIndex={0}');
|
|
26
27
|
}
|
|
27
|
-
return (_jsx("div", Object.assign({ tabIndex: onClick ? 0 : undefined, role: onClick ? 'button' : 'none', onClick: onClick, className: typeSafeStyles.iconWrapper, style: processedStyles }, rest, { children: React.createElement(InnerComponent, {
|
|
28
|
+
return (_jsx("div", Object.assign({ tabIndex: onClick ? 0 : undefined, role: onClick ? 'button' : 'none', onClick: onClick, className: clsx(typeSafeStyles.iconWrapper, className), style: processedStyles }, rest, { children: React.createElement(InnerComponent, {
|
|
28
29
|
style: {
|
|
29
30
|
fontSize: 'inherit',
|
|
30
31
|
color: colors[color || COLOR.PRIMARY],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
3
3
|
import { LABELV2_SIZE, LabelV2 } from '.';
|
|
4
|
-
import { ColumnV2 } from '../
|
|
4
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
5
5
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
6
|
const meta = {
|
|
7
7
|
title: 'Elements/LabelV2',
|
|
@@ -3,6 +3,7 @@ import { StyledElementPropsV2 } from '../../../theme';
|
|
|
3
3
|
import { BasicOption, RenderOption } from '../option';
|
|
4
4
|
type ListBoxV2Props<Value extends Key, Option extends BasicOption<Value>> = StyledElementPropsV2<HTMLDivElement, {
|
|
5
5
|
options: Option[];
|
|
6
|
+
className?: string;
|
|
6
7
|
renderOption?: RenderOption<Value, Option>;
|
|
7
8
|
selected?: Value;
|
|
8
9
|
focused?: Value;
|
|
@@ -17,6 +18,7 @@ export declare const ListBoxV2: <Value extends React.Key = string, Option extend
|
|
|
17
18
|
children?: React.ReactNode;
|
|
18
19
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & {
|
|
19
20
|
options: Option[];
|
|
21
|
+
className?: string | undefined;
|
|
20
22
|
renderOption?: RenderOption<Value, Option> | undefined;
|
|
21
23
|
selected?: Value | undefined;
|
|
22
24
|
focused?: Value | undefined;
|
|
@@ -15,6 +15,7 @@ import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography'
|
|
|
15
15
|
import { defaultRenderOption, getOptionId, } from '../option';
|
|
16
16
|
import { processSx } from '../../../utils/processSx';
|
|
17
17
|
import * as styles from './ListBoxV2.module.css';
|
|
18
|
+
import clsx from 'clsx';
|
|
18
19
|
const typeSafeStyles = styles;
|
|
19
20
|
function ListBoxOption({ option, selected, focused, selectOption, renderOption, }) {
|
|
20
21
|
return (_jsx("div", Object.assign({ id: getOptionId(option.value), "aria-selected": selected === option.value, role: "option", onClick: option.onClick, onMouseDown: () => selectOption && selectOption(option), className: typeSafeStyles.listBoxOption }, { children: renderOption({
|
|
@@ -24,11 +25,11 @@ function ListBoxOption({ option, selected, focused, selectOption, renderOption,
|
|
|
24
25
|
}) }), option.value));
|
|
25
26
|
}
|
|
26
27
|
function ListBoxInnerV2(_a, ref) {
|
|
27
|
-
var { options, renderOption: renderOptionParam, selected, focused, selectOption, sx, style } = _a, rest = __rest(_a, ["options", "renderOption", "selected", "focused", "selectOption", "sx", "style"]);
|
|
28
|
+
var { options, renderOption: renderOptionParam, selected, focused, selectOption, className, sx, style } = _a, rest = __rest(_a, ["options", "renderOption", "selected", "focused", "selectOption", "className", "sx", "style"]);
|
|
28
29
|
const renderOption = renderOptionParam || defaultRenderOption;
|
|
29
30
|
const typography = getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_MEDIUM);
|
|
30
31
|
const processedStyles = processSx(Object.assign(Object.assign({}, typography), sx));
|
|
31
|
-
return (_jsx("div", Object.assign({ role: "listbox", ref: ref, className: typeSafeStyles.listBox, style: Object.assign(Object.assign({}, style), processedStyles), onKeyDown: (e) => {
|
|
32
|
+
return (_jsx("div", Object.assign({ role: "listbox", ref: ref, className: clsx(typeSafeStyles.listBox, className), style: Object.assign(Object.assign({}, style), processedStyles), onKeyDown: (e) => {
|
|
32
33
|
console.log(e);
|
|
33
34
|
} }, rest, { children: options.map((option) => (_jsx(ListBoxOption, { option: option, selected: selected, focused: focused, selectOption: selectOption, renderOption: renderOption }, option.value))) })));
|
|
34
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
3
3
|
import { PARAGRAPHV2_SIZE, ParagraphV2 } from '.';
|
|
4
|
-
import { ColumnV2 } from '../
|
|
4
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
5
5
|
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
6
6
|
import { COLOR } from '../../../theme/colors';
|
|
7
7
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ReadMoreV2 } from '.';
|
|
3
|
-
import { ColumnV2 } from '../
|
|
3
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
4
4
|
import { TYPOGRAPHY_TYPE } from '../../../theme/typography';
|
|
5
5
|
import { COLOR } from '../../../theme/colors';
|
|
6
6
|
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
@@ -18,6 +18,7 @@ import { multiplyRemSize } from '../../../utils/misc';
|
|
|
18
18
|
import { useManualRerender } from '../../../utils/hooks/useManualRerender';
|
|
19
19
|
import { processSx } from '../../../utils/processSx';
|
|
20
20
|
import * as styles from './ReadMoreV2.module.css';
|
|
21
|
+
import clsx from 'clsx';
|
|
21
22
|
const typeSafeStyles = styles;
|
|
22
23
|
const ReadMoreLinkV2 = (props) => {
|
|
23
24
|
const bg = colors[props.bg || COLOR.BACKGROUND];
|
|
@@ -40,7 +41,7 @@ export const useLinesHeightV2 = (args) => {
|
|
|
40
41
|
};
|
|
41
42
|
export const ReadMoreV2 = (_a) => {
|
|
42
43
|
var _b, _c;
|
|
43
|
-
var { typography, sx, role, lines, fixedHeight, children } = _a, rest = __rest(_a, ["typography", "sx", "role", "lines", "fixedHeight", "children"]);
|
|
44
|
+
var { typography, sx, role, lines, fixedHeight, className, children } = _a, rest = __rest(_a, ["typography", "sx", "role", "lines", "fixedHeight", "className", "children"]);
|
|
44
45
|
const ref = React.useRef(null);
|
|
45
46
|
const [showEllipsis, setShowEllipsis] = useState(true);
|
|
46
47
|
const forceRerender = useManualRerender();
|
|
@@ -77,5 +78,5 @@ export const ReadMoreV2 = (_a) => {
|
|
|
77
78
|
(_b = ref === null || ref === void 0 ? void 0 : ref.current) === null || _b === void 0 ? void 0 : _b.scrollHeight,
|
|
78
79
|
(_c = ref === null || ref === void 0 ? void 0 : ref.current) === null || _c === void 0 ? void 0 : _c.clientHeight,
|
|
79
80
|
]);
|
|
80
|
-
return (_jsxs("div", Object.assign({ role: role || 'region', ref: ref, className: typeSafeStyles.outerWrapper, style: Object.assign(Object.assign({}, processedStyles), { maxHeight: wrapperHeight, height: fixedHeight ? wrapperHeight : '' }) }, rest, { children: [children, showEllipsis && _jsx(ReadMoreLinkV2, { bg: validBg, color: validColor })] })));
|
|
81
|
+
return (_jsxs("div", Object.assign({ role: role || 'region', ref: ref, className: clsx(typeSafeStyles.outerWrapper, className), style: Object.assign(Object.assign({}, processedStyles), { maxHeight: wrapperHeight, height: fixedHeight ? wrapperHeight : '' }) }, rest, { children: [children, showEllipsis && _jsx(ReadMoreLinkV2, { bg: validBg, color: validColor })] })));
|
|
81
82
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.row {
|
|
2
|
+
display: flex;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.flexRow {
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.bp0 {
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
|
|
12
|
+
@media screen and (min-width: 576px) {
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.bp1 {
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
|
|
20
|
+
@media screen and (min-width: 768px) {
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.bp2 {
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
|
|
28
|
+
@media screen and (min-width: 992px) {
|
|
29
|
+
flex-direction: row;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.bp3 {
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
|
|
36
|
+
@media screen and (min-width: 1200px) {
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.bp4 {
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
|
|
44
|
+
@media screen and (min-width: 1400px) {
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -14,6 +14,7 @@ export declare const RowV2: React.ForwardRefExoticComponent<{
|
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "children" | "onChange"> & FlexHelperPropsV2 & {
|
|
16
16
|
breakpoint?: number | undefined;
|
|
17
|
+
className?: string | undefined;
|
|
17
18
|
} & {
|
|
18
19
|
htmlFor?: string | undefined;
|
|
19
20
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -12,6 +12,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import React from 'react';
|
|
14
14
|
import { processSx } from '../../../utils/processSx';
|
|
15
|
+
import * as styles from './RowV2.module.css';
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
const typeSafeStyles = styles;
|
|
15
18
|
export const convertFlexHelperPropsV2 = (props) => {
|
|
16
19
|
const styleObject = {};
|
|
17
20
|
if (props.grow) {
|
|
@@ -39,16 +42,15 @@ export const convertFlexHelperPropsV2 = (props) => {
|
|
|
39
42
|
return styleObject;
|
|
40
43
|
};
|
|
41
44
|
export const RowV2 = React.forwardRef((_a, ref) => {
|
|
42
|
-
var { sx, children, breakpoint: breakpointParam } = _a, rest = __rest(_a, ["sx", "children", "breakpoint"]);
|
|
45
|
+
var { sx, children, breakpoint: breakpointParam, className } = _a, rest = __rest(_a, ["sx", "children", "breakpoint", "className"]);
|
|
43
46
|
const flexStyles = convertFlexHelperPropsV2(rest);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
flexDirection.push('column');
|
|
47
|
+
const processedStyles = processSx(sx);
|
|
48
|
+
const getBreakpointClass = (breakpoint) => {
|
|
49
|
+
if (breakpoint !== undefined && breakpoint >= 0 && breakpoint <= 4) {
|
|
50
|
+
return typeSafeStyles[`bp${breakpoint}`];
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
const
|
|
53
|
-
return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign(
|
|
52
|
+
return typeSafeStyles.flexRow;
|
|
53
|
+
};
|
|
54
|
+
const flexBreakpointClass = getBreakpointClass(breakpointParam);
|
|
55
|
+
return (_jsx("div", Object.assign({}, rest, { ref: ref, style: Object.assign(Object.assign({}, flexStyles), processedStyles), className: clsx(typeSafeStyles.row, flexBreakpointClass, className) }, { children: children })));
|
|
54
56
|
});
|
|
@@ -3,7 +3,7 @@ import AppleIcon from '@mui/icons-material/Apple';
|
|
|
3
3
|
import { INPUTV2_SIZE } from '../TextInputV2';
|
|
4
4
|
import { SelectV2 } from '.';
|
|
5
5
|
import { useState } from 'react';
|
|
6
|
-
import { ColumnV2 } from '../
|
|
6
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
7
7
|
import { GroupV2 } from '../GroupV2';
|
|
8
8
|
import { HeadingV2, HEADINGV2_SIZE } from '../HeadingV2';
|
|
9
9
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -13,6 +13,7 @@ type SelectV2Props<Value extends Key, Option extends BasicOption<Value>> = Style
|
|
|
13
13
|
options: Option[];
|
|
14
14
|
renderOption?: RenderOption<Value, Option>;
|
|
15
15
|
renderOptionLabel?: RenderOptionLabel<Option>;
|
|
16
|
+
className?: string;
|
|
16
17
|
}, string>;
|
|
17
|
-
export declare function SelectV2<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, inverted, renderOptionLabel: renderOptionLabelParam, sx, }: SelectV2Props<Value, Option>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function SelectV2<Value extends Key, Option extends BasicOption<Value>>({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, inverted, renderOptionLabel: renderOptionLabelParam, className, sx, }: SelectV2Props<Value, Option>): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export {};
|
|
@@ -9,7 +9,7 @@ import { BUTTONV2_SIZE, BUTTONV2_TYPE, ButtonV2 } from '../ButtonV2';
|
|
|
9
9
|
import { defaultRenderOptionLabel, getOptionId, } from '../option';
|
|
10
10
|
import { KEY_CODES, importedDefaultComponentShim } from '../../../utils/misc';
|
|
11
11
|
import { COLOR } from '../../../theme/colors';
|
|
12
|
-
import { BoxV2 } from '../
|
|
12
|
+
import { BoxV2 } from '../BoxV2';
|
|
13
13
|
import { LabelV2 } from '../LabelV2';
|
|
14
14
|
import { useUniqueId } from '../../providers/uniqueIds';
|
|
15
15
|
import { BOX_SHADOW, Z_INDEX } from '../../../theme/custom';
|
|
@@ -35,7 +35,7 @@ const buttonSizeMap = {
|
|
|
35
35
|
};
|
|
36
36
|
const DEFAULT_WIDTH = '16rem';
|
|
37
37
|
const typeSafeStyles = styles;
|
|
38
|
-
export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, inverted, renderOptionLabel: renderOptionLabelParam, sx, }) {
|
|
38
|
+
export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label, onSelectOption, options, renderOption, inverted, renderOptionLabel: renderOptionLabelParam, className, sx, }) {
|
|
39
39
|
const listboxId = useUniqueId('select-list-box');
|
|
40
40
|
const inputId = useUniqueId('select-input');
|
|
41
41
|
const { isHovered, anchorElementProps } = useHover();
|
|
@@ -130,7 +130,7 @@ export function SelectV2({ size: sizeParam, placeholder, leftIcon, value, label,
|
|
|
130
130
|
const fieldsetBorderColor = processSx({
|
|
131
131
|
borderColor: inverted ? COLOR.WHITE : COLOR.LIGHT_GRAY,
|
|
132
132
|
});
|
|
133
|
-
return (_jsxs(BoxV2, Object.assign({}, anchorElementProps, { sx: Object.assign(Object.assign(Object.assign({ width: DEFAULT_WIDTH, position: 'relative', borderRadius: '4px', backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE }, appliedHoverStyles), appliedFocusStyles), sx) }, { children: [_jsx("fieldset", Object.assign({ className: typeSafeStyles.fieldset, style: Object.assign({}, fieldsetBorderColor) }, { children: _jsx("legend", Object.assign({ className: typeSafeStyles.legend }, { children: label && (_jsx(LabelV2, Object.assign({ standalone: true, sx: {
|
|
133
|
+
return (_jsxs(BoxV2, Object.assign({}, anchorElementProps, { className: className, sx: Object.assign(Object.assign(Object.assign({ width: DEFAULT_WIDTH, position: 'relative', borderRadius: '4px', backgroundColor: inverted ? COLOR.DARK_GRAY : COLOR.WHITE }, appliedHoverStyles), appliedFocusStyles), sx) }, { children: [_jsx("fieldset", Object.assign({ className: typeSafeStyles.fieldset, style: Object.assign({}, fieldsetBorderColor) }, { children: _jsx("legend", Object.assign({ className: typeSafeStyles.legend }, { children: label && (_jsx(LabelV2, Object.assign({ standalone: true, sx: {
|
|
134
134
|
px: 1,
|
|
135
135
|
position: 'relative',
|
|
136
136
|
display: 'inline-flex',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ColumnV2 } from '../
|
|
2
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
3
3
|
import { GROUPV2_TYPE, GroupV2 } from '../GroupV2';
|
|
4
4
|
import { HEADINGV2_SIZE, HeadingV2 } from '../HeadingV2';
|
|
5
5
|
import { SPINNERV2_SIZE, SpinnerV2 } from '.';
|
|
@@ -9,6 +9,7 @@ export declare enum SPINNERV2_SIZE {
|
|
|
9
9
|
export type SpinnerV2Props = StyledElementPropsV2<HTMLDivElement, {
|
|
10
10
|
size?: SPINNERV2_SIZE;
|
|
11
11
|
color?: COLOR;
|
|
12
|
+
className?: string;
|
|
12
13
|
}>;
|
|
13
14
|
export declare const SPINNERV2_LABEL = "Loading";
|
|
14
15
|
export declare const SpinnerV2: React.FC<SpinnerV2Props>;
|
|
@@ -13,6 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
13
|
import { COLOR, colors } from '../../../theme/colors';
|
|
14
14
|
import { processSx } from '../../../utils/processSx';
|
|
15
15
|
import * as styles from './SpinnerV2.module.css';
|
|
16
|
+
import clsx from 'clsx';
|
|
16
17
|
export var SPINNERV2_SIZE;
|
|
17
18
|
(function (SPINNERV2_SIZE) {
|
|
18
19
|
SPINNERV2_SIZE["SM"] = "sm";
|
|
@@ -27,9 +28,9 @@ const sizeLengthMap = {
|
|
|
27
28
|
export const SPINNERV2_LABEL = 'Loading';
|
|
28
29
|
const typeSafeStyles = styles;
|
|
29
30
|
export const SpinnerV2 = (_a) => {
|
|
30
|
-
var { size: sizeParam, color: colorParam, sx } = _a, rest = __rest(_a, ["size", "color", "sx"]);
|
|
31
|
+
var { size: sizeParam, color: colorParam, className, sx } = _a, rest = __rest(_a, ["size", "color", "className", "sx"]);
|
|
31
32
|
const size = sizeParam || SPINNERV2_SIZE.MD;
|
|
32
33
|
const color = colors[colorParam || COLOR.PRIMARY];
|
|
33
34
|
const processedStyles = processSx(sx);
|
|
34
|
-
return (_jsx("div", Object.assign({ "aria-label": SPINNERV2_LABEL, className: typeSafeStyles.spinner, style: Object.assign(Object.assign({}, processedStyles), { height: `${sizeLengthMap[size]}`, width: `${sizeLengthMap[size]}`, borderWidth: `${size === SPINNERV2_SIZE.LG ? '6px' : '4px'}`, borderStyle: 'solid', borderRadius: '50%', borderColor: `${color} ${color} transparent` }) }, rest)));
|
|
35
|
+
return (_jsx("div", Object.assign({ "aria-label": SPINNERV2_LABEL, className: clsx(typeSafeStyles.spinner, className), style: Object.assign(Object.assign({}, processedStyles), { height: `${sizeLengthMap[size]}`, width: `${sizeLengthMap[size]}`, borderWidth: `${size === SPINNERV2_SIZE.LG ? '6px' : '4px'}`, borderStyle: 'solid', borderRadius: '50%', borderColor: `${color} ${color} transparent` }) }, rest)));
|
|
35
36
|
};
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import SearchIcon from '@mui/icons-material/Search';
|
|
3
3
|
import { INPUTV2_SIZE, TextInputV2 } from '.';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { ColumnV2 } from '../
|
|
5
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
6
6
|
import { GroupV2 } from '../GroupV2';
|
|
7
7
|
import { HeadingV2, HEADINGV2_SIZE } from '../HeadingV2';
|
|
8
8
|
import { COLOR } from '../../../theme/colors';
|
|
@@ -26,6 +26,7 @@ export type TextInputV2Props = StyledElementPropsV2<HTMLInputElement, {
|
|
|
26
26
|
value: string;
|
|
27
27
|
onChange?: (value: string) => void;
|
|
28
28
|
onChangeRaw?: (e: string | React.ChangeEvent) => void;
|
|
29
|
+
className?: string;
|
|
29
30
|
}, string>;
|
|
30
31
|
export declare const TextInputV2: React.ForwardRefExoticComponent<{
|
|
31
32
|
sx?: import("../../../theme").StylesPropV2 | undefined;
|
|
@@ -40,6 +41,7 @@ export declare const TextInputV2: React.ForwardRefExoticComponent<{
|
|
|
40
41
|
value: string;
|
|
41
42
|
onChange?: ((value: string) => void) | undefined;
|
|
42
43
|
onChangeRaw?: ((e: string | React.ChangeEvent) => void) | undefined;
|
|
44
|
+
className?: string | undefined;
|
|
43
45
|
} & {
|
|
44
46
|
htmlFor?: string | undefined;
|
|
45
47
|
} & React.RefAttributes<any>>;
|
|
@@ -21,6 +21,7 @@ import { useHover } from '../../../utils/hooks/useHover';
|
|
|
21
21
|
import { useFocus } from '../../../utils/hooks/useFocus';
|
|
22
22
|
import { processSx } from '../../../utils/processSx';
|
|
23
23
|
import * as styles from './TextInputV2.module.css';
|
|
24
|
+
import clsx from 'clsx';
|
|
24
25
|
export var INPUTV2_SIZE;
|
|
25
26
|
(function (INPUTV2_SIZE) {
|
|
26
27
|
INPUTV2_SIZE["SM"] = "sm";
|
|
@@ -54,7 +55,7 @@ const defaultHeight = {
|
|
|
54
55
|
};
|
|
55
56
|
const typeSafeStyles = styles;
|
|
56
57
|
export const TextInputV2 = React.forwardRef((_a, ref) => {
|
|
57
|
-
var { value, label, onChange, onChangeRaw, onClick, inline, inverted, size: sizeParam, leftIcon, sx, disabled } = _a, rest = __rest(_a, ["value", "label", "onChange", "onChangeRaw", "onClick", "inline", "inverted", "size", "leftIcon", "sx", "disabled"]);
|
|
58
|
+
var { value, label, onChange, onChangeRaw, onClick, inline, inverted, size: sizeParam, leftIcon, sx, disabled, className } = _a, rest = __rest(_a, ["value", "label", "onChange", "onChangeRaw", "onClick", "inline", "inverted", "size", "leftIcon", "sx", "disabled", "className"]);
|
|
58
59
|
const id = useUniqueId('text-input');
|
|
59
60
|
const size = sizeParam || INPUTV2_SIZE.MD;
|
|
60
61
|
const display = inline === false ? 'flex' : '';
|
|
@@ -72,7 +73,7 @@ export const TextInputV2 = React.forwardRef((_a, ref) => {
|
|
|
72
73
|
};
|
|
73
74
|
const appliedHoverStyles = isHovered ? focusStyles : {};
|
|
74
75
|
const appliedFocusStyles = isFocused ? focusStyles : {};
|
|
75
|
-
return (_jsxs("div", Object.assign({}, anchorElementProps, { ref: ref, onClick: onClick, id: id, className: `${typeSafeStyles.wrapper} ${inverted ? typeSafeStyles.inverted : ''}`, style: Object.assign(Object.assign(Object.assign({ height,
|
|
76
|
+
return (_jsxs("div", Object.assign({}, anchorElementProps, { ref: ref, onClick: onClick, id: id, className: clsx(`${typeSafeStyles.wrapper} ${inverted ? typeSafeStyles.inverted : ''}`, className), style: Object.assign(Object.assign(Object.assign({ height,
|
|
76
77
|
display, paddingLeft: paddingX, paddingRight: paddingX }, appliedHoverStyles), appliedFocusStyles), processedStyles) }, { children: [_jsx("fieldset", Object.assign({ className: `${typeSafeStyles.fieldset} ${inverted ? typeSafeStyles.inverted : ''}` }, { children: _jsx("legend", Object.assign({ className: typeSafeStyles.legend }, { children: label && (_jsx(LabelV2, Object.assign({ standalone: true, "aria-hidden": "true", sx: {
|
|
77
78
|
px: 1,
|
|
78
79
|
position: 'relative',
|
package/dist/index.d.ts
CHANGED
|
@@ -19,11 +19,11 @@ export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
|
|
|
19
19
|
export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
|
|
20
20
|
export { Markdown } from './components/elements/Markdown';
|
|
21
21
|
export { Box } from './components/elements/layout/Box';
|
|
22
|
-
export { BoxV2 } from './components/elements/
|
|
22
|
+
export { BoxV2 } from './components/elements/BoxV2';
|
|
23
23
|
export { Column } from './components/elements/layout/Column';
|
|
24
|
-
export { ColumnV2 } from './components/elements/
|
|
24
|
+
export { ColumnV2 } from './components/elements/ColumnV2';
|
|
25
25
|
export { Row } from './components/elements/layout/Row';
|
|
26
|
-
export { RowV2 } from './components/elements/
|
|
26
|
+
export { RowV2 } from './components/elements/RowV2';
|
|
27
27
|
export { Link, LINK_SIZE } from './components/elements/Link';
|
|
28
28
|
export { INPUT_SIZE, TextInput } from './components/elements/TextInput';
|
|
29
29
|
export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
|
package/dist/index.js
CHANGED
|
@@ -18,11 +18,11 @@ export { Group, useGroup, GROUP_TYPE } from './components/elements/Group';
|
|
|
18
18
|
export { GroupV2, useGroupV2, GROUPV2_TYPE, } from './components/elements/GroupV2';
|
|
19
19
|
export { Markdown } from './components/elements/Markdown';
|
|
20
20
|
export { Box } from './components/elements/layout/Box';
|
|
21
|
-
export { BoxV2 } from './components/elements/
|
|
21
|
+
export { BoxV2 } from './components/elements/BoxV2';
|
|
22
22
|
export { Column } from './components/elements/layout/Column';
|
|
23
|
-
export { ColumnV2 } from './components/elements/
|
|
23
|
+
export { ColumnV2 } from './components/elements/ColumnV2';
|
|
24
24
|
export { Row } from './components/elements/layout/Row';
|
|
25
|
-
export { RowV2 } from './components/elements/
|
|
25
|
+
export { RowV2 } from './components/elements/RowV2';
|
|
26
26
|
export { Link, LINK_SIZE } from './components/elements/Link';
|
|
27
27
|
export { INPUT_SIZE, TextInput } from './components/elements/TextInput';
|
|
28
28
|
export { INPUTV2_SIZE, TextInputV2 } from './components/elements/TextInputV2';
|
package/dist/theme/typography.js
CHANGED
package/dist/utils/processSx.js
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import { colors, COLOR } from '../theme/colors';
|
|
2
2
|
import { fontStyles, FONT, FONT_SIZE, TYPOGRAPHY_TYPE, FONT_WEIGHT, LINE_HEIGHT, } from '../theme/typography';
|
|
3
3
|
import { getTypographyStyles } from '../theme/typography';
|
|
4
|
-
const breakpoints = {
|
|
5
|
-
xs: '576px',
|
|
6
|
-
sm: '768px',
|
|
7
|
-
md: '992px',
|
|
8
|
-
lg: '1200px',
|
|
9
|
-
xl: '1400px',
|
|
10
|
-
};
|
|
11
4
|
const resolveMappedValue = (key, value) => {
|
|
12
5
|
if (Object.values(COLOR).includes(value)) {
|
|
13
6
|
return colors[value];
|
|
@@ -97,39 +90,11 @@ export const processSx = (sx) => {
|
|
|
97
90
|
for (const key in sx) {
|
|
98
91
|
let value = sx[key];
|
|
99
92
|
value = resolveMappedValue(key, value);
|
|
100
|
-
|
|
101
|
-
styles[key] = value[0];
|
|
102
|
-
if (value[1]) {
|
|
103
|
-
styles[`@media (min-width: ${breakpoints.xs})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xs})`]), { [key]: value[1] });
|
|
104
|
-
}
|
|
105
|
-
if (value[2]) {
|
|
106
|
-
styles[`@media (min-width: ${breakpoints.sm})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.sm})`]), { [key]: value[2] });
|
|
107
|
-
}
|
|
108
|
-
if (value[3]) {
|
|
109
|
-
styles[`@media (min-width: ${breakpoints.md})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.md})`]), { [key]: value[3] });
|
|
110
|
-
}
|
|
111
|
-
if (value[4]) {
|
|
112
|
-
styles[`@media (min-width: ${breakpoints.lg})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.lg})`]), { [key]: value[4] });
|
|
113
|
-
}
|
|
114
|
-
if (value[5]) {
|
|
115
|
-
styles[`@media (min-width: ${breakpoints.xl})`] = Object.assign(Object.assign({}, styles[`@media (min-width: ${breakpoints.xl})`]), { [key]: value[5] });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
Object.assign(styles, expandShorthandProperties(key, value));
|
|
120
|
-
}
|
|
93
|
+
Object.assign(styles, expandShorthandProperties(key, value));
|
|
121
94
|
}
|
|
122
95
|
const flattenedStyles = {};
|
|
123
96
|
for (const key in styles) {
|
|
124
|
-
|
|
125
|
-
const mediaStyles = styles[key];
|
|
126
|
-
for (const mediaKey in mediaStyles) {
|
|
127
|
-
flattenedStyles[key] = Object.assign(Object.assign({}, flattenedStyles[key]), { [mediaKey]: mediaStyles[mediaKey] });
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
flattenedStyles[key] = styles[key];
|
|
132
|
-
}
|
|
97
|
+
flattenedStyles[key] = styles[key];
|
|
133
98
|
}
|
|
134
99
|
return flattenedStyles;
|
|
135
100
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndlib/component-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"files": [
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@floating-ui/react": "^0.24.5",
|
|
95
|
+
"clsx": "^2.1.1",
|
|
95
96
|
"react-beautiful-dnd": "^13.1.1",
|
|
96
97
|
"react-datepicker": "^4.16.0",
|
|
97
98
|
"react-markdown": "^8.0.7",
|
|
File without changes
|
|
File without changes
|