@ndlib/component-library 1.0.22 → 1.0.23

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.
@@ -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>;
@@ -9,6 +9,7 @@ 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: onClick || shouldShowHoverStyle
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: {
@@ -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 }))] })));
@@ -4,6 +4,7 @@ type CheckboxV2Props = StyledElementPropsV2<HTMLInputElement, {
4
4
  checked: boolean;
5
5
  onChange: (value: boolean) => void;
6
6
  disabled?: boolean;
7
+ className?: string;
7
8
  }, string>;
8
9
  export declare const CheckboxV2: React.FC<CheckboxV2Props>;
9
10
  export {};
@@ -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
  };
@@ -11,6 +11,7 @@ type HeaderV2Props = StyledElementPropsV2<HTMLSpanElement, {
11
11
  typography?: TYPOGRAPHY_TYPE;
12
12
  headlineStyles?: any;
13
13
  level?: number;
14
+ className?: string;
14
15
  }>;
15
16
  export declare enum HEADINGV2_SIZE {
16
17
  SM = "sm",
@@ -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
  };
@@ -6,5 +6,6 @@ export type IconV2Props = StyledElementPropsV2<HTMLDivElement, {
6
6
  icon: React.FC<any>;
7
7
  size?: FONT_SIZE;
8
8
  color?: COLOR;
9
+ className?: string;
9
10
  }>;
10
11
  export declare const IconV2: React.FC<IconV2Props>;
@@ -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],
@@ -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
  }
@@ -9,4 +9,5 @@ export declare const ReadMoreV2: React.FC<StyledElementPropsV2<HTMLDivElement, {
9
9
  typography: TYPOGRAPHY_TYPE;
10
10
  lines: number;
11
11
  fixedHeight?: boolean;
12
+ className?: string;
12
13
  }, string>>;
@@ -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
  };
@@ -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 {};
@@ -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',
@@ -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
  };
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndlib/component-library",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
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",