@toptal/picasso-switch 4.0.12-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31 → 4.0.12-alpha-1757603192867.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/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@toptal/picasso-switch",
3
- "version": "4.0.12-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
3
+ "version": "4.0.12-alpha-1757603192867.0",
4
4
  "description": "Toptal UI components library - Switch",
5
5
  "publishConfig": {
6
- "access": "public"
6
+ "access": "public",
7
+ "provenance": true
7
8
  },
8
9
  "main": "./dist-package/src/index.js",
9
10
  "module": "./dist-package/src/index.js",
10
11
  "scripts": {
11
12
  "build:package": "tsc -b tsconfig.json",
12
- "prepublishOnly": "yarn build:package"
13
+ "prepublishOnly": "echo 0"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -22,9 +23,9 @@
22
23
  },
23
24
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
24
25
  "dependencies": {
26
+ "@toptal/picasso-form-label": "1.0.3-alpha-1757603192867.0",
27
+ "@toptal/picasso-shared": "15.0.1-alpha-1757603192867.0",
25
28
  "@mui/base": "5.0.0-beta.58",
26
- "@toptal/picasso-form-label": "1.0.3-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.31+7db07b500",
27
- "@toptal/picasso-shared": "15.0.1-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.377+7db07b500",
28
29
  "classnames": "^2.5.1"
29
30
  },
30
31
  "sideEffects": [
@@ -32,21 +33,20 @@
32
33
  "**/styles.js"
33
34
  ],
34
35
  "peerDependencies": {
35
- "@toptal/picasso-provider": "*",
36
- "@toptal/picasso-tailwind": "^3.0.0",
36
+ "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
37
+ "@toptal/picasso-tailwind": "^3.0.1-alpha-1757603192867.0",
37
38
  "react": ">=16.12.0 < 19.0.0"
38
39
  },
39
40
  "exports": {
40
41
  ".": "./dist-package/src/index.js"
41
42
  },
42
43
  "devDependencies": {
43
- "@toptal/picasso-provider": "5.0.2-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.10+7db07b500",
44
- "@toptal/picasso-test-utils": "1.1.2-alpha-MP-669-remove-default-props-dkjf3234-7db07b500.377+7db07b500"
44
+ "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
45
+ "@toptal/picasso-test-utils": "1.1.2-alpha-1757603192867.0"
45
46
  },
46
47
  "files": [
47
48
  "dist-package/**",
48
49
  "!dist-package/tsconfig.tsbuildinfo",
49
50
  "src"
50
- ],
51
- "gitHead": "7db07b500402a91f0c09da3be294305a194fd1e4"
51
+ ]
52
52
  }
@@ -23,7 +23,7 @@ export interface Props
23
23
  }
24
24
 
25
25
  export const Switch = forwardRef<HTMLButtonElement, Props>(function Switch(
26
- { disabled = false, onChange = () => {}, ...props },
26
+ props,
27
27
  ref
28
28
  ) {
29
29
  const {
@@ -31,6 +31,8 @@ export const Switch = forwardRef<HTMLButtonElement, Props>(function Switch(
31
31
  id,
32
32
  className,
33
33
  style,
34
+ disabled,
35
+ onChange,
34
36
  checked,
35
37
  titleCase,
36
38
  color, // eslint-disable-line
@@ -110,6 +112,11 @@ export const Switch = forwardRef<HTMLButtonElement, Props>(function Switch(
110
112
  )
111
113
  })
112
114
 
115
+ Switch.defaultProps = {
116
+ disabled: false,
117
+ onChange: () => {},
118
+ }
119
+
113
120
  Switch.displayName = 'Switch'
114
121
 
115
122
  export default Switch
package/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021-2022 Toptal, LLC
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the “Software”), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,16 +0,0 @@
1
- import type { BaseProps, TextLabelProps } from '@toptal/picasso-shared';
2
- import type { ButtonHTMLAttributes, ReactNode } from 'react';
3
- import React from 'react';
4
- export interface Props extends BaseProps, TextLabelProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'type'> {
5
- /** Show Switch initially as checked */
6
- checked?: boolean;
7
- /** Disable changing `Switch` state */
8
- disabled?: boolean;
9
- /** Text label for the `Switch` */
10
- label?: ReactNode;
11
- /** Callback invoked when `Switch` changed its value */
12
- onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
13
- }
14
- export declare const Switch: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLButtonElement>>;
15
- export default Switch;
16
- //# sourceMappingURL=Switch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/Switch/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAC5D,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,MAAM,WAAW,KACf,SAAQ,SAAS,EACf,cAAc,EACd,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACpE,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kCAAkC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,EAC1C,OAAO,EAAE,OAAO,KACb,IAAI,CAAA;CACV;AAED,eAAO,MAAM,MAAM,iFAsFjB,CAAA;AAIF,eAAe,MAAM,CAAA"}
@@ -1,49 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { Switch as MUISwitch } from '@mui/base/Switch';
13
- import React, { forwardRef } from 'react';
14
- import { FormControlLabel } from '@toptal/picasso-form-label';
15
- import cx from 'classnames';
16
- export const Switch = forwardRef(function Switch(_a, ref) {
17
- var { disabled = false, onChange = () => { } } = _a, props = __rest(_a, ["disabled", "onChange"]);
18
- const { label, id, className, style, checked, titleCase, color, // eslint-disable-line
19
- 'data-testid': dataTestId } = props, rest = __rest(props, ["label", "id", "className", "style", "checked", "titleCase", "color", 'data-testid']);
20
- const onChangeCallback = event => {
21
- if (onChange) {
22
- onChange(event, event.target.checked);
23
- }
24
- };
25
- const switchElement = (React.createElement(MUISwitch, Object.assign({}, rest, { color: 'primary', ref: ref, checked: checked, className: className, style: style, disabled: disabled, id: id, onChange: onChangeCallback, "data-testid": label ? undefined : dataTestId, slotProps: {
26
- root: {
27
- className: 'w-[40px] h-[24px] p-0 relative inline-flex z-0 overflow-visible shrink-0 align-middle group',
28
- },
29
- track: {
30
- className: cx('w-full h-full border border-solid bg-gray-600 border-gray-600 opacity-100 rounded-[12px]', 'transition-colors duration-300 ease-out', 'group-[.base--checked]:bg-blue-500 group-[.base--checked]:border-blue-500', 'group-[.base--disabled]:opacity-40', 'group-[.base--disabled:not(.base--checked)]:bg-black'),
31
- },
32
- thumb: {
33
- className: cx('w-[22px] h-[22px] bg-current text-white block rounded-full shadow-1 absolute z-10 p-0 top-[1px] left-[1px]', 'transition-transform duration-150 ease-out', 'group-[:not(.base--disabled):hover]:shadow-[0_0_0_4px_rgba(32,78,207,0.48)]', 'group-[.base--focusVisible]:shadow-[0_0_0_4px_rgba(32,78,207,0.48)]', 'group-[.base--checked]:translate-x-[16px]'),
34
- },
35
- input: {
36
- className: cx('w-[200%] h-full m-0 p-0 opacity-0 absolute top-0 -left-[50%] cursor-pointer z-20', 'group-[.base--disabled]:cursor-default'),
37
- },
38
- } })));
39
- if (!label) {
40
- return switchElement;
41
- }
42
- return (React.createElement(FormControlLabel, { classes: {
43
- root: 'items-start text-lg',
44
- label: 'ml-[0.5em] mt-[0.25em] max-w-[calc(100%-1em-0.5em+1px)]',
45
- }, control: switchElement, disabled: disabled, label: label, titleCase: titleCase, "data-testid": dataTestId }));
46
- });
47
- Switch.displayName = 'Switch';
48
- export default Switch;
49
- //# sourceMappingURL=Switch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../../src/Switch/Switch.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,O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C7E,qEAAqE,EACrE,2CAA2C,CAC5C;aACF;YACD,KAAK,EAAE;gBACL,SAAS,EAAE,EAAE,CACX,kFAAkF,EAClF,wCAAwC,CACzC;aACF;SACF,IACD,CACH,CAAA;IAED,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,aAAa,CAAA;KACrB;IAED,OAAO,CACL,oBAAC,gBAAgB,IACf,OAAO,EAAE;YACP,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,yDAAyD;SACjE,EACD,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,iBACP,UAAU,GACvB,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,eAAe,MAAM,CAAA"}
@@ -1,5 +0,0 @@
1
- import type { OmitInternalProps } from '@toptal/picasso-shared';
2
- import type { Props as InternalSwitchProps } from './Switch';
3
- export { default as Switch } from './Switch';
4
- export declare type SwitchProps = OmitInternalProps<InternalSwitchProps>;
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Switch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE/D,OAAO,KAAK,EAAE,KAAK,IAAI,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,oBAAY,WAAW,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default as Switch } from './Switch';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Switch/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Switch';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './Switch';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}