@synerise/ds-switch 1.0.4 → 1.1.1
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 +19 -0
- package/dist/Switch.d.ts +1 -5
- package/dist/Switch.js +8 -14
- package/dist/Switch.styles.d.ts +2 -1
- package/dist/Switch.styles.js +2 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.1.0...@synerise/ds-switch@1.1.1) (2025-04-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-switch
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.0.4...@synerise/ds-switch@1.1.0) (2025-04-16)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **form-field:** add form-field component ([7f6b191](https://github.com/synerise/synerise-design/commit/7f6b191132a3b0d694c21fb4d649f4deea6acb89))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [1.0.4](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.0.3...@synerise/ds-switch@1.0.4) (2025-04-02)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @synerise/ds-switch
|
package/dist/Switch.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import '@synerise/ds-core/dist/js/style';
|
|
3
3
|
import './style/index.less';
|
|
4
|
-
import { SwitchProps as AntdSwitchProps } from 'antd/lib/switch';
|
|
5
4
|
import { Props } from './Switch.types';
|
|
6
|
-
export declare const
|
|
7
|
-
id: string;
|
|
8
|
-
ref?: React.RefObject<HTMLInputElement> | undefined;
|
|
9
|
-
}>;
|
|
5
|
+
export declare const RawSwitch: React.ForwardRefExoticComponent<import("antd/lib/switch").SwitchProps & React.RefAttributes<HTMLElement>>;
|
|
10
6
|
export declare const Switch: ({ errorText, label, description, onChange, withFormElementMargin, tooltipIcon, tooltip, className, ...antdSwitchProps }: Props) => React.JSX.Element;
|
|
11
7
|
export default Switch;
|
package/dist/Switch.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
var _excluded = ["errorText", "label", "description", "onChange", "withFormElementMargin", "tooltipIcon", "tooltip", "className"];
|
|
2
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
3
|
-
function _objectWithoutPropertiesLoose(
|
|
4
|
-
import React, { useRef } from 'react';
|
|
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
|
+
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 React, { useRef, useId } from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import '@synerise/ds-core/dist/js/style';
|
|
7
|
-
import Label from '@synerise/ds-input/dist/Label/Label';
|
|
8
|
-
import { v4 as uuid } from 'uuid';
|
|
9
7
|
import "./style/index.css";
|
|
10
8
|
import AntdSwitch from 'antd/lib/switch';
|
|
11
9
|
import * as S from './Switch.styles';
|
|
12
|
-
//
|
|
13
|
-
export var
|
|
10
|
+
// export RawSwitch from this file to have .less style side effects applied when only RawSwitch is used
|
|
11
|
+
export var RawSwitch = AntdSwitch;
|
|
14
12
|
export var Switch = function Switch(_ref) {
|
|
15
13
|
var errorText = _ref.errorText,
|
|
16
14
|
label = _ref.label,
|
|
@@ -21,14 +19,12 @@ export var Switch = function Switch(_ref) {
|
|
|
21
19
|
tooltip = _ref.tooltip,
|
|
22
20
|
className = _ref.className,
|
|
23
21
|
antdSwitchProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
24
|
-
var id =
|
|
22
|
+
var id = useId();
|
|
25
23
|
var switchElement = useRef(null);
|
|
26
24
|
return /*#__PURE__*/React.createElement(S.SwitchWrapper, {
|
|
27
25
|
className: classnames(['ds-switch', className]),
|
|
28
26
|
formElementMargin: Boolean(withFormElementMargin)
|
|
29
|
-
}, /*#__PURE__*/React.createElement(S.LabelSwitchWrapper, null, /*#__PURE__*/React.createElement(
|
|
30
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
31
|
-
, _extends({}, antdSwitchProps, {
|
|
27
|
+
}, /*#__PURE__*/React.createElement(S.LabelSwitchWrapper, null, /*#__PURE__*/React.createElement(RawSwitch, _extends({}, antdSwitchProps, {
|
|
32
28
|
size: "small",
|
|
33
29
|
className: errorText ? 'error' : '',
|
|
34
30
|
id: id,
|
|
@@ -42,13 +38,11 @@ export var Switch = function Switch(_ref) {
|
|
|
42
38
|
})), /*#__PURE__*/React.createElement(S.Texts, {
|
|
43
39
|
className: "switch-texts"
|
|
44
40
|
}, /*#__PURE__*/React.createElement(S.Label, {
|
|
45
|
-
className: "switch-texts"
|
|
46
|
-
}, /*#__PURE__*/React.createElement(Label, {
|
|
47
41
|
id: id,
|
|
48
42
|
className: "switch-label",
|
|
49
43
|
label: label,
|
|
50
44
|
tooltip: tooltip
|
|
51
|
-
})))
|
|
45
|
+
}))), (errorText || description) && /*#__PURE__*/React.createElement(S.DescriptionWrapper, null, /*#__PURE__*/React.createElement(S.Texts, {
|
|
52
46
|
className: "switch-texts"
|
|
53
47
|
}, /*#__PURE__*/React.createElement(S.BelowLabel, null, errorText && /*#__PURE__*/React.createElement(S.Error, null, errorText), description && /*#__PURE__*/React.createElement(S.Description, {
|
|
54
48
|
className: "switch-description"
|
package/dist/Switch.styles.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
export declare const SwitchWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
2
3
|
formElementMargin: boolean;
|
|
3
4
|
}, never>;
|
|
4
5
|
export declare const Texts: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
5
|
-
export declare const Label: import("styled-components").StyledComponent<
|
|
6
|
+
export declare const Label: import("styled-components").StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import("@synerise/ds-form-field").FormFieldLabelProps) => import("react").JSX.Element, any, {}, never>;
|
|
6
7
|
export declare const BelowLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
8
|
export declare const LabelSwitchWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
9
|
export declare const Error: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/dist/Switch.styles.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { macro } from '@synerise/ds-typography';
|
|
3
|
+
import { FormFieldLabel } from '@synerise/ds-form-field';
|
|
3
4
|
export var SwitchWrapper = styled.div.withConfig({
|
|
4
5
|
displayName: "Switchstyles__SwitchWrapper",
|
|
5
6
|
componentId: "sc-1gmh4sk-0"
|
|
@@ -10,7 +11,7 @@ export var Texts = styled.div.withConfig({
|
|
|
10
11
|
displayName: "Switchstyles__Texts",
|
|
11
12
|
componentId: "sc-1gmh4sk-1"
|
|
12
13
|
})(["margin-left:16px;display:flex;flex-direction:row;justify-content:space-between;"]);
|
|
13
|
-
export var Label = styled.
|
|
14
|
+
export var Label = styled(FormFieldLabel).withConfig({
|
|
14
15
|
displayName: "Switchstyles__Label",
|
|
15
16
|
componentId: "sc-1gmh4sk-2"
|
|
16
17
|
})(["", ";cursor:pointer;transition:0.3s ease;width:100%;display:flex;align-items:center;"], macro.heading);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default,
|
|
1
|
+
export { default, RawSwitch } from './Switch';
|
|
2
2
|
export type { Props as SwitchProps } from './Switch.types';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default,
|
|
1
|
+
export { default, RawSwitch } from './Switch';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-switch",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Switch UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -34,11 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"types": "dist/index.d.ts",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@synerise/ds-
|
|
38
|
-
"@synerise/ds-typography": "^1.0.
|
|
37
|
+
"@synerise/ds-form-field": "^1.1.1",
|
|
38
|
+
"@synerise/ds-typography": "^1.0.6",
|
|
39
39
|
"@synerise/ds-utils": "^1.0.1",
|
|
40
|
-
"classnames": "2.3.2"
|
|
41
|
-
"uuid": "^8.3.2"
|
|
40
|
+
"classnames": "2.3.2"
|
|
42
41
|
},
|
|
43
42
|
"peerDependencies": {
|
|
44
43
|
"@synerise/ds-core": "*",
|
|
@@ -46,5 +45,5 @@
|
|
|
46
45
|
"react": ">=16.9.0 <= 18.3.1",
|
|
47
46
|
"styled-components": "^5.3.3"
|
|
48
47
|
},
|
|
49
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "fc601270d3c84a5a52b62473a01f1b3c1c7014a7"
|
|
50
49
|
}
|