@occmundial/occ-atomic 3.0.0-beta.15 → 3.0.0-beta.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,76 +5,91 @@ exports[`SlideToggle matches the snapshot 1`] = `ShallowWrapper {}`;
5
5
  exports[`SlideToggle styles matches the snapshot 1`] = `
6
6
  Object {
7
7
  "checked": Object {
8
- "& $icon": Object {
9
- "background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJCQkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgoJCTxwYXRoIGZpbGw9IiMwMDZFRkYiIGQ9Ik0xOC4zLDcuM2wxLjQsMS40bC04LjcsOWMtMC40LDAuNC0xLDAuNC0xLjQsMC4xbC00LjMtMy42bDEuMy0xLjVsMy42LDNDMTAuMiwxNS42LDE4LjMsNy4zLDE4LjMsNy4zeiIvPgoJCTwvc3ZnPg==)",
10
- },
11
8
  "& $slider": Object {
12
- "left": 16,
9
+ "left": "calc(100% - 28px)",
10
+ },
11
+ "& $switchBg": Object {
12
+ "background": "#0059CD",
13
13
  },
14
- "background": "#0059CD",
15
14
  },
16
15
  "cont": Object {
17
- "&:focus $switch$checked": Object {
18
- "background": "#0059CD",
19
- "boxShadow": "0 0 0 8px rgba(0,110,255,0.3)",
16
+ "&:active $switch $switchBg": Object {
17
+ "boxShadow": "inset 0 0 0 2px rgba(255,255,255,0.2)",
20
18
  },
21
- "&:focus $switch:not($checked)": Object {
22
- "background": "#E9EEF8",
19
+ "&:focus-visible $switch": Object {
23
20
  "boxShadow": "0 0 0 8px hsl(221 91.2% 35.7% / 0.3)",
24
21
  },
25
- "&:hover $switch$checked, &:active $switch$checked": Object {
26
- "background": "#083CAE",
22
+ "&:focus-visible $switch$checked": Object {
23
+ "boxShadow": "0 0 0 8px rgba(0,110,255,0.3)",
27
24
  },
28
- "&:hover $switch:not($checked), &:active $switch:not($checked)": Object {
29
- "background": "#CAD5EE !important",
25
+ "&:hover $switch $switchBg, &:active $switch $switchBg": Object {
26
+ "background": "#CAD5EE",
27
+ },
28
+ "&:hover $switch$checked $switchBg, &:active $switch$checked $switchBg": Object {
29
+ "background": "#083CAE",
30
30
  },
31
- "alignItems": "start",
31
+ "alignItems": "flex-start",
32
32
  "boxSizing": "border-box",
33
33
  "cursor": "pointer",
34
34
  "display": "flex",
35
35
  "outline": 0,
36
- "paddingBottom": "8px",
37
- "paddingTop": "8px",
38
36
  },
39
37
  "disabled": Object {
40
- "& $icon": Object {
41
- "background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgogICAgICAgIAkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgogICAgICAgIDxwYXRoIGZpbGw9IiNEM0Q0REMiIGQ9Ik0xMi4xLDEwLjhsNC42LTQuNkwxOCw3LjRMMTMuNCwxMmw0LjYsNC42TDE2LjcsMThsLTQuNi00LjZMNy40LDE4bC0xLjMtMS4zbDQuNi00LjZMNi4yLDcuNGwxLjMtMS4zTDEyLjEsMTAuOHoiLz4KICAgICAgICA8L3N2Zz4=)",
42
- },
43
- "& $switch": Object {
38
+ "& $switch $switchBg": Object {
44
39
  "background": "#EDEDF1",
40
+ "boxShadow": "inset 0 0 0 1px #D3D4DC",
45
41
  },
46
42
  "pointerEvents": "none",
47
43
  },
48
44
  "icon": Object {
49
- "background": "url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgogICAgICAgIAkgdmlld0JveD0iMCAwIDI0IDI0IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAyNCAyNDsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgogICAgICAgIDxwYXRoIGZpbGw9IiM4REE1REEiIGQ9Ik0xMi4xLDEwLjhsNC42LTQuNkwxOCw3LjRMMTMuNCwxMmw0LjYsNC42TDE2LjcsMThsLTQuNi00LjZMNy40LDE4bC0xLjMtMS4zbDQuNi00LjZMNi4yLDcuNGwxLjMtMS4zTDEyLjEsMTAuOHoiLz4KICAgICAgICA8L3N2Zz4=)",
50
- "display": "block",
51
- "height": "100%",
52
- "transition": "0.3s all",
53
- "width": "100%",
45
+ "margin": 4,
54
46
  },
55
47
  "label": Object {
56
48
  "cursor": "pointer",
57
- "marginLeft": "8px",
49
+ "marginLeft": "12px",
50
+ },
51
+ "labelWrap": Object {
52
+ "alignItems": "center",
53
+ "display": "flex",
54
+ "minHeight": 48,
55
+ "overflow": "hidden",
56
+ "paddingBottom": "4px",
57
+ "paddingTop": "4px",
58
58
  },
59
59
  "slider": Object {
60
60
  "background": "#fff",
61
61
  "borderRadius": "50%",
62
- "height": 20,
63
- "left": 2,
62
+ "height": 24,
63
+ "left": 4,
64
64
  "position": "absolute",
65
- "top": 2,
66
- "transition": "0.3s all",
67
- "width": 20,
65
+ "top": "50%",
66
+ "transform": "translateY(-50%)",
67
+ "transition": "all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
68
+ "width": 24,
68
69
  },
69
70
  "switch": Object {
70
- "background": "#E9EEF8",
71
- "borderRadius": 34,
71
+ "borderRadius": "9999px",
72
72
  "display": "inline-block",
73
73
  "flexShrink": 0,
74
- "height": "24px",
74
+ "height": 32,
75
75
  "position": "relative",
76
- "transition": "0.3s all",
77
- "width": 38,
76
+ "transition": "all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
77
+ "width": 52,
78
+ },
79
+ "switchBg": Object {
80
+ "background": "#E9EEF8",
81
+ "borderRadius": "9999px",
82
+ "boxShadow": "inset 0 0 0 1px rgba(255,255,255,0.2)",
83
+ "height": 32,
84
+ "transition": "all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s",
85
+ "width": 52,
86
+ },
87
+ "switchWrap": Object {
88
+ "alignItems": "center",
89
+ "display": "flex",
90
+ "flexShrink": 0,
91
+ "height": 48,
92
+ "width": 52,
78
93
  },
79
94
  }
80
95
  `;
@@ -5,89 +5,108 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
 
8
- var _icons = _interopRequireDefault(require("../subatomic/icons"));
9
-
10
8
  var _spacing = _interopRequireDefault(require("../tokens/spacing.json"));
11
9
 
12
10
  var _colors = _interopRequireDefault(require("../tokens/colors.json"));
13
11
 
14
12
  var _shadows = _interopRequireDefault(require("../tokens/shadows.json"));
15
13
 
14
+ var _borderRadius = _interopRequireDefault(require("../tokens/borderRadius.json"));
15
+
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
17
 
18
- var toggle = _colors["default"]["switch"],
19
- icon = _colors["default"].icon;
18
+ var toggle = _colors["default"]["switch"];
19
+ var transition = 'all cubic-bezier(0.25,0.46,0.45,0.94) 0.2s';
20
+ var contentHeight = 48;
21
+ var toggleWidth = 52;
22
+ var toggleHeight = 32;
23
+ var sliderSize = 24;
20
24
  var _default = {
21
25
  cont: {
22
- paddingTop: _spacing["default"]['size-2'],
23
- paddingBottom: _spacing["default"]['size-2'],
24
26
  boxSizing: 'border-box',
25
27
  display: 'flex',
26
- alignItems: 'start',
28
+ alignItems: 'flex-start',
27
29
  cursor: 'pointer',
28
30
  outline: 0,
29
- '&:hover $switch$checked, &:active $switch$checked': {
30
- background: toggle['selected']['bg']['hover']
31
+ '&:hover $switch $switchBg, &:active $switch $switchBg': {
32
+ background: toggle.unselected.bg.hover
31
33
  },
32
- '&:focus $switch$checked': {
33
- boxShadow: _shadows["default"]['focus-bright-blue'],
34
- background: toggle['selected']['bg']['default']
34
+ '&:focus-visible $switch': {
35
+ boxShadow: _shadows["default"]['focus-indigo']
35
36
  },
36
- '&:hover $switch:not($checked), &:active $switch:not($checked)': {
37
- background: "".concat(toggle['unselected']['bg']['hover'], " !important")
37
+ '&:hover $switch$checked $switchBg, &:active $switch$checked $switchBg': {
38
+ background: toggle.selected.bg.hover
38
39
  },
39
- '&:focus $switch:not($checked)': {
40
- background: toggle['unselected']['bg']['default'],
41
- boxShadow: _shadows["default"]['focus-indigo']
40
+ '&:active $switch $switchBg': {
41
+ boxShadow: "inset 0 0 0 2px ".concat(_colors["default"]["switch"].border["default"])
42
+ },
43
+ '&:focus-visible $switch$checked': {
44
+ boxShadow: _shadows["default"]['focus-bright-blue']
42
45
  }
43
46
  },
47
+ switchWrap: {
48
+ width: toggleWidth,
49
+ height: contentHeight,
50
+ display: 'flex',
51
+ alignItems: 'center',
52
+ flexShrink: 0
53
+ },
44
54
  "switch": {
45
55
  position: 'relative',
46
56
  display: 'inline-block',
47
- width: 38,
57
+ width: toggleWidth,
58
+ height: toggleHeight,
48
59
  flexShrink: 0,
49
- height: _spacing["default"]['size-5'],
50
- background: toggle['unselected']['bg']['default'],
51
- borderRadius: 34,
52
- transition: '0.3s all'
60
+ borderRadius: _borderRadius["default"]['br-full'],
61
+ transition: transition
62
+ },
63
+ switchBg: {
64
+ width: toggleWidth,
65
+ height: toggleHeight,
66
+ background: toggle.unselected.bg["default"],
67
+ boxShadow: "inset 0 0 0 1px ".concat(_colors["default"]["switch"].border["default"]),
68
+ borderRadius: _borderRadius["default"]['br-full'],
69
+ transition: transition
53
70
  },
54
71
  checked: {
55
- background: toggle['selected']['bg']['default'],
56
- '& $slider': {
57
- left: 16
72
+ '& $switchBg': {
73
+ background: toggle.selected.bg["default"]
58
74
  },
59
- '& $icon': {
60
- background: _icons["default"].base(_icons["default"].check.icon([icon.brand.bold]))
75
+ '& $slider': {
76
+ left: "calc(100% - 28px)"
61
77
  }
62
78
  },
63
79
  slider: {
64
80
  position: 'absolute',
65
- top: 2,
66
- left: 2,
67
- width: 20,
68
- height: 20,
81
+ top: '50%',
82
+ transform: 'translateY(-50%)',
83
+ left: 4,
84
+ width: sliderSize,
85
+ height: sliderSize,
69
86
  borderRadius: '50%',
70
- background: toggle['bg']['default'],
71
- transition: '0.3s all'
87
+ background: toggle.bg["default"],
88
+ transition: transition
72
89
  },
73
90
  icon: {
74
- width: '100%',
75
- height: '100%',
76
- display: 'block',
77
- background: _icons["default"].base(_icons["default"].cross.icon([icon.brand.disabled])),
78
- transition: '0.3s all'
91
+ margin: 4
79
92
  },
80
93
  disabled: {
81
- '& $switch': {
82
- background: toggle['bg']['disabled']
83
- },
84
- '& $icon': {
85
- background: _icons["default"].base(_icons["default"].cross.icon([icon["default"].disabled]))
94
+ '& $switch $switchBg': {
95
+ boxShadow: "inset 0 0 0 1px ".concat(_colors["default"]["switch"].border.disabled),
96
+ background: toggle.bg.disabled
86
97
  },
87
98
  pointerEvents: 'none'
88
99
  },
100
+ labelWrap: {
101
+ minHeight: contentHeight,
102
+ display: 'flex',
103
+ alignItems: 'center',
104
+ paddingTop: _spacing["default"]['size-1'],
105
+ paddingBottom: _spacing["default"]['size-1'],
106
+ overflow: 'hidden'
107
+ },
89
108
  label: {
90
- marginLeft: _spacing["default"]['size-2'],
109
+ marginLeft: _spacing["default"]['size-3'],
91
110
  cursor: 'pointer'
92
111
  }
93
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occmundial/occ-atomic",
3
- "version": "3.0.0-beta.15",
3
+ "version": "3.0.0-beta.17",
4
4
  "description": "Collection of shareable styled React components for OCC applications.",
5
5
  "homepage": "http://occmundial.github.io/occ-atomic",
6
6
  "main": "build/index.js",