@toptal/picasso-switch 4.0.12-alpha-1757603192867.0 → 4.0.12-alpha-FF-49-enhance-publishing-6b5d306f0.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.
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
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,iFAwFjB,CAAA;AASF,eAAe,MAAM,CAAA"}
@@ -0,0 +1,52 @@
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(props, ref) {
17
+ const { label, id, className, style, disabled, onChange, checked, titleCase, color, // eslint-disable-line
18
+ 'data-testid': dataTestId } = props, rest = __rest(props, ["label", "id", "className", "style", "disabled", "onChange", "checked", "titleCase", "color", 'data-testid']);
19
+ const onChangeCallback = event => {
20
+ if (onChange) {
21
+ onChange(event, event.target.checked);
22
+ }
23
+ };
24
+ 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: {
25
+ root: {
26
+ className: 'w-[40px] h-[24px] p-0 relative inline-flex z-0 overflow-visible shrink-0 align-middle group',
27
+ },
28
+ track: {
29
+ 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'),
30
+ },
31
+ thumb: {
32
+ 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]'),
33
+ },
34
+ input: {
35
+ 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'),
36
+ },
37
+ } })));
38
+ if (!label) {
39
+ return switchElement;
40
+ }
41
+ return (React.createElement(FormControlLabel, { classes: {
42
+ root: 'items-start text-lg',
43
+ label: 'ml-[0.5em] mt-[0.25em] max-w-[calc(100%-1em-0.5em+1px)]',
44
+ }, control: switchElement, disabled: disabled, label: label, titleCase: titleCase, "data-testid": dataTestId }));
45
+ });
46
+ Switch.defaultProps = {
47
+ disabled: false,
48
+ onChange: () => { },
49
+ };
50
+ Switch.displayName = 'Switch';
51
+ export default Switch;
52
+ //# sourceMappingURL=Switch.js.map
@@ -0,0 +1 @@
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,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,MAAM,YAAY,CAAA;AAmB3B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAA2B,SAAS,MAAM,CACxE,KAAK,EACL,GAAG;IAEH,MAAM,EACJ,KAAK,EACL,EAAE,EACF,SAAS,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,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,YAAY,GAAG;IACpB,QAAQ,EAAE,KAAK;IACf,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;CACnB,CAAA;AAED,MAAM,CAAC,WAAW,GAAG,QAAQ,CAAA;AAE7B,eAAe,MAAM,CAAA"}
@@ -0,0 +1,5 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ export { default as Switch } from './Switch';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Switch/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Switch';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './Switch';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/picasso-switch",
3
- "version": "4.0.12-alpha-1757603192867.0",
3
+ "version": "4.0.12-alpha-FF-49-enhance-publishing-6b5d306f0.0",
4
4
  "description": "Toptal UI components library - Switch",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -23,8 +23,8 @@
23
23
  },
24
24
  "homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
25
25
  "dependencies": {
26
- "@toptal/picasso-form-label": "1.0.3-alpha-1757603192867.0",
27
- "@toptal/picasso-shared": "15.0.1-alpha-1757603192867.0",
26
+ "@toptal/picasso-form-label": "1.0.3-alpha-FF-49-enhance-publishing-6b5d306f0.0",
27
+ "@toptal/picasso-shared": "15.0.1-alpha-FF-49-enhance-publishing-6b5d306f0.0",
28
28
  "@mui/base": "5.0.0-beta.58",
29
29
  "classnames": "^2.5.1"
30
30
  },
@@ -33,16 +33,16 @@
33
33
  "**/styles.js"
34
34
  ],
35
35
  "peerDependencies": {
36
- "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
37
- "@toptal/picasso-tailwind": "^3.0.1-alpha-1757603192867.0",
36
+ "@toptal/picasso-provider": "5.0.2-alpha-FF-49-enhance-publishing-6b5d306f0.0",
37
+ "@toptal/picasso-tailwind": "^3.0.1-alpha-FF-49-enhance-publishing-6b5d306f0.0",
38
38
  "react": ">=16.12.0 < 19.0.0"
39
39
  },
40
40
  "exports": {
41
41
  ".": "./dist-package/src/index.js"
42
42
  },
43
43
  "devDependencies": {
44
- "@toptal/picasso-provider": "5.0.2-alpha-1757603192867.0",
45
- "@toptal/picasso-test-utils": "1.1.2-alpha-1757603192867.0"
44
+ "@toptal/picasso-provider": "5.0.2-alpha-FF-49-enhance-publishing-6b5d306f0.0",
45
+ "@toptal/picasso-test-utils": "1.1.2-alpha-FF-49-enhance-publishing-6b5d306f0.0"
46
46
  },
47
47
  "files": [
48
48
  "dist-package/**",