@wonderflow/react-components 2.34.0-next.8 → 2.34.0-next.9

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.
@@ -14,7 +14,6 @@
14
14
  border: 0;
15
15
  appearance: none;
16
16
  font-weight: 600;
17
- line-height: 1;
18
17
  position: relative;
19
18
  overflow: hidden;
20
19
  border-radius: env(--radius-4);
@@ -117,6 +117,6 @@ code {
117
117
  color: var(--highlight-red-foreground);
118
118
  border-radius: env(--radius-4);
119
119
  padding: 2px 4px;
120
- font-size: 0.92em;
120
+ font-size: 1em;
121
121
  font-family: env(--font-family-mono);
122
122
  }
@@ -6,9 +6,10 @@ export declare type DropdownItemProps = PropsWithClass & {
6
6
  icon?: IconNames;
7
7
  dimension?: 'small' | 'regular';
8
8
  onClick?(): void;
9
- iconPosition: 'left' | 'right';
9
+ iconPosition?: 'left' | 'right';
10
10
  description?: ReactNode;
11
11
  disabled?: boolean;
12
+ padding?: boolean;
12
13
  };
13
14
  declare type PolymorphicDropdownItem = Polymorphic.ForwardRefComponent<'button', DropdownItemProps>;
14
15
  export declare const DropdownItem: PolymorphicDropdownItem;
@@ -3,7 +3,7 @@ import { useRovingTabIndex, useFocusEffect } from 'react-roving-tabindex';
3
3
  import { DropdownItem as DropdownItemClass, Icon as IconClass } from './dropdown-item.module.css';
4
4
  import { Tooltip, Stack, Icon } from '../';
5
5
  import clsx from 'clsx';
6
- export const DropdownItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, disabled = false, ...props }, forwardedRef) => {
6
+ export const DropdownItem = forwardRef(({ className, children, onClick, icon, dimension = 'regular', as: Wrapper = 'button', iconPosition = 'left', description, padding = true, disabled = false, ...props }, forwardedRef) => {
7
7
  const itemRef = useRef(forwardedRef);
8
8
  const [tabIndex, focused, handleKeyDown, handleClick] = useRovingTabIndex(itemRef, disabled);
9
9
  const isIconRight = iconPosition === 'right';
@@ -14,9 +14,9 @@ export const DropdownItem = forwardRef(({ className, children, onClick, icon, di
14
14
  onClick();
15
15
  }
16
16
  }, [handleClick, onClick]);
17
- const InnerContent = useMemo(() => (React.createElement(Stack, { direction: "row", as: "span", fill: false, horizontalAlign: isIconRight ? 'space-between' : 'start', verticalAlign: "center", columnGap: 8, horizontalPadding: 16, verticalPadding: 8, "data-dropdown-icon-right": isIconRight, "data-dropdown-has-icon": Boolean(icon), style: { inlineSize: '100%' } },
17
+ const InnerContent = useMemo(() => (React.createElement(Stack, { direction: "row", as: "span", fill: false, horizontalAlign: isIconRight ? 'space-between' : 'start', verticalAlign: "center", columnGap: 8, horizontalPadding: 16, verticalPadding: 8, "data-dropdown-icon-right": isIconRight, "data-dropdown-has-icon": Boolean(icon), "data-dropdown-padding": padding, style: { inlineSize: '100%' } },
18
18
  icon && (React.createElement(Icon, { className: IconClass, name: icon, dimension: dimension === 'small' ? 14 : 16 })),
19
- children)), [children, dimension, icon, isIconRight]);
19
+ children)), [children, dimension, icon, isIconRight, padding]);
20
20
  return (React.createElement(Wrapper, { ref: itemRef, role: "menuitem", className: clsx(DropdownItemClass, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-dropdown-item-dimension": dimension, ...props }, description
21
21
  ? (React.createElement(Tooltip, { fill: true, show: focused, placement: "right-start", trigger: InnerContent }, description))
22
22
  : InnerContent));
@@ -48,11 +48,11 @@
48
48
  cursor: not-allowed;
49
49
  }
50
50
 
51
- & span[data-dropdown-has-icon='false'][data-dropdown-icon-right='false'] {
51
+ & [data-dropdown-padding='true'][data-dropdown-has-icon='false'][data-dropdown-icon-right='false'] {
52
52
  padding-left: env(--space-40);
53
53
  }
54
54
 
55
- & span[data-dropdown-has-icon='false'][data-dropdown-icon-right='true'] {
55
+ & [data-dropdown-padding='true'][data-dropdown-has-icon='false'][data-dropdown-icon-right='true'] {
56
56
  padding-right: env(--space-40);
57
57
  }
58
58
  }
@@ -17,9 +17,10 @@ export declare const Dropdown: {
17
17
  icon?: import("../icons/types").IconNames | undefined;
18
18
  dimension?: "small" | "regular" | undefined;
19
19
  onClick?(): void;
20
- iconPosition: "left" | "right";
20
+ iconPosition?: "left" | "right" | undefined;
21
21
  description?: React.ReactNode;
22
22
  disabled?: boolean | undefined;
23
+ padding?: boolean | undefined;
23
24
  } & {
24
25
  checked?: boolean | undefined;
25
26
  }>;
package/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export { Icon, IconProps } from './icon';
16
16
  export { IconButton, IconButtonProps } from './icon-button';
17
17
  export { InfoState, InfoStateProps } from './info-state';
18
18
  export { List, ListProps } from './list';
19
+ export { MenuButton, MenuButtonProps } from './menu-button';
19
20
  export { Modal, ModalProps, useModalContext } from './modal';
20
21
  export { LinearProgress, LinearProgressProps } from './linear-progress';
21
22
  export { Prose, ProseProps } from './prose';
package/index.js CHANGED
@@ -16,6 +16,7 @@ export { Icon } from './icon';
16
16
  export { IconButton } from './icon-button';
17
17
  export { InfoState } from './info-state';
18
18
  export { List } from './list';
19
+ export { MenuButton } from './menu-button';
19
20
  export { Modal, useModalContext } from './modal';
20
21
  export { LinearProgress } from './linear-progress';
21
22
  export { Prose } from './prose';
@@ -0,0 +1,2 @@
1
+ export { MenuButton } from './menu-button';
2
+ export type { MenuButtonProps } from './menu-button';
@@ -0,0 +1 @@
1
+ export { MenuButton } from './menu-button';
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { Except } from 'type-fest';
3
+ import { ButtonProps, DropdownProps } from '../';
4
+ export declare type MenuButtonProps = Except<ButtonProps, 'iconPosition' | 'pressed'> & Pick<DropdownProps, 'placement'> & {
5
+ label: string;
6
+ dropdownOffset?: DropdownProps['offset'];
7
+ };
8
+ export declare const MenuButton: React.FC<MenuButtonProps>;
@@ -0,0 +1,13 @@
1
+ import clsx from 'clsx';
2
+ import React from 'react';
3
+ import { Button, Dropdown, Stack } from '../';
4
+ import { MenuButton as MenuButtonClass } from './menu-button.module.css';
5
+ export const MenuButton = ({ className, label, icon = 'chevron-down', kind, dimension, fullWidth, disabled, loading, children, placement, dropdownOffset }) => {
6
+ const commonProps = {
7
+ kind,
8
+ dimension
9
+ };
10
+ return (React.createElement(Stack, { className: clsx(MenuButtonClass, className), direction: "row", columnGap: 0, inline: !fullWidth },
11
+ React.createElement(Button, { loading: loading, disabled: disabled, fullWidth: fullWidth, ...commonProps }, label),
12
+ React.createElement(Dropdown, { placement: placement, offset: dropdownOffset, trigger: React.createElement(Button, { icon: icon, ...commonProps }) }, children)));
13
+ };
@@ -0,0 +1,28 @@
1
+ .MenuButton {
2
+ & > :nth-child(1) {
3
+ border-top-right-radius: 0;
4
+ border-bottom-right-radius: 0;
5
+
6
+ &[data-button-dimension='big'] {
7
+ padding-left: env(--space-16);
8
+ padding-right: env(--space-16);
9
+ }
10
+ }
11
+
12
+ & > * > button {
13
+ --separator-color: hsl(0deg 0% 40% / 40%);
14
+
15
+ border-top-left-radius: 0;
16
+ border-bottom-left-radius: 0;
17
+ box-shadow: inset 1px 0 0 0 var(--separator-color);
18
+
19
+ &[data-button-kind='primary'] {
20
+ --separator-color: hsl(0deg 0% 100% / 40%);
21
+ }
22
+
23
+ &:is([data-button-dimension='big'], [data-button-dimension='regular']) {
24
+ padding-left: env(--space-8);
25
+ padding-right: env(--space-8);
26
+ }
27
+ }
28
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
3
  "description": "UI components from Wonderflow's Wanda design system",
4
- "version": "2.34.0-next.8",
4
+ "version": "2.34.0-next.9",
5
5
  "author": "Wonderflow",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
package/themes/dark.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 03 Nov 2021 15:50:13 GMT
3
+ * Generated on Thu, 04 Nov 2021 13:21:13 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 Wed, 03 Nov 2021 15:50:13 GMT
3
+ * Generated on Thu, 04 Nov 2021 13:21:13 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 Wed, 03 Nov 2021 15:50:13 GMT
7
+ * Generated on Thu, 04 Nov 2021 13:21:13 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 Wed, 03 Nov 2021 15:50:13 GMT
54
+ * Generated on Thu, 04 Nov 2021 13:21:13 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 Wed, 03 Nov 2021 15:50:13 GMT
102
+ * Generated on Thu, 04 Nov 2021 13:21:13 GMT
103
103
  */
104
104
 
105
105