@wonderflow/react-components 2.39.5-next.3 → 2.40.1

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.
Files changed (85) hide show
  1. package/avatar/avatar.js +3 -2
  2. package/button/button.d.ts +4 -4
  3. package/button/button.js +5 -4
  4. package/button/button.module.css +6 -6
  5. package/card/card.d.ts +1 -1
  6. package/card/card.js +2 -2
  7. package/chip/chip.d.ts +3 -10
  8. package/chip/chip.js +3 -2
  9. package/circular-progress/circular-progress.js +3 -2
  10. package/clamp-text/clamp-text.d.ts +1 -1
  11. package/clamp-text/clamp-text.js +3 -2
  12. package/container/container.js +3 -2
  13. package/core/typography.css +6 -1
  14. package/disclosure/disclosure.js +4 -3
  15. package/dropdown/dropdown-item.d.ts +1 -1
  16. package/dropdown/dropdown-item.js +2 -0
  17. package/dropdown/dropdown-menu.d.ts +3 -3
  18. package/dropdown/dropdown-menu.js +5 -3
  19. package/dropdown/dropdown.js +1 -0
  20. package/elevator/elevator.d.ts +2 -2
  21. package/grid/grid-item.js +2 -2
  22. package/grid/grid.js +3 -2
  23. package/icon/icon.js +2 -2
  24. package/icon-button/icon-button.d.ts +1 -1
  25. package/icon-button/icon-button.js +2 -1
  26. package/index.d.ts +1 -1
  27. package/index.js +1 -1
  28. package/info-state/info-state.d.ts +3 -12
  29. package/info-state/info-state.js +3 -2
  30. package/input-group/input-group.js +4 -3
  31. package/input-group/input-group.module.css +3 -0
  32. package/linear-progress/linear-progress.d.ts +4 -4
  33. package/linear-progress/linear-progress.js +4 -3
  34. package/list/list.d.ts +1 -1
  35. package/list/list.js +3 -2
  36. package/masonry/masonry.d.ts +2 -2
  37. package/masonry/masonry.js +2 -2
  38. package/modal/modal-content.js +3 -2
  39. package/modal/modal.js +8 -6
  40. package/package.json +5 -5
  41. package/pagination/pagination.d.ts +4 -2
  42. package/pagination/pagination.js +2 -2
  43. package/prose/prose.js +3 -2
  44. package/select/select.js +3 -2
  45. package/selection-controls/checkbox.js +3 -2
  46. package/selection-controls/radio.js +3 -2
  47. package/selection-controls/toggle.js +3 -2
  48. package/separator/index.d.ts +1 -2
  49. package/separator/index.js +1 -1
  50. package/separator/separator.d.ts +3 -3
  51. package/separator/separator.js +4 -2
  52. package/skeleton-block/skeleton-block.d.ts +1 -1
  53. package/skeleton-block/skeleton-block.js +2 -2
  54. package/slider/slider.js +3 -2
  55. package/snackbar/snackbar.js +3 -2
  56. package/spinner/spinner.d.ts +2 -5
  57. package/spinner/spinner.js +4 -4
  58. package/split-button/split-button.js +3 -2
  59. package/stack/stack.js +3 -2
  60. package/star-meter/star-meter.d.ts +1 -1
  61. package/star-meter/star-meter.js +3 -2
  62. package/tab/tab-item.js +3 -2
  63. package/tab/tab-list.js +2 -1
  64. package/tab/tab-panel.js +2 -2
  65. package/tab/tab.js +2 -2
  66. package/table/table.d.ts +3 -3
  67. package/table/table.js +9 -8
  68. package/table/table.module.css +4 -0
  69. package/text/text.d.ts +1 -0
  70. package/text/text.js +3 -2
  71. package/text/text.module.css +20 -13
  72. package/textfield/base-field/base-field.d.ts +0 -1
  73. package/textfield/base-field/base-field.js +2 -2
  74. package/textfield/base-field/index.d.ts +1 -1
  75. package/textfield/textfield.d.ts +4 -4
  76. package/textfield/textfield.js +4 -3
  77. package/themes/dark.css +1 -1
  78. package/themes/light.css +1 -1
  79. package/themes.css +3 -3
  80. package/title/title.d.ts +1 -0
  81. package/title/title.js +3 -2
  82. package/title/title.module.css +33 -30
  83. package/toggle-button/toggle-button.js +3 -2
  84. package/tooltip/tooltip.d.ts +3 -2
  85. package/tooltip/tooltip.js +3 -2
@@ -1,14 +1,17 @@
1
- @import '../core/media.css';
2
-
3
1
  .Text {
4
2
  line-height: 1.5;
5
3
  min-block-size: 0.01vh;
6
- font-size: var(--fs-min);
4
+ font-size: var(--fluid-type-max);
7
5
  max-inline-size: var(--maxW, initial);
8
6
  text-align: var(--tAlign);
9
7
 
10
- @media (--from-small) {
11
- font-size: var(--fs-max);
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
+ );
12
15
  }
13
16
 
14
17
  /* Colors */
@@ -49,25 +52,29 @@
49
52
  }
50
53
 
51
54
  &[data-text-size='16'] {
52
- --fs-min: env(--font-size-14);
53
- --fs-max: env(--font-size-16);
55
+ --fluid-type-min: env(--font-size-14);
56
+ --fluid-type-factor: calc(0.69rem + 0.44vw);
57
+ --fluid-type-max: env(--font-size-16);
54
58
 
55
59
  line-height: 1.2;
56
60
  }
57
61
 
58
62
  &[data-text-size='18'] {
59
- --fs-min: env(--font-size-16);
60
- --fs-max: env(--font-size-18);
63
+ --fluid-type-min: env(--font-size-16);
64
+ --fluid-type-factor: calc(0.79rem + 0.48vw);
65
+ --fluid-type-max: env(--font-size-18);
61
66
  }
62
67
 
63
68
  &[data-text-size='22'] {
64
- --fs-min: env(--font-size-18);
65
- --fs-max: env(--font-size-22);
69
+ --fluid-type-min: env(--font-size-18);
70
+ --fluid-type-factor: calc(0.84rem + 0.88vw);
71
+ --fluid-type-max: env(--font-size-22);
66
72
  }
67
73
 
68
74
  &[data-text-size='28'] {
69
- --fs-min: env(--font-size-22);
70
- --fs-max: env(--font-size-28);
75
+ --fluid-type-min: env(--font-size-22);
76
+ --fluid-type-factor: calc(0.98rem + 1.32vw);
77
+ --fluid-type-max: env(--font-size-28);
71
78
  }
72
79
 
73
80
  /* Weights */
@@ -1,6 +1,5 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  import { Polymorphic } from '../../';
3
- export declare type PrimitiveInputType = HTMLInputElement | HTMLTextAreaElement;
4
3
  export declare type BaseFieldProps = InputHTMLAttributes<HTMLInputElement> & InputHTMLAttributes<HTMLTextAreaElement> & {
5
4
  invalid?: boolean;
6
5
  };
@@ -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, ...otherProps }, forwardedRef) => {
5
- return (React.createElement(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(BaseFieldClass, className), ...otherProps }));
4
+ export const BaseField = forwardRef(({ as: Wrapper = 'input', invalid, className, ...props }, forwardedRef) => {
5
+ return (React.createElement(Wrapper, { ref: forwardedRef, "data-basefield-invalid": invalid, className: clsx(BaseFieldClass, className), ...props }));
6
6
  });
7
7
  BaseField.displayName = 'BaseField';
@@ -1,2 +1,2 @@
1
1
  export { BaseField } from './base-field';
2
- export type { BaseFieldProps, PrimitiveInputType } from './base-field';
2
+ export type { BaseFieldProps } from './base-field';
@@ -1,6 +1,6 @@
1
1
  import React, { ChangeEvent } from 'react';
2
2
  import { IconNames } from '../icons/types';
3
- import { BaseFieldProps, PrimitiveInputType } from './base-field';
3
+ import { BaseFieldProps } 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<PrimitiveInputType>) => void;
13
+ onChange?: (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => 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<PrimitiveInputType>) => void) | undefined;
27
- } & React.RefAttributes<PrimitiveInputType>>;
26
+ onChange?: ((event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void) | undefined;
27
+ } & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement>>;
@@ -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, ...otherProps }, forwardedRef) => {
7
+ export const Textfield = forwardRef(({ children, className, disabled = false, icon, label, textarea, readOnly, invalid, iconPosition = 'right', dimension = 'regular', type, onChange, ...props }, forwardedRef) => {
8
8
  const [passwordVisible, setPasswordVisible] = useState(false);
9
9
  const uid = useUIDSeed();
10
10
  const isPassword = type === 'password';
@@ -31,8 +31,9 @@ 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, ...otherProps }))
35
- : (React.createElement(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...otherProps })),
34
+ ? (React.createElement(BaseField, { ref: forwardedRef, as: "textarea", id: uid('field'), ...commonProps, ...props }))
35
+ : (React.createElement(BaseField, { className: InputField, id: uid('field'), ref: forwardedRef, type: passwordVisible ? 'text' : type, ...commonProps, ...props })),
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
  });
39
+ Textfield.displayName = 'Textfield';
package/themes/dark.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 13 Dec 2021 16:09:51 GMT
3
+ * Generated on Fri, 14 Jan 2022 14:50:55 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes/light.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Mon, 13 Dec 2021 16:09:51 GMT
3
+ * Generated on Fri, 14 Jan 2022 14:50:55 GMT
4
4
  */
5
5
 
6
6
  :root {
package/themes.css CHANGED
@@ -4,7 +4,7 @@
4
4
  color: var(--global-foreground);
5
5
  /**
6
6
  * Do not edit directly
7
- * Generated on Mon, 13 Dec 2021 16:09:51 GMT
7
+ * Generated on Fri, 14 Jan 2022 14:50:55 GMT
8
8
  */
9
9
 
10
10
 
@@ -51,7 +51,7 @@
51
51
  color: var(--global-foreground);
52
52
  /**
53
53
  * Do not edit directly
54
- * Generated on Mon, 13 Dec 2021 16:09:51 GMT
54
+ * Generated on Fri, 14 Jan 2022 14:50:55 GMT
55
55
  */
56
56
 
57
57
 
@@ -99,7 +99,7 @@
99
99
  color: var(--global-foreground);
100
100
  /**
101
101
  * Do not edit directly
102
- * Generated on Mon, 13 Dec 2021 16:09:51 GMT
102
+ * Generated on Fri, 14 Jan 2022 14:50:55 GMT
103
103
  */
104
104
 
105
105
 
package/title/title.d.ts CHANGED
@@ -4,6 +4,7 @@ export declare type TitleProps = {
4
4
  lineHeight?: 'none' | 'small' | 'large';
5
5
  textAlign?: 'start' | 'center' | 'end';
6
6
  maxWidth?: string;
7
+ fluid?: boolean;
7
8
  };
8
9
  declare type PolymorphicTitle = Polymorphic.ForwardRefComponent<'span', TitleProps>;
9
10
  export declare const Title: PolymorphicTitle;
package/title/title.js CHANGED
@@ -1,11 +1,12 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import * as styles from './title.module.css';
3
3
  import clsx from 'clsx';
4
- export const Title = forwardRef(({ children, className, as: Wrapper = 'span', lineHeight = 'small', level = '1', textAlign = 'start', maxWidth, style, ...otherProps }, forwardedRef) => {
4
+ export const Title = forwardRef(({ children, className, as: Wrapper = 'span', lineHeight = 'small', level = '1', fluid = true, textAlign = 'start', maxWidth, style, ...props }, forwardedRef) => {
5
5
  const computedLevel = level.match(/\d/g) ? `H${level}` : level.charAt(0).toUpperCase() + level.slice(1);
6
6
  const dynamicStyle = {
7
7
  '--maxW': maxWidth,
8
8
  '--tAlign': textAlign
9
9
  };
10
- return (React.createElement(Wrapper, { ref: forwardedRef, "data-title-line-height": lineHeight, className: clsx(styles.Title, styles[computedLevel], className), style: { ...dynamicStyle, ...style }, ...otherProps }, children));
10
+ return (React.createElement(Wrapper, { ref: forwardedRef, "data-title-line-height": lineHeight, "data-title-is-fluid": fluid, className: clsx(styles.Title, styles[computedLevel], className), style: { ...dynamicStyle, ...style }, ...props }, children));
11
11
  });
12
+ Title.displayName = 'Title';
@@ -1,81 +1,84 @@
1
- @import '../core/media.css';
2
-
3
1
  .Title {
4
2
  &:is(.H1, .H2, .H3, .H4, .H5, .H6, .Display) {
5
- --lh: 0.3;
6
-
7
3
  display: block;
8
4
  line-height: env(--font-lh-small);
9
5
  color: var(--heading-foreground);
10
6
  min-block-size: 0.01vh;
11
- font-size: var(--fs-min);
7
+ font-size: var(--fluid-type-max);
12
8
  max-inline-size: var(--maxW, initial);
13
9
  text-align: var(--tAlign);
14
10
  overflow-wrap: break-word;
15
11
 
16
- @media (--from-small) {
17
- font-size: var(--fs-max);
12
+ &[data-title-is-fluid='true'] {
13
+ font-size:
14
+ clamp(
15
+ var(--fluid-type-min, env(--font-size-16)),
16
+ var(--fluid-type-factor, calc(0.6rem + 0.92vw)),
17
+ var(--fluid-type-max, 1rem)
18
+ );
18
19
  }
19
20
 
20
-
21
- &[data-title-line-height='small'] {
22
- --lh: 1.33;
21
+ &[data-title-line-height='none'] {
22
+ line-height: 0.3;
23
23
  }
24
24
 
25
- &::before {
26
- content: '';
27
- display: block;
28
- height: 0;
29
- width: 0;
30
- margin-top: calc((1 - var(--lh)) * 0.6em);
25
+ &[data-title-line-height='small'] {
26
+ line-height: 1.33;
31
27
  }
32
28
  }
33
29
 
34
30
  &:is(.H6) {
35
- --fs-min: env(--font-size-14);
36
- --fs-max: env(--font-size-18);
31
+ --fluid-type-min: env(--font-size-14);
32
+ --fluid-type-factor: calc(env(--font-size-16) + 0.44vw);
33
+ --fluid-type-max: env(--font-size-18);
37
34
 
38
35
  font-weight: 700;
39
36
  }
40
37
 
41
38
  &:is(.H5) {
42
- --fs-min: 1rem;
43
- --fs-max: 1.33rem;
39
+ --fluid-type-min: 1rem;
40
+ --fluid-type-factor: calc(0.76rem + 1.32vw);
41
+ --fluid-type-max: 1.33rem;
44
42
 
45
43
  font-weight: 700;
46
44
  }
47
45
 
48
46
  &:is(.H4) {
49
- --fs-min: 1.33rem;
50
- --fs-max: 1.77rem;
47
+ --fluid-type-min: 1.33rem;
48
+ --fluid-type-factor: calc(1.01rem + 1.76vw);
49
+ --fluid-type-max: 1.77rem;
51
50
 
52
51
  font-weight: 700;
53
52
  }
54
53
 
55
54
  &:is(.H3) {
56
- --fs-min: 1.77rem;
57
- --fs-max: 2.37rem;
55
+ --fluid-type-min: 1.77rem;
56
+ --fluid-type-factor: calc(1.35rem + 2.37vw);
57
+ --fluid-type-max: 2.37rem;
58
58
 
59
59
  font-weight: 800;
60
60
  }
61
61
 
62
62
  &:is(.H2) {
63
- --fs-min: 2.37rem;
64
- --fs-max: 3.16rem;
63
+ --fluid-type-min: 2.37rem;
64
+ --fluid-type-factor: calc(1.8rem + 3.17vw);
65
+ --fluid-type-max: 3.16rem;
65
66
 
66
67
  font-weight: 800;
67
68
  }
68
69
 
69
70
  &:is(.H1) {
70
- --fs-min: 3.16rem;
71
- --fs-max: 4.2rem;
71
+ --fluid-type-min: 3.16rem;
72
+ --fluid-type-factor: calc(2.23rem + 4.17vw);
73
+ --fluid-type-max: 4.2rem;
72
74
 
73
75
  font-weight: 800;
74
76
  }
75
77
 
76
78
  &.Display {
77
- --fs-min: 4.2rem;
78
- --fs-max: 5.6rem;
79
+ --fluid-type-min: 4.2rem;
80
+ --fluid-type-factor: calc(3.19rem + 5.66vw);
81
+ --fluid-type-max: 5.6rem;
79
82
 
80
83
  font-weight: 800;
81
84
  }
@@ -21,7 +21,7 @@ const scaleAnimation = {
21
21
  }
22
22
  }
23
23
  };
24
- export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, dimension, kind, disabled, iconColor, pressed = false, onClick, ...otherProps }, forwardedRef) => {
24
+ export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, dimension, kind, disabled, iconColor, pressed = false, onClick, ...props }, forwardedRef) => {
25
25
  const [isPressed, setIsPressed] = useState(pressed);
26
26
  const [firstRender, setFirstRender] = useState(true);
27
27
  useEffect(() => {
@@ -39,7 +39,8 @@ export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, d
39
39
  };
40
40
  return (React.createElement(Icon, { name: icon, dimension: iconSize[dimension] }));
41
41
  }, []);
42
- return (React.createElement(IconButton, { as: "button", ref: forwardedRef, dimension: dimension, "aria-pressed": isPressed, kind: kind, disabled: disabled, onClick: handleClick, className: clsx(ToggleButtonClass, className), ...otherProps }, isPressed && pressedIcon
42
+ return (React.createElement(IconButton, { as: "button", ref: forwardedRef, dimension: dimension, "aria-pressed": isPressed, kind: kind, disabled: disabled, onClick: handleClick, className: clsx(ToggleButtonClass, className), ...props }, isPressed && pressedIcon
43
43
  ? (React.createElement(motion.span, { key: "pressedIcon", variants: scaleAnimation, initial: firstRender && isPressed ? false : 'scaleOut', animate: "scaleIn" }, renderIcon(pressedIcon, dimension)))
44
44
  : restingIcon && (React.createElement(motion.span, { key: "restingIcon", variants: scaleAnimation, initial: firstRender && !isPressed ? false : 'scaleOut', animate: "scaleIn" }, renderIcon(restingIcon, dimension)))));
45
45
  });
46
+ ToggleButton.displayName = 'ToggleButton';
@@ -1,4 +1,4 @@
1
- import { FC, ReactNode } from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { AutoPlacement, BasePlacement, VariationPlacement } from '@popperjs/core/lib';
3
3
  export declare type TooltipProps = PropsWithClass & {
4
4
  children: ReactNode;
@@ -8,5 +8,6 @@ export declare type TooltipProps = PropsWithClass & {
8
8
  delay?: number;
9
9
  maxWidth?: string;
10
10
  fill?: boolean;
11
+ interactive?: boolean;
11
12
  };
12
- export declare const Tooltip: FC<TooltipProps>;
13
+ export declare const Tooltip: React.FC<TooltipProps>;
@@ -5,16 +5,17 @@ import { Elevator } from '../';
5
5
  import { useFocusWithin } from '@react-aria/interactions';
6
6
  import { Tooltip as TooltipClass, Arrow, Trigger } from './tooltip.module.css';
7
7
  import { usePopperTooltip } from 'react-popper-tooltip';
8
- export const Tooltip = ({ children, trigger, placement = 'bottom-start', show, style, maxWidth = '40ch', fill = false, delay = 500 }) => {
8
+ export const Tooltip = ({ children, trigger, placement = 'bottom-start', show, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500 }) => {
9
9
  const seedID = useUIDSeed();
10
10
  const [controlledVisible, setControlledVisible] = useState(false);
11
11
  useKey('Escape', () => setControlledVisible(false));
12
12
  const { getArrowProps, getTooltipProps, setTooltipRef, setTriggerRef, visible } = usePopperTooltip({
13
13
  delayShow: delay,
14
- delayHide: 200,
14
+ delayHide: 300,
15
15
  trigger: ['hover', 'focus'],
16
16
  visible: show || controlledVisible,
17
17
  closeOnTriggerHidden: true,
18
+ interactive: interactive,
18
19
  onVisibleChange: setControlledVisible,
19
20
  placement: placement,
20
21
  offset: [0, 16]