@xylabs/react-button 4.0.2 → 4.0.3

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 +1 @@
1
- {"version":3,"sources":["../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\nimport { ButtonToEx } from './ButtonExTo.tsx'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n","import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport React, { forwardRef, MouseEvent } from 'react'\n\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {\n const theme = useTheme()\n const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)\n\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (!busy) {\n onClick?.(event)\n }\n }\n\n return (\n <Button ref={ref} onClick={localOnClick} {...rootProps}>\n {busy && busyVariant === 'linear'\n ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} />\n : null}\n {busy && busyVariant === 'circular'\n ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />\n : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n","import React, { forwardRef, MouseEvent } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {\n const navigate = useNavigate()\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (to) {\n navigate(to, toOptions)\n }\n }\n\n return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />\n})\n\nButtonToEx.displayName = 'ButtonToExXYLabs'\n\nexport { ButtonToEx }\n"],"mappings":";;;;AAAA,OAAOA,UAASC,cAAAA,mBAAkB;;;ACAlC,SAASC,QAAQC,gBAAgB;AACjC,SAASC,sBAAsBC,oBAAoBC,0BAA0B;AAC7E,OAAOC,SAASC,kBAA8B;AAI9C,IAAMC,eAAeC,2BAA6C,CAACC,OAAOC,QAAAA;AACxE,QAAMC,QAAQC,SAAAA;AACd,QAAM,EAAEC,MAAMC,cAAc,UAAUC,aAAaC,SAASC,UAAU,GAAGC,UAAAA,IAAcC,mBAAkCR,OAAOF,KAAAA;AAEhI,QAAMW,eAAe,wBAACC,UAAAA;AACpB,QAAI,CAACR,MAAM;AACTG,gBAAUK,KAAAA;IACZ;EACF,GAJqB;AAMrB,SACE,sBAAA,cAACC,QAAAA;IAAOZ;IAAUM,SAASI;IAAe,GAAGF;KAC1CL,QAAQC,gBAAgB,WACrB,sBAAA,cAACS,oBAAAA;IAAmBC,SAAAA;IAAQC,SAASV,eAAe;OACpD,MACHF,QAAQC,gBAAgB,aACrB,sBAAA,cAACY,sBAAAA;IAAqBF,SAAAA;IAAQG,MAAM;IAAIF,SAASV,eAAe;OAChE,MACHE,QAAAA;AAGP,CAAA;AAEAV,aAAaqB,cAAc;;;AC7B3B,OAAOC,UAASC,cAAAA,mBAA8B;AAC9C,SAASC,mBAAmB;AAK5B,IAAMC,aAAaC,gBAAAA,YAA6C,CAAC,EAAEC,IAAIC,WAAWC,SAAS,GAAGC,MAAAA,GAASC,QAAAA;AACrG,QAAMC,WAAWC,YAAAA;AACjB,QAAMC,eAAe,wBAACC,UAAAA;AACpBN,cAAUM,KAAAA;AACV,QAAIR,IAAI;AACNK,eAASL,IAAIC,SAAAA;IACf;EACF,GALqB;AAOrB,SAAO,gBAAAQ,OAAA,cAACC,cAAAA;IAAaN;IAAUF,SAASK;IAAe,GAAGJ;;AAC5D,CAAA;AAEAL,WAAWa,cAAc;;;AFZzB,IAAMC,WAAWC,gBAAAA,YAA6C,CAAC,EAAEC,IAAI,GAAGC,MAAAA,GAASC,QAAAA;AAC/E,SAAOF,KAAK,gBAAAG,OAAA,cAACC,YAAAA;IAAWJ;IAAQE;IAAW,GAAGD;OAAY,gBAAAE,OAAA,cAACE,cAAiBJ,KAAAA;AAC9E,CAAA;AAEAH,SAASQ,cAAc;","names":["React","forwardRef","Button","useTheme","BusyCircularProgress","BusyLinearProgress","mergeBoxlikeStyles","React","forwardRef","ButtonExBase","forwardRef","props","ref","theme","useTheme","busy","busyVariant","busyOpacity","onClick","children","rootProps","mergeBoxlikeStyles","localOnClick","event","Button","BusyLinearProgress","rounded","opacity","BusyCircularProgress","size","displayName","React","forwardRef","useNavigate","ButtonToEx","forwardRef","to","toOptions","onClick","props","ref","navigate","useNavigate","localOnClick","event","React","ButtonExBase","displayName","ButtonEx","forwardRef","to","props","ref","React","ButtonToEx","ButtonExBase","displayName"]}
1
+ {"version":3,"sources":["../../src/components/ButtonEx.tsx","../../src/components/ButtonExBase.tsx","../../src/components/ButtonExTo.tsx"],"sourcesContent":["import React, { forwardRef } from 'react'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport type { ButtonExProps } from './ButtonExProps.tsx'\nimport { ButtonToEx } from './ButtonExTo.tsx'\n\nconst ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {\n return to ? <ButtonToEx to={to} ref={ref} {...props} /> : <ButtonExBase {...props} />\n})\n\nButtonEx.displayName = 'ButtonExXYLabs'\n\nexport { ButtonEx }\n","import { Button, useTheme } from '@mui/material'\nimport { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'\nimport type { MouseEvent } from 'react'\nimport React, { forwardRef } from 'react'\n\nimport type { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {\n const theme = useTheme()\n const { busy, busyVariant = 'linear', busyOpacity, onClick, children, ...rootProps } = mergeBoxlikeStyles<ButtonExProps>(theme, props)\n\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n if (!busy) {\n onClick?.(event)\n }\n }\n\n return (\n <Button ref={ref} onClick={localOnClick} {...rootProps}>\n {busy && busyVariant === 'linear'\n ? <BusyLinearProgress rounded opacity={busyOpacity ?? 0} />\n : null}\n {busy && busyVariant === 'circular'\n ? <BusyCircularProgress rounded size={24} opacity={busyOpacity ?? 0.5} />\n : null}\n {children}\n </Button>\n )\n})\n\nButtonExBase.displayName = 'ButtonExBaseXYLabs'\n\nexport { ButtonExBase }\n","import type { MouseEvent } from 'react'\nimport React, { forwardRef } from 'react'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ButtonExBase } from './ButtonExBase.tsx'\nimport type { ButtonExProps } from './ButtonExProps.tsx'\n\nconst ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {\n const navigate = useNavigate()\n const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (to) {\n navigate(to, toOptions)\n }\n }\n\n return <ButtonExBase ref={ref} onClick={localOnClick} {...props} />\n})\n\nButtonToEx.displayName = 'ButtonToExXYLabs'\n\nexport { ButtonToEx }\n"],"mappings":";;;;AAAA,OAAOA,UAASC,cAAAA,mBAAkB;;;ACAlC,SAASC,QAAQC,gBAAgB;AACjC,SAASC,sBAAsBC,oBAAoBC,0BAA0B;AAE7E,OAAOC,SAASC,kBAAkB;AAIlC,IAAMC,eAAeC,2BAA6C,CAACC,OAAOC,QAAAA;AACxE,QAAMC,QA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oxlikeStyles","React","forwardRef","ButtonExBase","forwardRef","props","ref","theme","useTheme","busy","busyVariant","busyOpacity","onClick","children","rootProps","mergeBoxlikeStyles","localOnClick","event","Button","BusyLinearProgress","rounded","opacity","BusyCircularProgress","size","displayName","React","forwardRef","useNavigate","ButtonToEx","forwardRef","to","toOptions","onClick","props","ref","navigate","useNavigate","localOnClick","event","React","ButtonExBase","displayName","ButtonEx","forwardRef","to","props","ref","React","ButtonToEx","ButtonExBase","displayName"]}
package/package.json CHANGED
@@ -7,23 +7,26 @@
7
7
  },
8
8
  "bugs": {
9
9
  "email": "support@xylabs.com",
10
- "url": "https://github.com/xylabs/sdk-react/issues"
10
+ "url": "git+https://github.com/xylabs/sdk-react/issues"
11
11
  },
12
12
  "workspaces": [
13
13
  "packages/*"
14
14
  ],
15
15
  "dependencies": {
16
- "@xylabs/react-shared": "^4.0.2",
17
- "react-router-dom": "^6.26.0"
16
+ "@xylabs/react-shared": "^4.0.3",
17
+ "react-router-dom": "^6.26.1"
18
18
  },
19
19
  "description": "Common React library for all XY Labs projects that use React",
20
20
  "devDependencies": {
21
+ "@mui/material": "^5.16.7",
21
22
  "@storybook/react": "^8.2.9",
22
23
  "@types/react": "^18.3.3",
23
- "@xylabs/react-flexbox": "^4.0.2",
24
- "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
25
- "@xylabs/tsconfig-react": "^4.0.0-rc.15",
24
+ "@xylabs/react-flexbox": "^4.0.3",
25
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.20",
26
+ "@xylabs/tsconfig-react": "^4.0.0-rc.20",
26
27
  "react": "^18.3.1",
28
+ "react-dom": "^18.3.1",
29
+ "storybook": "^8.2.9",
27
30
  "typescript": "^5.5.4"
28
31
  },
29
32
  "peerDependencies": {
@@ -52,9 +55,9 @@
52
55
  },
53
56
  "repository": {
54
57
  "type": "git",
55
- "url": "https://github.com/xylabs/sdk-react.git"
58
+ "url": "git+https://github.com/xylabs/sdk-react.git"
56
59
  },
57
60
  "sideEffects": false,
58
- "version": "4.0.2",
61
+ "version": "4.0.3",
59
62
  "type": "module"
60
63
  }
@@ -1,4 +1,4 @@
1
- import { Meta, StoryFn } from '@storybook/react'
1
+ import type { Meta, StoryFn } from '@storybook/react'
2
2
  import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
3
3
  import React from 'react'
4
4
 
@@ -1,7 +1,7 @@
1
1
  import React, { forwardRef } from 'react'
2
2
 
3
3
  import { ButtonExBase } from './ButtonExBase.tsx'
4
- import { ButtonExProps } from './ButtonExProps.tsx'
4
+ import type { ButtonExProps } from './ButtonExProps.tsx'
5
5
  import { ButtonToEx } from './ButtonExTo.tsx'
6
6
 
7
7
  const ButtonEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, ...props }, ref) => {
@@ -1,8 +1,9 @@
1
1
  import { Button, useTheme } from '@mui/material'
2
2
  import { BusyCircularProgress, BusyLinearProgress, mergeBoxlikeStyles } from '@xylabs/react-shared'
3
- import React, { forwardRef, MouseEvent } from 'react'
3
+ import type { MouseEvent } from 'react'
4
+ import React, { forwardRef } from 'react'
4
5
 
5
- import { ButtonExProps } from './ButtonExProps.tsx'
6
+ import type { ButtonExProps } from './ButtonExProps.tsx'
6
7
 
7
8
  const ButtonExBase = forwardRef<HTMLButtonElement, ButtonExProps>((props, ref) => {
8
9
  const theme = useTheme()
@@ -1,5 +1,5 @@
1
- import { ButtonProps } from '@mui/material'
2
- import { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared'
1
+ import type { ButtonProps } from '@mui/material'
2
+ import type { BoxlikeComponentProps, BusyProps } from '@xylabs/react-shared'
3
3
  import type { NavigateOptions, To } from 'react-router-dom'
4
4
 
5
5
  interface ButtonExProps extends Omit<ButtonProps, 'ref'>, BoxlikeComponentProps, BusyProps {
@@ -1,8 +1,9 @@
1
- import React, { forwardRef, MouseEvent } from 'react'
1
+ import type { MouseEvent } from 'react'
2
+ import React, { forwardRef } from 'react'
2
3
  import { useNavigate } from 'react-router-dom'
3
4
 
4
5
  import { ButtonExBase } from './ButtonExBase.tsx'
5
- import { ButtonExProps } from './ButtonExProps.tsx'
6
+ import type { ButtonExProps } from './ButtonExProps.tsx'
6
7
 
7
8
  const ButtonToEx = forwardRef<HTMLButtonElement, ButtonExProps>(({ to, toOptions, onClick, ...props }, ref) => {
8
9
  const navigate = useNavigate()
package/xy.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
1
+ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
4
  browser: {