@chayns-components/core 5.0.0-beta.454 → 5.0.0-beta.457

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.
@@ -5,12 +5,10 @@ export interface PostImageResult {
5
5
  meta?: Meta;
6
6
  }
7
7
  interface PostImageOptions {
8
- accessToken: string;
9
8
  file: File;
10
- personId: string;
11
9
  }
12
10
  /**
13
11
  * Uploads an image to the tsimg cloud service
14
12
  */
15
- export declare const postImage: ({ accessToken, file, personId, }: PostImageOptions) => Promise<PostImageResult>;
13
+ export declare const postImage: ({ file, }: PostImageOptions) => Promise<PostImageResult | undefined>;
16
14
  export {};
@@ -1,13 +1,19 @@
1
+ import { getAccessToken, getUser } from 'chayns-api';
1
2
  import { getFileAsArrayBuffer } from '../../utils/fileDialog';
2
3
  /**
3
4
  * Uploads an image to the tsimg cloud service
4
5
  */
5
6
  export const postImage = async _ref => {
6
7
  let {
7
- accessToken,
8
- file,
9
- personId
8
+ file
10
9
  } = _ref;
10
+ const {
11
+ accessToken
12
+ } = await getAccessToken();
13
+ const user = getUser();
14
+ if (!accessToken || !user?.personId) {
15
+ return undefined;
16
+ }
11
17
  const body = await getFileAsArrayBuffer(file);
12
18
  const response = await fetch('https://api.tsimg.cloud/image', {
13
19
  body,
@@ -15,7 +21,7 @@ export const postImage = async _ref => {
15
21
  Accept: 'application/json',
16
22
  Authorization: `bearer ${accessToken}`,
17
23
  'Content-Type': 'image/*',
18
- 'X-Person-Id': personId
24
+ 'X-Person-Id': user.personId
19
25
  },
20
26
  method: 'POST'
21
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"post.js","names":["getFileAsArrayBuffer","postImage","_ref","accessToken","file","personId","body","response","fetch","headers","Accept","Authorization","method","ok","json","Error","status"],"sources":["../../../src/api/image/post.ts"],"sourcesContent":["import type { Meta } from '../../types/file';\nimport { getFileAsArrayBuffer } from '../../utils/fileDialog';\n\nexport interface PostImageResult {\n key: string;\n base: string;\n meta?: Meta;\n}\n\ninterface PostImageOptions {\n accessToken: string;\n file: File;\n personId: string;\n}\n\n/**\n * Uploads an image to the tsimg cloud service\n */\nexport const postImage = async ({\n accessToken,\n file,\n personId,\n}: PostImageOptions): Promise<PostImageResult> => {\n const body = await getFileAsArrayBuffer(file);\n\n const response = await fetch('https://api.tsimg.cloud/image', {\n body,\n headers: {\n Accept: 'application/json',\n Authorization: `bearer ${accessToken}`,\n 'Content-Type': 'image/*',\n 'X-Person-Id': personId,\n },\n method: 'POST',\n });\n\n if (response.ok) {\n return (await response.json()) as PostImageResult;\n }\n\n throw Error(`Failed to POST image (status code: ${response.status}).`);\n};\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ,wBAAwB;AAc7D;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAAC,IAAA,IAIyB;EAAA,IAJlB;IAC5BC,WAAW;IACXC,IAAI;IACJC;EACc,CAAC,GAAAH,IAAA;EACf,MAAMI,IAAI,GAAG,MAAMN,oBAAoB,CAACI,IAAI,CAAC;EAE7C,MAAMG,QAAQ,GAAG,MAAMC,KAAK,CAAC,+BAA+B,EAAE;IAC1DF,IAAI;IACJG,OAAO,EAAE;MACLC,MAAM,EAAE,kBAAkB;MAC1BC,aAAa,EAAG,UAASR,WAAY,EAAC;MACtC,cAAc,EAAE,SAAS;MACzB,aAAa,EAAEE;IACnB,CAAC;IACDO,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,OAAQ,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;EACjC;EAEA,MAAMC,KAAK,CAAE,sCAAqCR,QAAQ,CAACS,MAAO,IAAG,CAAC;AAC1E,CAAC"}
1
+ {"version":3,"file":"post.js","names":["getAccessToken","getUser","getFileAsArrayBuffer","postImage","_ref","file","accessToken","user","personId","undefined","body","response","fetch","headers","Accept","Authorization","method","ok","json","Error","status"],"sources":["../../../src/api/image/post.ts"],"sourcesContent":["import { getAccessToken, getUser } from 'chayns-api';\nimport type { Meta } from '../../types/file';\nimport { getFileAsArrayBuffer } from '../../utils/fileDialog';\n\nexport interface PostImageResult {\n key: string;\n base: string;\n meta?: Meta;\n}\n\ninterface PostImageOptions {\n file: File;\n}\n\n/**\n * Uploads an image to the tsimg cloud service\n */\nexport const postImage = async ({\n file,\n}: PostImageOptions): Promise<PostImageResult | undefined> => {\n const { accessToken } = await getAccessToken();\n const user = getUser();\n\n if (!accessToken || !user?.personId) {\n return undefined;\n }\n\n const body = await getFileAsArrayBuffer(file);\n\n const response = await fetch('https://api.tsimg.cloud/image', {\n body,\n headers: {\n Accept: 'application/json',\n Authorization: `bearer ${accessToken}`,\n 'Content-Type': 'image/*',\n 'X-Person-Id': user.personId,\n },\n method: 'POST',\n });\n\n if (response.ok) {\n return (await response.json()) as PostImageResult;\n }\n\n throw Error(`Failed to POST image (status code: ${response.status}).`);\n};\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,OAAO,QAAQ,YAAY;AAEpD,SAASC,oBAAoB,QAAQ,wBAAwB;AAY7D;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAAC,IAAA,IAEqC;EAAA,IAF9B;IAC5BC;EACc,CAAC,GAAAD,IAAA;EACf,MAAM;IAAEE;EAAY,CAAC,GAAG,MAAMN,cAAc,CAAC,CAAC;EAC9C,MAAMO,IAAI,GAAGN,OAAO,CAAC,CAAC;EAEtB,IAAI,CAACK,WAAW,IAAI,CAACC,IAAI,EAAEC,QAAQ,EAAE;IACjC,OAAOC,SAAS;EACpB;EAEA,MAAMC,IAAI,GAAG,MAAMR,oBAAoB,CAACG,IAAI,CAAC;EAE7C,MAAMM,QAAQ,GAAG,MAAMC,KAAK,CAAC,+BAA+B,EAAE;IAC1DF,IAAI;IACJG,OAAO,EAAE;MACLC,MAAM,EAAE,kBAAkB;MAC1BC,aAAa,EAAG,UAAST,WAAY,EAAC;MACtC,cAAc,EAAE,SAAS;MACzB,aAAa,EAAEC,IAAI,CAACC;IACxB,CAAC;IACDQ,MAAM,EAAE;EACZ,CAAC,CAAC;EAEF,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,OAAQ,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;EACjC;EAEA,MAAMC,KAAK,CAAE,sCAAqCR,QAAQ,CAACS,MAAO,IAAG,CAAC;AAC1E,CAAC"}
@@ -6,11 +6,10 @@ export interface PostVideoResult {
6
6
  urlMP4: string;
7
7
  }
8
8
  interface PostVideoOptions {
9
- accessToken: string;
10
9
  file: File | Blob;
11
10
  }
12
11
  /**
13
12
  * Uploads a video to the streaming service
14
13
  */
15
- export declare const postVideo: ({ accessToken, file, }: PostVideoOptions) => Promise<PostVideoResult | undefined>;
14
+ export declare const postVideo: ({ file, }: PostVideoOptions) => Promise<PostVideoResult | undefined>;
16
15
  export {};
@@ -1,11 +1,17 @@
1
+ import { getAccessToken } from 'chayns-api';
1
2
  /**
2
3
  * Uploads a video to the streaming service
3
4
  */
4
5
  export const postVideo = async _ref => {
5
6
  let {
6
- accessToken,
7
7
  file
8
8
  } = _ref;
9
+ const {
10
+ accessToken
11
+ } = await getAccessToken();
12
+ if (!accessToken) {
13
+ return undefined;
14
+ }
9
15
  const formData = new FormData();
10
16
  formData.append('files', file);
11
17
  const response = await fetch('https://streamingservice.chayns.space/video?disableIntercom=true', {
@@ -1 +1 @@
1
- {"version":3,"file":"post.js","names":["postVideo","_ref","accessToken","file","formData","FormData","append","response","fetch","body","headers","Authorization","method","ok","data","json","Error","status"],"sources":["../../../src/api/video/post.ts"],"sourcesContent":["export interface PostVideoResult {\n id: string;\n originalVideoQuality: string;\n thumbnailUrl: string;\n url: string;\n urlMP4: string;\n}\n\ninterface PostVideoOptions {\n accessToken: string;\n file: File | Blob;\n}\n\n/**\n * Uploads a video to the streaming service\n */\nexport const postVideo = async ({\n accessToken,\n file,\n}: PostVideoOptions): Promise<PostVideoResult | undefined> => {\n const formData = new FormData();\n\n formData.append('files', file);\n\n const response = await fetch(\n 'https://streamingservice.chayns.space/video?disableIntercom=true',\n {\n body: formData,\n headers: {\n Authorization: `bearer ${accessToken}`,\n },\n method: 'POST',\n }\n );\n\n if (response.ok) {\n const data = (await response.json()) as PostVideoResult[];\n\n return data[0];\n }\n\n throw Error(`Failed to POST video (status code: ${response.status}).`);\n};\n"],"mappings":"AAaA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,MAAAC,IAAA,IAGqC;EAAA,IAH9B;IAC5BC,WAAW;IACXC;EACc,CAAC,GAAAF,IAAA;EACf,MAAMG,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAE/BD,QAAQ,CAACE,MAAM,CAAC,OAAO,EAAEH,IAAI,CAAC;EAE9B,MAAMI,QAAQ,GAAG,MAAMC,KAAK,CACxB,kEAAkE,EAClE;IACIC,IAAI,EAAEL,QAAQ;IACdM,OAAO,EAAE;MACLC,aAAa,EAAG,UAAST,WAAY;IACzC,CAAC;IACDU,MAAM,EAAE;EACZ,CACJ,CAAC;EAED,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,MAAMC,IAAI,GAAI,MAAMP,QAAQ,CAACQ,IAAI,CAAC,CAAuB;IAEzD,OAAOD,IAAI,CAAC,CAAC,CAAC;EAClB;EAEA,MAAME,KAAK,CAAE,sCAAqCT,QAAQ,CAACU,MAAO,IAAG,CAAC;AAC1E,CAAC"}
1
+ {"version":3,"file":"post.js","names":["getAccessToken","postVideo","_ref","file","accessToken","undefined","formData","FormData","append","response","fetch","body","headers","Authorization","method","ok","data","json","Error","status"],"sources":["../../../src/api/video/post.ts"],"sourcesContent":["import { getAccessToken } from 'chayns-api';\n\nexport interface PostVideoResult {\n id: string;\n originalVideoQuality: string;\n thumbnailUrl: string;\n url: string;\n urlMP4: string;\n}\n\ninterface PostVideoOptions {\n file: File | Blob;\n}\n\n/**\n * Uploads a video to the streaming service\n */\nexport const postVideo = async ({\n file,\n}: PostVideoOptions): Promise<PostVideoResult | undefined> => {\n const { accessToken } = await getAccessToken();\n\n if (!accessToken) {\n return undefined;\n }\n\n const formData = new FormData();\n\n formData.append('files', file);\n\n const response = await fetch(\n 'https://streamingservice.chayns.space/video?disableIntercom=true',\n {\n body: formData,\n headers: {\n Authorization: `bearer ${accessToken}`,\n },\n method: 'POST',\n },\n );\n\n if (response.ok) {\n const data = (await response.json()) as PostVideoResult[];\n\n return data[0];\n }\n\n throw Error(`Failed to POST video (status code: ${response.status}).`);\n};\n"],"mappings":"AAAA,SAASA,cAAc,QAAQ,YAAY;AAc3C;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAG,MAAAC,IAAA,IAEqC;EAAA,IAF9B;IAC5BC;EACc,CAAC,GAAAD,IAAA;EACf,MAAM;IAAEE;EAAY,CAAC,GAAG,MAAMJ,cAAc,CAAC,CAAC;EAE9C,IAAI,CAACI,WAAW,EAAE;IACd,OAAOC,SAAS;EACpB;EAEA,MAAMC,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAE/BD,QAAQ,CAACE,MAAM,CAAC,OAAO,EAAEL,IAAI,CAAC;EAE9B,MAAMM,QAAQ,GAAG,MAAMC,KAAK,CACxB,kEAAkE,EAClE;IACIC,IAAI,EAAEL,QAAQ;IACdM,OAAO,EAAE;MACLC,aAAa,EAAG,UAAST,WAAY;IACzC,CAAC;IACDU,MAAM,EAAE;EACZ,CACJ,CAAC;EAED,IAAIL,QAAQ,CAACM,EAAE,EAAE;IACb,MAAMC,IAAI,GAAI,MAAMP,QAAQ,CAACQ,IAAI,CAAC,CAAuB;IAEzD,OAAOD,IAAI,CAAC,CAAC,CAAC;EAClB;EAEA,MAAME,KAAK,CAAE,sCAAqCT,QAAQ,CAACU,MAAO,IAAG,CAAC;AAC1E,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import clsx from 'clsx';
2
2
  import { AnimatePresence } from 'framer-motion';
3
3
  import React from 'react';
4
+ import { useTheme } from 'styled-components';
4
5
  import Icon from '../icon/Icon';
5
6
  import SmallWaitCursor, { SmallWaitCursorSize } from '../small-wait-cursor/SmallWaitCursor';
6
- import { StyledButton, StyledIconWrapper, StyledMotionChildrenWrapper, StyledMotionWaitCursorWrapper } from './Button.styles';
7
+ import { StyledIconWrapper, StyledMotionButton, StyledMotionChildrenWrapper, StyledMotionWaitCursorWrapper } from './Button.styles';
7
8
  const Button = _ref => {
8
9
  let {
9
10
  children,
@@ -22,14 +23,21 @@ const Button = _ref => {
22
23
  onClick(event);
23
24
  };
24
25
  const buttonClasses = clsx('beta-chayns-button ellipsis', className);
25
- return /*#__PURE__*/React.createElement(StyledButton, {
26
+ const theme = useTheme();
27
+ return /*#__PURE__*/React.createElement(StyledMotionButton, {
26
28
  className: buttonClasses,
27
29
  disabled: isDisabled,
28
30
  isDisabled: isDisabled,
29
31
  hasChildren: !!children,
30
32
  hasIcon: typeof icon === 'string' && icon !== '',
31
33
  isSecondary: isSecondary,
32
- onClick: handleClick
34
+ onClick: handleClick,
35
+ whileTap: isDisabled ? {} : {
36
+ backgroundColor: isSecondary ? theme['201'] : theme['407']
37
+ },
38
+ whileHover: isDisabled ? {} : {
39
+ backgroundColor: isSecondary ? theme['203'] : theme['409']
40
+ }
33
41
  }, /*#__PURE__*/React.createElement(AnimatePresence, {
34
42
  initial: false
35
43
  }, icon && /*#__PURE__*/React.createElement(StyledIconWrapper, null, /*#__PURE__*/React.createElement(Icon, {
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["clsx","AnimatePresence","React","Icon","SmallWaitCursor","SmallWaitCursorSize","StyledButton","StyledIconWrapper","StyledMotionChildrenWrapper","StyledMotionWaitCursorWrapper","Button","_ref","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","handleClick","event","stopPropagation","buttonClasses","createElement","disabled","hasChildren","hasIcon","initial","color","icons","animate","opacity","width","exit","key","style","overflow","transition","duration","shouldHideBackground","size","Small","displayName"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'framer-motion';\nimport React, { FC, MouseEventHandler, ReactNode } from 'react';\nimport Icon from '../icon/Icon';\nimport SmallWaitCursor, { SmallWaitCursorSize } from '../small-wait-cursor/SmallWaitCursor';\nimport {\n StyledButton,\n StyledIconWrapper,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\n\nexport type ButtonProps = {\n /**\n * The label of the button\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text\n */\n icon?: string;\n /**\n * Disables the button so that it cannot be clicked anymore\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Shows a wait cursor instead of button text\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click\n */\n shouldStopPropagation?: boolean;\n};\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n return (\n <StyledButton\n className={buttonClasses}\n disabled={isDisabled}\n isDisabled={isDisabled}\n hasChildren={!!children}\n hasIcon={typeof icon === 'string' && icon !== ''}\n isSecondary={isSecondary}\n onClick={handleClick}\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color=\"white\" icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <SmallWaitCursor\n color=\"white\"\n shouldHideBackground\n size={SmallWaitCursorSize.Small}\n />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM;AACvB,SAASC,eAAe,QAAQ,eAAe;AAC/C,OAAOC,KAAK,MAA4C,OAAO;AAC/D,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,eAAe,IAAIC,mBAAmB,QAAQ,sCAAsC;AAC3F,SACIC,YAAY,EACZC,iBAAiB,EACjBC,2BAA2B,EAC3BC,6BAA6B,QAC1B,iBAAiB;AAqCxB,MAAMC,MAAuB,GAAGC,IAAA,IAS1B;EAAA,IAT2B;IAC7BC,QAAQ;IACRC,SAAS;IACTC,IAAI;IACJC,UAAU;IACVC,WAAW;IACXC,OAAO;IACPC,oBAAoB;IACpBC;EACJ,CAAC,GAAAR,IAAA;EACG,MAAMS,WAAiD,GAAIC,KAAK,IAAK;IACjE,IAAIF,qBAAqB,EAAE;MACvBE,KAAK,CAACC,eAAe,CAAC,CAAC;IAC3B;IAEAL,OAAO,CAACI,KAAK,CAAC;EAClB,CAAC;EAED,MAAME,aAAa,GAAGvB,IAAI,CAAC,6BAA6B,EAAEa,SAAS,CAAC;EAEpE,oBACIX,KAAA,CAAAsB,aAAA,CAAClB,YAAY;IACTO,SAAS,EAAEU,aAAc;IACzBE,QAAQ,EAAEV,UAAW;IACrBA,UAAU,EAAEA,UAAW;IACvBW,WAAW,EAAE,CAAC,CAACd,QAAS;IACxBe,OAAO,EAAE,OAAOb,IAAI,KA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EAAC,UAAU;IACdC,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAS,CAAE;IAC9BC,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B3B,QACwB,CAEpB,CACP,CAAC;AAEvB,CAAC;AAEDF,MAAM,CAACiC,WAAW,GAAG,QAAQ;AAE7B,eAAejC,MAAM"}
1
+ {"version":3,"file":"Button.js","names":["clsx","AnimatePresence","React","useTheme","Icon","SmallWaitCursor","SmallWaitCursorSize","StyledIconWrapper","StyledMotionButton","StyledMotionChildrenWrapper","StyledMotionWaitCursorWrapper","Button","_ref","children","className","icon","isDisabled","isSecondary","onClick","shouldShowWaitCursor","shouldStopPropagation","handleClick","event","stopPropagation","buttonClasses","theme","createElement","disabled","hasChildren","hasIcon","whileTap","backgroundColor","whileHover","initial","color","icons","animate","opacity","width","exit","key","style","overflow","transition","duration","shouldHideBackground","size","Small","displayName"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import clsx from 'clsx';\nimport { AnimatePresence } from 'framer-motion';\nimport React, { FC, MouseEventHandler, ReactNode } from 'react';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport Icon from '../icon/Icon';\nimport SmallWaitCursor, { SmallWaitCursorSize } from '../small-wait-cursor/SmallWaitCursor';\nimport {\n StyledIconWrapper,\n StyledMotionButton,\n StyledMotionChildrenWrapper,\n StyledMotionWaitCursorWrapper,\n} from './Button.styles';\n\nexport type ButtonProps = {\n /**\n * The label of the button\n */\n children?: ReactNode;\n /**\n * Additional class names for the button element\n */\n className?: string;\n /**\n * An icon that is displayed on the left-hand side of the button text\n */\n icon?: string;\n /**\n * Disables the button so that it cannot be clicked anymore\n */\n isDisabled?: boolean;\n /**\n * Displays the button in the secondary style\n */\n isSecondary?: boolean;\n /**\n * Function to be executed when the button is clicked\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n /**\n * Shows a wait cursor instead of button text\n */\n shouldShowWaitCursor?: boolean;\n /**\n * Stops event propagation on click\n */\n shouldStopPropagation?: boolean;\n};\n\nconst Button: FC<ButtonProps> = ({\n children,\n className,\n icon,\n isDisabled,\n isSecondary,\n onClick,\n shouldShowWaitCursor,\n shouldStopPropagation,\n}) => {\n const handleClick: MouseEventHandler<HTMLButtonElement> = (event) => {\n if (shouldStopPropagation) {\n event.stopPropagation();\n }\n\n onClick(event);\n };\n\n const buttonClasses = clsx('beta-chayns-button ellipsis', className);\n\n const theme: Theme = useTheme();\n\n return (\n <StyledMotionButton\n className={buttonClasses}\n disabled={isDisabled}\n isDisabled={isDisabled}\n hasChildren={!!children}\n hasIcon={typeof icon === 'string' && icon !== ''}\n isSecondary={isSecondary}\n onClick={handleClick}\n whileTap={\n isDisabled ? {} : { backgroundColor: isSecondary ? theme['201'] : theme['407'] }\n }\n whileHover={\n isDisabled ? {} : { backgroundColor: isSecondary ? theme['203'] : theme['409'] }\n }\n >\n <AnimatePresence initial={false}>\n {icon && (\n <StyledIconWrapper>\n <Icon color=\"white\" icons={[icon]} />\n </StyledIconWrapper>\n )}\n {shouldShowWaitCursor && (\n <StyledMotionWaitCursorWrapper\n animate={{ opacity: 1, width: 40 }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"wait-cursor\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n <SmallWaitCursor\n color=\"white\"\n shouldHideBackground\n size={SmallWaitCursorSize.Small}\n />\n </StyledMotionWaitCursorWrapper>\n )}\n {!shouldShowWaitCursor && children && (\n <StyledMotionChildrenWrapper\n animate={{ opacity: 1, width: 'auto' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"children\"\n style={{ overflow: 'hidden' }}\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionChildrenWrapper>\n )}\n </AnimatePresence>\n </StyledMotionButton>\n );\n};\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":"AAAA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GAAG,EAAC,UAAU;IACdC,KAAK,EAAE;MAAEC,QAAQ,EAAE;IAAS,CAAE;IAC9BC,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B/B,QACwB,CAEpB,CACD,CAAC;AAE7B,CAAC;AAEDF,MAAM,CAACqC,WAAW,GAAG,QAAQ;AAE7B,eAAerC,MAAM"}
@@ -7,7 +7,279 @@ type StyledButtonProps = ButtonProps & WithTheme<{
7
7
  hasChildren: boolean;
8
8
  isDisabled?: boolean;
9
9
  }>;
10
- export declare const StyledButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, StyledButtonProps>>;
10
+ export declare const StyledMotionButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<{
11
+ form?: string | undefined;
12
+ slot?: string | undefined;
13
+ title?: string | undefined;
14
+ value?: string | number | readonly string[] | undefined;
15
+ onScroll?: import("react").UIEventHandler<HTMLButtonElement> | undefined;
16
+ defaultChecked?: boolean | undefined;
17
+ defaultValue?: string | number | readonly string[] | undefined;
18
+ suppressContentEditableWarning?: boolean | undefined;
19
+ suppressHydrationWarning?: boolean | undefined;
20
+ accessKey?: string | undefined;
21
+ autoFocus?: boolean | undefined;
22
+ className?: string | undefined;
23
+ contentEditable?: "inherit" | (boolean | "true" | "false") | "plaintext-only" | undefined;
24
+ contextMenu?: string | undefined;
25
+ dir?: string | undefined;
26
+ draggable?: (boolean | "true" | "false") | undefined;
27
+ hidden?: boolean | undefined;
28
+ id?: string | undefined;
29
+ lang?: string | undefined;
30
+ nonce?: string | undefined;
31
+ spellCheck?: (boolean | "true" | "false") | undefined;
32
+ tabIndex?: number | undefined;
33
+ translate?: "yes" | "no" | undefined;
34
+ radioGroup?: string | undefined;
35
+ role?: import("react").AriaRole | undefined;
36
+ about?: string | undefined;
37
+ content?: string | undefined;
38
+ datatype?: string | undefined;
39
+ inlist?: any;
40
+ prefix?: string | undefined;
41
+ property?: string | undefined;
42
+ rel?: string | undefined;
43
+ resource?: string | undefined;
44
+ rev?: string | undefined;
45
+ typeof?: string | undefined;
46
+ vocab?: string | undefined;
47
+ autoCapitalize?: string | undefined;
48
+ autoCorrect?: string | undefined;
49
+ autoSave?: string | undefined;
50
+ color?: string | undefined;
51
+ itemProp?: string | undefined;
52
+ itemScope?: boolean | undefined;
53
+ itemType?: string | undefined;
54
+ itemID?: string | undefined;
55
+ itemRef?: string | undefined;
56
+ results?: number | undefined;
57
+ security?: string | undefined;
58
+ unselectable?: "on" | "off" | undefined;
59
+ inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
60
+ is?: string | undefined;
61
+ "aria-activedescendant"?: string | undefined;
62
+ "aria-atomic"?: (boolean | "true" | "false") | undefined;
63
+ "aria-autocomplete"?: "list" | "none" | "both" | "inline" | undefined;
64
+ "aria-braillelabel"?: string | undefined;
65
+ "aria-brailleroledescription"?: string | undefined;
66
+ "aria-busy"?: (boolean | "true" | "false") | undefined;
67
+ "aria-checked"?: boolean | "true" | "false" | "mixed" | undefined;
68
+ "aria-colcount"?: number | undefined;
69
+ "aria-colindex"?: number | undefined;
70
+ "aria-colindextext"?: string | undefined;
71
+ "aria-colspan"?: number | undefined;
72
+ "aria-controls"?: string | undefined;
73
+ "aria-current"?: boolean | "time" | "true" | "false" | "page" | "step" | "location" | "date" | undefined;
74
+ "aria-describedby"?: string | undefined;
75
+ "aria-description"?: string | undefined;
76
+ "aria-details"?: string | undefined;
77
+ "aria-disabled"?: (boolean | "true" | "false") | undefined;
78
+ "aria-dropeffect"?: "link" | "none" | "copy" | "move" | "execute" | "popup" | undefined;
79
+ "aria-errormessage"?: string | undefined;
80
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
81
+ "aria-flowto"?: string | undefined;
82
+ "aria-grabbed"?: (boolean | "true" | "false") | undefined;
83
+ "aria-haspopup"?: boolean | "dialog" | "menu" | "true" | "false" | "grid" | "listbox" | "tree" | undefined;
84
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
85
+ "aria-invalid"?: boolean | "true" | "false" | "grammar" | "spelling" | undefined;
86
+ "aria-keyshortcuts"?: string | undefined;
87
+ "aria-label"?: string | undefined;
88
+ "aria-labelledby"?: string | undefined;
89
+ "aria-level"?: number | undefined;
90
+ "aria-live"?: "off" | "assertive" | "polite" | undefined;
91
+ "aria-modal"?: (boolean | "true" | "false") | undefined;
92
+ "aria-multiline"?: (boolean | "true" | "false") | undefined;
93
+ "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
94
+ "aria-orientation"?: "horizontal" | "vertical" | undefined;
95
+ "aria-owns"?: string | undefined;
96
+ "aria-placeholder"?: string | undefined;
97
+ "aria-posinset"?: number | undefined;
98
+ "aria-pressed"?: boolean | "true" | "false" | "mixed" | undefined;
99
+ "aria-readonly"?: (boolean | "true" | "false") | undefined;
100
+ "aria-relevant"?: "text" | "all" | "additions" | "additions removals" | "additions text" | "removals" | "removals additions" | "removals text" | "text additions" | "text removals" | undefined;
101
+ "aria-required"?: (boolean | "true" | "false") | undefined;
102
+ "aria-roledescription"?: string | undefined;
103
+ "aria-rowcount"?: number | undefined;
104
+ "aria-rowindex"?: number | undefined;
105
+ "aria-rowindextext"?: string | undefined;
106
+ "aria-rowspan"?: number | undefined;
107
+ "aria-selected"?: (boolean | "true" | "false") | undefined;
108
+ "aria-setsize"?: number | undefined;
109
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
110
+ "aria-valuemax"?: number | undefined;
111
+ "aria-valuemin"?: number | undefined;
112
+ "aria-valuenow"?: number | undefined;
113
+ "aria-valuetext"?: string | undefined;
114
+ dangerouslySetInnerHTML?: {
115
+ __html: string | TrustedHTML;
116
+ } | undefined;
117
+ onCopy?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
118
+ onCopyCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
119
+ onCut?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
120
+ onCutCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
121
+ onPaste?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
122
+ onPasteCapture?: import("react").ClipboardEventHandler<HTMLButtonElement> | undefined;
123
+ onCompositionEnd?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
124
+ onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
125
+ onCompositionStart?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
126
+ onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
127
+ onCompositionUpdate?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
128
+ onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLButtonElement> | undefined;
129
+ onFocus?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
130
+ onFocusCapture?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
131
+ onBlur?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
132
+ onBlurCapture?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
133
+ onChange?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
134
+ onChangeCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
135
+ onBeforeInput?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
136
+ onBeforeInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
137
+ onInput?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
138
+ onInputCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
139
+ onReset?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
140
+ onResetCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
141
+ onSubmit?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
142
+ onSubmitCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
143
+ onInvalid?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
144
+ onInvalidCapture?: import("react").FormEventHandler<HTMLButtonElement> | undefined;
145
+ onLoad?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
146
+ onLoadCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
147
+ onError?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
148
+ onErrorCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
149
+ onKeyDown?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
150
+ onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
151
+ onKeyPress?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
152
+ onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
153
+ onKeyUp?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
154
+ onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLButtonElement> | undefined;
155
+ onAbort?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
156
+ onAbortCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
157
+ onCanPlay?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
158
+ onCanPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
159
+ onCanPlayThrough?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
160
+ onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
161
+ onDurationChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
162
+ onDurationChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
163
+ onEmptied?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
164
+ onEmptiedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
165
+ onEncrypted?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
166
+ onEncryptedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
167
+ onEnded?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
168
+ onEndedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
169
+ onLoadedData?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
170
+ onLoadedDataCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
171
+ onLoadedMetadata?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
172
+ onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
173
+ onLoadStart?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
174
+ onLoadStartCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
175
+ onPause?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
176
+ onPauseCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
177
+ onPlay?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
178
+ onPlayCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
179
+ onPlaying?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
180
+ onPlayingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
181
+ onProgress?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
182
+ onProgressCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
183
+ onRateChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
184
+ onRateChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
185
+ onResize?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
186
+ onResizeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
187
+ onSeeked?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
188
+ onSeekedCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
189
+ onSeeking?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
190
+ onSeekingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
191
+ onStalled?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
192
+ onStalledCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
193
+ onSuspend?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
194
+ onSuspendCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
195
+ onTimeUpdate?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
196
+ onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
197
+ onVolumeChange?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
198
+ onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
199
+ onWaiting?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
200
+ onWaitingCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
201
+ onAuxClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
202
+ onAuxClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
203
+ onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
204
+ onClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
205
+ onContextMenu?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
206
+ onContextMenuCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
207
+ onDoubleClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
208
+ onDoubleClickCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
209
+ onDragCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
210
+ onDragEndCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
211
+ onDragEnter?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
212
+ onDragEnterCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
213
+ onDragExit?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
214
+ onDragExitCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
215
+ onDragLeave?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
216
+ onDragLeaveCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
217
+ onDragOver?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
218
+ onDragOverCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
219
+ onDragStartCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
220
+ onDrop?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
221
+ onDropCapture?: import("react").DragEventHandler<HTMLButtonElement> | undefined;
222
+ onMouseDown?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
223
+ onMouseDownCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
224
+ onMouseEnter?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
225
+ onMouseLeave?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
226
+ onMouseMove?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
227
+ onMouseMoveCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
228
+ onMouseOut?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
229
+ onMouseOutCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
230
+ onMouseOver?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
231
+ onMouseOverCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
232
+ onMouseUp?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
233
+ onMouseUpCapture?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
234
+ onSelect?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
235
+ onSelectCapture?: import("react").ReactEventHandler<HTMLButtonElement> | undefined;
236
+ onTouchCancel?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
237
+ onTouchCancelCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
238
+ onTouchEnd?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
239
+ onTouchEndCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
240
+ onTouchMove?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
241
+ onTouchMoveCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
242
+ onTouchStart?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
243
+ onTouchStartCapture?: import("react").TouchEventHandler<HTMLButtonElement> | undefined;
244
+ onPointerDown?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
245
+ onPointerDownCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
246
+ onPointerMove?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
247
+ onPointerMoveCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
248
+ onPointerUp?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
249
+ onPointerUpCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
250
+ onPointerCancel?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
251
+ onPointerCancelCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
252
+ onPointerEnter?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
253
+ onPointerEnterCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
254
+ onPointerLeave?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
255
+ onPointerLeaveCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
256
+ onPointerOver?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
257
+ onPointerOverCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
258
+ onPointerOut?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
259
+ onPointerOutCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
260
+ onGotPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
261
+ onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
262
+ onLostPointerCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
263
+ onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLButtonElement> | undefined;
264
+ onScrollCapture?: import("react").UIEventHandler<HTMLButtonElement> | undefined;
265
+ onWheel?: import("react").WheelEventHandler<HTMLButtonElement> | undefined;
266
+ onWheelCapture?: import("react").WheelEventHandler<HTMLButtonElement> | undefined;
267
+ onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
268
+ onAnimationEnd?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
269
+ onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
270
+ onAnimationIteration?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
271
+ onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
272
+ onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
273
+ onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
274
+ disabled?: boolean | undefined;
275
+ name?: string | undefined;
276
+ type?: "button" | "reset" | "submit" | undefined;
277
+ formAction?: string | undefined;
278
+ formEncType?: string | undefined;
279
+ formMethod?: string | undefined;
280
+ formNoValidate?: boolean | undefined;
281
+ formTarget?: string | undefined;
282
+ } & import("framer-motion").MotionProps & import("react").RefAttributes<HTMLButtonElement>, StyledButtonProps>> & Omit<import("framer-motion").ForwardRefComponent<HTMLButtonElement, import("framer-motion").HTMLMotionProps<"button">>, keyof import("react").Component<any, {}, any>>;
11
283
  export declare const StyledIconWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>;
12
284
  export declare const StyledMotionChildrenWrapper: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<{
13
285
  slot?: string | undefined;
@@ -1,6 +1,6 @@
1
1
  import { motion } from 'framer-motion';
2
2
  import styled, { css } from 'styled-components';
3
- export const StyledButton = styled.button`
3
+ export const StyledMotionButton = styled(motion.button)`
4
4
  align-items: center;
5
5
  background-color: ${_ref => {
6
6
  let {
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.js","names":["motion","styled","css","StyledButton","button","_ref","isSecondary","theme","_ref2","text","_ref3","isDisabled","_ref4","disabled","_ref5","hasIcon","hasChildren","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { FramerMotionBugFix, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { ButtonProps } from './Button';\n\ntype StyledButtonProps = ButtonProps &\n WithTheme<{\n hasIcon: boolean;\n hasChildren: boolean;\n isDisabled?: boolean;\n }>;\n\nexport const StyledButton = styled.button<StyledButtonProps>`\n align-items: center;\n background-color: ${({ isSecondary, theme }: StyledButtonProps) =>\n isSecondary ? theme['202'] : theme['408']};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ${({ isSecondary, theme }: StyledButtonProps) => (isSecondary ? theme.text : 'white')};\n cursor: ${({ isDisabled }) => (isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n line-height: 1.15;\n min-height: 32px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n\n ${({ hasIcon, hasChildren }) => {\n if (hasIcon) {\n if (hasChildren) {\n return css`\n padding: 7px 12px 7px 42px;\n `;\n }\n return css`\n padding: 7px 12px 7px 18px;\n `;\n }\n return css`\n padding: 7px 12px 7px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)<FramerMotionBugFix>``;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)<FramerMotionBugFix>`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":"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,6BAA6B,GAAGpB,MAAM,CAACD,MAAM,CAACoB,GAAG,CAAsB;AACpF;AACA;AACA;AACA,CAAC"}
1
+ {"version":3,"file":"Button.styles.js","names":["motion","styled","css","StyledMotionButton","button","_ref","isSecondary","theme","_ref2","text","_ref3","isDisabled","_ref4","disabled","_ref5","hasIcon","hasChildren","StyledIconWrapper","span","StyledMotionChildrenWrapper","div","StyledMotionWaitCursorWrapper"],"sources":["../../../src/components/button/Button.styles.ts"],"sourcesContent":["import { motion } from 'framer-motion';\nimport styled, { css } from 'styled-components';\nimport type { FramerMotionBugFix, WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\nimport type { ButtonProps } from './Button';\n\ntype StyledButtonProps = ButtonProps &\n WithTheme<{\n hasIcon: boolean;\n hasChildren: boolean;\n isDisabled?: boolean;\n }>;\n\nexport const StyledMotionButton = styled(motion.button)<StyledButtonProps>`\n align-items: center;\n background-color: ${({ isSecondary, theme }: StyledButtonProps) =>\n isSecondary ? theme['202'] : theme['408']};\n border-radius: 3px;\n box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.2);\n border: none;\n color: ${({ isSecondary, theme }: StyledButtonProps) => (isSecondary ? theme.text : 'white')};\n cursor: ${({ isDisabled }) => (isDisabled ? 'default' : 'pointer')};\n display: inline-flex;\n line-height: 1.15;\n min-height: 32px;\n opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};\n position: relative;\n user-select: none;\n transition: opacity 0.3s ease;\n\n ${({ hasIcon, hasChildren }) => {\n if (hasIcon) {\n if (hasChildren) {\n return css`\n padding: 7px 12px 7px 42px;\n `;\n }\n return css`\n padding: 7px 12px 7px 18px;\n `;\n }\n return css`\n padding: 7px 12px 7px 12px;\n `;\n }}\n`;\n\nexport const StyledIconWrapper = styled.span`\n align-items: center;\n background-color: rgba(255, 255, 255, 0.2);\n bottom: 0;\n display: flex;\n justify-content: center;\n left: 0;\n position: absolute;\n top: 0;\n width: 30px;\n`;\n\nexport const StyledMotionChildrenWrapper = styled(motion.div)<FramerMotionBugFix>``;\n\nexport const StyledMotionWaitCursorWrapper = styled(motion.div)<FramerMotionBugFix>`\n align-items: center;\n display: flex;\n justify-content: center;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,eAAe;AACtC,OAAOC,MAAM,IAAIC,GAAG,QAAQ,mBAAmB;AAW/C,OAAO,MAAMC,kBAAkB,GAAGF,MAAM,CAACD,MAAM,CAACI,MAAM,CAAqB;AAC3E;AACA,wBAAwBC,IAAA;EAAA,IAAC;IAAEC,WAAW;IAAEC;EAAyB,CAAC,GAAAF,IAAA;EAAA,OAC1DC,WAAW,GAAGC,KAAK,CAAC,KAAK,CAAC,GAAGA,KAAK,CAAC,KAAK,CAAC;AAAA,CAAC;AAClD;AACA;AACA;AACA,aAAaC,KAAA;EAAA,IAAC;IAAEF,WAAW;IAAEC;EAAyB,CAAC,GAAAC,KAAA;EAAA,OAAMF,WAAW,GAAGC,KAAK,CAACE,IAAI,GAAG,OAAO;AAAA,CAAE;AACjG,cAAcC,KAAA;EAAA,IAAC;IAAEC;EAAW,CAAC,GAAAD,KAAA;EAAA,OAAMC,UAAU,GAAG,SAAS,GAAG,SAAS;AAAA,CAAE;AACvE;AACA;AACA;AACA,eAAeC,KAAA;EAAA,IAAC;IAAEC;EAAS,CAAC,GAAAD,KAAA;EAAA,OAAMC,QAAQ,GAAG,GAAG,GAAG,CAAC;AAAA,CAAE;AACtD;AACA;AACA;AACA;AACA,MAAMC,KAAA,IAA8B;EAAA,IAA7B;IAAEC,OAAO;IAAEC;EAAY,CAAC,GAAAF,KAAA;EACvB,IAAIC,OAAO,EAAE;IACT,IAAIC,WAAW,EAAE;MACb,OAAOd,GAAI;AAC3B;AACA,iBAAiB;IACL;IACA,OAAOA,GAAI;AACvB;AACA,aAAa;EACL;EACA,OAAOA,GAAI;AACnB;AACA,SAAS;AACL,CAAE;AACN,CAAC;AAED,OAAO,MAAMe,iBAAiB,GAAGhB,MAAM,CAACiB,IAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAGlB,MAAM,CAACD,MAAM,CAACoB,GAAG,CAAsB,EAAC;AAEnF,OAAO,MAAMC,6BAA6B,GAAGpB,MAAM,CAACD,MAAM,CAACoB,GAAG,CAAsB;AACpF;AACA;AACA;AACA,CAAC"}
@@ -1,9 +1,7 @@
1
1
  import type { FileItem, Image, Video } from '../types/file';
2
2
  interface UploadFilesOptions {
3
3
  fileToUpload: FileItem;
4
- accessToken: string;
5
- personId: string;
6
4
  callback: (UploadedFile: Video | Image) => void;
7
5
  }
8
- export declare const uploadFile: ({ fileToUpload, personId, accessToken, callback, }: UploadFilesOptions) => Promise<void>;
6
+ export declare const uploadFile: ({ fileToUpload, callback }: UploadFilesOptions) => Promise<void>;
9
7
  export {};
@@ -3,8 +3,6 @@ import { postVideo } from '../api/video/post';
3
3
  export const uploadFile = async _ref => {
4
4
  let {
5
5
  fileToUpload,
6
- personId,
7
- accessToken,
8
6
  callback
9
7
  } = _ref;
10
8
  if (!fileToUpload || fileToUpload.state !== 'none') {
@@ -12,8 +10,7 @@ export const uploadFile = async _ref => {
12
10
  }
13
11
  if (fileToUpload.file?.type.includes('video/')) {
14
12
  const uploadedVideo = await postVideo({
15
- file: fileToUpload.file,
16
- accessToken
13
+ file: fileToUpload.file
17
14
  });
18
15
  if (uploadedVideo) {
19
16
  callback({
@@ -24,9 +21,7 @@ export const uploadFile = async _ref => {
24
21
  }
25
22
  if (fileToUpload.file?.type.includes('image/')) {
26
23
  const uploadedImage = await postImage({
27
- file: fileToUpload.file,
28
- personId,
29
- accessToken
24
+ file: fileToUpload.file
30
25
  });
31
26
  if (uploadedImage) {
32
27
  callback({
@@ -1 +1 @@
1
- {"version":3,"file":"uploadFile.js","names":["postImage","postVideo","uploadFile","_ref","fileToUpload","personId","accessToken","callback","state","file","type","includes","uploadedVideo","id","toString","uploadedImage","url","base","key","meta"],"sources":["../../src/utils/uploadFile.ts"],"sourcesContent":["import { postImage } from '../api/image/post';\nimport { postVideo } from '../api/video/post';\nimport type { FileItem, Image, Video } from '../types/file';\n\ninterface UploadFilesOptions {\n fileToUpload: FileItem;\n accessToken: string;\n personId: string;\n callback: (UploadedFile: Video | Image) => void;\n}\n\nexport const uploadFile = async ({\n fileToUpload,\n personId,\n accessToken,\n callback,\n}: UploadFilesOptions): Promise<void> => {\n if (!fileToUpload || fileToUpload.state !== 'none') {\n return;\n }\n\n if (fileToUpload.file?.type.includes('video/')) {\n const uploadedVideo = await postVideo({ file: fileToUpload.file, accessToken });\n\n if (uploadedVideo) {\n callback({\n ...uploadedVideo,\n id: uploadedVideo.id.toString(),\n });\n }\n }\n\n if (fileToUpload.file?.type.includes('image/')) {\n const uploadedImage = await postImage({ file: fileToUpload.file, personId, accessToken });\n\n if (uploadedImage) {\n callback({\n url: `${uploadedImage.base}/${uploadedImage.key}`,\n id: uploadedImage.key,\n meta: uploadedImage.meta,\n });\n }\n }\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,QAAQ,mBAAmB;AAU7C,OAAO,MAAMC,UAAU,GAAG,MAAAC,IAAA,IAKe;EAAA,IALR;IAC7BC,YAAY;IACZC,QAAQ;IACRC,WAAW;IACXC;EACgB,CAAC,GAAAJ,IAAA;EACjB,IAAI,CAACC,YAAY,IAAIA,YAAY,CAACI,KAAK,KAAK,MAAM,EAAE;IAChD;EACJ;EAEA,IAAIJ,YAAY,CAACK,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMC,aAAa,GAAG,MAAMX,SAAS,CAAC;MAAEQ,IAAI,EAAEL,YAAY,CAACK,IAAI;MAAEH;IAAY,CAAC,CAAC;IAE/E,IAAIM,aAAa,EAAE;MACfL,QAAQ,CAAC;QACL,GAAGK,aAAa;QAChBC,EAAE,EAAED,aAAa,CAACC,EAAE,CAACC,QAAQ,CAAC;MAClC,CAAC,CAAC;IACN;EACJ;EAEA,IAAIV,YAAY,CAACK,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMI,aAAa,GAAG,MAAMf,SAAS,CAAC;MAAES,IAAI,EAAEL,YAAY,CAACK,IAAI;MAAEJ,QAAQ;MAAEC;IAAY,CAAC,CAAC;IAEzF,IAAIS,aAAa,EAAE;MACfR,QAAQ,CAAC;QACLS,GAAG,EAAG,GAAED,aAAa,CAACE,IAAK,IAAGF,aAAa,CAACG,GAAI,EAAC;QACjDL,EAAE,EAAEE,aAAa,CAACG,GAAG;QACrBC,IAAI,EAAEJ,aAAa,CAACI;MACxB,CAAC,CAAC;IACN;EACJ;AACJ,CAAC"}
1
+ {"version":3,"file":"uploadFile.js","names":["postImage","postVideo","uploadFile","_ref","fileToUpload","callback","state","file","type","includes","uploadedVideo","id","toString","uploadedImage","url","base","key","meta"],"sources":["../../src/utils/uploadFile.ts"],"sourcesContent":["import { postImage } from '../api/image/post';\nimport { postVideo } from '../api/video/post';\nimport type { FileItem, Image, Video } from '../types/file';\n\ninterface UploadFilesOptions {\n fileToUpload: FileItem;\n callback: (UploadedFile: Video | Image) => void;\n}\n\nexport const uploadFile = async ({ fileToUpload, callback }: UploadFilesOptions): Promise<void> => {\n if (!fileToUpload || fileToUpload.state !== 'none') {\n return;\n }\n\n if (fileToUpload.file?.type.includes('video/')) {\n const uploadedVideo = await postVideo({ file: fileToUpload.file });\n\n if (uploadedVideo) {\n callback({\n ...uploadedVideo,\n id: uploadedVideo.id.toString(),\n });\n }\n }\n\n if (fileToUpload.file?.type.includes('image/')) {\n const uploadedImage = await postImage({ file: fileToUpload.file });\n\n if (uploadedImage) {\n callback({\n url: `${uploadedImage.base}/${uploadedImage.key}`,\n id: uploadedImage.key,\n meta: uploadedImage.meta,\n });\n }\n }\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,SAAS,QAAQ,mBAAmB;AAQ7C,OAAO,MAAMC,UAAU,GAAG,MAAAC,IAAA,IAAyE;EAAA,IAAlE;IAAEC,YAAY;IAAEC;EAA6B,CAAC,GAAAF,IAAA;EAC3E,IAAI,CAACC,YAAY,IAAIA,YAAY,CAACE,KAAK,KAAK,MAAM,EAAE;IAChD;EACJ;EAEA,IAAIF,YAAY,CAACG,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMC,aAAa,GAAG,MAAMT,SAAS,CAAC;MAAEM,IAAI,EAAEH,YAAY,CAACG;IAAK,CAAC,CAAC;IAElE,IAAIG,aAAa,EAAE;MACfL,QAAQ,CAAC;QACL,GAAGK,aAAa;QAChBC,EAAE,EAAED,aAAa,CAACC,EAAE,CAACC,QAAQ,CAAC;MAClC,CAAC,CAAC;IACN;EACJ;EAEA,IAAIR,YAAY,CAACG,IAAI,EAAEC,IAAI,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;IAC5C,MAAMI,aAAa,GAAG,MAAMb,SAAS,CAAC;MAAEO,IAAI,EAAEH,YAAY,CAACG;IAAK,CAAC,CAAC;IAElE,IAAIM,aAAa,EAAE;MACfR,QAAQ,CAAC;QACLS,GAAG,EAAG,GAAED,aAAa,CAACE,IAAK,IAAGF,aAAa,CAACG,GAAI,EAAC;QACjDL,EAAE,EAAEE,aAAa,CAACG,GAAG;QACrBC,IAAI,EAAEJ,aAAa,CAACI;MACxB,CAAC,CAAC;IACN;EACJ;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.0.0-beta.454",
3
+ "version": "5.0.0-beta.457",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -72,5 +72,5 @@
72
72
  "publishConfig": {
73
73
  "access": "public"
74
74
  },
75
- "gitHead": "d9d9e638a8af08a5f4d3f456a09019aff260c8a3"
75
+ "gitHead": "14f7fd7ff2e7c85c81793db66efc02482cdbd527"
76
76
  }