@zohodesk/components 1.4.0 → 1.4.2
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/README.md +9 -0
- package/es/v1/Switch/Switch.js +6 -4
- package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +0 -2
- package/es/v1/Switch/contants/index.js +7 -1
- package/es/v1/Switch/css/Switch_v1.module.css +4 -3
- package/es/v1/Switch/props/defaultProps.js +0 -3
- package/es/v1/Switch/useSwitch.js +1 -1
- package/lib/v1/Switch/Switch.js +5 -3
- package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +0 -2
- package/lib/v1/Switch/contants/index.js +10 -3
- package/lib/v1/Switch/css/Switch_v1.module.css +4 -3
- package/lib/v1/Switch/props/defaultProps.js +0 -3
- package/lib/v1/Switch/useSwitch.js +1 -1
- package/package.json +4 -4
- package/result.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
|
|
4
4
|
|
|
5
|
+
# 1.4.2
|
|
6
|
+
|
|
7
|
+
- **Switch(v1)** - ?. operator removed
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# 1.4.1
|
|
11
|
+
|
|
12
|
+
- **Switch(v1)** - labelPlacement top | bottom alignment and hover style issue fixed.
|
|
13
|
+
|
|
5
14
|
# 1.4.0
|
|
6
15
|
|
|
7
16
|
- **Switch(v1)** - Existing v1 Switch moved to depreacated folder and all New component Switch created with required accessibility and customization.
|
package/es/v1/Switch/Switch.js
CHANGED
|
@@ -8,7 +8,7 @@ import { mergeStyle } from '@zohodesk/utils'; // hooks
|
|
|
8
8
|
|
|
9
9
|
import useSwitch from "./useSwitch"; // constants
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { ALIGN_ITEMS, ITEMS_DIRECTION, OFF_LABEL_RADIUS, THUMB_RADIUS } from "./contants"; // components
|
|
12
12
|
|
|
13
13
|
import Flex from '@zohodesk/layout/es/Flex/Flex';
|
|
14
14
|
import Label from "../../Label/Label"; // css
|
|
@@ -78,8 +78,8 @@ const Switch = props => {
|
|
|
78
78
|
});
|
|
79
79
|
return /*#__PURE__*/React.createElement(Flex, { ...customProps_container,
|
|
80
80
|
$ui_displayMode: "inline",
|
|
81
|
-
$ui_direction:
|
|
82
|
-
$ui_alignItems:
|
|
81
|
+
$ui_direction: ITEMS_DIRECTION[labelPlacement],
|
|
82
|
+
$ui_alignItems: ALIGN_ITEMS[labelPlacement],
|
|
83
83
|
$tagAttributes_container: { ...tagAttributes_container,
|
|
84
84
|
'data-selector-id': customId
|
|
85
85
|
},
|
|
@@ -93,7 +93,9 @@ const Switch = props => {
|
|
|
93
93
|
size: labelSize,
|
|
94
94
|
htmlFor: id,
|
|
95
95
|
customClass: labelClass,
|
|
96
|
-
a11y: a11yAttributes_label
|
|
96
|
+
a11y: a11yAttributes_label,
|
|
97
|
+
clipped: true,
|
|
98
|
+
title: label
|
|
97
99
|
}), /*#__PURE__*/React.createElement(Flex, {
|
|
98
100
|
$flag_shrink: false,
|
|
99
101
|
$ui_className: trackWrapperClass
|
|
@@ -13,7 +13,6 @@ exports[`Switch rendering the Switch with Checked 1`] = `
|
|
|
13
13
|
data-test-id="flex"
|
|
14
14
|
>
|
|
15
15
|
<input
|
|
16
|
-
aria-disabled="false"
|
|
17
16
|
checked=""
|
|
18
17
|
class="track"
|
|
19
18
|
id="switch"
|
|
@@ -105,7 +104,6 @@ exports[`Switch rendering the defult props 1`] = `
|
|
|
105
104
|
data-test-id="flex"
|
|
106
105
|
>
|
|
107
106
|
<input
|
|
108
|
-
aria-disabled="false"
|
|
109
107
|
class="track"
|
|
110
108
|
role="switch"
|
|
111
109
|
type="checkbox"
|
|
@@ -10,9 +10,15 @@ export const THUMB_RADIUS = {
|
|
|
10
10
|
large: '44.45%',
|
|
11
11
|
xlarge: '45.45%'
|
|
12
12
|
};
|
|
13
|
-
export const
|
|
13
|
+
export const ITEMS_DIRECTION = {
|
|
14
14
|
start: 'row',
|
|
15
15
|
end: 'rowReverse',
|
|
16
16
|
top: 'column',
|
|
17
17
|
bottom: 'columnReverse'
|
|
18
|
+
};
|
|
19
|
+
export const ALIGN_ITEMS = {
|
|
20
|
+
start: 'center',
|
|
21
|
+
end: 'center',
|
|
22
|
+
top: 'start',
|
|
23
|
+
bottom: 'start'
|
|
18
24
|
};
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
.disabled, .readonly {
|
|
51
51
|
--local-switch-cursor: not-allowed;
|
|
52
52
|
}
|
|
53
|
-
.checked.enabled:hover {
|
|
53
|
+
.checked.enabled > .trackWrapper:hover {
|
|
54
54
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_hover_bg);
|
|
55
55
|
}
|
|
56
|
-
.unChecked.enabled:hover {
|
|
56
|
+
.unChecked.enabled > .trackWrapper:hover {
|
|
57
57
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_hover_bg);
|
|
58
58
|
}
|
|
59
|
-
.enabled:hover {
|
|
59
|
+
.enabled > .trackWrapper:hover {
|
|
60
60
|
--local-switch-offLabel-stroke: var(--zdt_v1_switch_offLabel_hover);
|
|
61
61
|
}
|
|
62
62
|
.trackWrapper {
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
right: var(--zd_size1) ;
|
|
97
97
|
}
|
|
98
98
|
.label {
|
|
99
|
+
max-width: 100% ;
|
|
99
100
|
cursor: var(--local-switch-cursor);
|
|
100
101
|
}
|
|
101
102
|
.onLabel {
|
package/lib/v1/Switch/Switch.js
CHANGED
|
@@ -99,8 +99,8 @@ var Switch = function Switch(props) {
|
|
|
99
99
|
|
|
100
100
|
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], _extends({}, customProps_container, {
|
|
101
101
|
$ui_displayMode: "inline",
|
|
102
|
-
$ui_direction: _contants.
|
|
103
|
-
$ui_alignItems:
|
|
102
|
+
$ui_direction: _contants.ITEMS_DIRECTION[labelPlacement],
|
|
103
|
+
$ui_alignItems: _contants.ALIGN_ITEMS[labelPlacement],
|
|
104
104
|
$tagAttributes_container: _objectSpread(_objectSpread({}, tagAttributes_container), {}, {
|
|
105
105
|
'data-selector-id': customId
|
|
106
106
|
}),
|
|
@@ -114,7 +114,9 @@ var Switch = function Switch(props) {
|
|
|
114
114
|
size: labelSize,
|
|
115
115
|
htmlFor: id,
|
|
116
116
|
customClass: labelClass,
|
|
117
|
-
a11y: a11yAttributes_label
|
|
117
|
+
a11y: a11yAttributes_label,
|
|
118
|
+
clipped: true,
|
|
119
|
+
title: label
|
|
118
120
|
})), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
119
121
|
$flag_shrink: false,
|
|
120
122
|
$ui_className: trackWrapperClass
|
|
@@ -13,7 +13,6 @@ exports[`Switch rendering the Switch with Checked 1`] = `
|
|
|
13
13
|
data-test-id="flex"
|
|
14
14
|
>
|
|
15
15
|
<input
|
|
16
|
-
aria-disabled="false"
|
|
17
16
|
checked=""
|
|
18
17
|
class="track"
|
|
19
18
|
id="switch"
|
|
@@ -105,7 +104,6 @@ exports[`Switch rendering the defult props 1`] = `
|
|
|
105
104
|
data-test-id="flex"
|
|
106
105
|
>
|
|
107
106
|
<input
|
|
108
|
-
aria-disabled="false"
|
|
109
107
|
class="track"
|
|
110
108
|
role="switch"
|
|
111
109
|
type="checkbox"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.THUMB_RADIUS = exports.OFF_LABEL_RADIUS = exports.
|
|
6
|
+
exports.THUMB_RADIUS = exports.OFF_LABEL_RADIUS = exports.ITEMS_DIRECTION = exports.ALIGN_ITEMS = void 0;
|
|
7
7
|
var OFF_LABEL_RADIUS = {
|
|
8
8
|
small: '35.7%',
|
|
9
9
|
medium: '37.5%',
|
|
@@ -18,10 +18,17 @@ var THUMB_RADIUS = {
|
|
|
18
18
|
xlarge: '45.45%'
|
|
19
19
|
};
|
|
20
20
|
exports.THUMB_RADIUS = THUMB_RADIUS;
|
|
21
|
-
var
|
|
21
|
+
var ITEMS_DIRECTION = {
|
|
22
22
|
start: 'row',
|
|
23
23
|
end: 'rowReverse',
|
|
24
24
|
top: 'column',
|
|
25
25
|
bottom: 'columnReverse'
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
27
|
+
exports.ITEMS_DIRECTION = ITEMS_DIRECTION;
|
|
28
|
+
var ALIGN_ITEMS = {
|
|
29
|
+
start: 'center',
|
|
30
|
+
end: 'center',
|
|
31
|
+
top: 'start',
|
|
32
|
+
bottom: 'start'
|
|
33
|
+
};
|
|
34
|
+
exports.ALIGN_ITEMS = ALIGN_ITEMS;
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
.disabled, .readonly {
|
|
51
51
|
--local-switch-cursor: not-allowed;
|
|
52
52
|
}
|
|
53
|
-
.checked.enabled:hover {
|
|
53
|
+
.checked.enabled > .trackWrapper:hover {
|
|
54
54
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_on_hover_bg);
|
|
55
55
|
}
|
|
56
|
-
.unChecked.enabled:hover {
|
|
56
|
+
.unChecked.enabled > .trackWrapper:hover {
|
|
57
57
|
--local-switch-track-background-color: var(--zdt_v1_switch_track_off_hover_bg);
|
|
58
58
|
}
|
|
59
|
-
.enabled:hover {
|
|
59
|
+
.enabled > .trackWrapper:hover {
|
|
60
60
|
--local-switch-offLabel-stroke: var(--zdt_v1_switch_offLabel_hover);
|
|
61
61
|
}
|
|
62
62
|
.trackWrapper {
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
right: var(--zd_size1) ;
|
|
97
97
|
}
|
|
98
98
|
.label {
|
|
99
|
+
max-width: 100% ;
|
|
99
100
|
cursor: var(--local-switch-cursor);
|
|
100
101
|
}
|
|
101
102
|
.onLabel {
|
|
@@ -6,9 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _default = {
|
|
8
8
|
size: 'medium',
|
|
9
|
-
isDefaultChecked: false,
|
|
10
|
-
isDisabled: false,
|
|
11
|
-
isReadOnly: false,
|
|
12
9
|
hasStateIndication: true,
|
|
13
10
|
labelPlacement: 'start',
|
|
14
11
|
labelSize: 'medium',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"postpublish": "node postPublish.js",
|
|
43
43
|
"report": "react-cli publish:report",
|
|
44
44
|
"test": "react-cli test",
|
|
45
|
-
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest",
|
|
45
|
+
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest react-cli clean ./es && react-cli clean ./lib && react-cli clean ./package-lock.json && react-cli clean ./result.json ",
|
|
46
46
|
"snap-update": "npm run test-clean && npm run test -- -u",
|
|
47
47
|
"sstest": "npm run init && react-cli sstest",
|
|
48
48
|
"build:external": "npm run clean && npm run init && npm run docsjs:build && npm run build:externalDocCopy && react-cli build:component:umd && npm run externalDocHTMLChange",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@zohodesk/docstool": "1.0.0-alpha-2",
|
|
73
73
|
"@zohodesk/dotkit": "1.0.2",
|
|
74
74
|
"@zohodesk/hooks": "2.0.5",
|
|
75
|
-
"@zohodesk/icons": "1.0.
|
|
75
|
+
"@zohodesk/icons": "1.0.79",
|
|
76
76
|
"@zohodesk/layout": "3.1.0",
|
|
77
77
|
"@zohodesk/svg": "1.1.22",
|
|
78
78
|
"@zohodesk/utils": "1.3.14",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"selectn": "1.1.2"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@zohodesk/icons": "1.0.
|
|
91
|
+
"@zohodesk/icons": "1.0.79",
|
|
92
92
|
"@zohodesk/variables": "1.0.0",
|
|
93
93
|
"@zohodesk/svg": "1.1.22",
|
|
94
94
|
"@zohodesk/virtualizer": "1.0.3",
|