@synerise/ds-switch 1.1.6 → 1.1.8
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/CHANGELOG.md +255 -1049
- package/README.md +17 -17
- package/dist/Switch.d.ts +1 -1
- package/dist/Switch.js +7 -4
- package/dist/Switch.styles.js +1 -1
- package/dist/Switch.types.d.ts +2 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -15,25 +15,25 @@ Based on [Ant Design Switch](https://ant.design/components/switch/)
|
|
|
15
15
|
|
|
16
16
|
### Props
|
|
17
17
|
|
|
18
|
-
| Property | Description | Type
|
|
19
|
-
|
|
20
|
-
| autoFocus | get focus when component mounted | boolean
|
|
21
|
-
| checked | determine whether the Switch is checked | boolean
|
|
22
|
-
| checkedChildren | content to be shown when the state is checked | string / React.ReactNode
|
|
23
|
-
| className | additional class to Switch | string
|
|
24
|
-
| defaultChecked | to set the initial state | boolean
|
|
25
|
-
| disabled | Disable switch | boolean
|
|
26
|
-
| description | Switch description | string
|
|
27
|
-
| errorText | Error message, when provided changes switch style | string
|
|
28
|
-
| label | switch label | string
|
|
29
|
-
| tooltip | tooltip next to label | string | null
|
|
30
|
-
| tooltipIcon | icon for tooltip | React.ReactNode
|
|
31
|
-
| tooltipConfig | configuration of tooltip | React.ReactNode
|
|
32
|
-
| loading | loading state of switch | boolean
|
|
18
|
+
| Property | Description | Type | Default |
|
|
19
|
+
| ----------------- | ------------------------------------------------- | ---------------------------------------- | --------- |
|
|
20
|
+
| autoFocus | get focus when component mounted | boolean | `false` |
|
|
21
|
+
| checked | determine whether the Switch is checked | boolean | `false` |
|
|
22
|
+
| checkedChildren | content to be shown when the state is checked | string / React.ReactNode | - |
|
|
23
|
+
| className | additional class to Switch | string | - |
|
|
24
|
+
| defaultChecked | to set the initial state | boolean | `false` |
|
|
25
|
+
| disabled | Disable switch | boolean | `false` |
|
|
26
|
+
| description | Switch description | string | - |
|
|
27
|
+
| errorText | Error message, when provided changes switch style | string | - |
|
|
28
|
+
| label | switch label | string | - |
|
|
29
|
+
| tooltip | tooltip next to label | string | null | `null` |
|
|
30
|
+
| tooltipIcon | icon for tooltip | React.ReactNode | - |
|
|
31
|
+
| tooltipConfig | configuration of tooltip | React.ReactNode | - |
|
|
32
|
+
| loading | loading state of switch | boolean | `false` |
|
|
33
33
|
| onChange | trigger when the checked state is changing | (checked: boolean, event: Event) => void | - |
|
|
34
34
|
| onClick | trigger when clicked | (checked: boolean, event: Event) => void | - |
|
|
35
|
-
| unCheckedChildren | content to be shown when the state is unchecked | string / React.ReactNode
|
|
36
|
-
| size | the size of the Switch, | `small` | `default`
|
|
35
|
+
| unCheckedChildren | content to be shown when the state is unchecked | string / React.ReactNode | - |
|
|
36
|
+
| size | the size of the Switch, | `small` | `default` | `default` |
|
|
37
37
|
|
|
38
38
|
### Methods
|
|
39
39
|
|
package/dist/Switch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@synerise/ds-core/dist/js/style';
|
|
3
|
+
import { type Props } from './Switch.types';
|
|
3
4
|
import './style/index.less';
|
|
4
|
-
import { Props } from './Switch.types';
|
|
5
5
|
export declare const RawSwitch: React.ForwardRefExoticComponent<import("antd/lib/switch").SwitchProps & React.RefAttributes<HTMLElement>>;
|
|
6
6
|
export declare const Switch: ({ errorText, label, description, onChange, withFormElementMargin, tooltipIcon, tooltip, className, ...antdSwitchProps }: Props) => React.JSX.Element;
|
|
7
7
|
export default Switch;
|
package/dist/Switch.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
var _excluded = ["errorText", "label", "description", "onChange", "withFormElementMargin", "tooltipIcon", "tooltip", "className"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import
|
|
4
|
+
import AntdSwitch from 'antd/lib/switch';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
+
import React, { useId, useRef } from 'react';
|
|
6
7
|
import '@synerise/ds-core/dist/js/style';
|
|
7
|
-
import "./style/index.css";
|
|
8
|
-
import AntdSwitch from 'antd/lib/switch';
|
|
9
8
|
import * as S from './Switch.styles';
|
|
9
|
+
import "./style/index.css";
|
|
10
|
+
|
|
10
11
|
// export RawSwitch from this file to have .less style side effects applied when only RawSwitch is used
|
|
11
12
|
export var RawSwitch = AntdSwitch;
|
|
12
13
|
export var Switch = function Switch(_ref) {
|
|
@@ -31,7 +32,9 @@ export var Switch = function Switch(_ref) {
|
|
|
31
32
|
ref: switchElement,
|
|
32
33
|
onChange: function onChange(checked, event) {
|
|
33
34
|
setTimeout(function () {
|
|
34
|
-
if (switchElement !== null && switchElement.current !== null)
|
|
35
|
+
if (switchElement !== null && switchElement.current !== null) {
|
|
36
|
+
switchElement.current.blur();
|
|
37
|
+
}
|
|
35
38
|
}, 300);
|
|
36
39
|
_onChange && _onChange(checked, event);
|
|
37
40
|
}
|
package/dist/Switch.styles.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { macro } from '@synerise/ds-typography';
|
|
3
2
|
import { FormFieldLabel } from '@synerise/ds-form-field';
|
|
3
|
+
import { macro } from '@synerise/ds-typography';
|
|
4
4
|
export var SwitchWrapper = styled.div.withConfig({
|
|
5
5
|
displayName: "Switchstyles__SwitchWrapper",
|
|
6
6
|
componentId: "sc-1gmh4sk-0"
|
package/dist/Switch.types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SwitchProps as AntdSwitchProps } from 'antd/lib/switch';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { type SwitchProps as AntdSwitchProps } from 'antd/lib/switch';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
3
|
type TooltipProps = {
|
|
4
4
|
tooltipIcon?: ReactNode;
|
|
5
5
|
tooltip?: ReactNode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-switch",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Switch UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-form-field": "^1.1.
|
|
38
|
-
"@synerise/ds-typography": "^1.0.
|
|
39
|
-
"@synerise/ds-utils": "^1.3.
|
|
37
|
+
"@synerise/ds-form-field": "^1.1.8",
|
|
38
|
+
"@synerise/ds-typography": "^1.0.13",
|
|
39
|
+
"@synerise/ds-utils": "^1.3.1",
|
|
40
40
|
"classnames": "2.3.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"react": ">=16.9.0 <= 18.3.1",
|
|
46
46
|
"styled-components": "^5.3.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4512641033ba3581a3df208143c547fcfed45895"
|
|
49
49
|
}
|