@operato/input 8.0.0-alpha.41 → 8.0.0-alpha.46
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 +18 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-input-switch.d.ts +10 -0
- package/dist/src/ox-input-switch.js +125 -0
- package/dist/src/ox-input-switch.js.map +1 -0
- package/dist/stories/ox-input-switch.stories.d.ts +38 -0
- package/dist/stories/ox-input-switch.stories.js +68 -0
- package/dist/stories/ox-input-switch.stories.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/src/index.ts +1 -0
- package/src/ox-input-switch.ts +117 -0
- package/stories/ox-input-switch.stories.ts +91 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,24 @@
|
|
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
|
+
## [8.0.0-alpha.46](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.45...v8.0.0-alpha.46) (2024-10-23)
|
7
|
+
|
8
|
+
|
9
|
+
### :bug: Bug Fix
|
10
|
+
|
11
|
+
* add switch into input module ([b2d1880](https://github.com/hatiolab/operato/commit/b2d1880d27f3d57b68c045f9b3d8ad9c0b82952d))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
## [8.0.0-alpha.45](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.44...v8.0.0-alpha.45) (2024-10-23)
|
16
|
+
|
17
|
+
|
18
|
+
### :bug: Bug Fix
|
19
|
+
|
20
|
+
* add switch into input module ([3eb9c84](https://github.com/hatiolab/operato/commit/3eb9c84e3de2e8b36522e230e785948171df2aba))
|
21
|
+
|
22
|
+
|
23
|
+
|
6
24
|
## [8.0.0-alpha.41](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.40...v8.0.0-alpha.41) (2024-10-21)
|
7
25
|
|
8
26
|
|
package/dist/src/index.d.ts
CHANGED
@@ -5,6 +5,7 @@ export * from './ox-form-field.js';
|
|
5
5
|
export * from './ox-buttons-radio.js';
|
6
6
|
export * from './ox-checkbox.js';
|
7
7
|
export * from './ox-select.js';
|
8
|
+
export * from './ox-input-switch.js';
|
8
9
|
export * from './ox-input-angle.js';
|
9
10
|
export * from './ox-input-3dish.js';
|
10
11
|
export * from './ox-input-3axis.js';
|
package/dist/src/index.js
CHANGED
@@ -5,6 +5,7 @@ export * from './ox-form-field.js';
|
|
5
5
|
export * from './ox-buttons-radio.js';
|
6
6
|
export * from './ox-checkbox.js';
|
7
7
|
export * from './ox-select.js';
|
8
|
+
export * from './ox-input-switch.js';
|
8
9
|
export * from './ox-input-angle.js';
|
9
10
|
export * from './ox-input-3dish.js';
|
10
11
|
export * from './ox-input-3axis.js';
|
package/dist/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-color-stops.js'\nexport * from './ox-input-color-gradient.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-table.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-signature.js'\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AACnC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kCAAkC,CAAA;AAChD,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mCAAmC,CAAA;AACjD,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA","sourcesContent":["/**\n * @license Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport * from './ox-form-field.js'\nexport * from './ox-buttons-radio.js'\nexport * from './ox-checkbox.js'\nexport * from './ox-select.js'\nexport * from './ox-input-switch.js'\nexport * from './ox-input-angle.js'\nexport * from './ox-input-3dish.js'\nexport * from './ox-input-3axis.js'\nexport * from './ox-input-stack.js'\nexport * from './ox-input-barcode.js'\nexport * from './ox-input-code.js'\nexport * from './ox-input-color.js'\nexport * from './ox-input-multiple-colors.js'\nexport * from './ox-input-color-stops.js'\nexport * from './ox-input-color-gradient.js'\nexport * from './ox-input-file.js'\nexport * from './ox-input-image.js'\nexport * from './ox-input-value-ranges.js'\nexport * from './ox-input-value-map.js'\nexport * from './ox-input-table.js'\nexport * from './ox-input-scene-component-id.js'\nexport * from './ox-input-crontab.js'\nexport * from './ox-input-partition-keys.js'\nexport * from './ox-input-duration.js'\nexport * from './ox-input-quantifier.js'\nexport * from './ox-input-select-buttons.js'\nexport * from './ox-input-textarea.js'\nexport * from './ox-input-direction.js'\nexport * from './ox-input-table-column-config.js'\nexport * from './ox-input-search.js'\nexport * from './ox-input-signature.js'\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { OxFormField } from './ox-form-field';
|
2
|
+
export declare class OxInputSwitch extends OxFormField {
|
3
|
+
static styles: import("lit").CSSResult;
|
4
|
+
round: boolean;
|
5
|
+
value: boolean;
|
6
|
+
disabled: boolean;
|
7
|
+
render(): import("lit-html").TemplateResult<1>;
|
8
|
+
firstUpdated(): void;
|
9
|
+
protected appendFormData({ formData }: FormDataEvent): void;
|
10
|
+
}
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
import { css, html } from 'lit';
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
4
|
+
import { OxFormField } from './ox-form-field';
|
5
|
+
let OxInputSwitch = class OxInputSwitch extends OxFormField {
|
6
|
+
constructor() {
|
7
|
+
super(...arguments);
|
8
|
+
this.round = false;
|
9
|
+
this.value = false;
|
10
|
+
this.disabled = false;
|
11
|
+
}
|
12
|
+
static { this.styles = css `
|
13
|
+
:host {
|
14
|
+
--ox-simple-switch-fullwidth: 2em;
|
15
|
+
--ox-simple-switch-fullheight: 1em;
|
16
|
+
--ox-simple-switch-thumbnail-size: 1em;
|
17
|
+
}
|
18
|
+
|
19
|
+
label {
|
20
|
+
position: relative;
|
21
|
+
display: inline-block;
|
22
|
+
width: 100%;
|
23
|
+
height: 100%;
|
24
|
+
}
|
25
|
+
|
26
|
+
label input {
|
27
|
+
opacity: 0;
|
28
|
+
width: 0;
|
29
|
+
height: 0;
|
30
|
+
}
|
31
|
+
|
32
|
+
span {
|
33
|
+
position: absolute;
|
34
|
+
cursor: pointer;
|
35
|
+
width: var(--ox-simple-switch-fullwidth);
|
36
|
+
height: var(--ox-simple-switch-fullheight);
|
37
|
+
top: calc(0 - var(--ox-simple-switch-thumbnail-size));
|
38
|
+
left: 0;
|
39
|
+
background-color: var(--ox-simple-switch-off-color, #ccc);
|
40
|
+
-webkit-transition: 0.4s;
|
41
|
+
transition: 0.4s;
|
42
|
+
}
|
43
|
+
|
44
|
+
span:before {
|
45
|
+
position: absolute;
|
46
|
+
content: '';
|
47
|
+
height: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
|
48
|
+
width: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
|
49
|
+
left: 4px;
|
50
|
+
top: 4px;
|
51
|
+
background-color: var(--ox-simple-switch-thumbnail-color, white);
|
52
|
+
-webkit-transition: 0.4s;
|
53
|
+
transition: 0.4s;
|
54
|
+
}
|
55
|
+
|
56
|
+
input:checked + span {
|
57
|
+
background-color: var(--ox-simple-switch-on-color, #2196f3);
|
58
|
+
}
|
59
|
+
|
60
|
+
input + span:before {
|
61
|
+
-webkit-transform: translateY(
|
62
|
+
calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
|
63
|
+
);
|
64
|
+
-ms-transform: translateY(
|
65
|
+
calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
|
66
|
+
);
|
67
|
+
transform: translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
68
|
+
}
|
69
|
+
|
70
|
+
input:checked + span:before {
|
71
|
+
-webkit-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
72
|
+
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
73
|
+
-ms-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
74
|
+
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
75
|
+
transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
76
|
+
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
77
|
+
}
|
78
|
+
|
79
|
+
/* Rounded sliders */
|
80
|
+
span[round] {
|
81
|
+
border-radius: calc(var(--ox-simple-switch-thumbnail-size) / 2);
|
82
|
+
}
|
83
|
+
|
84
|
+
span[round]:before {
|
85
|
+
border-radius: calc((var(--ox-simple-switch-thumbnail-size) - 8px) / 2);
|
86
|
+
}
|
87
|
+
`; }
|
88
|
+
render() {
|
89
|
+
return html `
|
90
|
+
<label>
|
91
|
+
<input type="checkbox" .checked=${this.value} ?disabled=${this.disabled} />
|
92
|
+
<span ?round=${this.round}></span>
|
93
|
+
</label>
|
94
|
+
`;
|
95
|
+
}
|
96
|
+
firstUpdated() {
|
97
|
+
this.renderRoot.addEventListener('change', (e) => {
|
98
|
+
e.preventDefault();
|
99
|
+
e.stopPropagation();
|
100
|
+
this.value = e.target?.checked;
|
101
|
+
this.dispatchEvent(new CustomEvent('change', {
|
102
|
+
bubbles: true,
|
103
|
+
composed: true,
|
104
|
+
detail: this.value
|
105
|
+
}));
|
106
|
+
});
|
107
|
+
}
|
108
|
+
appendFormData({ formData }) {
|
109
|
+
this.name && formData.append(this.name, this.value ? 'true' : 'false');
|
110
|
+
}
|
111
|
+
};
|
112
|
+
__decorate([
|
113
|
+
property({ type: Boolean })
|
114
|
+
], OxInputSwitch.prototype, "round", void 0);
|
115
|
+
__decorate([
|
116
|
+
property({ type: Boolean })
|
117
|
+
], OxInputSwitch.prototype, "value", void 0);
|
118
|
+
__decorate([
|
119
|
+
property({ type: Boolean })
|
120
|
+
], OxInputSwitch.prototype, "disabled", void 0);
|
121
|
+
OxInputSwitch = __decorate([
|
122
|
+
customElement('ox-input-switch')
|
123
|
+
], OxInputSwitch);
|
124
|
+
export { OxInputSwitch };
|
125
|
+
//# sourceMappingURL=ox-input-switch.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-switch.js","sourceRoot":"","sources":["../../src/ox-input-switch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGtC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,WAAW;IAAvC;;QA8EwB,UAAK,GAAY,KAAK,CAAA;QACtB,UAAK,GAAY,KAAK,CAAA;QACtB,aAAQ,GAAY,KAAK,CAAA;IA8BxD,CAAC;aA7GQ,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2ElB,AA3EY,CA2EZ;IAMD,MAAM;QACJ,OAAO,IAAI,CAAA;;0CAE2B,IAAI,CAAC,KAAK,cAAc,IAAI,CAAC,QAAQ;uBACxD,IAAI,CAAC,KAAK;;KAE5B,CAAA;IACH,CAAC;IAED,YAAY;QACV,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAQ,EAAE,EAAE;YACtD,CAAC,CAAC,cAAc,EAAE,CAAA;YAClB,CAAC,CAAC,eAAe,EAAE,CAAA;YAEnB,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA2B,EAAE,OAAO,CAAA;YACpD,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,QAAQ,EAAE;gBACxB,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;gBACd,MAAM,EAAE,IAAI,CAAC,KAAK;aACnB,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAES,cAAc,CAAC,EAAE,QAAQ,EAAiB;QAClD,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACxE,CAAC;;AA/B4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAuB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4CAAuB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;+CAA0B;AAhF3C,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA8GzB","sourcesContent":["import { css, html } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { OxFormField } from './ox-form-field'\n\n@customElement('ox-input-switch')\nexport class OxInputSwitch extends OxFormField {\n static styles = css`\n :host {\n --ox-simple-switch-fullwidth: 2em;\n --ox-simple-switch-fullheight: 1em;\n --ox-simple-switch-thumbnail-size: 1em;\n }\n\n label {\n position: relative;\n display: inline-block;\n width: 100%;\n height: 100%;\n }\n\n label input {\n opacity: 0;\n width: 0;\n height: 0;\n }\n\n span {\n position: absolute;\n cursor: pointer;\n width: var(--ox-simple-switch-fullwidth);\n height: var(--ox-simple-switch-fullheight);\n top: calc(0 - var(--ox-simple-switch-thumbnail-size));\n left: 0;\n background-color: var(--ox-simple-switch-off-color, #ccc);\n -webkit-transition: 0.4s;\n transition: 0.4s;\n }\n\n span:before {\n position: absolute;\n content: '';\n height: calc(var(--ox-simple-switch-thumbnail-size) - 8px);\n width: calc(var(--ox-simple-switch-thumbnail-size) - 8px);\n left: 4px;\n top: 4px;\n background-color: var(--ox-simple-switch-thumbnail-color, white);\n -webkit-transition: 0.4s;\n transition: 0.4s;\n }\n\n input:checked + span {\n background-color: var(--ox-simple-switch-on-color, #2196f3);\n }\n\n input + span:before {\n -webkit-transform: translateY(\n calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)\n );\n -ms-transform: translateY(\n calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)\n );\n transform: translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));\n }\n\n input:checked + span:before {\n -webkit-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))\n translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));\n -ms-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))\n translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));\n transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))\n translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));\n }\n\n /* Rounded sliders */\n span[round] {\n border-radius: calc(var(--ox-simple-switch-thumbnail-size) / 2);\n }\n\n span[round]:before {\n border-radius: calc((var(--ox-simple-switch-thumbnail-size) - 8px) / 2);\n }\n `\n\n @property({ type: Boolean }) round: boolean = false\n @property({ type: Boolean }) value: boolean = false\n @property({ type: Boolean }) disabled: boolean = false\n\n render() {\n return html`\n <label>\n <input type=\"checkbox\" .checked=${this.value} ?disabled=${this.disabled} />\n <span ?round=${this.round}></span>\n </label>\n `\n }\n\n firstUpdated() {\n this.renderRoot.addEventListener('change', (e: Event) => {\n e.preventDefault()\n e.stopPropagation()\n\n this.value = (e.target as HTMLInputElement)?.checked\n this.dispatchEvent(\n new CustomEvent('change', {\n bubbles: true,\n composed: true,\n detail: this.value\n })\n )\n })\n }\n\n protected appendFormData({ formData }: FormDataEvent): void {\n this.name && formData.append(this.name, this.value ? 'true' : 'false')\n }\n}\n"]}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import '@material/web/all.js';
|
2
|
+
import '../src/ox-input-switch.js';
|
3
|
+
import { TemplateResult } from 'lit';
|
4
|
+
declare const _default: {
|
5
|
+
title: string;
|
6
|
+
component: string;
|
7
|
+
argTypes: {
|
8
|
+
label: {
|
9
|
+
control: string;
|
10
|
+
};
|
11
|
+
name: {
|
12
|
+
control: string;
|
13
|
+
};
|
14
|
+
round: {
|
15
|
+
control: string;
|
16
|
+
};
|
17
|
+
value: {
|
18
|
+
control: string;
|
19
|
+
};
|
20
|
+
disabled: {
|
21
|
+
control: string;
|
22
|
+
};
|
23
|
+
};
|
24
|
+
};
|
25
|
+
export default _default;
|
26
|
+
interface Story<T> {
|
27
|
+
(args: T): TemplateResult;
|
28
|
+
args?: Partial<T>;
|
29
|
+
argTypes?: Record<string, unknown>;
|
30
|
+
}
|
31
|
+
interface ArgTypes {
|
32
|
+
label?: string;
|
33
|
+
name?: string;
|
34
|
+
round?: boolean;
|
35
|
+
value?: boolean;
|
36
|
+
disabled?: boolean;
|
37
|
+
}
|
38
|
+
export declare const Regular: Story<ArgTypes>;
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import '@material/web/all.js';
|
2
|
+
import '../src/ox-input-switch.js';
|
3
|
+
import { html } from 'lit';
|
4
|
+
import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles';
|
5
|
+
export default {
|
6
|
+
title: 'ox-input-switch',
|
7
|
+
component: 'ox-input-switch',
|
8
|
+
argTypes: {
|
9
|
+
label: { control: 'text' },
|
10
|
+
name: { control: 'text' },
|
11
|
+
round: { control: 'boolean' },
|
12
|
+
value: { control: 'boolean' },
|
13
|
+
disabled: { control: 'boolean' }
|
14
|
+
}
|
15
|
+
};
|
16
|
+
const Template = ({ label = 'Checkbox', name = 'hello', round = false, value = false, disabled }) => html `
|
17
|
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
|
18
|
+
|
19
|
+
<link href="/themes/light.css" rel="stylesheet" />
|
20
|
+
<link href="/themes/dark.css" rel="stylesheet" />
|
21
|
+
<link href="/themes/spacing.css" rel="stylesheet" />
|
22
|
+
|
23
|
+
<link
|
24
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
|
25
|
+
rel="stylesheet"
|
26
|
+
/>
|
27
|
+
<link
|
28
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
|
29
|
+
rel="stylesheet"
|
30
|
+
/>
|
31
|
+
<link
|
32
|
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
|
33
|
+
rel="stylesheet"
|
34
|
+
/>
|
35
|
+
|
36
|
+
<style>
|
37
|
+
${MDTypeScaleStyles.cssText}
|
38
|
+
</style>
|
39
|
+
|
40
|
+
<style>
|
41
|
+
.container {
|
42
|
+
height: 500px;
|
43
|
+
text-align: center;
|
44
|
+
padding: 20px;
|
45
|
+
background-color: var(--md-sys-color-primary-container);
|
46
|
+
color: var(--md-sys-color-on-primary-container);
|
47
|
+
padding: 20px;
|
48
|
+
}
|
49
|
+
|
50
|
+
ox-input-switch {
|
51
|
+
--ox-simple-switch-fullwidth: 120px;
|
52
|
+
--ox-simple-switch-fullheight: 40px;
|
53
|
+
--ox-simple-switch-thumbnail-size: 60px;
|
54
|
+
}
|
55
|
+
</style>
|
56
|
+
|
57
|
+
<div class="container md-typescale-body-large-prominent">
|
58
|
+
<ox-input-switch name=${name} .value=${value} .round=${round} ?disabled=${disabled}> </ox-input-switch>
|
59
|
+
</div>
|
60
|
+
`;
|
61
|
+
export const Regular = Template.bind({});
|
62
|
+
Regular.args = {
|
63
|
+
label: 'label',
|
64
|
+
name: 'label',
|
65
|
+
round: false,
|
66
|
+
value: false
|
67
|
+
};
|
68
|
+
//# sourceMappingURL=ox-input-switch.stories.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ox-input-switch.stories.js","sourceRoot":"","sources":["../../stories/ox-input-switch.stories.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,2BAA2B,CAAA;AAElC,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAE1F,eAAe;IACb,KAAK,EAAE,iBAAiB;IACxB,SAAS,EAAE,iBAAiB;IAC5B,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACzB,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAC7B,KAAK,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;QAC7B,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;KACjC;CACF,CAAA;AAgBD,MAAM,QAAQ,GAAoB,CAAC,EACjC,KAAK,GAAG,UAAU,EAClB,IAAI,GAAG,OAAO,EACd,KAAK,GAAG,KAAK,EACb,KAAK,GAAG,KAAK,EACb,QAAQ,EACC,EAAE,EAAE,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;MAqBd,iBAAiB,CAAC,OAAO;;;;;;;;;;;;;;;;;;;;;4BAqBH,IAAI,WAAW,KAAK,WAAW,KAAK,cAAc,QAAQ;;CAErF,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxC,OAAO,CAAC,IAAI,GAAG;IACb,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,KAAK;IACZ,KAAK,EAAE,KAAK;CACb,CAAA","sourcesContent":["import '@material/web/all.js'\nimport '../src/ox-input-switch.js'\n\nimport { TemplateResult, html } from 'lit'\nimport { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'\n\nexport default {\n title: 'ox-input-switch',\n component: 'ox-input-switch',\n argTypes: {\n label: { control: 'text' },\n name: { control: 'text' },\n round: { control: 'boolean' },\n value: { control: 'boolean' },\n disabled: { control: 'boolean' }\n }\n}\n\ninterface Story<T> {\n (args: T): TemplateResult\n args?: Partial<T>\n argTypes?: Record<string, unknown>\n}\n\ninterface ArgTypes {\n label?: string\n name?: string\n round?: boolean\n value?: boolean\n disabled?: boolean\n}\n\nconst Template: Story<ArgTypes> = ({\n label = 'Checkbox',\n name = 'hello',\n round = false,\n value = false,\n disabled\n}: ArgTypes) => html`\n <link href=\"https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap\" rel=\"stylesheet\" />\n\n <link href=\"/themes/light.css\" rel=\"stylesheet\" />\n <link href=\"/themes/dark.css\" rel=\"stylesheet\" />\n <link href=\"/themes/spacing.css\" rel=\"stylesheet\" />\n\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n <link\n href=\"https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1\"\n rel=\"stylesheet\"\n />\n\n <style>\n ${MDTypeScaleStyles.cssText}\n </style>\n\n <style>\n .container {\n height: 500px;\n text-align: center;\n padding: 20px;\n background-color: var(--md-sys-color-primary-container);\n color: var(--md-sys-color-on-primary-container);\n padding: 20px;\n }\n\n ox-input-switch {\n --ox-simple-switch-fullwidth: 120px;\n --ox-simple-switch-fullheight: 40px;\n --ox-simple-switch-thumbnail-size: 60px;\n }\n </style>\n\n <div class=\"container md-typescale-body-large-prominent\">\n <ox-input-switch name=${name} .value=${value} .round=${round} ?disabled=${disabled}> </ox-input-switch>\n </div>\n`\n\nexport const Regular = Template.bind({})\nRegular.args = {\n label: 'label',\n name: 'label',\n round: false,\n value: false\n}\n"]}
|