@synerise/ds-switch 1.2.19 → 1.2.21

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 CHANGED
@@ -3,6 +3,14 @@
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.2.21](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.2.20...@synerise/ds-switch@1.2.21) (2026-04-01)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-switch
9
+
10
+ ## [1.2.20](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.2.19...@synerise/ds-switch@1.2.20) (2026-03-24)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-switch
13
+
6
14
  ## [1.2.19](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.2.18...@synerise/ds-switch@1.2.19) (2026-03-20)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-switch
package/dist/Switch.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import React from 'react';
2
- import '@synerise/ds-core/dist/js/style';
3
- import './style/index.less';
4
- export declare const RawSwitch: React.ForwardRefExoticComponent<import("antd/lib/switch").SwitchProps & React.RefAttributes<HTMLElement>>;
5
- export declare const Switch: React.ForwardRefExoticComponent<Omit<import("antd/lib/switch").SwitchProps, "size"> & {
1
+ import { default as React } from 'react';
2
+ export declare const RawSwitch: React.ForwardRefExoticComponent<import('antd/lib/switch').SwitchProps & React.RefAttributes<HTMLElement>>;
3
+ export declare const Switch: React.ForwardRefExoticComponent<Omit<import('antd/lib/switch').SwitchProps, "size"> & {
6
4
  errorText?: React.ReactNode;
7
5
  label: React.ReactNode;
8
6
  description?: React.ReactNode;
@@ -10,6 +8,6 @@ export declare const Switch: React.ForwardRefExoticComponent<Omit<import("antd/l
10
8
  } & {
11
9
  tooltipIcon?: React.ReactNode;
12
10
  tooltip?: React.ReactNode;
13
- tooltipConfig?: import("@synerise/ds-tooltip").TooltipProps;
11
+ tooltipConfig?: import('@synerise/ds-tooltip').TooltipProps;
14
12
  } & React.RefAttributes<HTMLDivElement>>;
15
13
  export default Switch;
package/dist/Switch.js CHANGED
@@ -1,57 +1,44 @@
1
- var _excluded = ["errorText", "label", "description", "onChange", "withFormElementMargin", "tooltipIcon", "tooltip", "className", "tooltipConfig"];
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 AntdSwitch from 'antd/lib/switch';
5
- import classnames from 'classnames';
6
- import React, { forwardRef, useId, useRef } from 'react';
7
- import '@synerise/ds-core/dist/js/style';
8
- import * as S from './Switch.styles';
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import AntdSwitch from "antd/lib/switch";
3
+ import classnames from "classnames";
4
+ import { forwardRef, useId, useRef } from "react";
5
+ import { SwitchWrapper, LabelSwitchWrapper, Texts, Label, DescriptionWrapper, BelowLabel, Error, Description } from "./Switch.styles.js";
9
6
  import "./style/index.css";
10
-
11
- // export RawSwitch from this file to have .less style side effects applied when only RawSwitch is used
12
- export var RawSwitch = AntdSwitch;
13
- export var Switch = /*#__PURE__*/forwardRef(function (_ref, ref) {
14
- var errorText = _ref.errorText,
15
- label = _ref.label,
16
- description = _ref.description,
17
- _onChange = _ref.onChange,
18
- withFormElementMargin = _ref.withFormElementMargin,
19
- tooltipIcon = _ref.tooltipIcon,
20
- tooltip = _ref.tooltip,
21
- className = _ref.className,
22
- tooltipConfig = _ref.tooltipConfig,
23
- antdSwitchProps = _objectWithoutPropertiesLoose(_ref, _excluded);
24
- var id = useId();
25
- var switchElement = useRef(null);
26
- return /*#__PURE__*/React.createElement(S.SwitchWrapper, {
27
- ref: ref,
28
- className: classnames(['ds-switch', className]),
29
- formElementMargin: Boolean(withFormElementMargin)
30
- }, /*#__PURE__*/React.createElement(S.LabelSwitchWrapper, null, /*#__PURE__*/React.createElement(RawSwitch, _extends({}, antdSwitchProps, {
31
- size: "small",
32
- className: errorText ? 'error' : '',
33
- id: id,
34
- ref: switchElement,
35
- onChange: function onChange(checked, event) {
36
- setTimeout(function () {
37
- if (switchElement !== null && switchElement.current !== null) {
38
- switchElement.current.blur();
39
- }
40
- }, 300);
41
- _onChange && _onChange(checked, event);
42
- }
43
- })), /*#__PURE__*/React.createElement(S.Texts, {
44
- className: "switch-texts"
45
- }, /*#__PURE__*/React.createElement(S.Label, {
46
- id: id,
47
- className: "switch-label",
48
- label: label,
49
- tooltip: tooltip,
50
- tooltipConfig: tooltipConfig
51
- }))), (errorText || description) && /*#__PURE__*/React.createElement(S.DescriptionWrapper, null, /*#__PURE__*/React.createElement(S.Texts, {
52
- className: "switch-texts"
53
- }, /*#__PURE__*/React.createElement(S.BelowLabel, null, errorText && /*#__PURE__*/React.createElement(S.Error, null, errorText), description && /*#__PURE__*/React.createElement(S.Description, {
54
- className: "switch-description"
55
- }, description)))));
7
+ const RawSwitch = AntdSwitch;
8
+ const Switch = forwardRef(({
9
+ errorText,
10
+ label,
11
+ description,
12
+ onChange,
13
+ withFormElementMargin,
14
+ tooltipIcon,
15
+ tooltip,
16
+ className,
17
+ tooltipConfig,
18
+ ...antdSwitchProps
19
+ }, ref) => {
20
+ const id = useId();
21
+ const switchElement = useRef(null);
22
+ return /* @__PURE__ */ jsxs(SwitchWrapper, { ref, className: classnames(["ds-switch", className]), formElementMargin: Boolean(withFormElementMargin), children: [
23
+ /* @__PURE__ */ jsxs(LabelSwitchWrapper, { children: [
24
+ /* @__PURE__ */ jsx(RawSwitch, { ...antdSwitchProps, size: "small", className: errorText ? "error" : "", id, ref: switchElement, onChange: (checked, event) => {
25
+ setTimeout(() => {
26
+ if (switchElement !== null && switchElement.current !== null) {
27
+ switchElement.current.blur();
28
+ }
29
+ }, 300);
30
+ onChange && onChange(checked, event);
31
+ } }),
32
+ /* @__PURE__ */ jsx(Texts, { className: "switch-texts", children: /* @__PURE__ */ jsx(Label, { id, className: "switch-label", label, tooltip, tooltipConfig }) })
33
+ ] }),
34
+ (errorText || description) && /* @__PURE__ */ jsx(DescriptionWrapper, { children: /* @__PURE__ */ jsx(Texts, { className: "switch-texts", children: /* @__PURE__ */ jsxs(BelowLabel, { children: [
35
+ errorText && /* @__PURE__ */ jsx(Error, { children: errorText }),
36
+ description && /* @__PURE__ */ jsx(Description, { className: "switch-description", children: description })
37
+ ] }) }) })
38
+ ] });
56
39
  });
57
- export default Switch;
40
+ export {
41
+ RawSwitch,
42
+ Switch,
43
+ Switch as default
44
+ };
@@ -1,10 +1,10 @@
1
- export declare const SwitchWrapper: import("styled-components").StyledComponent<"div", any, {
1
+ export declare const SwitchWrapper: import('styled-components').StyledComponent<"div", any, {
2
2
  formElementMargin: boolean;
3
3
  }, never>;
4
- export declare const Texts: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const Label: import("styled-components").StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import("@synerise/ds-form-field").FormFieldLabelProps) => React.JSX.Element, any, {}, never>;
6
- export declare const BelowLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
7
- export declare const LabelSwitchWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
- export declare const Error: import("styled-components").StyledComponent<"div", any, {}, never>;
9
- export declare const Description: import("styled-components").StyledComponent<"div", any, {}, never>;
10
- export declare const DescriptionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const Texts: import('styled-components').StyledComponent<"div", any, {}, never>;
5
+ export declare const Label: import('styled-components').StyledComponent<({ id, label, tooltip, tooltipConfig, children, ...htmlAttributes }: import('@synerise/ds-form-field').FormFieldLabelProps) => React.JSX.Element, any, {}, never>;
6
+ export declare const BelowLabel: import('styled-components').StyledComponent<"div", any, {}, never>;
7
+ export declare const LabelSwitchWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
8
+ export declare const Error: import('styled-components').StyledComponent<"div", any, {}, never>;
9
+ export declare const Description: import('styled-components').StyledComponent<"div", any, {}, never>;
10
+ export declare const DescriptionWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,41 +1,45 @@
1
- import styled from 'styled-components';
2
- import { FormFieldLabel } from '@synerise/ds-form-field';
3
- import { macro } from '@synerise/ds-typography';
4
- export var SwitchWrapper = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ import { FormFieldLabel } from "@synerise/ds-form-field";
3
+ import { macro } from "@synerise/ds-typography";
4
+ const SwitchWrapper = /* @__PURE__ */ styled.div.withConfig({
5
5
  displayName: "Switchstyles__SwitchWrapper",
6
6
  componentId: "sc-1gmh4sk-0"
7
- })(["display:flex;gap:3px 0;flex-direction:column;justify-content:space-between;", ";"], function (props) {
8
- return props.formElementMargin ? 'margin: 0 0 16px 0' : '';
9
- });
10
- export var Texts = styled.div.withConfig({
7
+ })(["display:flex;gap:3px 0;flex-direction:column;justify-content:space-between;", ";"], (props) => props.formElementMargin ? "margin: 0 0 16px 0" : "");
8
+ const Texts = /* @__PURE__ */ styled.div.withConfig({
11
9
  displayName: "Switchstyles__Texts",
12
10
  componentId: "sc-1gmh4sk-1"
13
11
  })(["margin-left:16px;display:flex;flex-direction:row;justify-content:space-between;"]);
14
- export var Label = styled(FormFieldLabel).withConfig({
12
+ const Label = /* @__PURE__ */ styled(FormFieldLabel).withConfig({
15
13
  displayName: "Switchstyles__Label",
16
14
  componentId: "sc-1gmh4sk-2"
17
15
  })(["", ";cursor:pointer;transition:0.3s ease;width:100%;display:flex;align-items:center;"], macro.heading);
18
- export var BelowLabel = styled.div.withConfig({
16
+ const BelowLabel = /* @__PURE__ */ styled.div.withConfig({
19
17
  displayName: "Switchstyles__BelowLabel",
20
18
  componentId: "sc-1gmh4sk-3"
21
19
  })([""]);
22
- export var LabelSwitchWrapper = styled.div.withConfig({
20
+ const LabelSwitchWrapper = /* @__PURE__ */ styled.div.withConfig({
23
21
  displayName: "Switchstyles__LabelSwitchWrapper",
24
22
  componentId: "sc-1gmh4sk-4"
25
23
  })(["display:flex;flex-direction:row;justify-content:flex-start;align-items:center;"]);
26
- export var Error = styled.div.withConfig({
24
+ const Error = /* @__PURE__ */ styled.div.withConfig({
27
25
  displayName: "Switchstyles__Error",
28
26
  componentId: "sc-1gmh4sk-5"
29
- })(["color:", ";margin-bottom:4px;"], function (props) {
30
- return props.theme.palette['red-600'];
31
- });
32
- export var Description = styled.div.withConfig({
27
+ })(["color:", ";margin-bottom:4px;"], (props) => props.theme.palette["red-600"]);
28
+ const Description = /* @__PURE__ */ styled.div.withConfig({
33
29
  displayName: "Switchstyles__Description",
34
30
  componentId: "sc-1gmh4sk-6"
35
- })(["color:", ";transition:0.3s ease;"], function (props) {
36
- return props.theme.palette['grey-600'];
37
- });
38
- export var DescriptionWrapper = styled.div.withConfig({
31
+ })(["color:", ";transition:0.3s ease;"], (props) => props.theme.palette["grey-600"]);
32
+ const DescriptionWrapper = /* @__PURE__ */ styled.div.withConfig({
39
33
  displayName: "Switchstyles__DescriptionWrapper",
40
34
  componentId: "sc-1gmh4sk-7"
41
- })(["justify-content:space-between;padding-left:28px;"]);
35
+ })(["justify-content:space-between;padding-left:28px;"]);
36
+ export {
37
+ BelowLabel,
38
+ Description,
39
+ DescriptionWrapper,
40
+ Error,
41
+ Label,
42
+ LabelSwitchWrapper,
43
+ SwitchWrapper,
44
+ Texts
45
+ };
@@ -1,6 +1,6 @@
1
- import { type SwitchProps as AntdSwitchProps } from 'antd/lib/switch';
2
- import { type ReactNode } from 'react';
3
- import { type TooltipProps as DsTooltipProps } from '@synerise/ds-tooltip';
1
+ import { SwitchProps as AntdSwitchProps } from 'antd/lib/switch';
2
+ import { ReactNode } from 'react';
3
+ import { TooltipProps as DsTooltipProps } from '@synerise/ds-tooltip';
4
4
  type TooltipProps = {
5
5
  tooltipIcon?: ReactNode;
6
6
  tooltip?: ReactNode;
@@ -1 +1 @@
1
- export {};
1
+
File without changes
package/dist/index.js CHANGED
@@ -1 +1,5 @@
1
- export { default, RawSwitch } from './Switch';
1
+ import { RawSwitch, Switch } from "./Switch.js";
2
+ export {
3
+ RawSwitch,
4
+ Switch as default
5
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-switch",
3
- "version": "1.2.19",
3
+ "version": "1.2.21",
4
4
  "description": "Switch UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-form-field": "^1.3.9",
39
- "@synerise/ds-typography": "^1.1.12",
38
+ "@synerise/ds-form-field": "^1.3.11",
39
+ "@synerise/ds-typography": "^1.1.14",
40
40
  "classnames": "^2.5.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@synerise/ds-tooltip": "^1.4.9"
43
+ "@synerise/ds-tooltip": "^1.4.11"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@synerise/ds-core": "*",
@@ -48,5 +48,5 @@
48
48
  "react": ">=16.9.0 <= 18.3.1",
49
49
  "styled-components": "^5.3.3"
50
50
  },
51
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
51
+ "gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
52
52
  }
@@ -1 +0,0 @@
1
- export {};
@@ -1,135 +0,0 @@
1
- import figma from '@figma/code-connect';
2
- import Switch, { RawSwitch } from './Switch';
3
- var FIGMA_URL = 'https://www.figma.com/design/fsSZONXpVvtrDsCgtu01Jb/Synerise-Design-System?node-id=249-3688&m=dev';
4
- var labelProps = {
5
- labelNested: figma.nestedProps('Label', {
6
- text: figma.string('Text')
7
- })
8
- };
9
- var descriptionProps = {
10
- labelNested: figma.nestedProps('Label', {
11
- text: figma.string('Text')
12
- }),
13
- descriptionNested: figma.nestedProps('Description', {
14
- text: figma.string('Text')
15
- })
16
- };
17
- figma.connect(Switch, FIGMA_URL, {
18
- variant: {
19
- State: 'Default',
20
- 'Content Type': 'Solo'
21
- },
22
- example: function example() {
23
- return /*#__PURE__*/React.createElement(RawSwitch, null);
24
- }
25
- });
26
- figma.connect(Switch, FIGMA_URL, {
27
- variant: {
28
- State: 'Default',
29
- 'Content Type': 'Label'
30
- },
31
- props: labelProps,
32
- example: function example(_ref) {
33
- var labelNested = _ref.labelNested;
34
- return /*#__PURE__*/React.createElement(Switch, {
35
- label: labelNested.text
36
- });
37
- }
38
- });
39
- figma.connect(Switch, FIGMA_URL, {
40
- variant: {
41
- State: 'Default',
42
- 'Content Type': 'With Description'
43
- },
44
- props: descriptionProps,
45
- example: function example(_ref2) {
46
- var labelNested = _ref2.labelNested,
47
- descriptionNested = _ref2.descriptionNested;
48
- return /*#__PURE__*/React.createElement(Switch, {
49
- label: labelNested.text,
50
- description: descriptionNested.text
51
- });
52
- }
53
- });
54
- figma.connect(Switch, FIGMA_URL, {
55
- variant: {
56
- State: 'Selected',
57
- 'Content Type': 'Solo'
58
- },
59
- example: function example() {
60
- return /*#__PURE__*/React.createElement(RawSwitch, {
61
- checked: true
62
- });
63
- }
64
- });
65
- figma.connect(Switch, FIGMA_URL, {
66
- variant: {
67
- State: 'Selected',
68
- 'Content Type': 'Label'
69
- },
70
- props: labelProps,
71
- example: function example(_ref3) {
72
- var labelNested = _ref3.labelNested;
73
- return /*#__PURE__*/React.createElement(Switch, {
74
- checked: true,
75
- label: labelNested.text
76
- });
77
- }
78
- });
79
- figma.connect(Switch, FIGMA_URL, {
80
- variant: {
81
- State: 'Selected',
82
- 'Content Type': 'With Description'
83
- },
84
- props: descriptionProps,
85
- example: function example(_ref4) {
86
- var labelNested = _ref4.labelNested,
87
- descriptionNested = _ref4.descriptionNested;
88
- return /*#__PURE__*/React.createElement(Switch, {
89
- checked: true,
90
- label: labelNested.text,
91
- description: descriptionNested.text
92
- });
93
- }
94
- });
95
- figma.connect(Switch, FIGMA_URL, {
96
- variant: {
97
- State: 'Disabled',
98
- 'Content Type': 'Solo'
99
- },
100
- example: function example() {
101
- return /*#__PURE__*/React.createElement(RawSwitch, {
102
- disabled: true
103
- });
104
- }
105
- });
106
- figma.connect(Switch, FIGMA_URL, {
107
- variant: {
108
- State: 'Disabled',
109
- 'Content Type': 'Label'
110
- },
111
- props: labelProps,
112
- example: function example(_ref5) {
113
- var labelNested = _ref5.labelNested;
114
- return /*#__PURE__*/React.createElement(Switch, {
115
- disabled: true,
116
- label: labelNested.text
117
- });
118
- }
119
- });
120
- figma.connect(Switch, FIGMA_URL, {
121
- variant: {
122
- State: 'Disabled',
123
- 'Content Type': 'With Description'
124
- },
125
- props: descriptionProps,
126
- example: function example(_ref6) {
127
- var labelNested = _ref6.labelNested,
128
- descriptionNested = _ref6.descriptionNested;
129
- return /*#__PURE__*/React.createElement(Switch, {
130
- disabled: true,
131
- label: labelNested.text,
132
- description: descriptionNested.text
133
- });
134
- }
135
- });