@lemonadejs/switch 1.0.2 → 1.1.1

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/dist/index.d.ts CHANGED
@@ -16,6 +16,10 @@ declare namespace Switch {
16
16
  name?: string;
17
17
  /** Determines whether the switch can be toggled or not */
18
18
  disabled?: boolean;
19
+ /** Text position. Default undefined */
20
+ position?: 'right' | undefined;
21
+ /** Onchange event */
22
+ onchange: (value: string) => void;
19
23
  }
20
24
 
21
25
  interface Instance {
package/dist/index.js CHANGED
@@ -10,8 +10,16 @@ if (!lemonade && typeof (require) === 'function') {
10
10
  const Switch = function () {
11
11
  let self = this;
12
12
 
13
+ const onchange = self.onchange;
14
+
15
+ self.onchange = function(prop) {
16
+ if (typeof(onchange) === 'function') {
17
+ onchange.call(self, self.value);
18
+ }
19
+ }
20
+
13
21
  return `<label class="lm-switch" position="{{self.position}}">
14
- <input type="checkbox" name="{{self.name}}" disabled="{{self.disabled}}" :bind="self.value"> <span>{{self.text}}</span>
22
+ <input type="checkbox" name="{{self.name}}" disabled="{{self.disabled}}" :bind="self.value" /> <span>{{self.text}}</span>
15
23
  </label>`
16
24
  }
17
25
 
package/dist/style.css CHANGED
@@ -1,6 +1,6 @@
1
1
  .lm-switch {
2
- position: relative;
3
- display: inline-flex;
2
+ position: relative !important;
3
+ display: inline-flex !important;
4
4
  z-index: 0;
5
5
  align-items: center;
6
6
  }
package/package.json CHANGED
@@ -13,8 +13,8 @@
13
13
  "switch js"
14
14
  ],
15
15
  "dependencies": {
16
- "lemonadejs": "^4.0.7"
16
+ "lemonadejs": "^4.1.0"
17
17
  },
18
18
  "main": "dist/index.js",
19
- "version": "1.0.2"
19
+ "version": "1.1.1"
20
20
  }