@mirohq/design-system-switch 4.1.0-stop-using-strict-component-props.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sources":["../src/switch.styled.ts","../src/switch.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport * as RadixSwitch from '@radix-ui/react-switch'\nimport { focus } from '@mirohq/design-system-styles'\nimport { styles } from '@mirohq/design-system-base-switch'\n\nexport const StyledSwitch = styled(RadixSwitch.Root, {\n ...styles.default,\n cursor: 'pointer',\n\n ...focus.css({\n boxShadow: '$focus',\n }),\n\n '&[aria-checked=true]': styles.checked,\n\n '&:hover:not([disabled]):not([aria-disabled=true])': {\n ...styles.hovered,\n\n '&[aria-checked=true]': styles.checkedHovered,\n },\n '&[disabled], &[aria-disabled=true]': styles.disabled,\n\n variants: {\n size: {\n medium: {\n width: '$7',\n height: '$4',\n },\n large: {\n width: '$9',\n height: '$5',\n },\n },\n },\n})\n\nexport type StyledSwitchProps = ComponentPropsWithRef<typeof StyledSwitch>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { Booleanish } from '@mirohq/design-system-types'\nimport { booleanify, booleanishAttrValue } from '@mirohq/design-system-utils'\nimport { Thumb } from '@mirohq/design-system-base-switch'\n\nimport type { StyledSwitchProps } from './switch.styled'\nimport { StyledSwitch } from './switch.styled'\n\nexport interface SwitchProps extends StyledSwitchProps {\n /**\n * Change the size of the switch.\n * @default 'medium'\n */\n size?: StyledSwitchProps['size']\n\n /**\n * The state of the switch.\n */\n checked?: boolean\n\n /**\n * The checked state of the checkbox when it is initially rendered. Use when\n * you do not need to control its checked state.\n */\n defaultChecked?: boolean\n\n /**\n * Event handler called when the checked state equals true.\n */\n onChecked?: () => void\n\n /**\n * Event handler called when the checked state equals false.\n */\n onUnchecked?: () => void\n\n /**\n * Prevents the user from interacting with the switch.\n * @default false\n */\n disabled?: boolean\n\n /**\n * Indicates that the user must check the switch.\n * @default false\n */\n required?: boolean\n\n /**\n * The name of the switch used in the form.\n */\n name?: string\n\n /**\n * The data when accessing the switch by its name in the form.\n */\n value?: string\n\n /**\n * When true, prevents the user from interacting with the switch but focus\n * is still possible.\n */\n 'aria-disabled'?: Booleanish\n}\n\nexport const Switch = React.forwardRef<\n ElementRef<typeof StyledSwitch>,\n SwitchProps\n>(\n (\n {\n size = 'medium',\n disabled = false,\n required = false,\n 'aria-disabled': ariaDisabled,\n onChecked,\n onUnchecked,\n onClick,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledSwitch\n {...restProps}\n ref={forwardRef}\n data-form-element='switch'\n size={size}\n disabled={disabled}\n required={required}\n aria-disabled={ariaDisabled}\n aria-required={undefined}\n data-required={booleanishAttrValue(required)}\n onClick={e => {\n if (booleanify(ariaDisabled)) {\n e.preventDefault()\n } else {\n onClick?.(e)\n }\n }}\n onCheckedChange={value => {\n if (value) {\n onChecked?.()\n } else {\n onUnchecked?.()\n }\n }}\n >\n <Thumb />\n </StyledSwitch>\n )\n)\n"],"names":["styled","RadixSwitch","styles","focus","React","jsx","booleanishAttrValue","booleanify","Thumb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMa,MAAA,YAAA,GAAeA,2BAAO,CAAAC,sBAAA,CAAY,IAAM,EAAA;AAAA,EACnD,GAAGC,6BAAO,CAAA,OAAA;AAAA,EACV,MAAQ,EAAA,SAAA;AAAA,EAER,GAAGC,yBAAM,GAAI,CAAA;AAAA,IACX,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AAAA,EAED,wBAAwBD,6BAAO,CAAA,OAAA;AAAA,EAE/B,mDAAqD,EAAA;AAAA,IACnD,GAAGA,6BAAO,CAAA,OAAA;AAAA,IAEV,wBAAwBA,6BAAO,CAAA,cAAA;AAAA,GACjC;AAAA,EACA,sCAAsCA,6BAAO,CAA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;AAAA,SACK,MAAA;AACL,UAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,EAAA,CAAA;AAAA,SACF;AAAA,OACF;AAAA,MAEA,yCAACC,4BAAM,EAAA,EAAA,CAAA;AAAA,KAAA;AAAA,GACT;AAEJ;;;;"}
1
+ {"version":3,"file":"main.js","sources":["../src/switch.styled.ts","../src/switch.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixSwitch from '@radix-ui/react-switch'\nimport { focus } from '@mirohq/design-system-styles'\nimport { styles } from '@mirohq/design-system-base-switch'\n\nexport const StyledSwitch = styled(RadixSwitch.Root, {\n ...styles.default,\n cursor: 'pointer',\n\n ...focus.css({\n boxShadow: '$focus',\n }),\n\n '&[aria-checked=true]': styles.checked,\n\n '&:hover:not([disabled]):not([aria-disabled=true])': {\n ...styles.hovered,\n\n '&[aria-checked=true]': styles.checkedHovered,\n },\n '&[disabled], &[aria-disabled=true]': styles.disabled,\n\n variants: {\n size: {\n medium: {\n width: '$7',\n height: '$4',\n },\n large: {\n width: '$9',\n height: '$5',\n },\n },\n },\n})\n\nexport type StyledSwitchProps = StrictComponentProps<typeof StyledSwitch>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { Booleanish } from '@mirohq/design-system-types'\nimport { booleanify, booleanishAttrValue } from '@mirohq/design-system-utils'\nimport { Thumb } from '@mirohq/design-system-base-switch'\n\nimport type { StyledSwitchProps } from './switch.styled'\nimport { StyledSwitch } from './switch.styled'\n\nexport interface SwitchProps extends StyledSwitchProps {\n /**\n * Change the size of the switch.\n * @default 'medium'\n */\n size?: StyledSwitchProps['size']\n\n /**\n * The state of the switch.\n */\n checked?: boolean\n\n /**\n * The checked state of the checkbox when it is initially rendered. Use when\n * you do not need to control its checked state.\n */\n defaultChecked?: boolean\n\n /**\n * Event handler called when the checked state equals true.\n */\n onChecked?: () => void\n\n /**\n * Event handler called when the checked state equals false.\n */\n onUnchecked?: () => void\n\n /**\n * Prevents the user from interacting with the switch.\n * @default false\n */\n disabled?: boolean\n\n /**\n * Indicates that the user must check the switch.\n * @default false\n */\n required?: boolean\n\n /**\n * The name of the switch used in the form.\n */\n name?: string\n\n /**\n * The data when accessing the switch by its name in the form.\n */\n value?: string\n\n /**\n * When true, prevents the user from interacting with the switch but focus\n * is still possible.\n */\n 'aria-disabled'?: Booleanish\n}\n\nexport const Switch = React.forwardRef<\n ElementRef<typeof StyledSwitch>,\n SwitchProps\n>(\n (\n {\n size = 'medium',\n disabled = false,\n required = false,\n 'aria-disabled': ariaDisabled,\n onChecked,\n onUnchecked,\n onClick,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledSwitch\n {...restProps}\n ref={forwardRef}\n data-form-element='switch'\n size={size}\n disabled={disabled}\n required={required}\n aria-disabled={ariaDisabled}\n aria-required={undefined}\n data-required={booleanishAttrValue(required)}\n onClick={e => {\n if (booleanify(ariaDisabled)) {\n e.preventDefault()\n } else {\n onClick?.(e)\n }\n }}\n onCheckedChange={value => {\n if (value) {\n onChecked?.()\n } else {\n onUnchecked?.()\n }\n }}\n >\n <Thumb />\n </StyledSwitch>\n )\n)\n"],"names":["styled","RadixSwitch","styles","focus","React","jsx","booleanishAttrValue","booleanify","Thumb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMa,MAAA,YAAA,GAAeA,2BAAO,CAAAC,sBAAA,CAAY,IAAM,EAAA;AAAA,EACnD,GAAGC,6BAAO,CAAA,OAAA;AAAA,EACV,MAAQ,EAAA,SAAA;AAAA,EAER,GAAGC,yBAAM,GAAI,CAAA;AAAA,IACX,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AAAA,EAED,wBAAwBD,6BAAO,CAAA,OAAA;AAAA,EAE/B,mDAAqD,EAAA;AAAA,IACnD,GAAGA,6BAAO,CAAA,OAAA;AAAA,IAEV,wBAAwBA,6BAAO,CAAA,cAAA;AAAA,GACj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AAA,CAAA,GAAA,SAAA,EAAA,CAAA;AAAA,SACK,MAAA;AACL,UAAA,WAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,EAAA,CAAA;AAAA,SACF;AAAA,OACF;AAAA,MAEA,yCAACC,4BAAM,EAAA,EAAA,CAAA;AAAA,KAAA;AAAA,GACT;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sources":["../src/switch.styled.ts","../src/switch.tsx"],"sourcesContent":["import type { ComponentPropsWithRef } from 'react'\nimport { styled } from '@mirohq/design-system-stitches'\nimport * as RadixSwitch from '@radix-ui/react-switch'\nimport { focus } from '@mirohq/design-system-styles'\nimport { styles } from '@mirohq/design-system-base-switch'\n\nexport const StyledSwitch = styled(RadixSwitch.Root, {\n ...styles.default,\n cursor: 'pointer',\n\n ...focus.css({\n boxShadow: '$focus',\n }),\n\n '&[aria-checked=true]': styles.checked,\n\n '&:hover:not([disabled]):not([aria-disabled=true])': {\n ...styles.hovered,\n\n '&[aria-checked=true]': styles.checkedHovered,\n },\n '&[disabled], &[aria-disabled=true]': styles.disabled,\n\n variants: {\n size: {\n medium: {\n width: '$7',\n height: '$4',\n },\n large: {\n width: '$9',\n height: '$5',\n },\n },\n },\n})\n\nexport type StyledSwitchProps = ComponentPropsWithRef<typeof StyledSwitch>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { Booleanish } from '@mirohq/design-system-types'\nimport { booleanify, booleanishAttrValue } from '@mirohq/design-system-utils'\nimport { Thumb } from '@mirohq/design-system-base-switch'\n\nimport type { StyledSwitchProps } from './switch.styled'\nimport { StyledSwitch } from './switch.styled'\n\nexport interface SwitchProps extends StyledSwitchProps {\n /**\n * Change the size of the switch.\n * @default 'medium'\n */\n size?: StyledSwitchProps['size']\n\n /**\n * The state of the switch.\n */\n checked?: boolean\n\n /**\n * The checked state of the checkbox when it is initially rendered. Use when\n * you do not need to control its checked state.\n */\n defaultChecked?: boolean\n\n /**\n * Event handler called when the checked state equals true.\n */\n onChecked?: () => void\n\n /**\n * Event handler called when the checked state equals false.\n */\n onUnchecked?: () => void\n\n /**\n * Prevents the user from interacting with the switch.\n * @default false\n */\n disabled?: boolean\n\n /**\n * Indicates that the user must check the switch.\n * @default false\n */\n required?: boolean\n\n /**\n * The name of the switch used in the form.\n */\n name?: string\n\n /**\n * The data when accessing the switch by its name in the form.\n */\n value?: string\n\n /**\n * When true, prevents the user from interacting with the switch but focus\n * is still possible.\n */\n 'aria-disabled'?: Booleanish\n}\n\nexport const Switch = React.forwardRef<\n ElementRef<typeof StyledSwitch>,\n SwitchProps\n>(\n (\n {\n size = 'medium',\n disabled = false,\n required = false,\n 'aria-disabled': ariaDisabled,\n onChecked,\n onUnchecked,\n onClick,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledSwitch\n {...restProps}\n ref={forwardRef}\n data-form-element='switch'\n size={size}\n disabled={disabled}\n required={required}\n aria-disabled={ariaDisabled}\n aria-required={undefined}\n data-required={booleanishAttrValue(required)}\n onClick={e => {\n if (booleanify(ariaDisabled)) {\n e.preventDefault()\n } else {\n onClick?.(e)\n }\n }}\n onCheckedChange={value => {\n if (value) {\n onChecked?.()\n } else {\n onUnchecked?.()\n }\n }}\n >\n <Thumb />\n </StyledSwitch>\n )\n)\n"],"names":[],"mappings":";;;;;;;;AAMa,MAAA,YAAA,GAAe,MAAO,CAAA,WAAA,CAAY,IAAM,EAAA;AAAA,EACnD,GAAG,MAAO,CAAA,OAAA;AAAA,EACV,MAAQ,EAAA,SAAA;AAAA,EAER,GAAG,MAAM,GAAI,CAAA;AAAA,IACX,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AAAA,EAED,wBAAwB,MAAO,CAAA,OAAA;AAAA,EAE/B,mDAAqD,EAAA;AAAA,IACnD,GAAG,MAAO,CAAA,OAAA;AAAA,IAEV,wBAAwB,MAAO,CAAA,cAAA;AAAA,GACjC;AAAA,EACA,sCAAsC,MAAO,CAAA,QAAA;AAAA,EAE7C,QAAU,E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IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,WAAA,EAAA,CAAA;AAAA,SACF;AAAA,OACF;AAAA,MAEA,8BAAC,KAAM,EAAA,EAAA,CAAA;AAAA,KAAA;AAAA,GACT;AAEJ;;;;"}
1
+ {"version":3,"file":"module.js","sources":["../src/switch.styled.ts","../src/switch.tsx"],"sourcesContent":["import { styled } from '@mirohq/design-system-stitches'\nimport type { StrictComponentProps } from '@mirohq/design-system-stitches'\nimport * as RadixSwitch from '@radix-ui/react-switch'\nimport { focus } from '@mirohq/design-system-styles'\nimport { styles } from '@mirohq/design-system-base-switch'\n\nexport const StyledSwitch = styled(RadixSwitch.Root, {\n ...styles.default,\n cursor: 'pointer',\n\n ...focus.css({\n boxShadow: '$focus',\n }),\n\n '&[aria-checked=true]': styles.checked,\n\n '&:hover:not([disabled]):not([aria-disabled=true])': {\n ...styles.hovered,\n\n '&[aria-checked=true]': styles.checkedHovered,\n },\n '&[disabled], &[aria-disabled=true]': styles.disabled,\n\n variants: {\n size: {\n medium: {\n width: '$7',\n height: '$4',\n },\n large: {\n width: '$9',\n height: '$5',\n },\n },\n },\n})\n\nexport type StyledSwitchProps = StrictComponentProps<typeof StyledSwitch>\n","import React from 'react'\nimport type { ElementRef } from 'react'\nimport type { Booleanish } from '@mirohq/design-system-types'\nimport { booleanify, booleanishAttrValue } from '@mirohq/design-system-utils'\nimport { Thumb } from '@mirohq/design-system-base-switch'\n\nimport type { StyledSwitchProps } from './switch.styled'\nimport { StyledSwitch } from './switch.styled'\n\nexport interface SwitchProps extends StyledSwitchProps {\n /**\n * Change the size of the switch.\n * @default 'medium'\n */\n size?: StyledSwitchProps['size']\n\n /**\n * The state of the switch.\n */\n checked?: boolean\n\n /**\n * The checked state of the checkbox when it is initially rendered. Use when\n * you do not need to control its checked state.\n */\n defaultChecked?: boolean\n\n /**\n * Event handler called when the checked state equals true.\n */\n onChecked?: () => void\n\n /**\n * Event handler called when the checked state equals false.\n */\n onUnchecked?: () => void\n\n /**\n * Prevents the user from interacting with the switch.\n * @default false\n */\n disabled?: boolean\n\n /**\n * Indicates that the user must check the switch.\n * @default false\n */\n required?: boolean\n\n /**\n * The name of the switch used in the form.\n */\n name?: string\n\n /**\n * The data when accessing the switch by its name in the form.\n */\n value?: string\n\n /**\n * When true, prevents the user from interacting with the switch but focus\n * is still possible.\n */\n 'aria-disabled'?: Booleanish\n}\n\nexport const Switch = React.forwardRef<\n ElementRef<typeof StyledSwitch>,\n SwitchProps\n>(\n (\n {\n size = 'medium',\n disabled = false,\n required = false,\n 'aria-disabled': ariaDisabled,\n onChecked,\n onUnchecked,\n onClick,\n ...restProps\n },\n forwardRef\n ) => (\n <StyledSwitch\n {...restProps}\n ref={forwardRef}\n data-form-element='switch'\n size={size}\n disabled={disabled}\n required={required}\n aria-disabled={ariaDisabled}\n aria-required={undefined}\n data-required={booleanishAttrValue(required)}\n onClick={e => {\n if (booleanify(ariaDisabled)) {\n e.preventDefault()\n } else {\n onClick?.(e)\n }\n }}\n onCheckedChange={value => {\n if (value) {\n onChecked?.()\n } else {\n onUnchecked?.()\n }\n }}\n >\n <Thumb />\n </StyledSwitch>\n )\n)\n"],"names":[],"mappings":";;;;;;;;AAMa,MAAA,YAAA,GAAe,MAAO,CAAA,WAAA,CAAY,IAAM,EAAA;AAAA,EACnD,GAAG,MAAO,CAAA,OAAA;AAAA,EACV,MAAQ,EAAA,SAAA;AAAA,EAER,GAAG,MAAM,GAAI,CAAA;AAAA,IACX,SAAW,EAAA,QAAA;AAAA,GACZ,CAAA;AAAA,EAED,wBAAwB,MAAO,CAAA,OAAA;AAAA,EAE/B,mDAAqD,EAAA;AAAA,IACnD,GAAG,MAAO,CAAA,OAAA;AAAA,IAEV,wBAAwB,MAAO,CAAA,cAAA;AAAA,GACjC;AAAA,EACA,sCAAsC,MAAO,CAAA,QAAA;AAAA,EAE7C,QAAU,EAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA;AAAA,QACN,KAAO,EAAA,I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AAA,MAEA,8BAAC,KAAM,EAAA,EAAA,CAAA;AAAA,KAAA;AAAA,GACT;AAEJ;;;;"}
package/dist/types.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import * as react from 'react';
2
- import react__default, { ComponentPropsWithRef } from 'react';
2
+ import react__default from 'react';
3
3
  import { Booleanish } from '@mirohq/design-system-types';
4
4
  import * as _stitches_react_types_styled_component from '@stitches/react/types/styled-component';
5
5
  import * as _mirohq_design_system_stitches from '@mirohq/design-system-stitches';
6
+ import { StrictComponentProps } from '@mirohq/design-system-stitches';
6
7
  import * as RadixSwitch from '@radix-ui/react-switch';
7
8
 
8
9
  declare const StyledSwitch: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_design_system_stitches.StyledComponentProps<react.ForwardRefExoticComponent<RadixSwitch.SwitchProps & react.RefAttributes<HTMLButtonElement>>>, "size"> & _stitches_react_types_styled_component.TransformProps<{
@@ -10,7 +11,7 @@ declare const StyledSwitch: react.ForwardRefExoticComponent<Omit<Omit<_mirohq_de
10
11
  }, {}> & _mirohq_design_system_stitches.CustomStylesProps, "ref"> & react.RefAttributes<HTMLButtonElement>> & _mirohq_design_system_stitches.StitchesInternals<react.ForwardRefExoticComponent<RadixSwitch.SwitchProps & react.RefAttributes<HTMLButtonElement>>, {
11
12
  size?: "medium" | "large" | undefined;
12
13
  }, {}>;
13
- type StyledSwitchProps = ComponentPropsWithRef<typeof StyledSwitch>;
14
+ type StyledSwitchProps = StrictComponentProps<typeof StyledSwitch>;
14
15
 
15
16
  interface SwitchProps extends StyledSwitchProps {
16
17
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirohq/design-system-switch",
3
- "version": "4.1.0-stop-using-strict-component-props.0",
3
+ "version": "4.1.0",
4
4
  "description": "",
5
5
  "author": "Miro",
6
6
  "source": "src/index.ts",
@@ -23,16 +23,16 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@stitches/react": "^1.2.8",
26
- "react": "^16.14 || ^17 || ^18",
27
- "react-dom": "^16.14 || ^17 || ^18"
26
+ "react": "^16.14 || ^17 || ^18 || ^19",
27
+ "react-dom": "^16.14 || ^17 || ^18 || ^19"
28
28
  },
29
29
  "dependencies": {
30
30
  "@radix-ui/react-switch": "^1.0.0",
31
- "@mirohq/design-system-base-switch": "^1.0.0",
32
- "@mirohq/design-system-styles": "^2.0.0",
33
- "@mirohq/design-system-stitches": "^3.0.0",
31
+ "@mirohq/design-system-base-switch": "^1.1.0",
34
32
  "@mirohq/design-system-types": "^1.0.0",
35
- "@mirohq/design-system-utils": "^1.0.0"
33
+ "@mirohq/design-system-utils": "^1.2.0",
34
+ "@mirohq/design-system-styles": "^2.1.0",
35
+ "@mirohq/design-system-stitches": "^3.1.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "rollup -c ../../../rollup.config.js",