@wonderflow/react-components 10.15.0 → 10.16.0

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.
@@ -1,4 +1,5 @@
1
1
  import type { TokensTypes } from '@wonderflow/tokens/platforms/web';
2
+ import { SymbolProps } from '../..';
2
3
  export declare type ChipProps = {
3
4
  /**
4
5
  * Set the dimension of the component.
@@ -16,6 +17,11 @@ export declare type ChipProps = {
16
17
  * Callback function to be called when the dismiss button is pressed.
17
18
  */
18
19
  onDismissClick?: () => void;
20
+ /**
21
+ * Show an icon before the chip content.
22
+ * @important The icon is not rendered if `dismissable` is `true`
23
+ */
24
+ icon?: SymbolProps['source'];
19
25
  };
20
26
  export declare const Chip: FCChildrenClass<ChipProps>;
21
27
  //# sourceMappingURL=chip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAQpE,oBAAY,SAAS,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,eAAe,CAAC,SAAS,CAiD1C,CAAC"}
1
+ {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAIpE,OAAO,EAAiB,WAAW,EAAE,MAAM,cAAc,CAAC;AAI1D,oBAAY,SAAS,GAAG;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IACxC;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAC9B,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,eAAe,CAAC,SAAS,CA0D1C,CAAC"}
@@ -3,7 +3,7 @@ import clsx from 'clsx';
3
3
  import { forwardRef } from 'react';
4
4
  import { Stack, Symbol } from '../..';
5
5
  import * as styles from './chip.module.css';
6
- export const Chip = forwardRef(({ children, className, dimension = 'regular', color = 'gray', interactive, onDismissClick, ...otherProps }, forwardedRef) => {
6
+ export const Chip = forwardRef(({ children, className, dimension = 'regular', color = 'gray', icon, interactive, onDismissClick, ...otherProps }, forwardedRef) => {
7
7
  const properties = {
8
8
  small: {
9
9
  iconSize: 12,
@@ -15,9 +15,9 @@ export const Chip = forwardRef(({ children, className, dimension = 'regular', co
15
15
  },
16
16
  big: {
17
17
  iconSize: 16,
18
- style: 'outline',
18
+ style: 'solid',
19
19
  },
20
20
  };
21
- return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [_jsx("b", { children: children }), interactive && (_jsx("button", { onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Symbol, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }) }))] }));
21
+ return (_jsxs(Stack, { as: "span", direction: "row", columnGap: 8, inline: true, "data-chip-color": color, "data-chip-dimension": dimension, className: clsx(styles.Chip, className), vAlign: "center", ref: forwardedRef, ...otherProps, children: [(icon && !interactive) && (_jsx(Symbol, { source: icon, weight: properties[dimension].style, dimension: properties[dimension].iconSize })), _jsx("b", { children: children }), interactive && (_jsx("button", { onClick: interactive && onDismissClick, className: styles.Action, type: "button", children: _jsx(Symbol, { source: "xmark", weight: properties[dimension].style, dimension: properties[dimension].iconSize }) }))] }));
22
22
  });
23
23
  Chip.displayName = 'Chip';
@@ -3,4 +3,5 @@ import { Chip } from './chip';
3
3
  declare const story: ComponentMeta<typeof Chip>;
4
4
  export default story;
5
5
  export declare const Default: ComponentStory<FCChildrenClass<import("./chip").ChipProps>>;
6
+ export declare const WithIcon: ComponentStory<FCChildrenClass<import("./chip").ChipProps>>;
6
7
  //# sourceMappingURL=chip.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAwBrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,6DAAoB,CAAC"}
1
+ {"version":3,"file":"chip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/chip/chip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGjE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAwBrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAIrB,eAAO,MAAM,OAAO,6DAAoB,CAAC;AAEzC,eAAO,MAAM,QAAQ,6DAAoB,CAAC"}
@@ -28,3 +28,7 @@ const story = {
28
28
  export default story;
29
29
  const Template = args => _jsx(Chip, { ...args, children: "Chip text" });
30
30
  export const Default = Template.bind({});
31
+ export const WithIcon = Template.bind({});
32
+ WithIcon.args = {
33
+ icon: 'bell',
34
+ };
@@ -26,5 +26,5 @@ export const Snackbar = forwardRef(({ children, className, title, icon, kind = '
26
26
  positive: 'circle-check',
27
27
  danger: 'circle-x',
28
28
  };
29
- return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, children: [_jsx(Symbol, { className: styles.Icon, weight: "duotone", source: icon ?? defaultIcons[kind], dimension: 24 }), _jsxs(Stack, { rowGap: 16, vPadding: 4, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "6", responsive: false, children: title }), _jsx(Text, { size: 14, lineHeight: "small", children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, dimension: "small", children: dismissLabel }) }))] })] }) }));
29
+ return (_jsx(Wrapper, { ref: forwardedRef, className: clsx(styles.Snackbar, className), "data-snackbar-kind": kind, role: "status", ...otherProps, children: _jsxs(Stack, { vAlign: "start", hAlign: "start", direction: "row", columnGap: 16, children: [_jsx(Symbol, { className: styles.Icon, weight: "duotone", source: icon ?? defaultIcons[kind], dimension: 18 }), _jsxs(Stack, { rowGap: 16, vPadding: 4, children: [_jsxs(Stack, { rowGap: 8, children: [title && _jsx(Title, { level: "6", responsive: false, children: title }), _jsx(Text, { size: 14, lineHeight: "small", children: children })] }), dismissable && (_jsx(Stack, { hAlign: "end", children: _jsx(Button, { onClick: onDismiss, className: styles.Action, dimension: "small", children: dismissLabel }) }))] })] }) }));
30
30
  });
@@ -6,7 +6,7 @@ export declare type SymbolProps = SVGAttributes<SVGElement | SVGSVGElement> & {
6
6
  * Set the icon name to display. Icon names are defined in
7
7
  * the `SymbolNames` enum and are part of Wanda's symbols system.
8
8
  *
9
- * Available icons: https://design.wonderflow.ai/design/symbols/
9
+ * Available icons: https://design.wonderflow.ai/get-started/symbols
10
10
  */
11
11
  source: SymbolNames | ReactElement<HTMLOrSVGElement>;
12
12
  /**
@@ -27,7 +27,7 @@ export declare const Symbol: import("react").ForwardRefExoticComponent<SVGAttrib
27
27
  * Set the icon name to display. Icon names are defined in
28
28
  * the `SymbolNames` enum and are part of Wanda's symbols system.
29
29
  *
30
- * Available icons: https://design.wonderflow.ai/design/symbols/
30
+ * Available icons: https://design.wonderflow.ai/get-started/symbols
31
31
  */
32
32
  source: SymbolNames | ReactElement<HTMLOrSVGElement>;
33
33
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "10.15.0",
3
+ "version": "10.16.0",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "Apache-2.0",
@@ -73,8 +73,8 @@
73
73
  "@types/react": "17.0.43",
74
74
  "@types/react-dom": "17.0.14",
75
75
  "@types/react-table": "7.7.12",
76
- "@wonderflow/config": "10.15.0",
77
- "@wonderflow/tokens": "10.15.0",
76
+ "@wonderflow/config": "10.16.0",
77
+ "@wonderflow/tokens": "10.16.0",
78
78
  "babel-loader": "8.2.5",
79
79
  "cpy-cli": "3.1.1",
80
80
  "postcss": "8.4.17",