@channel.io/bezier-react 2.0.4 → 2.0.6
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/dist/cjs/components/AlphaAvatar/Avatar.js +1 -1
- package/dist/cjs/components/AlphaAvatar/Avatar.js.map +1 -1
- package/dist/cjs/components/AlphaButton/Button.js +18 -10
- package/dist/cjs/components/AlphaButton/Button.js.map +1 -1
- package/dist/cjs/components/AlphaFloatingButton/FloatingButton.js +18 -9
- package/dist/cjs/components/AlphaFloatingButton/FloatingButton.js.map +1 -1
- package/dist/cjs/components/AlphaFloatingIconButton/FloatingIconButton.js +57 -0
- package/dist/cjs/components/AlphaFloatingIconButton/FloatingIconButton.js.map +1 -0
- package/dist/cjs/components/AlphaFloatingIconButton/FloatingIconButton.module.scss.js +8 -0
- package/dist/cjs/components/AlphaFloatingIconButton/FloatingIconButton.module.scss.js.map +1 -0
- package/dist/cjs/components/AlphaIconButton/IconButton.js +59 -0
- package/dist/cjs/components/AlphaIconButton/IconButton.js.map +1 -0
- package/dist/cjs/components/AlphaIconButton/IconButton.module.scss.js +8 -0
- package/dist/cjs/components/AlphaIconButton/IconButton.module.scss.js.map +1 -0
- package/dist/cjs/components/Avatar/Avatar.js +1 -1
- package/dist/cjs/components/Avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/Emoji/Emoji.js +1 -1
- package/dist/cjs/components/Emoji/Emoji.js.map +1 -1
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/esm/components/AlphaAvatar/Avatar.mjs +1 -1
- package/dist/esm/components/AlphaAvatar/Avatar.mjs.map +1 -1
- package/dist/esm/components/AlphaButton/Button.mjs +18 -10
- package/dist/esm/components/AlphaButton/Button.mjs.map +1 -1
- package/dist/esm/components/AlphaFloatingButton/FloatingButton.mjs +18 -9
- package/dist/esm/components/AlphaFloatingButton/FloatingButton.mjs.map +1 -1
- package/dist/esm/components/AlphaFloatingIconButton/FloatingIconButton.mjs +55 -0
- package/dist/esm/components/AlphaFloatingIconButton/FloatingIconButton.mjs.map +1 -0
- package/dist/esm/components/AlphaFloatingIconButton/FloatingIconButton.module.scss.mjs +4 -0
- package/dist/esm/components/AlphaFloatingIconButton/FloatingIconButton.module.scss.mjs.map +1 -0
- package/dist/esm/components/AlphaIconButton/IconButton.mjs +57 -0
- package/dist/esm/components/AlphaIconButton/IconButton.mjs.map +1 -0
- package/dist/esm/components/AlphaIconButton/IconButton.module.scss.mjs +4 -0
- package/dist/esm/components/AlphaIconButton/IconButton.module.scss.mjs.map +1 -0
- package/dist/esm/components/Avatar/Avatar.mjs +1 -1
- package/dist/esm/components/Avatar/Avatar.mjs.map +1 -1
- package/dist/esm/components/Emoji/Emoji.mjs +1 -1
- package/dist/esm/components/Emoji/Emoji.mjs.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/styles.css +1 -1
- package/dist/types/components/AlphaButton/Button.d.ts.map +1 -1
- package/dist/types/components/AlphaButton/Button.types.d.ts +3 -2
- package/dist/types/components/AlphaButton/Button.types.d.ts.map +1 -1
- package/dist/types/components/AlphaFloatingButton/FloatingButton.d.ts.map +1 -1
- package/dist/types/components/AlphaFloatingButton/FloatingButton.types.d.ts +3 -2
- package/dist/types/components/AlphaFloatingButton/FloatingButton.types.d.ts.map +1 -1
- package/dist/types/components/AlphaFloatingIconButton/FloatingIconButton.d.ts +4 -0
- package/dist/types/components/AlphaFloatingIconButton/FloatingIconButton.d.ts.map +1 -0
- package/dist/types/components/AlphaFloatingIconButton/FloatingIconButton.types.d.ts +37 -0
- package/dist/types/components/AlphaFloatingIconButton/FloatingIconButton.types.d.ts.map +1 -0
- package/dist/types/components/AlphaFloatingIconButton/index.d.ts +3 -0
- package/dist/types/components/AlphaFloatingIconButton/index.d.ts.map +1 -0
- package/dist/types/components/AlphaIconButton/IconButton.d.ts +4 -0
- package/dist/types/components/AlphaIconButton/IconButton.d.ts.map +1 -0
- package/dist/types/components/AlphaIconButton/IconButton.types.d.ts +42 -0
- package/dist/types/components/AlphaIconButton/IconButton.types.d.ts.map +1 -0
- package/dist/types/components/AlphaIconButton/index.d.ts +3 -0
- package/dist/types/components/AlphaIconButton/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AlphaAvatar/Avatar.tsx +1 -1
- package/src/components/AlphaAvatar/__snapshots__/Avatar.test.tsx.snap +2 -2
- package/src/components/AlphaAvatarGroup/__snapshots__/AvatarGroup.test.tsx.snap +12 -12
- package/src/components/AlphaButton/AlphaButton.stories.tsx +2 -2
- package/src/components/AlphaButton/Button.tsx +34 -20
- package/src/components/AlphaButton/Button.types.ts +4 -2
- package/src/components/AlphaFloatingButton/AlphaFloatingButton.stories.tsx +2 -2
- package/src/components/AlphaFloatingButton/FloatingButton.tsx +30 -17
- package/src/components/AlphaFloatingButton/FloatingButton.types.ts +4 -2
- package/src/components/AlphaFloatingIconButton/AlphaFloatingIconButton.stories.tsx +28 -0
- package/src/components/AlphaFloatingIconButton/FloatingIconButton.module.scss +175 -0
- package/src/components/AlphaFloatingIconButton/FloatingIconButton.tsx +91 -0
- package/src/components/AlphaFloatingIconButton/FloatingIconButton.types.ts +64 -0
- package/src/components/AlphaFloatingIconButton/index.ts +2 -0
- package/src/components/AlphaIconButton/AlphaIconButton.stories.tsx +29 -0
- package/src/components/AlphaIconButton/IconButton.module.scss +250 -0
- package/src/components/AlphaIconButton/IconButton.tsx +96 -0
- package/src/components/AlphaIconButton/IconButton.types.ts +71 -0
- package/src/components/AlphaIconButton/index.ts +2 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +2 -2
- package/src/components/AvatarGroup/__snapshots__/AvatarGroup.test.tsx.snap +12 -12
- package/src/components/Emoji/Emoji.tsx +1 -1
- package/src/components/Emoji/__snapshots__/Emoji.test.tsx.snap +1 -1
- package/src/index.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaButton/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaButton/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EACL,KAAK,WAAW,EAEjB,uBAAiD;AA8DlD,eAAO,MAAM,MAAM,uFAmElB,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type BezierIcon } from '@channel.io/bezier-icons';
|
|
2
3
|
import { type BezierComponentProps, type DisableProps, type PolymorphicProps, type SizeProps } from "../../types/props";
|
|
3
4
|
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
@@ -32,11 +33,11 @@ interface ButtonOwnProps {
|
|
|
32
33
|
/**
|
|
33
34
|
* Icon on the left.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
prefixContent?: BezierIcon | ReactNode;
|
|
36
37
|
/**
|
|
37
38
|
* Icon on the right.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
suffixContent?: BezierIcon | ReactNode;
|
|
40
41
|
}
|
|
41
42
|
export interface ButtonProps extends Omit<BezierComponentProps<'button'>, 'color'>, PolymorphicProps, SizeProps<ButtonSize>, DisableProps, ButtonOwnProps {
|
|
42
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaButton/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAEhE,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,OAAO,CAAA;AAEX,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEtD,UAAU,cAAc;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAA;IAEnB;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaButton/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAEhE,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,OAAO,CAAA;AAEX,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEtD,UAAU,cAAc;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IAEvB;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,CAAA;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAEtC;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CACvC;AAED,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EACnD,gBAAgB,EAChB,SAAS,CAAC,UAAU,CAAC,EACrB,YAAY,EACZ,cAAc;CAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingButton.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingButton/FloatingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"FloatingButton.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingButton/FloatingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EACL,KAAK,mBAAmB,EAEzB,+BAAiE;AA8DlE,eAAO,MAAM,cAAc,+FAiEzB,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
1
2
|
import { type BezierIcon } from '@channel.io/bezier-icons';
|
|
2
3
|
import { type BezierComponentProps, type DisableProps, type PolymorphicProps, type SizeProps } from "../../types/props";
|
|
3
4
|
export type FloatingButtonVariant = 'primary' | 'secondary';
|
|
@@ -31,11 +32,11 @@ interface FloatingButtonOwnProps {
|
|
|
31
32
|
/**
|
|
32
33
|
* Icon on the left.
|
|
33
34
|
*/
|
|
34
|
-
|
|
35
|
+
prefixContent?: BezierIcon | ReactNode;
|
|
35
36
|
/**
|
|
36
37
|
* Icon on the right.
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
suffixContent?: BezierIcon | ReactNode;
|
|
39
40
|
}
|
|
40
41
|
export interface FloatingButtonProps extends Omit<BezierComponentProps<'button'>, 'color'>, PolymorphicProps, SizeProps<FloatingButtonSize>, DisableProps, FloatingButtonOwnProps {
|
|
41
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingButton.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingButton/FloatingButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,WAAW,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,CAAA;AAEhB,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAE9D,UAAU,sBAAsB;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAE3B;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"FloatingButton.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingButton/FloatingButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,WAAW,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,CAAA;AAEhB,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAE9D,UAAU,sBAAsB;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,qBAAqB,CAAA;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAA;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAEtC;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CACvC;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EACnD,gBAAgB,EAChB,SAAS,CAAC,kBAAkB,CAAC,EAC7B,YAAY,EACZ,sBAAsB;CAAG"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type AlphaFloatingIconButtonProps } from "./";
|
|
3
|
+
export declare const FloatingIconButton: React.ForwardRefExoticComponent<AlphaFloatingIconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
4
|
+
//# sourceMappingURL=FloatingIconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingIconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingIconButton/FloatingIconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EAAE,KAAK,4BAA4B,EAAE,WAAgD;AAgC5F,eAAO,MAAM,kBAAkB,wGAqD7B,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BezierIcon } from '@channel.io/bezier-icons';
|
|
3
|
+
import { type BezierComponentProps, type DisableProps, type PolymorphicProps, type SizeProps } from "../../types/props";
|
|
4
|
+
type FloatingIconButtonVariant = 'primary' | 'secondary';
|
|
5
|
+
type FloatingIconButtonColor = 'blue' | 'cobalt' | 'red' | 'orange' | 'green' | 'pink' | 'purple' | 'dark-grey' | 'light-grey';
|
|
6
|
+
type FloatingIconButtonSize = 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
7
|
+
interface FloatingIconButtonOwnProps {
|
|
8
|
+
/**
|
|
9
|
+
* If `loading` is true, spinner will be shown, replacing the content.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If `active` is true, the button will be styled as if it is hovered.
|
|
15
|
+
* You may want to use this prop for a button which opens dropdown, etc.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Types of visual styles for button.
|
|
21
|
+
* @default 'primary'
|
|
22
|
+
*/
|
|
23
|
+
variant?: FloatingIconButtonVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Color of the button.
|
|
26
|
+
* @default 'blue'
|
|
27
|
+
*/
|
|
28
|
+
color?: FloatingIconButtonColor;
|
|
29
|
+
/**
|
|
30
|
+
* Icon in the button.
|
|
31
|
+
*/
|
|
32
|
+
content: BezierIcon | ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export interface FloatingIconButtonProps extends Omit<BezierComponentProps<'button'>, 'color' | 'content'>, PolymorphicProps, SizeProps<FloatingIconButtonSize>, DisableProps, FloatingIconButtonOwnProps {
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=FloatingIconButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingIconButton.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingIconButton/FloatingIconButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,KAAK,yBAAyB,GAAG,SAAS,GAAG,WAAW,CAAA;AAExD,KAAK,uBAAuB,GACxB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,CAAA;AAEhB,KAAK,sBAAsB,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAE3D,UAAU,0BAA0B;IAClC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,yBAAyB,CAAA;IAEnC;;;OAGG;IACH,KAAK,CAAC,EAAE,uBAAuB,CAAA;IAE/B;;OAEG;IACH,OAAO,EAAE,UAAU,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,WAAW,uBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,EAC/D,gBAAgB,EAChB,SAAS,CAAC,sBAAsB,CAAC,EACjC,YAAY,EACZ,0BAA0B;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaFloatingIconButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACpF,YAAY,EAAE,uBAAuB,IAAI,4BAA4B,EAAE,MAAM,4BAA4B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaIconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAKzC,OAAO,EAAE,KAAK,oBAAoB,EAAE,WAAwC;AAgC5E,eAAO,MAAM,UAAU,gGA0DtB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type BezierIcon } from '@channel.io/bezier-icons';
|
|
3
|
+
import { type BezierComponentProps, type DisableProps, type PolymorphicProps, type SizeProps } from "../../types/props";
|
|
4
|
+
type IconButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
5
|
+
type IconButtonColor = 'blue' | 'cobalt' | 'red' | 'orange' | 'green' | 'pink' | 'purple' | 'dark-grey' | 'light-grey' | 'white';
|
|
6
|
+
type IconButtonSize = 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
7
|
+
interface IconButtonOwnProps {
|
|
8
|
+
/**
|
|
9
|
+
* If `loading` is true, spinner will be shown, replacing the content.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If `active` is true, the button will be styled as if it is hovered.
|
|
15
|
+
* You may want to use this prop for a button which opens dropdown, etc.
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
active?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Types of visual styles for button.
|
|
21
|
+
* @default 'primary'
|
|
22
|
+
*/
|
|
23
|
+
variant?: IconButtonVariant;
|
|
24
|
+
/**
|
|
25
|
+
* Color of the button.
|
|
26
|
+
* @default 'blue'
|
|
27
|
+
*/
|
|
28
|
+
color?: IconButtonColor;
|
|
29
|
+
/**
|
|
30
|
+
* Icon in the button.
|
|
31
|
+
*/
|
|
32
|
+
content: BezierIcon | ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Shape of the button.
|
|
35
|
+
* @default 'rectangle'
|
|
36
|
+
*/
|
|
37
|
+
shape?: 'rectangle' | 'circle';
|
|
38
|
+
}
|
|
39
|
+
export interface IconButtonProps extends Omit<BezierComponentProps<'button'>, 'color' | 'content'>, PolymorphicProps, SizeProps<IconButtonSize>, DisableProps, IconButtonOwnProps {
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=IconButton.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaIconButton/IconButton.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACf,0BAAyB;AAE1B,KAAK,iBAAiB,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAA;AAE7D,KAAK,eAAe,GAChB,MAAM,GACN,QAAQ,GACR,KAAK,GACL,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,YAAY,GACZ,OAAO,CAAA;AAEX,KAAK,cAAc,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAA;AAEnD,UAAU,kBAAkB;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAE3B;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAA;IAEvB;;OAEG;IACH,OAAO,EAAE,UAAU,GAAG,SAAS,CAAA;IAE/B;;;OAGG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;CAC/B;AAED,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,EAC/D,gBAAgB,EAChB,SAAS,CAAC,cAAc,CAAC,EACzB,YAAY,EACZ,kBAAkB;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/AlphaIconButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,cAAc,CAAA;AAC5D,YAAY,EAAE,eAAe,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export * from "./components/AlphaAvatarGroup";
|
|
|
5
5
|
export * from "./components/AlphaButton";
|
|
6
6
|
export * from "./components/AlphaDialogPrimitive";
|
|
7
7
|
export * from "./components/AlphaFloatingButton";
|
|
8
|
+
export * from "./components/AlphaFloatingIconButton";
|
|
9
|
+
export * from "./components/AlphaIconButton";
|
|
8
10
|
export * from "./components/AlphaTooltipPrimitive";
|
|
9
11
|
export * from "./components/AppProvider";
|
|
10
12
|
export * from "./components/AutoFocus";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAA;AAGhC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAGlD,yCAA4C;AAC5C,8CAAiD;AACjD,yCAA4C;AAC5C,kDAAqD;AACrD,iDAAoD;AACpD,mDAAsD;AACtD,yCAA4C;AAC5C,uCAA0C;AAC1C,oCAAuC;AACvC,yCAA4C;AAC5C,mCAAsC;AACtC,oCAAuC;AACvC,iCAAoC;AACpC,oCAAuC;AACvC,yCAA4C;AAC5C,oCAAuC;AACvC,6CAAgD;AAChD,sCAAyC;AACzC,0CAA6C;AAC7C,qCAAwC;AACxC,mCAAsC;AACtC,6CAAgD;AAChD,yCAA4C;AAC5C,uCAA0C;AAC1C,4CAA+C;AAC/C,uCAA0C;AAC1C,kCAAqC;AACrC,kCAAqC;AACrC,0CAA6C;AAC7C,wCAA2C;AAC3C,yCAA4C;AAC5C,2CAA8C;AAC9C,sCAAyC;AACzC,mCAAsC;AACtC,sCAAyC;AACzC,qCAAwC;AACxC,yCAA4C;AAC5C,qCAAwC;AACxC,yCAA4C;AAC5C,wCAA2C;AAC3C,0CAA6C;AAC7C,8CAAiD;AACjD,oCAAuC;AACvC,oCAAuC;AACvC,8CAAiD;AACjD,qCAAwC;AACxC,mCAAsC;AACtC,oCAAuC;AACvC,oCAAuC;AACvC,kCAAqC;AACrC,iCAAoC;AACpC,kCAAqC;AACrC,sCAAyC;AACzC,uCAA0C;AAC1C,2CAA8C;AAC9C,mCAAsC;AACtC,qCAAwC;AACxC,4CAA+C;AAC/C,4CAA+C;AAG/C,8DAAiE;AAGjE,8BAAiC;AACjC,+BAAkC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,yBAAyB,CAAA;AAGhC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAGlD,yCAA4C;AAC5C,8CAAiD;AACjD,yCAA4C;AAC5C,kDAAqD;AACrD,iDAAoD;AACpD,qDAAwD;AACxD,6CAAgD;AAChD,mDAAsD;AACtD,yCAA4C;AAC5C,uCAA0C;AAC1C,oCAAuC;AACvC,yCAA4C;AAC5C,mCAAsC;AACtC,oCAAuC;AACvC,iCAAoC;AACpC,oCAAuC;AACvC,yCAA4C;AAC5C,oCAAuC;AACvC,6CAAgD;AAChD,sCAAyC;AACzC,0CAA6C;AAC7C,qCAAwC;AACxC,mCAAsC;AACtC,6CAAgD;AAChD,yCAA4C;AAC5C,uCAA0C;AAC1C,4CAA+C;AAC/C,uCAA0C;AAC1C,kCAAqC;AACrC,kCAAqC;AACrC,0CAA6C;AAC7C,wCAA2C;AAC3C,yCAA4C;AAC5C,2CAA8C;AAC9C,sCAAyC;AACzC,mCAAsC;AACtC,sCAAyC;AACzC,qCAAwC;AACxC,yCAA4C;AAC5C,qCAAwC;AACxC,yCAA4C;AAC5C,wCAA2C;AAC3C,0CAA6C;AAC7C,8CAAiD;AACjD,oCAAuC;AACvC,oCAAuC;AACvC,8CAAiD;AACjD,qCAAwC;AACxC,mCAAsC;AACtC,oCAAuC;AACvC,oCAAuC;AACvC,kCAAqC;AACrC,iCAAoC;AACpC,kCAAqC;AACrC,sCAAyC;AACzC,uCAA0C;AAC1C,2CAA8C;AAC9C,mCAAsC;AACtC,qCAAwC;AACxC,4CAA+C;AAC/C,4CAA+C;AAG/C,8DAAiE;AAGjE,8BAAiC;AACjC,+BAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@channel.io/bezier-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "React components library that implements Bezier design system.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
"dependencies": {
|
|
130
|
-
"@channel.io/bezier-tokens": "0.2.
|
|
130
|
+
"@channel.io/bezier-tokens": "0.2.4",
|
|
131
131
|
"@radix-ui/react-checkbox": "^1.0.4",
|
|
132
132
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
133
133
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
@@ -139,7 +139,7 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
|
|
|
139
139
|
>
|
|
140
140
|
<SmoothCornersBox
|
|
141
141
|
ref={forwardedRef}
|
|
142
|
-
aria-
|
|
142
|
+
aria-description={name}
|
|
143
143
|
className={classNames(
|
|
144
144
|
styles.AvatarImage,
|
|
145
145
|
Number(size) >= 72 && styles['big-size'],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Avatar > Snapshot 1`] = `
|
|
4
4
|
<div
|
|
5
|
-
aria-
|
|
5
|
+
aria-description="Name"
|
|
6
6
|
class="SmoothCornersBox AvatarImage"
|
|
7
7
|
data-state="disabled"
|
|
8
8
|
data-testid="bezier-avatar"
|
|
@@ -12,7 +12,7 @@ exports[`Avatar > Snapshot 1`] = `
|
|
|
12
12
|
|
|
13
13
|
exports[`Avatar > renders border style 1`] = `
|
|
14
14
|
<div
|
|
15
|
-
aria-
|
|
15
|
+
aria-description="Name"
|
|
16
16
|
class="SmoothCornersBox AvatarImage bordered"
|
|
17
17
|
data-state="disabled"
|
|
18
18
|
data-testid="bezier-avatar"
|
|
@@ -12,7 +12,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
12
12
|
data-testid="bezier-avatar-wrapper"
|
|
13
13
|
>
|
|
14
14
|
<div
|
|
15
|
-
aria-
|
|
15
|
+
aria-description="Christian Nwamba"
|
|
16
16
|
class="SmoothCornersBox AvatarImage"
|
|
17
17
|
data-state="disabled"
|
|
18
18
|
data-testid="bezier-avatar"
|
|
@@ -25,7 +25,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
25
25
|
data-testid="bezier-avatar-wrapper"
|
|
26
26
|
>
|
|
27
27
|
<div
|
|
28
|
-
aria-
|
|
28
|
+
aria-description="Kola Tioluwani"
|
|
29
29
|
class="SmoothCornersBox AvatarImage"
|
|
30
30
|
data-state="disabled"
|
|
31
31
|
data-testid="bezier-avatar"
|
|
@@ -38,7 +38,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
38
38
|
data-testid="bezier-avatar-wrapper"
|
|
39
39
|
>
|
|
40
40
|
<div
|
|
41
|
-
aria-
|
|
41
|
+
aria-description="Kent Dodds"
|
|
42
42
|
class="SmoothCornersBox AvatarImage"
|
|
43
43
|
data-state="disabled"
|
|
44
44
|
data-testid="bezier-avatar"
|
|
@@ -51,7 +51,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
51
51
|
data-testid="bezier-avatar-wrapper"
|
|
52
52
|
>
|
|
53
53
|
<div
|
|
54
|
-
aria-
|
|
54
|
+
aria-description="Ryan Florence"
|
|
55
55
|
class="SmoothCornersBox AvatarImage"
|
|
56
56
|
data-state="disabled"
|
|
57
57
|
data-testid="bezier-avatar"
|
|
@@ -64,7 +64,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
64
64
|
data-testid="bezier-avatar-wrapper"
|
|
65
65
|
>
|
|
66
66
|
<div
|
|
67
|
-
aria-
|
|
67
|
+
aria-description="Dan Abrahmov"
|
|
68
68
|
class="SmoothCornersBox AvatarImage"
|
|
69
69
|
data-state="disabled"
|
|
70
70
|
data-testid="bezier-avatar"
|
|
@@ -77,7 +77,7 @@ exports[`AvatarGroup Ellipsis type - Count Snapshot 1`] = `
|
|
|
77
77
|
data-testid="bezier-avatar-wrapper"
|
|
78
78
|
>
|
|
79
79
|
<div
|
|
80
|
-
aria-
|
|
80
|
+
aria-description="Prosper Otemuyiwa"
|
|
81
81
|
class="SmoothCornersBox AvatarImage"
|
|
82
82
|
data-state="disabled"
|
|
83
83
|
data-testid="bezier-avatar"
|
|
@@ -111,7 +111,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
111
111
|
data-testid="bezier-avatar-wrapper"
|
|
112
112
|
>
|
|
113
113
|
<div
|
|
114
|
-
aria-
|
|
114
|
+
aria-description="Christian Nwamba"
|
|
115
115
|
class="SmoothCornersBox AvatarImage"
|
|
116
116
|
data-state="disabled"
|
|
117
117
|
data-testid="bezier-avatar"
|
|
@@ -124,7 +124,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
124
124
|
data-testid="bezier-avatar-wrapper"
|
|
125
125
|
>
|
|
126
126
|
<div
|
|
127
|
-
aria-
|
|
127
|
+
aria-description="Kola Tioluwani"
|
|
128
128
|
class="SmoothCornersBox AvatarImage"
|
|
129
129
|
data-state="disabled"
|
|
130
130
|
data-testid="bezier-avatar"
|
|
@@ -137,7 +137,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
137
137
|
data-testid="bezier-avatar-wrapper"
|
|
138
138
|
>
|
|
139
139
|
<div
|
|
140
|
-
aria-
|
|
140
|
+
aria-description="Kent Dodds"
|
|
141
141
|
class="SmoothCornersBox AvatarImage"
|
|
142
142
|
data-state="disabled"
|
|
143
143
|
data-testid="bezier-avatar"
|
|
@@ -150,7 +150,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
150
150
|
data-testid="bezier-avatar-wrapper"
|
|
151
151
|
>
|
|
152
152
|
<div
|
|
153
|
-
aria-
|
|
153
|
+
aria-description="Ryan Florence"
|
|
154
154
|
class="SmoothCornersBox AvatarImage"
|
|
155
155
|
data-state="disabled"
|
|
156
156
|
data-testid="bezier-avatar"
|
|
@@ -163,7 +163,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
163
163
|
data-testid="bezier-avatar-wrapper"
|
|
164
164
|
>
|
|
165
165
|
<div
|
|
166
|
-
aria-
|
|
166
|
+
aria-description="Dan Abrahmov"
|
|
167
167
|
class="SmoothCornersBox AvatarImage"
|
|
168
168
|
data-state="disabled"
|
|
169
169
|
data-testid="bezier-avatar"
|
|
@@ -203,7 +203,7 @@ exports[`AvatarGroup Ellipsis type - Icon Snapshot 1`] = `
|
|
|
203
203
|
data-testid="bezier-avatar-wrapper"
|
|
204
204
|
>
|
|
205
205
|
<div
|
|
206
|
-
aria-
|
|
206
|
+
aria-description="Prosper Otemuyiwa"
|
|
207
207
|
class="SmoothCornersBox AvatarImage"
|
|
208
208
|
data-state="disabled"
|
|
209
209
|
data-testid="bezier-avatar"
|
|
@@ -20,8 +20,8 @@ export const Playground: StoryObj<AlphaButtonProps> = {
|
|
|
20
20
|
disabled: false,
|
|
21
21
|
active: false,
|
|
22
22
|
loading: false,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
prefixContent: PlusIcon,
|
|
24
|
+
suffixContent: ArrowRightIcon,
|
|
25
25
|
size: 'm',
|
|
26
26
|
variant: 'primary',
|
|
27
27
|
color: 'blue',
|
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
|
+
import { isBezierIcon } from '@channel.io/bezier-icons'
|
|
3
4
|
import classNames from 'classnames'
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type ButtonProps,
|
|
8
|
+
type ButtonSize,
|
|
9
|
+
} from '~/src/components/AlphaButton/Button.types'
|
|
6
10
|
import { BaseButton } from '~/src/components/BaseButton'
|
|
7
|
-
import { type
|
|
8
|
-
import { Icon } from '~/src/components/Icon'
|
|
11
|
+
import { Icon, type IconSize } from '~/src/components/Icon'
|
|
9
12
|
import { Spinner } from '~/src/components/Spinner'
|
|
10
13
|
import { Text } from '~/src/components/Text'
|
|
11
14
|
|
|
12
15
|
import styles from './Button.module.scss'
|
|
13
16
|
|
|
17
|
+
function SideContent({
|
|
18
|
+
size,
|
|
19
|
+
content,
|
|
20
|
+
}: {
|
|
21
|
+
size: IconSize
|
|
22
|
+
content?: ButtonProps['prefixContent']
|
|
23
|
+
}) {
|
|
24
|
+
return isBezierIcon(content) ? (
|
|
25
|
+
<Icon
|
|
26
|
+
source={content}
|
|
27
|
+
size={size}
|
|
28
|
+
className={styles.ButtonIcon}
|
|
29
|
+
/>
|
|
30
|
+
) : (
|
|
31
|
+
content
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
14
35
|
function getIconSize(size: ButtonSize) {
|
|
15
36
|
return (
|
|
16
37
|
{
|
|
@@ -52,12 +73,11 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
52
73
|
{
|
|
53
74
|
as = BaseButton,
|
|
54
75
|
text,
|
|
55
|
-
|
|
56
|
-
|
|
76
|
+
prefixContent,
|
|
77
|
+
suffixContent,
|
|
57
78
|
color = 'blue',
|
|
58
79
|
variant = 'primary',
|
|
59
80
|
size = 'm',
|
|
60
|
-
disabled,
|
|
61
81
|
active,
|
|
62
82
|
className,
|
|
63
83
|
loading,
|
|
@@ -86,13 +106,10 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
86
106
|
loading && styles.loading
|
|
87
107
|
)}
|
|
88
108
|
>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
className={styles.ButtonIcon}
|
|
94
|
-
/>
|
|
95
|
-
)}
|
|
109
|
+
<SideContent
|
|
110
|
+
size={getIconSize(size)}
|
|
111
|
+
content={prefixContent}
|
|
112
|
+
/>
|
|
96
113
|
|
|
97
114
|
{/* TODO: use AlphaText later, add typo */}
|
|
98
115
|
<Text
|
|
@@ -103,13 +120,10 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
103
120
|
{text}
|
|
104
121
|
</Text>
|
|
105
122
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
className={styles.ButtonIcon}
|
|
111
|
-
/>
|
|
112
|
-
)}
|
|
123
|
+
<SideContent
|
|
124
|
+
size={getIconSize(size)}
|
|
125
|
+
content={suffixContent}
|
|
126
|
+
/>
|
|
113
127
|
</div>
|
|
114
128
|
|
|
115
129
|
{/* TODO: use AlphaSpinner */}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ReactNode } from 'react'
|
|
2
|
+
|
|
1
3
|
import { type BezierIcon } from '@channel.io/bezier-icons'
|
|
2
4
|
|
|
3
5
|
import {
|
|
@@ -57,12 +59,12 @@ interface ButtonOwnProps {
|
|
|
57
59
|
/**
|
|
58
60
|
* Icon on the left.
|
|
59
61
|
*/
|
|
60
|
-
|
|
62
|
+
prefixContent?: BezierIcon | ReactNode
|
|
61
63
|
|
|
62
64
|
/**
|
|
63
65
|
* Icon on the right.
|
|
64
66
|
*/
|
|
65
|
-
|
|
67
|
+
suffixContent?: BezierIcon | ReactNode
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
export interface ButtonProps
|
|
@@ -20,8 +20,8 @@ export const Playground: StoryObj<AlphaFloatingButtonProps> = {
|
|
|
20
20
|
disabled: false,
|
|
21
21
|
active: false,
|
|
22
22
|
loading: false,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
prefixContent: PlusIcon,
|
|
24
|
+
suffixContent: ArrowRightIcon,
|
|
25
25
|
size: 'm',
|
|
26
26
|
variant: 'primary',
|
|
27
27
|
color: 'blue',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react'
|
|
2
2
|
|
|
3
|
+
import { isBezierIcon } from '@channel.io/bezier-icons'
|
|
3
4
|
import classNames from 'classnames'
|
|
4
5
|
|
|
5
6
|
import {
|
|
@@ -7,12 +8,30 @@ import {
|
|
|
7
8
|
type FloatingButtonSize,
|
|
8
9
|
} from '~/src/components/AlphaFloatingButton/FloatingButton.types'
|
|
9
10
|
import { BaseButton } from '~/src/components/BaseButton'
|
|
10
|
-
import { Icon } from '~/src/components/Icon'
|
|
11
|
+
import { Icon, type IconSize } from '~/src/components/Icon'
|
|
11
12
|
import { Spinner } from '~/src/components/Spinner'
|
|
12
13
|
import { Text } from '~/src/components/Text'
|
|
13
14
|
|
|
14
15
|
import styles from './FloatingButton.module.scss'
|
|
15
16
|
|
|
17
|
+
function SideContent({
|
|
18
|
+
size,
|
|
19
|
+
content,
|
|
20
|
+
}: {
|
|
21
|
+
size: IconSize
|
|
22
|
+
content?: FloatingButtonProps['prefixContent']
|
|
23
|
+
}) {
|
|
24
|
+
return isBezierIcon(content) ? (
|
|
25
|
+
<Icon
|
|
26
|
+
source={content}
|
|
27
|
+
size={size}
|
|
28
|
+
className={styles.ButtonIcon}
|
|
29
|
+
/>
|
|
30
|
+
) : (
|
|
31
|
+
content
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
function getIconSize(size: FloatingButtonSize) {
|
|
17
36
|
return (
|
|
18
37
|
{
|
|
@@ -56,8 +75,8 @@ export const FloatingButton = forwardRef<
|
|
|
56
75
|
{
|
|
57
76
|
as = BaseButton,
|
|
58
77
|
text,
|
|
59
|
-
|
|
60
|
-
|
|
78
|
+
prefixContent,
|
|
79
|
+
suffixContent,
|
|
61
80
|
color = 'blue',
|
|
62
81
|
variant = 'primary',
|
|
63
82
|
size = 'm',
|
|
@@ -86,13 +105,10 @@ export const FloatingButton = forwardRef<
|
|
|
86
105
|
<div
|
|
87
106
|
className={classNames(styles.ButtonContent, loading && styles.loading)}
|
|
88
107
|
>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
className={styles.ButtonIcon}
|
|
94
|
-
/>
|
|
95
|
-
)}
|
|
108
|
+
<SideContent
|
|
109
|
+
size={getIconSize(size)}
|
|
110
|
+
content={prefixContent}
|
|
111
|
+
/>
|
|
96
112
|
|
|
97
113
|
{/* TODO: use AlphaText later, add typo */}
|
|
98
114
|
<Text
|
|
@@ -103,13 +119,10 @@ export const FloatingButton = forwardRef<
|
|
|
103
119
|
{text}
|
|
104
120
|
</Text>
|
|
105
121
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
className={styles.ButtonIcon}
|
|
111
|
-
/>
|
|
112
|
-
)}
|
|
122
|
+
<SideContent
|
|
123
|
+
size={getIconSize(size)}
|
|
124
|
+
content={suffixContent}
|
|
125
|
+
/>
|
|
113
126
|
</div>
|
|
114
127
|
|
|
115
128
|
{/* TODO: use AlphaSpinner */}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ReactNode } from 'react'
|
|
2
|
+
|
|
1
3
|
import { type BezierIcon } from '@channel.io/bezier-icons'
|
|
2
4
|
|
|
3
5
|
import {
|
|
@@ -55,12 +57,12 @@ interface FloatingButtonOwnProps {
|
|
|
55
57
|
/**
|
|
56
58
|
* Icon on the left.
|
|
57
59
|
*/
|
|
58
|
-
|
|
60
|
+
prefixContent?: BezierIcon | ReactNode
|
|
59
61
|
|
|
60
62
|
/**
|
|
61
63
|
* Icon on the right.
|
|
62
64
|
*/
|
|
63
|
-
|
|
65
|
+
suffixContent?: BezierIcon | ReactNode
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
export interface FloatingButtonProps
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PlusIcon } from '@channel.io/bezier-icons'
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AlphaFloatingIconButton,
|
|
6
|
+
type AlphaFloatingIconButtonProps,
|
|
7
|
+
} from '~/src/components/AlphaFloatingIconButton'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof AlphaFloatingIconButton> = {
|
|
10
|
+
component: AlphaFloatingIconButton,
|
|
11
|
+
argTypes: {
|
|
12
|
+
onClick: { action: 'onClick' },
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
export default meta
|
|
16
|
+
|
|
17
|
+
export const Playground: StoryObj<AlphaFloatingIconButtonProps> = {
|
|
18
|
+
args: {
|
|
19
|
+
disabled: false,
|
|
20
|
+
active: false,
|
|
21
|
+
loading: false,
|
|
22
|
+
content: PlusIcon,
|
|
23
|
+
'aria-label': 'invite',
|
|
24
|
+
size: 'm',
|
|
25
|
+
variant: 'primary',
|
|
26
|
+
color: 'blue',
|
|
27
|
+
},
|
|
28
|
+
}
|