@synerise/ds-switch 1.2.19 → 1.2.20

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,10 @@
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.20](https://github.com/synerise/synerise-design/compare/@synerise/ds-switch@1.2.19...@synerise/ds-switch@1.2.20) (2026-03-24)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-switch
9
+
6
10
  ## [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
11
 
8
12
  **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;
@@ -1,135 +1,101 @@
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')
1
+ import { jsx } from "react/jsx-runtime";
2
+ import figma from "@figma/code-connect";
3
+ import { Switch, RawSwitch } from "./Switch.js";
4
+ const FIGMA_URL = "https://www.figma.com/design/fsSZONXpVvtrDsCgtu01Jb/Synerise-Design-System?node-id=249-3688&m=dev";
5
+ const labelProps = {
6
+ labelNested: figma.nestedProps("Label", {
7
+ text: figma.string("Text")
7
8
  })
8
9
  };
9
- var descriptionProps = {
10
- labelNested: figma.nestedProps('Label', {
11
- text: figma.string('Text')
10
+ const descriptionProps = {
11
+ labelNested: figma.nestedProps("Label", {
12
+ text: figma.string("Text")
12
13
  }),
13
- descriptionNested: figma.nestedProps('Description', {
14
- text: figma.string('Text')
14
+ descriptionNested: figma.nestedProps("Description", {
15
+ text: figma.string("Text")
15
16
  })
16
17
  };
17
18
  figma.connect(Switch, FIGMA_URL, {
18
19
  variant: {
19
- State: 'Default',
20
- 'Content Type': 'Solo'
20
+ State: "Default",
21
+ "Content Type": "Solo"
21
22
  },
22
- example: function example() {
23
- return /*#__PURE__*/React.createElement(RawSwitch, null);
24
- }
23
+ example: () => /* @__PURE__ */ jsx(RawSwitch, {})
25
24
  });
26
25
  figma.connect(Switch, FIGMA_URL, {
27
26
  variant: {
28
- State: 'Default',
29
- 'Content Type': 'Label'
27
+ State: "Default",
28
+ "Content Type": "Label"
30
29
  },
31
30
  props: labelProps,
32
- example: function example(_ref) {
33
- var labelNested = _ref.labelNested;
34
- return /*#__PURE__*/React.createElement(Switch, {
35
- label: labelNested.text
36
- });
37
- }
31
+ example: ({
32
+ labelNested
33
+ }) => /* @__PURE__ */ jsx(Switch, { label: labelNested.text })
38
34
  });
39
35
  figma.connect(Switch, FIGMA_URL, {
40
36
  variant: {
41
- State: 'Default',
42
- 'Content Type': 'With Description'
37
+ State: "Default",
38
+ "Content Type": "With Description"
43
39
  },
44
40
  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
- }
41
+ example: ({
42
+ labelNested,
43
+ descriptionNested
44
+ }) => /* @__PURE__ */ jsx(Switch, { label: labelNested.text, description: descriptionNested.text })
53
45
  });
54
46
  figma.connect(Switch, FIGMA_URL, {
55
47
  variant: {
56
- State: 'Selected',
57
- 'Content Type': 'Solo'
48
+ State: "Selected",
49
+ "Content Type": "Solo"
58
50
  },
59
- example: function example() {
60
- return /*#__PURE__*/React.createElement(RawSwitch, {
61
- checked: true
62
- });
63
- }
51
+ example: () => /* @__PURE__ */ jsx(RawSwitch, { checked: true })
64
52
  });
65
53
  figma.connect(Switch, FIGMA_URL, {
66
54
  variant: {
67
- State: 'Selected',
68
- 'Content Type': 'Label'
55
+ State: "Selected",
56
+ "Content Type": "Label"
69
57
  },
70
58
  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
- }
59
+ example: ({
60
+ labelNested
61
+ }) => /* @__PURE__ */ jsx(Switch, { checked: true, label: labelNested.text })
78
62
  });
79
63
  figma.connect(Switch, FIGMA_URL, {
80
64
  variant: {
81
- State: 'Selected',
82
- 'Content Type': 'With Description'
65
+ State: "Selected",
66
+ "Content Type": "With Description"
83
67
  },
84
68
  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
- }
69
+ example: ({
70
+ labelNested,
71
+ descriptionNested
72
+ }) => /* @__PURE__ */ jsx(Switch, { checked: true, label: labelNested.text, description: descriptionNested.text })
94
73
  });
95
74
  figma.connect(Switch, FIGMA_URL, {
96
75
  variant: {
97
- State: 'Disabled',
98
- 'Content Type': 'Solo'
76
+ State: "Disabled",
77
+ "Content Type": "Solo"
99
78
  },
100
- example: function example() {
101
- return /*#__PURE__*/React.createElement(RawSwitch, {
102
- disabled: true
103
- });
104
- }
79
+ example: () => /* @__PURE__ */ jsx(RawSwitch, { disabled: true })
105
80
  });
106
81
  figma.connect(Switch, FIGMA_URL, {
107
82
  variant: {
108
- State: 'Disabled',
109
- 'Content Type': 'Label'
83
+ State: "Disabled",
84
+ "Content Type": "Label"
110
85
  },
111
86
  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
- }
87
+ example: ({
88
+ labelNested
89
+ }) => /* @__PURE__ */ jsx(Switch, { disabled: true, label: labelNested.text })
119
90
  });
120
91
  figma.connect(Switch, FIGMA_URL, {
121
92
  variant: {
122
- State: 'Disabled',
123
- 'Content Type': 'With Description'
93
+ State: "Disabled",
94
+ "Content Type": "With Description"
124
95
  },
125
96
  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
- });
97
+ example: ({
98
+ labelNested,
99
+ descriptionNested
100
+ }) => /* @__PURE__ */ jsx(Switch, { disabled: true, label: labelNested.text, description: descriptionNested.text })
101
+ });
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.20",
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.10",
39
+ "@synerise/ds-typography": "^1.1.13",
40
40
  "classnames": "^2.5.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@synerise/ds-tooltip": "^1.4.9"
43
+ "@synerise/ds-tooltip": "^1.4.10"
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": "e4ecca8944fc9b41c1b9d59c8bcad5e5e2013225"
52
52
  }