@lemonadejs/switch 1.1.4 → 1.3.0
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 +36 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/react.d.ts +6 -3
- package/dist/style.css +9 -9
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -51,6 +51,41 @@ export default function App() {
|
|
|
51
51
|
}
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
```jsx
|
|
55
|
+
import React, { useRef } from "react";
|
|
56
|
+
import Switch from "@lemonadejs/switch/dist/react";
|
|
57
|
+
import '@lemonadejs/switch/dist/style.css';
|
|
58
|
+
|
|
59
|
+
export default function App() {
|
|
60
|
+
const switchRef = useRef();
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
<Switch text='On/Off' ref={switchRef} />
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Quick example with Lemonade
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<template>
|
|
73
|
+
<Switch text='On/Off' />
|
|
74
|
+
</template>
|
|
75
|
+
|
|
76
|
+
<script>
|
|
77
|
+
import Switch from '@lemonadejs/switch/dist/vue';
|
|
78
|
+
import '@lemonadejs/switch/dist/style.css';
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
name: 'App',
|
|
82
|
+
components: {
|
|
83
|
+
Switch,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
54
89
|
[You can find more examples here in the official documentation.](https://lemonadejs.net/components/switch)
|
|
55
90
|
|
|
56
91
|
#### Settings
|
|
@@ -69,5 +104,5 @@ The [LemonadeJS](https://lemonadejs.net) Switch is released under the MIT.
|
|
|
69
104
|
|
|
70
105
|
## Other Tools
|
|
71
106
|
|
|
72
|
-
- [jSuites](https://jsuites.net/
|
|
107
|
+
- [jSuites](https://jsuites.net/docs)
|
|
73
108
|
- [Jspreadsheet Data Grid](https://jspreadsheet.com)
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
7
7
|
typeof define === 'function' && define.amd ? define(factory) :
|
|
8
8
|
global.Switch = factory();
|
|
9
9
|
}(this, (function () {
|
|
10
|
+
|
|
10
11
|
const Switch = function () {
|
|
11
12
|
let self = this;
|
|
12
13
|
|
|
@@ -23,7 +24,10 @@ if (!lemonade && typeof (require) === 'function') {
|
|
|
23
24
|
</label>`
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
// Create LemonadeJS references
|
|
26
28
|
lemonade.setComponents({ Switch: Switch });
|
|
29
|
+
// Create web-component
|
|
30
|
+
lemonade.createWebComponent('switch', Switch);
|
|
27
31
|
|
|
28
32
|
return function (root, options) {
|
|
29
33
|
if (typeof (root) === 'object') {
|
package/dist/react.d.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Official Type definitions for the LemonadeJS plugins
|
|
3
|
-
* https://lemonadejs.net
|
|
3
|
+
* https://lemonadejs.net/docs/plugins/switch
|
|
4
4
|
* Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
5
5
|
*/
|
|
6
6
|
import Component from './index';
|
|
7
7
|
|
|
8
8
|
interface Switch {
|
|
9
|
+
ref?: MutableRefObject<undefined>;
|
|
9
10
|
(): any
|
|
10
11
|
[key: string]: any
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
type SwitchProps = IntrinsicAttributes & Component.Options & Switch;
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
declare function Switch<Switch>(props: SwitchProps): any;
|
|
17
|
+
|
|
18
|
+
export default Switch;
|
package/dist/style.css
CHANGED
|
@@ -63,15 +63,15 @@
|
|
|
63
63
|
|
|
64
64
|
.lm-switch > input:checked {
|
|
65
65
|
left: 6px;
|
|
66
|
-
background-color:
|
|
66
|
+
background-color: var(--lm-main-color, #2196f3);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.lm-switch > input:checked + span::before {
|
|
70
|
-
background-color:
|
|
70
|
+
background-color: var(--lm-main-color-alpha, #2196f388);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
.lm-switch > input:checked + span::after {
|
|
74
|
-
background-color:
|
|
74
|
+
background-color: var(--lm-main-color, #2196f3);
|
|
75
75
|
transform: translateX(16px);
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.lm-switch > input:active + span::before {
|
|
98
|
-
background-color:
|
|
98
|
+
background-color: var(--lm-main-color-alpha, #2196f388);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
.lm-switch > input:checked:active + span::before {
|
|
102
|
-
background-color: rgba(var(--lm-
|
|
102
|
+
background-color: rgba(var(--lm-front-color, 0,0,0), 0.38);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
.lm-switch > input:disabled {
|
|
@@ -107,17 +107,17 @@
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
.lm-switch > input:disabled + span {
|
|
110
|
-
color: rgb(var(--lm-
|
|
111
|
-
opacity: 0.
|
|
110
|
+
color: rgb(var(--lm-front-color,0,0,0));
|
|
111
|
+
opacity: 0.50;
|
|
112
112
|
cursor: default;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
.lm-switch > input:disabled + span::before {
|
|
116
|
-
background-color: rgba(var(--lm-
|
|
116
|
+
background-color: rgba(var(--lm-front-color,0,0,0), 0.38);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
.lm-switch > input:checked:disabled + span::before {
|
|
120
|
-
background-color:
|
|
120
|
+
background-color: var(--lm-main-color-alpha, #2196f388);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.lm-switch[position="right"] > span {
|