@wonderflow/react-components 3.0.0-next.2 → 3.0.0-next.3
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/avatar/avatar.js +2 -2
- package/button/button.d.ts +4 -4
- package/button/button.js +4 -5
- package/button/button.module.css +22 -19
- package/card/card.d.ts +1 -1
- package/card/card.js +2 -2
- package/chip/chip.d.ts +10 -3
- package/chip/chip.js +2 -2
- package/circular-progress/circular-progress.js +2 -2
- package/clamp-text/clamp-text.d.ts +1 -1
- package/clamp-text/clamp-text.js +2 -3
- package/container/container.js +2 -3
- package/core/typography.css +1 -6
- package/core.css +5 -1
- package/disclosure/disclosure.js +3 -3
- package/dropdown/dropdown-item.d.ts +1 -1
- package/dropdown/dropdown-item.js +2 -2
- package/dropdown/dropdown-menu.d.ts +3 -3
- package/dropdown/dropdown-menu.js +11 -5
- package/dropdown/dropdown.d.ts +9 -19
- package/dropdown/dropdown.js +7 -5
- package/elevator/elevator.d.ts +2 -2
- package/grid/grid-item.d.ts +5 -1
- package/grid/grid-item.js +5 -4
- package/grid/grid.d.ts +5 -21
- package/grid/grid.js +3 -3
- package/grid/index.d.ts +1 -1
- package/grid/index.js +1 -1
- package/icon/icon.js +2 -2
- package/icon-button/icon-button.d.ts +1 -1
- package/icon-button/icon-button.js +1 -2
- package/icons/all.svg +15 -7
- package/icons/structure.json +2 -0
- package/icons/types.d.ts +4 -0
- package/index.d.ts +1 -1
- package/info-state/info-state.d.ts +12 -3
- package/info-state/info-state.js +2 -2
- package/input-group/input-group.js +3 -3
- package/input-group/input-group.module.css +0 -3
- package/linear-progress/linear-progress.d.ts +4 -4
- package/linear-progress/linear-progress.js +3 -3
- package/list/list.d.ts +2 -1
- package/list/list.js +2 -3
- package/list/list.module.css +7 -0
- package/masonry/masonry.d.ts +2 -2
- package/masonry/masonry.js +2 -2
- package/modal/modal-content.js +2 -2
- package/modal/modal.d.ts +5 -7
- package/modal/modal.js +11 -14
- package/package.json +30 -30
- package/pagination/pagination.d.ts +2 -4
- package/pagination/pagination.js +2 -2
- package/prose/prose.js +2 -3
- package/select/select.js +2 -2
- package/selection-controls/checkbox.js +2 -2
- package/selection-controls/radio.js +2 -2
- package/selection-controls/toggle.js +2 -2
- package/separator/index.d.ts +1 -0
- package/separator/separator.d.ts +3 -2
- package/separator/separator.js +2 -2
- package/skeleton-block/skeleton-block.d.ts +1 -1
- package/skeleton-block/skeleton-block.js +2 -2
- package/slider/slider.js +2 -2
- package/snackbar/snackbar.js +2 -3
- package/spinner/spinner.d.ts +5 -2
- package/spinner/spinner.js +5 -4
- package/split-button/split-button.js +2 -3
- package/stack/stack.js +2 -3
- package/star-meter/star-meter.d.ts +1 -1
- package/star-meter/star-meter.js +2 -3
- package/tab/tab-item.js +2 -2
- package/tab/tab-list.js +1 -1
- package/tab/tab-panel.js +3 -2
- package/tab/tab.d.ts +4 -4
- package/tab/tab.js +3 -2
- package/table/table.d.ts +3 -3
- package/table/table.js +8 -9
- package/table/table.module.css +0 -4
- package/text/text.d.ts +1 -1
- package/text/text.js +2 -3
- package/text/text.module.css +25 -24
- package/textfield/base-field/base-field.d.ts +1 -0
- package/textfield/base-field/base-field.js +2 -2
- package/textfield/base-field/index.d.ts +1 -1
- package/textfield/textfield.d.ts +4 -4
- package/textfield/textfield.js +3 -3
- package/themes/dark.css +1 -1
- package/themes/light.css +1 -1
- package/themes.css +3 -3
- package/title/title.d.ts +1 -1
- package/title/title.js +2 -3
- package/title/title.module.css +35 -34
- package/toggle-button/toggle-button.js +2 -3
- package/toggle-button/toggle-button.module.css +16 -2
- package/tooltip/tooltip.d.ts +2 -2
package/prose/prose.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Prose as ProseClass } from './prose.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
export const Prose = forwardRef(({ children, className, as: Wrapper = 'div', ...
|
|
5
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ProseClass, className), ...
|
|
4
|
+
export const Prose = forwardRef(({ children, className, as: Wrapper = 'div', ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(ProseClass, className), ...otherProps }, children));
|
|
6
6
|
});
|
|
7
|
-
Prose.displayName = 'Prose';
|
package/select/select.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Text, Stack, Icon } from '../';
|
|
|
3
3
|
import { Select as SelectClass, FieldContainer, Icon as IconClass, Field } from './select.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
6
|
-
export const Select = forwardRef(({ children, className, disabled = false, icon = 'sort-alt', label, kind = 'single', dimension = 'regular', onChange, ...
|
|
6
|
+
export const Select = forwardRef(({ children, className, disabled = false, icon = 'sort-alt', label, kind = 'single', dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
7
7
|
const uid = useUIDSeed();
|
|
8
8
|
const iconSizes = {
|
|
9
9
|
small: 14,
|
|
@@ -13,7 +13,7 @@ export const Select = forwardRef(({ children, className, disabled = false, icon
|
|
|
13
13
|
return (React.createElement(Stack, { as: "fieldset", rowGap: 4, className: clsx(SelectClass, className), "data-select-is-multiple": kind === 'multiple', "data-select-has-label": Boolean(label), "data-select-dimension": dimension, "aria-disabled": disabled, horizontalAlign: "start", verticalAlign: "start", inline: true, tabIndex: disabled ? 0 : undefined },
|
|
14
14
|
label && React.createElement(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: uid('select') }, label),
|
|
15
15
|
React.createElement("div", { className: FieldContainer },
|
|
16
|
-
React.createElement("select", { disabled: disabled, className: Field, id: uid('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...
|
|
16
|
+
React.createElement("select", { disabled: disabled, className: Field, id: uid('select'), multiple: kind === 'multiple', onChange: onChange, ref: forwardedRef, ...otherProps }, children),
|
|
17
17
|
kind === 'single' && (React.createElement(Icon, { className: IconClass, name: icon, dimension: iconSizes[dimension] })))));
|
|
18
18
|
});
|
|
19
19
|
Select.displayName = 'Select';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Checkbox as CheckboxClass } from './selection-controls.module.css';
|
|
4
|
-
export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, ...
|
|
5
|
-
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, "data-control-indeterminate": indeterminate, onChange: onChange, className: clsx(CheckboxClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Checkbox = forwardRef(({ className, disabled, dimension = 'regular', onChange, indeterminate, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, "data-control-indeterminate": indeterminate, onChange: onChange, className: clsx(CheckboxClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
7
|
Checkbox.displayName = 'Checkbox';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Radio as RadioClass } from './selection-controls.module.css';
|
|
4
|
-
export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...
|
|
5
|
-
return (React.createElement("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(RadioClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Radio = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "radio", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(RadioClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
7
|
Radio.displayName = 'Radio';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Toggle as ToggleClass } from './selection-controls.module.css';
|
|
4
|
-
export const Toggle = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...
|
|
5
|
-
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(ToggleClass, className), ref: forwardedRef, ...
|
|
4
|
+
export const Toggle = forwardRef(({ className, disabled, dimension = 'regular', onChange, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("input", { type: "checkbox", disabled: disabled, "aria-disabled": disabled, "data-control-dimension": dimension, onChange: onChange, className: clsx(ToggleClass, className), ref: forwardedRef, ...otherProps }));
|
|
6
6
|
});
|
|
7
7
|
Toggle.displayName = 'Toggle';
|
package/separator/index.d.ts
CHANGED
package/separator/separator.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare
|
|
1
|
+
import React, { HTMLAttributes } from 'react';
|
|
2
|
+
export declare type SeparatorProps = HTMLAttributes<HTMLHRElement>;
|
|
3
|
+
export declare const Separator: React.ForwardRefExoticComponent<SeparatorProps & React.RefAttributes<HTMLHRElement>>;
|
package/separator/separator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { Separator as SeparatorClass } from './separator.module.css';
|
|
4
|
-
export const Separator = forwardRef(({ className, ...
|
|
5
|
-
return (React.createElement("hr", { ref: forwardedRef, className: clsx(SeparatorClass, className), ...
|
|
4
|
+
export const Separator = forwardRef(({ className, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement("hr", { ref: forwardedRef, className: clsx(SeparatorClass, className), ...otherProps }));
|
|
6
6
|
});
|
|
7
7
|
Separator.displayName = 'Separator';
|
|
@@ -5,4 +5,4 @@ import { TokensTypes } from '@wonderflow/tokens/platforms/web/types';
|
|
|
5
5
|
export declare type SkeletonBlockProps = SkeletonProps & {
|
|
6
6
|
borderRadius?: TokensTypes['radius'];
|
|
7
7
|
};
|
|
8
|
-
export declare const SkeletonBlock: ({ className, borderRadius, ...
|
|
8
|
+
export declare const SkeletonBlock: ({ className, borderRadius, ...otherProps }: SkeletonBlockProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Skeleton from 'react-loading-skeleton';
|
|
3
3
|
import 'react-loading-skeleton/dist/skeleton.css';
|
|
4
|
-
export const SkeletonBlock = ({ className, borderRadius = 4, ...
|
|
5
|
-
return (React.createElement(Skeleton, { className: className, borderRadius: borderRadius, baseColor: "var(--dimmed-1)", highlightColor: "var(--dimmed-0)", ...
|
|
4
|
+
export const SkeletonBlock = ({ className, borderRadius = 4, ...otherProps }) => {
|
|
5
|
+
return (React.createElement(Skeleton, { className: className, borderRadius: borderRadius, baseColor: "var(--dimmed-1)", highlightColor: "var(--dimmed-0)", ...otherProps }));
|
|
6
6
|
};
|
package/slider/slider.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useState } from 'react';
|
|
|
2
2
|
import { Stack, Text, Icon } from '..';
|
|
3
3
|
import { Slider as SliderClass, Input, Value } from './slider.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className, defaultValue = 0, dimension = 'regular', showValues, iconMin, iconMax, ...
|
|
5
|
+
export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className, defaultValue = 0, dimension = 'regular', showValues, iconMin, iconMax, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const [value, setValue] = useState(defaultValue);
|
|
7
7
|
const isSmall = dimension === 'small';
|
|
8
8
|
const handleInput = useCallback(({ currentTarget }) => {
|
|
@@ -12,7 +12,7 @@ export const Slider = forwardRef(({ min = 0, max = 100, step, onInput, className
|
|
|
12
12
|
return (React.createElement(Stack, { direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(SliderClass, className), "data-slider-dimension": dimension },
|
|
13
13
|
showValues && React.createElement(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", textAlign: "end", className: Value }, value),
|
|
14
14
|
(iconMin && !showValues) && React.createElement(Icon, { name: iconMin, dimension: isSmall ? 16 : 24 }),
|
|
15
|
-
React.createElement("input", { ref: forwardedRef, className: Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...
|
|
15
|
+
React.createElement("input", { ref: forwardedRef, className: Input, type: "range", min: min, max: max, defaultValue: value, "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": value, step: step, onInput: handleInput, ...otherProps }),
|
|
16
16
|
showValues && React.createElement(Text, { as: "span", size: isSmall ? 14 : 16, weight: "bold", className: Value }, max),
|
|
17
17
|
(iconMax && !showValues) && React.createElement(Icon, { name: iconMax, dimension: isSmall ? 16 : 24 })));
|
|
18
18
|
});
|
package/snackbar/snackbar.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { Snackbar as SnackbarClass, Icon as IconClass, Action } from './snackbar.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { Title, Stack, Icon, Button } from '../';
|
|
5
|
-
export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'div', dismissable, dismissLabel = 'Dismiss', onDismiss, ...
|
|
5
|
+
export const Snackbar = forwardRef(({ children, className, title, icon, kind = 'neutral', as: Wrapper = 'div', dismissable, dismissLabel = 'Dismiss', onDismiss, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const defaultIcons = {
|
|
7
7
|
info: 'circle-info',
|
|
8
8
|
warning: 'triangle-exclamation',
|
|
@@ -10,7 +10,7 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
10
10
|
positive: 'check',
|
|
11
11
|
danger: 'circle-x'
|
|
12
12
|
};
|
|
13
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "alert", ...
|
|
13
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, className: clsx(SnackbarClass, className), "data-snackbar-kind": kind, role: "alert", ...otherProps },
|
|
14
14
|
React.createElement(Stack, { verticalAlign: "start", horizontalAlign: "start", direction: "row", columnGap: 16, fill: false },
|
|
15
15
|
React.createElement(Icon, { className: IconClass, name: icon || defaultIcons[kind], dimension: 24 }),
|
|
16
16
|
React.createElement(Stack, { rowGap: 16 },
|
|
@@ -20,4 +20,3 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
|
|
|
20
20
|
dismissable && (React.createElement(Stack, { horizontalAlign: "end" },
|
|
21
21
|
React.createElement(Button, { onClick: onDismiss, className: Action }, dismissLabel)))))));
|
|
22
22
|
});
|
|
23
|
-
Snackbar.displayName = 'Snackbar';
|
package/spinner/spinner.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { SVGAttributes } from 'react';
|
|
1
|
+
import React, { SVGAttributes } from 'react';
|
|
2
2
|
export declare type SpinnerProps = SVGAttributes<SVGElement> & {
|
|
3
3
|
dimension?: 'small' | 'regular' | 'big';
|
|
4
4
|
color?: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const Spinner:
|
|
6
|
+
export declare const Spinner: React.ForwardRefExoticComponent<React.SVGAttributes<SVGElement> & {
|
|
7
|
+
dimension?: "big" | "small" | "regular" | undefined;
|
|
8
|
+
color?: string | undefined;
|
|
9
|
+
} & React.RefAttributes<SVGSVGElement>>;
|
package/spinner/spinner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
|
-
export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
4
|
+
export const Spinner = forwardRef(({ className, style, color, dimension = 'big' }, forwardedRef) => {
|
|
5
5
|
const attributes = {
|
|
6
6
|
small: {
|
|
7
7
|
size: 14
|
|
@@ -13,7 +13,7 @@ export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
|
13
13
|
size: 30
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return (React.createElement(motion.svg, { className: clsx(className), animate: { rotate: '2turn' }, transition: {
|
|
16
|
+
return (React.createElement(motion.svg, { ref: forwardedRef, className: clsx(className), animate: { rotate: '2turn' }, transition: {
|
|
17
17
|
duration: 2,
|
|
18
18
|
repeat: Infinity,
|
|
19
19
|
repeatDelay: 2
|
|
@@ -22,4 +22,5 @@ export const Spinner = ({ className, style, color, dimension = 'big' }) => {
|
|
|
22
22
|
React.createElement("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
|
|
23
23
|
React.createElement("path", { d: "M36 18c0-9.94-8.06-18-18-18" },
|
|
24
24
|
React.createElement("animateTransform", { attributeName: "transform", type: "rotate", from: "0 18 18", to: "360 18 18", dur: "1s", repeatCount: "indefinite" })))));
|
|
25
|
-
};
|
|
25
|
+
});
|
|
26
|
+
Spinner.displayName = 'Spinner';
|
|
@@ -2,13 +2,12 @@ import clsx from 'clsx';
|
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { Button, Dropdown, Stack } from '..';
|
|
4
4
|
import { SplitButton as SplitButtonClass } from './split-button.module.css';
|
|
5
|
-
export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled,
|
|
5
|
+
export const SplitButton = forwardRef(({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled, busy, children, placement, dropdownOffset, onClick, pressed = false, iconPosition = 'left', ...otherProps }, forwardedRef) => {
|
|
6
6
|
const commonProps = {
|
|
7
7
|
kind,
|
|
8
8
|
dimension
|
|
9
9
|
};
|
|
10
10
|
return (React.createElement(Stack, { className: clsx(SplitButtonClass, className), direction: "row", columnGap: 0, inline: !fullWidth },
|
|
11
|
-
React.createElement(Button, {
|
|
11
|
+
React.createElement(Button, { busy: busy, disabled: disabled, fullWidth: fullWidth, onClick: onClick, pressed: pressed, iconPosition: iconPosition, ref: forwardedRef, ...commonProps, ...otherProps }, label),
|
|
12
12
|
React.createElement(Dropdown, { placement: placement, offset: dropdownOffset, trigger: React.createElement(Button, { icon: icon, ...commonProps }) }, children)));
|
|
13
13
|
});
|
|
14
|
-
SplitButton.displayName = 'SplitButton';
|
package/stack/stack.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import tksn from '@wonderflow/tokens/platforms/web/tokens.json';
|
|
3
3
|
import { Stack as StackClass } from './stack.module.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
-
export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap = 0, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true, verticalAlign = 'initial', horizontalAlign = 'initial', horizontalPadding = 0, verticalPadding = 0, style, ...
|
|
5
|
+
export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap = 0, as: Wrapper = 'div', inline = false, direction = 'column', wrap = false, fill = true, verticalAlign = 'initial', horizontalAlign = 'initial', horizontalPadding = 0, verticalPadding = 0, style, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const alignmentTemplate = (prop) => {
|
|
7
7
|
if (prop.includes('start') || prop.includes('end')) {
|
|
8
8
|
return `flex-${prop}`;
|
|
@@ -17,6 +17,5 @@ export const Stack = forwardRef(({ children, className, rowGap = 0, columnGap =
|
|
|
17
17
|
'--vPadding': verticalPadding && tksn.space[verticalPadding],
|
|
18
18
|
'--hPadding': horizontalPadding && tksn.space[horizontalPadding]
|
|
19
19
|
};
|
|
20
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, className: clsx(StackClass, className), ...
|
|
20
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, style: { ...computedStyle, ...style }, "data-stack-inline": inline, "data-stack-wrap": wrap, "data-stack-direction": direction, "data-stack-fill": fill, className: clsx(StackClass, className), ...otherProps }, children));
|
|
21
21
|
});
|
|
22
|
-
Stack.displayName = 'Stack';
|
package/star-meter/star-meter.js
CHANGED
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { useUIDSeed } from 'react-uid';
|
|
4
4
|
import { Text, Stack, Icon } from '../';
|
|
5
5
|
import { StarMeter as StarMeterClass, Gradient, Icon as IconClass } from './star-meter.module.css';
|
|
6
|
-
export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, label, dimension = 'regular', ...
|
|
6
|
+
export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, label, dimension = 'regular', ...otherProps }, forwardedRef) => {
|
|
7
7
|
const uid = useUIDSeed();
|
|
8
8
|
const labelSize = {
|
|
9
9
|
small: 14,
|
|
@@ -38,7 +38,7 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
38
38
|
return React.createElement(Icon, { name: "star", className: IconClass, dimension: 16, fill: fillType, key: starIndex });
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
-
return (React.createElement(Stack, { inline: true, direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(StarMeterClass, className), role: "meter", "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": uid('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...
|
|
41
|
+
return (React.createElement(Stack, { inline: true, direction: "row", verticalAlign: "center", columnGap: 8, className: clsx(StarMeterClass, className), role: "meter", "aria-valuenow": clamp(value, 0, starCount), "aria-valuemin": 0, "aria-valuemax": starCount, "aria-labelledby": uid('star-meter'), "data-star-meter-dimension": dimension, ref: forwardedRef, ...otherProps },
|
|
42
42
|
React.createElement("svg", { "aria-hidden": "true", className: Gradient, width: "100", height: "50", version: "1.1", xmlns: "http://www.w3.org/2000/svg" },
|
|
43
43
|
React.createElement("defs", null,
|
|
44
44
|
React.createElement("linearGradient", { id: "HalfStar" },
|
|
@@ -49,4 +49,3 @@ export const StarMeter = forwardRef(({ className, value = 0, starCount = 5, labe
|
|
|
49
49
|
React.createElement(Stack, { direction: "row", columnGap: 2 }, starType(starCount, roundValue(value))),
|
|
50
50
|
React.createElement(Text, { dimmed: 6, id: uid('star-meter'), size: labelSize[dimension], weight: "bold" }, label || value.toString())));
|
|
51
51
|
});
|
|
52
|
-
StarMeter.displayName = 'StarMeter';
|
package/tab/tab-item.js
CHANGED
|
@@ -4,7 +4,7 @@ import clsx from 'clsx';
|
|
|
4
4
|
import { Stack, Icon } from '../';
|
|
5
5
|
import { useTabState } from './primitive-tab';
|
|
6
6
|
import { TabItem as TabItemClass } from './tab.module.css';
|
|
7
|
-
export const TabItem = forwardRef(({ children, className, icon, ...
|
|
7
|
+
export const TabItem = forwardRef(({ children, className, icon, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const { onClick, isActive } = useTabState(children);
|
|
9
9
|
const internalRef = useRef(forwardedRef);
|
|
10
10
|
const [, focused, handleKeyDown, handleClick] = useRovingTabIndex(internalRef, false);
|
|
@@ -13,7 +13,7 @@ export const TabItem = forwardRef(({ children, className, icon, ...props }, forw
|
|
|
13
13
|
onClick();
|
|
14
14
|
handleClick();
|
|
15
15
|
}, [handleClick, onClick]);
|
|
16
|
-
return (React.createElement(Stack, { as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...
|
|
16
|
+
return (React.createElement(Stack, { as: "button", direction: "row", verticalAlign: "center", horizontalAlign: "start", fill: false, columnGap: 8, role: "tab", ref: internalRef, className: clsx(TabItemClass, className), "aria-selected": isActive, onClick: fireClick, onKeyDown: handleKeyDown, onFocus: fireClick, type: "button", tabIndex: isActive ? 0 : -1, ...otherProps },
|
|
17
17
|
icon && React.createElement(Icon, { name: icon, dimension: 16 }),
|
|
18
18
|
children));
|
|
19
19
|
});
|
package/tab/tab-list.js
CHANGED
|
@@ -2,6 +2,6 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import { RovingTabIndexProvider } from 'react-roving-tabindex';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { TabList as TabListClass } from './tab.module.css';
|
|
5
|
-
export const TabList = forwardRef(({ children, className, ...
|
|
5
|
+
export const TabList = forwardRef(({ children, className, ...otherProps }, forwardedRef) => (React.createElement("div", { ref: forwardedRef, role: "tablist", tabIndex: -1, className: clsx(TabListClass, className), ...otherProps },
|
|
6
6
|
React.createElement(RovingTabIndexProvider, null, children))));
|
|
7
7
|
TabList.displayName = 'Tab.List';
|
package/tab/tab-panel.js
CHANGED
|
@@ -2,9 +2,10 @@ import React, { forwardRef } from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { usePanelState } from './primitive-tab';
|
|
4
4
|
import { TabPanel as TabPanelClass } from './tab.module.css';
|
|
5
|
-
export const TabPanel = forwardRef(({ children, className, ...
|
|
5
|
+
export const TabPanel = forwardRef(({ children, className, ...otherProps }, forwardedRef) => {
|
|
6
6
|
const isActive = usePanelState(children);
|
|
7
7
|
return isActive
|
|
8
|
-
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...
|
|
8
|
+
? (React.createElement("div", { ref: forwardedRef, tabIndex: 0, className: clsx(TabPanelClass, className), ...otherProps }, children))
|
|
9
9
|
: null;
|
|
10
10
|
});
|
|
11
|
+
TabPanel.displayName = 'Tab.Panel';
|
package/tab/tab.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ export declare type TabProps = PropsWithClass & {
|
|
|
8
8
|
state?: [number, React.Dispatch<React.SetStateAction<number>>];
|
|
9
9
|
onChange?(index: number): void;
|
|
10
10
|
};
|
|
11
|
-
declare type TabComponent = React.ForwardRefExoticComponent<TabProps &
|
|
12
|
-
Panel: React.ForwardRefExoticComponent<TabPanelProps
|
|
13
|
-
Item: React.ForwardRefExoticComponent<Polymorphic.OwnProps<typeof TabItem
|
|
14
|
-
List: React.ForwardRefExoticComponent<TabListProps
|
|
11
|
+
declare type TabComponent = React.ForwardRefExoticComponent<TabProps> & {
|
|
12
|
+
Panel: React.ForwardRefExoticComponent<TabPanelProps>;
|
|
13
|
+
Item: React.ForwardRefExoticComponent<Polymorphic.OwnProps<typeof TabItem>>;
|
|
14
|
+
List: React.ForwardRefExoticComponent<TabListProps>;
|
|
15
15
|
};
|
|
16
16
|
export declare const Tab: TabComponent;
|
|
17
17
|
export {};
|
package/tab/tab.js
CHANGED
|
@@ -6,7 +6,7 @@ import { TabList } from './tab-list';
|
|
|
6
6
|
import { TabPanel } from './tab-panel';
|
|
7
7
|
import { Tabs as TabsWrapper } from './primitive-tab';
|
|
8
8
|
import { Tab as TabClass } from './tab.module.css';
|
|
9
|
-
export const Tab = forwardRef(({ children, className, state, onChange, ...
|
|
9
|
+
export const Tab = forwardRef(({ children, className, state, onChange, ...otherProps }, forwardedRef) => {
|
|
10
10
|
const renderedChildren = Children.toArray(children).filter(Boolean);
|
|
11
11
|
const innerState = useState(0);
|
|
12
12
|
const tabState = state || innerState;
|
|
@@ -17,7 +17,7 @@ export const Tab = forwardRef(({ children, className, state, onChange, ...props
|
|
|
17
17
|
onChange(currentTab);
|
|
18
18
|
}
|
|
19
19
|
}, [currentTab, onChange]);
|
|
20
|
-
return (React.createElement("div", { ref: forwardedRef, className: clsx(TabClass, className), ...
|
|
20
|
+
return (React.createElement("div", { ref: forwardedRef, className: clsx(TabClass, className), ...otherProps },
|
|
21
21
|
React.createElement(TabsWrapper, { state: tabState },
|
|
22
22
|
React.createElement(TabList, null, Children.map(renderedChildren, (child, index) => (React.createElement(TabItem, { id: seedID(`tab-item-${index}`), "aria-controls": seedID(`tab-panel-${index}`), icon: child.props.icon }, child.props.label)))),
|
|
23
23
|
Children.map(renderedChildren, (child, index) => cloneElement(child, {
|
|
@@ -25,6 +25,7 @@ export const Tab = forwardRef(({ children, className, state, onChange, ...props
|
|
|
25
25
|
'aria-labelledby': seedID(`tab-item-${index}`)
|
|
26
26
|
})))));
|
|
27
27
|
});
|
|
28
|
+
Tab.displayName = 'Tab';
|
|
28
29
|
Tab.Panel = TabPanel;
|
|
29
30
|
Tab.Item = TabItem;
|
|
30
31
|
Tab.List = TabList;
|
package/table/table.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FC } from 'react';
|
|
2
2
|
import { TableProps as ReactTableProps } from 'react-data-table-component';
|
|
3
3
|
import { IconNames } from '../icons/types';
|
|
4
4
|
export declare type TableProps<T> = ReactTableProps<T> & {
|
|
5
|
-
ExpandableRowsComponent?:
|
|
5
|
+
ExpandableRowsComponent?: FC<{
|
|
6
6
|
data: T;
|
|
7
7
|
}>;
|
|
8
8
|
collapsedRowIcon?: IconNames;
|
|
9
9
|
expandedRowIcon?: IconNames;
|
|
10
10
|
minRowHeight?: string;
|
|
11
11
|
};
|
|
12
|
-
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...
|
|
12
|
+
export declare const Table: <T>({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination, responsive, fixedHeader, noHeader, paginationPerPage, striped, theme, collapsedRowIcon, expandedRowIcon, minRowHeight, ...otherProps }: TableProps<T>) => JSX.Element;
|
package/table/table.js
CHANGED
|
@@ -2,20 +2,19 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import ReactDataTable from 'react-data-table-component';
|
|
3
3
|
import { Icon, SkeletonBlock, Checkbox } from '..';
|
|
4
4
|
import { customStyle } from './theme';
|
|
5
|
-
import {
|
|
5
|
+
import { SortIcon, ExpandWrapper, ExpandContent } from './table.module.css';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...
|
|
7
|
+
export const Table = ({ className, ExpandableRowsComponent, progressComponent, customStyles, pagination = false, responsive = true, fixedHeader = false, noHeader = true, paginationPerPage = 8, striped = false, theme = 'default', collapsedRowIcon = 'chevron-right', expandedRowIcon = 'chevron-down', minRowHeight = '48px', ...otherProps }) => {
|
|
8
8
|
const selectProps = {
|
|
9
9
|
indeterminate: (isIndeterminate) => isIndeterminate,
|
|
10
10
|
dimension: 'small'
|
|
11
11
|
};
|
|
12
12
|
const ExpandComponent = useMemo(() => ({ data: innerData }) => (React.createElement("div", { className: ExpandWrapper },
|
|
13
13
|
React.createElement("div", { className: ExpandContent }, ExpandableRowsComponent ? React.createElement(ExpandableRowsComponent, { data: innerData }) : null))), [ExpandableRowsComponent]);
|
|
14
|
-
return (React.createElement(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
React.createElement(Icon, { name: "arrow-up", dimension: 16 }))), ...props })));
|
|
14
|
+
return (React.createElement(ReactDataTable, { className: clsx(className), pagination: pagination, responsive: responsive, fixedHeader: fixedHeader, paginationPerPage: paginationPerPage, expandableRows: Boolean(ExpandableRowsComponent), expandOnRowClicked: Boolean(ExpandableRowsComponent), expandableRowsComponent: ExpandComponent, theme: theme, noHeader: noHeader, progressComponent: progressComponent || React.createElement("div", { style: { width: '100%' } },
|
|
15
|
+
React.createElement(SkeletonBlock, { height: 40, count: 8 })), striped: striped, customStyles: customStyles || customStyle(minRowHeight), selectableRowsComponent: Checkbox, selectableRowsComponentProps: selectProps, expandableIcon: {
|
|
16
|
+
collapsed: React.createElement(Icon, { name: collapsedRowIcon, fill: "var(--global-foreground)", dimension: 16 }),
|
|
17
|
+
expanded: React.createElement(Icon, { name: expandedRowIcon, fill: "var(--global-foreground)", dimension: 16 })
|
|
18
|
+
}, paginationIconFirstPage: React.createElement(Icon, { name: "backward-step", dimension: 24 }), paginationIconPrevious: React.createElement(Icon, { name: "chevron-left", dimension: 24 }), paginationIconNext: React.createElement(Icon, { name: "chevron-right", dimension: 24 }), paginationIconLastPage: React.createElement(Icon, { name: "forward-step", dimension: 24 }), sortIcon: (React.createElement("span", { className: SortIcon },
|
|
19
|
+
React.createElement(Icon, { name: "arrow-up" }))), ...otherProps }));
|
|
21
20
|
};
|
package/table/table.module.css
CHANGED
package/text/text.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export declare type TextProps = {
|
|
|
5
5
|
sentiment?: 'positive' | 'informative' | 'danger' | 'warning';
|
|
6
6
|
dimmed?: 5 | 6 | 7;
|
|
7
7
|
weight?: 'thin' | 'bold';
|
|
8
|
-
fluid?: boolean;
|
|
9
8
|
maxWidth?: string;
|
|
10
9
|
textAlign?: 'start' | 'center' | 'end';
|
|
10
|
+
responsive?: boolean;
|
|
11
11
|
};
|
|
12
12
|
declare type PolymorphicText = Polymorphic.ForwardRefComponent<'p', TextProps>;
|
|
13
13
|
export declare const Text: PolymorphicText;
|
package/text/text.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { Text as TextClass } from './text.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
export const Text = forwardRef(({ children, className, size, sentiment, dimmed, weight, maxWidth, textAlign = 'start', as: Wrapper = 'p',
|
|
4
|
+
export const Text = forwardRef(({ children, className, size, sentiment, dimmed, weight, maxWidth, textAlign = 'start', as: Wrapper = 'p', responsive = true, style, ...otherProps }, forwardedRef) => {
|
|
5
5
|
const dynamicStyle = {
|
|
6
6
|
'--maxW': maxWidth,
|
|
7
7
|
'--tAlign': textAlign
|
|
8
8
|
};
|
|
9
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, "data-text-size": size, "data-text-weight": weight, "data-text-sentiment": sentiment, "data-text-dimmed": dimmed, "data-text-
|
|
9
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, "data-text-size": size, "data-text-weight": weight, "data-text-sentiment": sentiment, "data-text-dimmed": dimmed, "data-text-responsive": responsive, className: clsx(TextClass, className), style: { ...dynamicStyle, ...style }, ...otherProps }, children));
|
|
10
10
|
});
|
|
11
|
-
Text.displayName = 'Text';
|
package/text/text.module.css
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
@import '../core/media.css';
|
|
2
|
+
|
|
1
3
|
.Text {
|
|
4
|
+
--fs-min: env(--font-size-16);
|
|
5
|
+
--fs-max: env(--font-size-18);
|
|
6
|
+
|
|
2
7
|
line-height: 1.5;
|
|
3
8
|
min-block-size: 0.01vh;
|
|
4
|
-
font-size: var(--
|
|
9
|
+
font-size: var(--fs-max);
|
|
5
10
|
max-inline-size: var(--maxW, initial);
|
|
6
11
|
text-align: var(--tAlign);
|
|
7
12
|
|
|
8
|
-
&[data-text-is-fluid='true'] {
|
|
9
|
-
font-size:
|
|
10
|
-
clamp(
|
|
11
|
-
var(--fluid-type-min, env(--font-size-16)),
|
|
12
|
-
var(--fluid-type-factor, calc(0.6rem + 0.92vw)),
|
|
13
|
-
var(--fluid-type-max, 1rem)
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
/* Colors */
|
|
18
14
|
|
|
19
15
|
&[data-text-dimmed='5'] {
|
|
@@ -48,33 +44,29 @@
|
|
|
48
44
|
|
|
49
45
|
&[data-text-size='14'] {
|
|
50
46
|
font-size: env(--font-size-14);
|
|
51
|
-
line-height:
|
|
47
|
+
line-height: env(--font-lh-small);
|
|
52
48
|
}
|
|
53
49
|
|
|
54
50
|
&[data-text-size='16'] {
|
|
55
|
-
--
|
|
56
|
-
--
|
|
57
|
-
--fluid-type-max: env(--font-size-16);
|
|
51
|
+
--fs-min: env(--font-size-14);
|
|
52
|
+
--fs-max: env(--font-size-16);
|
|
58
53
|
|
|
59
|
-
line-height:
|
|
54
|
+
line-height: env(--font-lh-small);
|
|
60
55
|
}
|
|
61
56
|
|
|
62
57
|
&[data-text-size='18'] {
|
|
63
|
-
--
|
|
64
|
-
--
|
|
65
|
-
--fluid-type-max: env(--font-size-18);
|
|
58
|
+
--fs-min: env(--font-size-16);
|
|
59
|
+
--fs-max: env(--font-size-18);
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
&[data-text-size='22'] {
|
|
69
|
-
--
|
|
70
|
-
--
|
|
71
|
-
--fluid-type-max: env(--font-size-22);
|
|
63
|
+
--fs-min: env(--font-size-18);
|
|
64
|
+
--fs-max: env(--font-size-22);
|
|
72
65
|
}
|
|
73
66
|
|
|
74
67
|
&[data-text-size='28'] {
|
|
75
|
-
--
|
|
76
|
-
--
|
|
77
|
-
--fluid-type-max: env(--font-size-28);
|
|
68
|
+
--fs-min: env(--font-size-22);
|
|
69
|
+
--fs-max: env(--font-size-28);
|
|
78
70
|
}
|
|
79
71
|
|
|
80
72
|
/* Weights */
|
|
@@ -86,4 +78,13 @@
|
|
|
86
78
|
&[data-text-weight='bold'] {
|
|
87
79
|
font-weight: 600;
|
|
88
80
|
}
|
|
81
|
+
|
|
82
|
+
/* Responsiveness */
|
|
83
|
+
&[data-text-responsive='true'] {
|
|
84
|
+
font-size: var(--fs-min);
|
|
85
|
+
|
|
86
|
+
@media (--from-small) {
|
|
87
|
+
font-size: var(--fs-max);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
89
90
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { Polymorphic } from '../../';
|
|
3
|
+
export declare type PrimitiveInputType = HTMLInputElement | HTMLTextAreaElement;
|
|
3
4
|
export declare type BaseFieldProps = InputHTMLAttributes<HTMLInputElement> & InputHTMLAttributes<HTMLTextAreaElement> & {
|
|
4
5
|
invalid?: boolean;
|
|
5
6
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { BaseField as BaseFieldClass } from './base-field.module.css';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...
|
|
5
|
-
return (React.createElement(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(BaseFieldClass, className), ...
|
|
4
|
+
export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...otherProps }, forwardedRef) => {
|
|
5
|
+
return (React.createElement(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(BaseFieldClass, className), ...otherProps }));
|
|
6
6
|
});
|
|
7
7
|
BaseField.displayName = 'BaseField';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { BaseField } from './base-field';
|
|
2
|
-
export type { BaseFieldProps } from './base-field';
|
|
2
|
+
export type { BaseFieldProps, PrimitiveInputType } from './base-field';
|
package/textfield/textfield.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ChangeEvent } from 'react';
|
|
2
2
|
import { IconNames } from '../icons/types';
|
|
3
|
-
import { BaseFieldProps } from './base-field';
|
|
3
|
+
import { BaseFieldProps, PrimitiveInputType } from './base-field';
|
|
4
4
|
export declare type TextfieldProps = BaseFieldProps & {
|
|
5
5
|
icon?: IconNames;
|
|
6
6
|
label?: string;
|
|
@@ -10,7 +10,7 @@ export declare type TextfieldProps = BaseFieldProps & {
|
|
|
10
10
|
readOnly?: boolean;
|
|
11
11
|
iconPosition?: 'left' | 'right';
|
|
12
12
|
disabled?: boolean;
|
|
13
|
-
onChange?: (event: ChangeEvent<
|
|
13
|
+
onChange?: (event: ChangeEvent<PrimitiveInputType>) => void;
|
|
14
14
|
};
|
|
15
15
|
export declare const Textfield: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLTextAreaElement> & {
|
|
16
16
|
invalid?: boolean | undefined;
|
|
@@ -23,5 +23,5 @@ export declare const Textfield: React.ForwardRefExoticComponent<React.InputHTMLA
|
|
|
23
23
|
readOnly?: boolean | undefined;
|
|
24
24
|
iconPosition?: "left" | "right" | undefined;
|
|
25
25
|
disabled?: boolean | undefined;
|
|
26
|
-
onChange?: ((event: ChangeEvent<
|
|
27
|
-
} & React.RefAttributes<
|
|
26
|
+
onChange?: ((event: ChangeEvent<PrimitiveInputType>) => void) | undefined;
|
|
27
|
+
} & React.RefAttributes<PrimitiveInputType>>;
|
package/textfield/textfield.js
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseField } from './base-field';
|
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { useUIDSeed } from 'react-uid';
|
|
6
6
|
import { Textfield as TextfieldClass, FieldContainer, InputField, Icon as IconClass, IconButton as IconButtonClass } from './textfield.module.css';
|
|
7
|
-
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, iconPosition = 'right', dimension = 'regular', type, onChange, ...
|
|
7
|
+
export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, iconPosition = 'right', dimension = 'regular', type, onChange, ...otherProps }, forwardedRef) => {
|
|
8
8
|
const [passwordVisible, setPasswordVisible] = useState(false);
|
|
9
9
|
const uid = useUIDSeed();
|
|
10
10
|
const isPassword = type === 'password';
|
|
@@ -31,8 +31,8 @@ export const Textfield = forwardRef(({ children, className, disabled = false, ic
|
|
|
31
31
|
label && React.createElement(Text, { as: "label", size: dimension === 'small' ? 14 : 16, htmlFor: uid('field') }, label),
|
|
32
32
|
React.createElement("div", { className: FieldContainer },
|
|
33
33
|
textarea
|
|
34
|
-
? (React.createElement(BaseField, { ref: forwardedRef, as: "textarea", id: uid('field'), ...commonProps, ...
|
|
35
|
-
: (React.createElement(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...
|
|
34
|
+
? (React.createElement(BaseField, { ref: forwardedRef, as: "textarea", id: uid('field'), ...commonProps, ...otherProps }))
|
|
35
|
+
: (React.createElement(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...otherProps })),
|
|
36
36
|
isPassword && (React.createElement(IconButton, { className: IconButtonClass, dimension: actionSizes[dimension], onClick: handlePasswordVisibility, kind: "flat", "aria-label": "Reveal password", icon: passwordVisible ? 'eye-slash' : 'eye' })),
|
|
37
37
|
!textarea && icon && type !== 'password' && (React.createElement(Icon, { className: IconClass, name: icon, dimension: iconSizes[dimension] })))));
|
|
38
38
|
});
|