@limetech/lime-elements 35.0.0-next.7 → 35.0.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/dist/cjs/checkbox.template-b6c6562c.js +43 -0
- package/dist/cjs/{component-f7ef9087.js → component-66df95e7.js} +190 -132
- package/dist/cjs/{component-f532119f.js → component-67144c1c.js} +47 -3
- package/dist/cjs/{component-ed21410d.js → component-ae3bfacf.js} +367 -235
- package/dist/cjs/{component-2faaa141.js → component-cf490570.js} +213 -143
- package/dist/cjs/{component-10dbdd60.js → component-dd795ff0.js} +7 -5
- package/dist/cjs/{dateFormatter-26eac73a.js → dateFormatter-34b77ead.js} +37 -31
- package/dist/cjs/{index-e63a89d7.js → index-2a28697b.js} +27 -1
- package/dist/cjs/lime-elements.cjs.js +3 -3
- package/dist/cjs/limel-badge.cjs.entry.js +4 -4
- package/dist/cjs/limel-banner.cjs.entry.js +2 -2
- package/dist/cjs/limel-button-group.cjs.entry.js +3 -3
- package/dist/cjs/limel-button.cjs.entry.js +3 -3
- package/dist/cjs/limel-checkbox.cjs.entry.js +136 -90
- package/dist/cjs/limel-chip-set.cjs.entry.js +235 -191
- package/dist/cjs/limel-circular-progress.cjs.entry.js +3 -3
- package/dist/cjs/limel-code-editor.cjs.entry.js +50 -23
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +2 -2
- package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +3 -3
- package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/limel-config.cjs.entry.js +2 -2
- package/dist/cjs/limel-date-picker.cjs.entry.js +8 -8
- package/dist/cjs/limel-dialog.cjs.entry.js +9 -10
- package/dist/cjs/limel-file.cjs.entry.js +11 -9
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +971 -657
- package/dist/cjs/limel-flex-container.cjs.entry.js +6 -2
- package/dist/cjs/limel-form.cjs.entry.js +423 -449
- package/dist/cjs/limel-grid.cjs.entry.js +2 -2
- package/dist/cjs/limel-header.cjs.entry.js +2 -2
- package/dist/cjs/limel-icon-button.cjs.entry.js +6 -6
- package/dist/cjs/limel-icon.cjs.entry.js +2 -2
- package/dist/cjs/limel-input-field.cjs.entry.js +12 -10
- package/dist/cjs/limel-linear-progress.cjs.entry.js +4 -4
- package/dist/cjs/limel-list_3.cjs.entry.js +154 -91
- package/dist/cjs/limel-menu-list.cjs.entry.js +87 -74
- package/dist/cjs/limel-menu.cjs.entry.js +2 -2
- package/dist/cjs/limel-picker.cjs.entry.js +4 -7
- package/dist/cjs/limel-popover-surface.cjs.entry.js +3 -3
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +2 -2
- package/dist/cjs/limel-progress-flow.cjs.entry.js +2 -2
- package/dist/cjs/limel-select.cjs.entry.js +6 -6
- package/dist/cjs/limel-slider.cjs.entry.js +34 -7
- package/dist/cjs/limel-snackbar.cjs.entry.js +79 -73
- package/dist/cjs/limel-spinner.cjs.entry.js +2 -2
- package/dist/cjs/limel-switch.cjs.entry.js +498 -202
- package/dist/cjs/limel-tab-bar.cjs.entry.js +263 -186
- package/dist/cjs/limel-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/limel-table.cjs.entry.js +78 -17
- package/dist/cjs/limel-tooltip_2.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{moment-d287c0ed.js → moment-5c6581b7.js} +94 -79
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/badge/badge.css +9 -15
- package/dist/collection/components/badge/badge.js +2 -2
- package/dist/collection/components/button/button.css +333 -145
- package/dist/collection/components/button-group/button-group.css +30 -5
- package/dist/collection/components/checkbox/checkbox.css +70 -17
- package/dist/collection/components/checkbox/checkbox.js +5 -4
- package/dist/collection/components/checkbox/checkbox.template.js +24 -20
- package/dist/collection/components/chip-set/chip-set.css +367 -34
- package/dist/collection/components/circular-progress/circular-progress.css +2 -2
- package/dist/collection/components/code-editor/code-editor.css +8 -13
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.css +1 -1
- package/dist/collection/components/dialog/dialog.css +153 -109
- package/dist/collection/components/dialog/dialog.js +7 -0
- package/dist/collection/components/file/icon-background-colors.js +2 -1
- package/dist/collection/components/file/icon-fill-colors.js +2 -1
- package/dist/collection/components/file/icons.js +1 -1
- package/dist/collection/components/flex-container/flex-container.js +10 -0
- package/dist/collection/components/form/fields/schema-field.js +0 -1
- package/dist/collection/components/form/form.css +5 -1
- package/dist/collection/components/form/form.js +34 -0
- package/dist/collection/components/form/form.types.js +0 -1
- package/dist/collection/components/form/templates/common.js +4 -1
- package/dist/collection/components/icon-button/icon-button.css +116 -59
- package/dist/collection/components/icon-button/icon-button.js +1 -0
- package/dist/collection/components/input-field/input-field.css +344 -29
- package/dist/collection/components/input-field/input-field.js +5 -3
- package/dist/collection/components/linear-progress/linear-progress.css +14 -2
- package/dist/collection/components/list/list-renderer.js +1 -4
- package/dist/collection/components/list/list.css +937 -90
- package/dist/collection/components/list/list.js +13 -6
- package/dist/collection/components/menu-list/menu-list-renderer.js +1 -4
- package/dist/collection/components/menu-list/menu-list.css +937 -90
- package/dist/collection/components/menu-surface/menu-surface.css +31 -7
- package/dist/collection/components/picker/picker.js +4 -6
- package/dist/collection/components/popover-surface/popover-surface.css +1 -0
- package/dist/collection/components/select/select.css +424 -17
- package/dist/collection/components/select/select.template.js +1 -1
- package/dist/collection/components/slider/slider.css +49 -2
- package/dist/collection/components/snackbar/snackbar.css +588 -301
- package/dist/collection/components/switch/switch.css +592 -222
- package/dist/collection/components/switch/switch.js +18 -12
- package/dist/collection/components/tab-bar/tab-bar.css +77 -48
- package/dist/collection/components/table/table.css +219 -165
- package/dist/collection/components/table/table.js +104 -19
- package/dist/collection/components/table/table.types.js +0 -1
- package/dist/collection/style/functions.scss +3 -1
- package/dist/collection/style/internal/lime-theme.scss +30 -31
- package/dist/collection/style/internal/lime-typography.scss +55 -56
- package/dist/esm/checkbox.template-2f1bbc98.js +41 -0
- package/dist/esm/{component-89e0ce26.js → component-19eb6e2b.js} +7 -5
- package/dist/esm/{component-2630c3d7.js → component-288691f3.js} +367 -235
- package/dist/esm/{component-d682c974.js → component-410aad5a.js} +44 -4
- package/dist/esm/{component-429e92ee.js → component-5b4ac85a.js} +213 -143
- package/dist/esm/{component-834d85a1.js → component-fffa3419.js} +190 -132
- package/dist/esm/{dateFormatter-c9b41548.js → dateFormatter-ed618478.js} +37 -31
- package/dist/esm/{index-2316f345.js → index-11cd0b60.js} +27 -1
- package/dist/esm/lime-elements.js +3 -3
- package/dist/esm/limel-badge.entry.js +4 -4
- package/dist/esm/limel-banner.entry.js +2 -2
- package/dist/esm/limel-button-group.entry.js +3 -3
- package/dist/esm/limel-button.entry.js +3 -3
- package/dist/esm/limel-checkbox.entry.js +136 -90
- package/dist/esm/limel-chip-set.entry.js +235 -191
- package/dist/esm/limel-circular-progress.entry.js +3 -3
- package/dist/esm/limel-code-editor.entry.js +50 -23
- package/dist/esm/limel-collapsible-section.entry.js +2 -2
- package/dist/esm/limel-color-picker-palette_2.entry.js +3 -3
- package/dist/esm/limel-color-picker.entry.js +2 -2
- package/dist/esm/limel-config.entry.js +2 -2
- package/dist/esm/limel-date-picker.entry.js +8 -8
- package/dist/esm/limel-dialog.entry.js +9 -10
- package/dist/esm/limel-file.entry.js +11 -9
- package/dist/esm/limel-flatpickr-adapter.entry.js +971 -657
- package/dist/esm/limel-flex-container.entry.js +6 -2
- package/dist/esm/limel-form.entry.js +424 -450
- package/dist/esm/limel-grid.entry.js +2 -2
- package/dist/esm/limel-header.entry.js +2 -2
- package/dist/esm/limel-icon-button.entry.js +6 -6
- package/dist/esm/limel-icon.entry.js +2 -2
- package/dist/esm/limel-input-field.entry.js +12 -10
- package/dist/esm/limel-linear-progress.entry.js +4 -4
- package/dist/esm/limel-list_3.entry.js +154 -91
- package/dist/esm/limel-menu-list.entry.js +87 -74
- package/dist/esm/limel-menu.entry.js +2 -2
- package/dist/esm/limel-picker.entry.js +4 -7
- package/dist/esm/limel-popover-surface.entry.js +3 -3
- package/dist/esm/limel-progress-flow-item.entry.js +2 -2
- package/dist/esm/limel-progress-flow.entry.js +2 -2
- package/dist/esm/limel-select.entry.js +6 -6
- package/dist/esm/limel-slider.entry.js +34 -7
- package/dist/esm/limel-snackbar.entry.js +79 -73
- package/dist/esm/limel-spinner.entry.js +2 -2
- package/dist/esm/limel-switch.entry.js +498 -202
- package/dist/esm/limel-tab-bar.entry.js +263 -186
- package/dist/esm/limel-tab-panel.entry.js +2 -2
- package/dist/esm/limel-table.entry.js +78 -17
- package/dist/esm/limel-tooltip_2.entry.js +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{moment-8dadd938.js → moment-29c213b7.js} +94 -79
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-04b5bc13.entry.js +82 -0
- package/dist/lime-elements/p-101af376.entry.js +1 -0
- package/dist/lime-elements/p-1c284626.js +73 -0
- package/dist/lime-elements/p-1ede893b.js +1 -0
- package/dist/lime-elements/p-2639edf9.entry.js +73 -0
- package/dist/lime-elements/p-2da6e2a3.entry.js +1 -0
- package/dist/lime-elements/p-2ff40ce6.js +3 -0
- package/dist/lime-elements/{p-cd619c16.entry.js → p-358706b6.entry.js} +1 -1
- package/dist/lime-elements/p-36ecbd03.entry.js +1 -0
- package/dist/lime-elements/p-404e1465.entry.js +1 -0
- package/dist/lime-elements/p-42b67933.entry.js +1 -0
- package/dist/lime-elements/p-440454ed.entry.js +1 -0
- package/dist/lime-elements/{p-076bd4dc.js → p-48d4ef20.js} +3 -3
- package/dist/lime-elements/p-53e01330.entry.js +1 -0
- package/dist/lime-elements/p-5908c21d.entry.js +1 -0
- package/dist/lime-elements/p-5b7a8c61.entry.js +20 -0
- package/dist/lime-elements/p-63e25a0a.entry.js +1 -0
- package/dist/lime-elements/p-6e7809a6.entry.js +1 -0
- package/dist/lime-elements/p-705334c1.entry.js +1 -0
- package/dist/lime-elements/p-716a6acd.entry.js +16 -0
- package/dist/lime-elements/p-71efe2ca.entry.js +37 -0
- package/dist/lime-elements/{p-e1928c0e.js → p-72e03943.js} +1 -1
- package/dist/lime-elements/p-80327bb8.entry.js +16 -0
- package/dist/lime-elements/p-83ea517b.entry.js +1 -0
- package/dist/lime-elements/p-87a1e1cb.entry.js +1 -0
- package/dist/lime-elements/{p-8ad5e143.entry.js → p-94899019.entry.js} +1 -1
- package/dist/lime-elements/p-95f275ab.entry.js +1 -0
- package/dist/lime-elements/p-96f4b892.entry.js +131 -0
- package/dist/lime-elements/p-97d6c4a6.entry.js +1 -0
- package/dist/lime-elements/p-a465084b.entry.js +82 -0
- package/dist/lime-elements/p-a5af84a7.entry.js +1 -0
- package/dist/lime-elements/p-b91dc1ef.entry.js +1 -0
- package/dist/lime-elements/p-bd8c9384.entry.js +1 -0
- package/dist/lime-elements/p-c4b38454.entry.js +1 -0
- package/dist/lime-elements/p-c7953a05.entry.js +82 -0
- package/dist/lime-elements/p-c80acfb2.entry.js +59 -0
- package/dist/lime-elements/p-cbc43682.js +81 -0
- package/dist/lime-elements/{p-ace9affc.js → p-d0a7de87.js} +2 -2
- package/dist/lime-elements/p-d1ee4501.entry.js +37 -0
- package/dist/lime-elements/p-d74fa89e.entry.js +1 -0
- package/dist/lime-elements/p-da962c64.entry.js +1 -0
- package/dist/lime-elements/p-dfba92de.js +126 -0
- package/dist/lime-elements/p-dfbe015e.entry.js +1 -0
- package/dist/lime-elements/p-e83dddcd.entry.js +126 -0
- package/dist/lime-elements/p-e98d76e8.entry.js +59 -0
- package/dist/lime-elements/{p-92146da6.js → p-e9a95b8f.js} +1 -1
- package/dist/lime-elements/p-eae8c615.entry.js +1 -0
- package/dist/lime-elements/p-ed65468d.entry.js +1 -0
- package/dist/lime-elements/p-f0c9dadd.entry.js +1 -0
- package/dist/lime-elements/style/functions.scss +3 -1
- package/dist/lime-elements/style/internal/lime-theme.scss +30 -31
- package/dist/lime-elements/style/internal/lime-typography.scss +55 -56
- package/dist/types/components/badge/badge.d.ts +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +3 -2
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/dialog/dialog.d.ts +7 -0
- package/dist/types/components/flex-container/flex-container.d.ts +7 -0
- package/dist/types/components/form/fields/array-field.d.ts +0 -1
- package/dist/types/components/form/fields/object-field.d.ts +2 -2
- package/dist/types/components/form/form.d.ts +8 -1
- package/dist/types/components/form/form.types.d.ts +6 -0
- package/dist/types/components/picker/picker.d.ts +2 -1
- package/dist/types/components/switch/switch.d.ts +2 -2
- package/dist/types/components/table/table.d.ts +10 -1
- package/dist/types/components/table/table.types.d.ts +13 -0
- package/dist/types/components.d.ts +20 -4
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +30 -43
- package/dist/cjs/checkbox.template-50eb8b76.js +0 -39
- package/dist/esm/checkbox.template-50f7c07b.js +0 -37
- package/dist/lime-elements/p-041ae00c.entry.js +0 -1
- package/dist/lime-elements/p-0ce9165f.entry.js +0 -1
- package/dist/lime-elements/p-0fd208f3.entry.js +0 -82
- package/dist/lime-elements/p-143705b1.entry.js +0 -1
- package/dist/lime-elements/p-1876a96a.entry.js +0 -1
- package/dist/lime-elements/p-1fb5340d.entry.js +0 -1
- package/dist/lime-elements/p-250f55be.js +0 -1
- package/dist/lime-elements/p-29f054cc.entry.js +0 -37
- package/dist/lime-elements/p-31fecf5d.entry.js +0 -1
- package/dist/lime-elements/p-34c7872e.entry.js +0 -1
- package/dist/lime-elements/p-468e940e.entry.js +0 -16
- package/dist/lime-elements/p-4932c029.entry.js +0 -1
- package/dist/lime-elements/p-4b5af81b.entry.js +0 -1
- package/dist/lime-elements/p-510bb5a4.entry.js +0 -1
- package/dist/lime-elements/p-58cbe99d.entry.js +0 -1
- package/dist/lime-elements/p-597cbe05.entry.js +0 -1
- package/dist/lime-elements/p-6003f817.entry.js +0 -1
- package/dist/lime-elements/p-668795a7.js +0 -73
- package/dist/lime-elements/p-714fde78.entry.js +0 -1
- package/dist/lime-elements/p-7476efe0.entry.js +0 -1
- package/dist/lime-elements/p-8707d77b.entry.js +0 -73
- package/dist/lime-elements/p-8a2c1038.entry.js +0 -16
- package/dist/lime-elements/p-902347b9.js +0 -81
- package/dist/lime-elements/p-90c6fa15.js +0 -126
- package/dist/lime-elements/p-90f3e17c.entry.js +0 -37
- package/dist/lime-elements/p-98d50f52.entry.js +0 -1
- package/dist/lime-elements/p-a2cf74c1.entry.js +0 -1
- package/dist/lime-elements/p-a397bab7.js +0 -3
- package/dist/lime-elements/p-a4c532a7.entry.js +0 -1
- package/dist/lime-elements/p-a93f4190.entry.js +0 -82
- package/dist/lime-elements/p-be56ffab.entry.js +0 -1
- package/dist/lime-elements/p-c35874db.entry.js +0 -1
- package/dist/lime-elements/p-c8c8a946.entry.js +0 -59
- package/dist/lime-elements/p-ca664c9f.entry.js +0 -1
- package/dist/lime-elements/p-d2c74396.entry.js +0 -1
- package/dist/lime-elements/p-d48ad9f7.entry.js +0 -126
- package/dist/lime-elements/p-d93a3b07.entry.js +0 -16
- package/dist/lime-elements/p-df8faeb4.entry.js +0 -59
- package/dist/lime-elements/p-dfe0a58b.entry.js +0 -1
- package/dist/lime-elements/p-e275f502.entry.js +0 -37
- package/dist/lime-elements/p-e881e98d.entry.js +0 -1
- package/dist/lime-elements/p-f2c706b8.entry.js +0 -131
- package/dist/lime-elements/p-fc30b8e3.entry.js +0 -1
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-2a28697b.js');
|
|
6
6
|
const randomString = require('./random-string-4c3b7f1c.js');
|
|
7
|
-
const component = require('./component-
|
|
8
|
-
const component$1 = require('./component-
|
|
9
|
-
|
|
7
|
+
const component = require('./component-67144c1c.js');
|
|
8
|
+
const component$1 = require('./component-cf490570.js');
|
|
9
|
+
require('./ponyfill-98ca4766.js');
|
|
10
10
|
|
|
11
11
|
/*! *****************************************************************************
|
|
12
12
|
Copyright (c) Microsoft Corporation.
|
|
@@ -48,38 +48,237 @@ var __assign = function() {
|
|
|
48
48
|
return t;
|
|
49
49
|
};
|
|
50
50
|
return __assign.apply(this, arguments);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright 2021 Google Inc.
|
|
56
|
+
*
|
|
57
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
58
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
59
|
+
* in the Software without restriction, including without limitation the rights
|
|
60
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
61
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
62
|
+
* furnished to do so, subject to the following conditions:
|
|
63
|
+
*
|
|
64
|
+
* The above copyright notice and this permission notice shall be included in
|
|
65
|
+
* all copies or substantial portions of the Software.
|
|
66
|
+
*
|
|
67
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
68
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
69
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
70
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
71
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
72
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
73
|
+
* THE SOFTWARE.
|
|
74
|
+
*/
|
|
75
|
+
/**
|
|
76
|
+
* CSS classes used for switch.
|
|
77
|
+
*/
|
|
78
|
+
var CssClasses;
|
|
79
|
+
(function (CssClasses) {
|
|
80
|
+
CssClasses["PROCESSING"] = "mdc-switch--processing";
|
|
81
|
+
CssClasses["SELECTED"] = "mdc-switch--selected";
|
|
82
|
+
CssClasses["UNSELECTED"] = "mdc-switch--unselected";
|
|
83
|
+
})(CssClasses || (CssClasses = {}));
|
|
84
|
+
/**
|
|
85
|
+
* Query selectors used for switch.
|
|
86
|
+
*/
|
|
87
|
+
var Selectors;
|
|
88
|
+
(function (Selectors) {
|
|
89
|
+
Selectors["RIPPLE"] = ".mdc-switch__ripple";
|
|
90
|
+
})(Selectors || (Selectors = {}));
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @license
|
|
94
|
+
* Copyright 2021 Google Inc.
|
|
95
|
+
*
|
|
96
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
97
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
98
|
+
* in the Software without restriction, including without limitation the rights
|
|
99
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
100
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
101
|
+
* furnished to do so, subject to the following conditions:
|
|
102
|
+
*
|
|
103
|
+
* The above copyright notice and this permission notice shall be included in
|
|
104
|
+
* all copies or substantial portions of the Software.
|
|
105
|
+
*
|
|
106
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
107
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
108
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
109
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
110
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
111
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
112
|
+
* THE SOFTWARE.
|
|
113
|
+
*/
|
|
114
|
+
/**
|
|
115
|
+
* Observe a target's property for changes. When a property changes, the
|
|
116
|
+
* provided `Observer` function will be invoked with the properties current and
|
|
117
|
+
* previous values.
|
|
118
|
+
*
|
|
119
|
+
* The returned cleanup function will stop listening to changes for the
|
|
120
|
+
* provided `Observer`.
|
|
121
|
+
*
|
|
122
|
+
* @template T The observed target type.
|
|
123
|
+
* @template K The observed property.
|
|
124
|
+
* @param target - The target to observe.
|
|
125
|
+
* @param property - The property of the target to observe.
|
|
126
|
+
* @param observer - An observer function to invoke each time the property
|
|
127
|
+
* changes.
|
|
128
|
+
* @return A cleanup function that will stop observing changes for the provided
|
|
129
|
+
* `Observer`.
|
|
130
|
+
*/
|
|
131
|
+
function observeProperty(target, property, observer) {
|
|
132
|
+
var targetObservers = installObserver(target, property);
|
|
133
|
+
var observers = targetObservers.getObservers(property);
|
|
134
|
+
observers.push(observer);
|
|
135
|
+
return function () {
|
|
136
|
+
observers.splice(observers.indexOf(observer), 1);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A Map of all `TargetObservers` that have been installed.
|
|
141
|
+
*/
|
|
142
|
+
var allTargetObservers = new WeakMap();
|
|
143
|
+
/**
|
|
144
|
+
* Installs a `TargetObservers` for the provided target (if not already
|
|
145
|
+
* installed), and replaces the given property with a getter and setter that
|
|
146
|
+
* will respond to changes and call `TargetObservers`.
|
|
147
|
+
*
|
|
148
|
+
* Subsequent calls to `installObserver()` with the same target and property
|
|
149
|
+
* will not override the property's previously installed getter/setter.
|
|
150
|
+
*
|
|
151
|
+
* @template T The observed target type.
|
|
152
|
+
* @template K The observed property to create a getter/setter for.
|
|
153
|
+
* @param target - The target to observe.
|
|
154
|
+
* @param property - The property to create a getter/setter for, if needed.
|
|
155
|
+
* @return The installed `TargetObservers` for the provided target.
|
|
156
|
+
*/
|
|
157
|
+
function installObserver(target, property) {
|
|
158
|
+
var observersMap = new Map();
|
|
159
|
+
if (!allTargetObservers.has(target)) {
|
|
160
|
+
allTargetObservers.set(target, {
|
|
161
|
+
isEnabled: true,
|
|
162
|
+
getObservers: function (key) {
|
|
163
|
+
var observers = observersMap.get(key) || [];
|
|
164
|
+
if (!observersMap.has(key)) {
|
|
165
|
+
observersMap.set(key, observers);
|
|
166
|
+
}
|
|
167
|
+
return observers;
|
|
168
|
+
},
|
|
169
|
+
installedProperties: new Set()
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
var targetObservers = allTargetObservers.get(target);
|
|
173
|
+
if (targetObservers.installedProperties.has(property)) {
|
|
174
|
+
// The getter/setter has already been replaced for this property
|
|
175
|
+
return targetObservers;
|
|
176
|
+
}
|
|
177
|
+
// Retrieve (or create if it's a plain property) the original descriptor from
|
|
178
|
+
// the target...
|
|
179
|
+
var descriptor = getDescriptor(target, property) || {
|
|
180
|
+
configurable: true,
|
|
181
|
+
enumerable: true,
|
|
182
|
+
value: target[property],
|
|
183
|
+
writable: true
|
|
184
|
+
};
|
|
185
|
+
// ...and create a copy that will be used for the observer.
|
|
186
|
+
var observedDescriptor = component.__assign({}, descriptor);
|
|
187
|
+
var descGet = descriptor.get, descSet = descriptor.set;
|
|
188
|
+
if ('value' in descriptor) {
|
|
189
|
+
// The descriptor is a simple value (not a getter/setter).
|
|
190
|
+
// For our observer descriptor that we copied, delete the value/writable
|
|
191
|
+
// properties, since they are incompatible with the get/set properties
|
|
192
|
+
// for descriptors.
|
|
193
|
+
delete observedDescriptor.value;
|
|
194
|
+
delete observedDescriptor.writable;
|
|
195
|
+
// Set up a simple getter...
|
|
196
|
+
var value_1 = descriptor.value;
|
|
197
|
+
descGet = function () { return value_1; };
|
|
198
|
+
// ...and setter (if the original property was writable).
|
|
199
|
+
if (descriptor.writable) {
|
|
200
|
+
descSet = function (newValue) {
|
|
201
|
+
value_1 = newValue;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (descGet) {
|
|
206
|
+
observedDescriptor.get = function () {
|
|
207
|
+
// `this as T` needed for closure conformance
|
|
208
|
+
return descGet.call(this);
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (descSet) {
|
|
212
|
+
observedDescriptor.set = function (newValue) {
|
|
213
|
+
var e_4, _a;
|
|
214
|
+
// `thus as T` needed for closure conformance
|
|
215
|
+
var previous = descGet ? descGet.call(this) : newValue;
|
|
216
|
+
descSet.call(this, newValue);
|
|
217
|
+
if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {
|
|
218
|
+
try {
|
|
219
|
+
for (var _b = component.__values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
220
|
+
var observer = _c.value;
|
|
221
|
+
observer(newValue, previous);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
225
|
+
finally {
|
|
226
|
+
try {
|
|
227
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
228
|
+
}
|
|
229
|
+
finally { if (e_4) throw e_4.error; }
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
targetObservers.installedProperties.add(property);
|
|
235
|
+
Object.defineProperty(target, property, observedDescriptor);
|
|
236
|
+
return targetObservers;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Retrieves the descriptor for a property from the provided target. This
|
|
240
|
+
* function will walk up the target's prototype chain to search for the
|
|
241
|
+
* descriptor.
|
|
242
|
+
*
|
|
243
|
+
* @template T The target type.
|
|
244
|
+
* @template K The property type.
|
|
245
|
+
* @param target - The target to retrieve a descriptor from.
|
|
246
|
+
* @param property - The name of the property to retrieve a descriptor for.
|
|
247
|
+
* @return the descriptor, or undefined if it does not exist. Keep in mind that
|
|
248
|
+
* plain properties may not have a descriptor defined.
|
|
249
|
+
*/
|
|
250
|
+
function getDescriptor(target, property) {
|
|
251
|
+
var descriptorTarget = target;
|
|
252
|
+
var descriptor;
|
|
253
|
+
while (descriptorTarget) {
|
|
254
|
+
descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);
|
|
255
|
+
if (descriptor) {
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
// Walk up the instance's prototype chain in case the property is declared
|
|
259
|
+
// on a superclass.
|
|
260
|
+
descriptorTarget = Object.getPrototypeOf(descriptorTarget);
|
|
261
|
+
}
|
|
262
|
+
return descriptor;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Enables or disables all observers for a provided target. Changes to observed
|
|
266
|
+
* properties will not call any observers when disabled.
|
|
267
|
+
*
|
|
268
|
+
* @template T The observed target type.
|
|
269
|
+
* @param target - The target to enable or disable observers for.
|
|
270
|
+
* @param enabled - True to enable or false to disable observers.
|
|
271
|
+
*/
|
|
272
|
+
function setObserversEnabled(target, enabled) {
|
|
273
|
+
var targetObservers = allTargetObservers.get(target);
|
|
274
|
+
if (targetObservers) {
|
|
275
|
+
targetObservers.isEnabled = enabled;
|
|
276
|
+
}
|
|
78
277
|
}
|
|
79
278
|
|
|
80
279
|
/**
|
|
81
280
|
* @license
|
|
82
|
-
* Copyright
|
|
281
|
+
* Copyright 2021 Google Inc.
|
|
83
282
|
*
|
|
84
283
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
85
284
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -99,26 +298,124 @@ function __spreadArray(to, from, pack) {
|
|
|
99
298
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
100
299
|
* THE SOFTWARE.
|
|
101
300
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
301
|
+
var MDCObserverFoundation = /** @class */ (function (_super) {
|
|
302
|
+
component.__extends(MDCObserverFoundation, _super);
|
|
303
|
+
function MDCObserverFoundation(adapter) {
|
|
304
|
+
var _this = _super.call(this, adapter) || this;
|
|
305
|
+
/** A set of cleanup functions to unobserve changes. */
|
|
306
|
+
_this.unobserves = new Set();
|
|
307
|
+
return _this;
|
|
308
|
+
}
|
|
309
|
+
MDCObserverFoundation.prototype.destroy = function () {
|
|
310
|
+
_super.prototype.destroy.call(this);
|
|
311
|
+
this.unobserve();
|
|
312
|
+
};
|
|
313
|
+
/**
|
|
314
|
+
* Observe a target's properties for changes using the provided map of
|
|
315
|
+
* property names and observer functions.
|
|
316
|
+
*
|
|
317
|
+
* @template T The target type.
|
|
318
|
+
* @param target - The target to observe.
|
|
319
|
+
* @param observers - An object whose keys are target properties and values
|
|
320
|
+
* are observer functions that are called when the associated property
|
|
321
|
+
* changes.
|
|
322
|
+
* @return A cleanup function that can be called to unobserve the
|
|
323
|
+
* target.
|
|
324
|
+
*/
|
|
325
|
+
MDCObserverFoundation.prototype.observe = function (target, observers) {
|
|
326
|
+
var e_1, _a;
|
|
327
|
+
var _this = this;
|
|
328
|
+
var cleanup = [];
|
|
329
|
+
try {
|
|
330
|
+
for (var _b = component.__values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
331
|
+
var property = _c.value;
|
|
332
|
+
var observer = observers[property].bind(this);
|
|
333
|
+
cleanup.push(this.observeProperty(target, property, observer));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
337
|
+
finally {
|
|
338
|
+
try {
|
|
339
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
340
|
+
}
|
|
341
|
+
finally { if (e_1) throw e_1.error; }
|
|
342
|
+
}
|
|
343
|
+
var unobserve = function () {
|
|
344
|
+
var e_2, _a;
|
|
345
|
+
try {
|
|
346
|
+
for (var cleanup_1 = component.__values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
|
347
|
+
var cleanupFn = cleanup_1_1.value;
|
|
348
|
+
cleanupFn();
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
352
|
+
finally {
|
|
353
|
+
try {
|
|
354
|
+
if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
|
355
|
+
}
|
|
356
|
+
finally { if (e_2) throw e_2.error; }
|
|
357
|
+
}
|
|
358
|
+
_this.unobserves.delete(unobserve);
|
|
359
|
+
};
|
|
360
|
+
this.unobserves.add(unobserve);
|
|
361
|
+
return unobserve;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Observe a target's property for changes. When a property changes, the
|
|
365
|
+
* provided `Observer` function will be invoked with the properties current
|
|
366
|
+
* and previous values.
|
|
367
|
+
*
|
|
368
|
+
* The returned cleanup function will stop listening to changes for the
|
|
369
|
+
* provided `Observer`.
|
|
370
|
+
*
|
|
371
|
+
* @template T The observed target type.
|
|
372
|
+
* @template K The observed property.
|
|
373
|
+
* @param target - The target to observe.
|
|
374
|
+
* @param property - The property of the target to observe.
|
|
375
|
+
* @param observer - An observer function to invoke each time the property
|
|
376
|
+
* changes.
|
|
377
|
+
* @return A cleanup function that will stop observing changes for the
|
|
378
|
+
* provided `Observer`.
|
|
379
|
+
*/
|
|
380
|
+
MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {
|
|
381
|
+
return observeProperty(target, property, observer);
|
|
382
|
+
};
|
|
383
|
+
/**
|
|
384
|
+
* Enables or disables all observers for the provided target. Disabling
|
|
385
|
+
* observers will prevent them from being called until they are re-enabled.
|
|
386
|
+
*
|
|
387
|
+
* @param target - The target to enable or disable observers for.
|
|
388
|
+
* @param enabled - Whether or not observers should be called.
|
|
389
|
+
*/
|
|
390
|
+
MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {
|
|
391
|
+
setObserversEnabled(target, enabled);
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* Clean up all observers and stop listening for property changes.
|
|
395
|
+
*/
|
|
396
|
+
MDCObserverFoundation.prototype.unobserve = function () {
|
|
397
|
+
var e_3, _a;
|
|
398
|
+
try {
|
|
399
|
+
// Iterate over a copy since unobserve() will remove themselves from the set
|
|
400
|
+
for (var _b = component.__values(component.__spreadArray([], component.__read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
401
|
+
var unobserve = _c.value;
|
|
402
|
+
unobserve();
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
406
|
+
finally {
|
|
407
|
+
try {
|
|
408
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
409
|
+
}
|
|
410
|
+
finally { if (e_3) throw e_3.error; }
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
return MDCObserverFoundation;
|
|
414
|
+
}(component.MDCFoundation));
|
|
118
415
|
|
|
119
416
|
/**
|
|
120
417
|
* @license
|
|
121
|
-
* Copyright
|
|
418
|
+
* Copyright 2021 Google Inc.
|
|
122
419
|
*
|
|
123
420
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
124
421
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -138,81 +435,116 @@ var strings = {
|
|
|
138
435
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
139
436
|
* THE SOFTWARE.
|
|
140
437
|
*/
|
|
438
|
+
/**
|
|
439
|
+
* `MDCSwitchFoundation` provides a state-only foundation for a switch
|
|
440
|
+
* component.
|
|
441
|
+
*
|
|
442
|
+
* State observers and event handler entrypoints update a component's adapter's
|
|
443
|
+
* state with the logic needed for switch to function.
|
|
444
|
+
*/
|
|
141
445
|
var MDCSwitchFoundation = /** @class */ (function (_super) {
|
|
142
446
|
__extends(MDCSwitchFoundation, _super);
|
|
143
447
|
function MDCSwitchFoundation(adapter) {
|
|
144
|
-
|
|
448
|
+
var _this = _super.call(this, adapter) || this;
|
|
449
|
+
_this.handleClick = _this.handleClick.bind(_this);
|
|
450
|
+
return _this;
|
|
145
451
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
|
|
155
|
-
/** The CSS classes used by the switch. */
|
|
156
|
-
get: function () {
|
|
157
|
-
return cssClasses;
|
|
158
|
-
},
|
|
159
|
-
enumerable: false,
|
|
160
|
-
configurable: true
|
|
161
|
-
});
|
|
162
|
-
Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
|
|
163
|
-
/** The default Adapter for the switch. */
|
|
164
|
-
get: function () {
|
|
165
|
-
return {
|
|
166
|
-
addClass: function () { return undefined; },
|
|
167
|
-
removeClass: function () { return undefined; },
|
|
168
|
-
setNativeControlChecked: function () { return undefined; },
|
|
169
|
-
setNativeControlDisabled: function () { return undefined; },
|
|
170
|
-
setNativeControlAttr: function () { return undefined; },
|
|
171
|
-
};
|
|
172
|
-
},
|
|
173
|
-
enumerable: false,
|
|
174
|
-
configurable: true
|
|
175
|
-
});
|
|
176
|
-
/** Sets the checked state of the switch. */
|
|
177
|
-
MDCSwitchFoundation.prototype.setChecked = function (checked) {
|
|
178
|
-
this.adapter.setNativeControlChecked(checked);
|
|
179
|
-
this.updateAriaChecked_(checked);
|
|
180
|
-
this.updateCheckedStyling_(checked);
|
|
452
|
+
/**
|
|
453
|
+
* Initializes the foundation and starts observing state changes.
|
|
454
|
+
*/
|
|
455
|
+
MDCSwitchFoundation.prototype.init = function () {
|
|
456
|
+
this.observe(this.adapter.state, {
|
|
457
|
+
disabled: this.stopProcessingIfDisabled,
|
|
458
|
+
processing: this.stopProcessingIfDisabled,
|
|
459
|
+
});
|
|
181
460
|
};
|
|
182
|
-
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
461
|
+
/**
|
|
462
|
+
* Event handler for switch click events. Clicking on a switch will toggle its
|
|
463
|
+
* selected state.
|
|
464
|
+
*/
|
|
465
|
+
MDCSwitchFoundation.prototype.handleClick = function () {
|
|
466
|
+
if (this.adapter.state.disabled) {
|
|
467
|
+
return;
|
|
187
468
|
}
|
|
188
|
-
|
|
189
|
-
|
|
469
|
+
this.adapter.state.selected = !this.adapter.state.selected;
|
|
470
|
+
};
|
|
471
|
+
MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {
|
|
472
|
+
if (this.adapter.state.disabled) {
|
|
473
|
+
this.adapter.state.processing = false;
|
|
190
474
|
}
|
|
191
475
|
};
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
476
|
+
return MDCSwitchFoundation;
|
|
477
|
+
}(MDCObserverFoundation));
|
|
478
|
+
/**
|
|
479
|
+
* `MDCSwitchRenderFoundation` provides a state and rendering foundation for a
|
|
480
|
+
* switch component.
|
|
481
|
+
*
|
|
482
|
+
* State observers and event handler entrypoints update a component's
|
|
483
|
+
* adapter's state with the logic needed for switch to function.
|
|
484
|
+
*
|
|
485
|
+
* In response to state changes, the rendering foundation uses the component's
|
|
486
|
+
* render adapter to keep the component's DOM updated with the state.
|
|
487
|
+
*/
|
|
488
|
+
var MDCSwitchRenderFoundation = /** @class */ (function (_super) {
|
|
489
|
+
__extends(MDCSwitchRenderFoundation, _super);
|
|
490
|
+
function MDCSwitchRenderFoundation() {
|
|
491
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Initializes the foundation and starts observing state changes.
|
|
495
|
+
*/
|
|
496
|
+
MDCSwitchRenderFoundation.prototype.init = function () {
|
|
497
|
+
_super.prototype.init.call(this);
|
|
498
|
+
this.observe(this.adapter.state, {
|
|
499
|
+
disabled: this.onDisabledChange,
|
|
500
|
+
processing: this.onProcessingChange,
|
|
501
|
+
selected: this.onSelectedChange,
|
|
502
|
+
});
|
|
503
|
+
};
|
|
504
|
+
/**
|
|
505
|
+
* Initializes the foundation from a server side rendered (SSR) component.
|
|
506
|
+
* This will sync the adapter's state with the current state of the DOM.
|
|
507
|
+
*
|
|
508
|
+
* This method should be called after `init()`.
|
|
509
|
+
*/
|
|
510
|
+
MDCSwitchRenderFoundation.prototype.initFromDOM = function () {
|
|
511
|
+
// Turn off observers while setting state
|
|
512
|
+
this.setObserversEnabled(this.adapter.state, false);
|
|
513
|
+
this.adapter.state.selected = this.adapter.hasClass(CssClasses.SELECTED);
|
|
514
|
+
// Ensure aria-checked is set if attribute is not present
|
|
515
|
+
this.onSelectedChange();
|
|
516
|
+
this.adapter.state.disabled = this.adapter.isDisabled();
|
|
517
|
+
this.adapter.state.processing =
|
|
518
|
+
this.adapter.hasClass(CssClasses.PROCESSING);
|
|
519
|
+
// Re-observe state
|
|
520
|
+
this.setObserversEnabled(this.adapter.state, true);
|
|
521
|
+
this.stopProcessingIfDisabled();
|
|
522
|
+
};
|
|
523
|
+
MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {
|
|
524
|
+
this.adapter.setDisabled(this.adapter.state.disabled);
|
|
525
|
+
};
|
|
526
|
+
MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {
|
|
527
|
+
this.toggleClass(this.adapter.state.processing, CssClasses.PROCESSING);
|
|
197
528
|
};
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
529
|
+
MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {
|
|
530
|
+
this.adapter.setAriaChecked(String(this.adapter.state.selected));
|
|
531
|
+
this.toggleClass(this.adapter.state.selected, CssClasses.SELECTED);
|
|
532
|
+
this.toggleClass(!this.adapter.state.selected, CssClasses.UNSELECTED);
|
|
533
|
+
};
|
|
534
|
+
MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {
|
|
535
|
+
if (addClass) {
|
|
536
|
+
this.adapter.addClass(className);
|
|
202
537
|
}
|
|
203
538
|
else {
|
|
204
|
-
this.adapter.removeClass(
|
|
539
|
+
this.adapter.removeClass(className);
|
|
205
540
|
}
|
|
206
541
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
};
|
|
210
|
-
return MDCSwitchFoundation;
|
|
211
|
-
}(component.MDCFoundation));
|
|
542
|
+
return MDCSwitchRenderFoundation;
|
|
543
|
+
}(MDCSwitchFoundation));
|
|
212
544
|
|
|
213
545
|
/**
|
|
214
546
|
* @license
|
|
215
|
-
* Copyright
|
|
547
|
+
* Copyright 2021 Google Inc.
|
|
216
548
|
*
|
|
217
549
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
218
550
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -232,112 +564,77 @@ var MDCSwitchFoundation = /** @class */ (function (_super) {
|
|
|
232
564
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
233
565
|
* THE SOFTWARE.
|
|
234
566
|
*/
|
|
567
|
+
/**
|
|
568
|
+
* `MDCSwitch` provides a component implementation of a Material Design switch.
|
|
569
|
+
*/
|
|
235
570
|
var MDCSwitch = /** @class */ (function (_super) {
|
|
236
571
|
__extends(MDCSwitch, _super);
|
|
237
|
-
function MDCSwitch() {
|
|
238
|
-
var _this = _super
|
|
239
|
-
_this.
|
|
572
|
+
function MDCSwitch(root, foundation) {
|
|
573
|
+
var _this = _super.call(this, root, foundation) || this;
|
|
574
|
+
_this.root = root;
|
|
240
575
|
return _this;
|
|
241
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Creates a new `MDCSwitch` and attaches it to the given root element.
|
|
579
|
+
* @param root The root to attach to.
|
|
580
|
+
* @return the new component instance.
|
|
581
|
+
*/
|
|
242
582
|
MDCSwitch.attachTo = function (root) {
|
|
243
583
|
return new MDCSwitch(root);
|
|
244
584
|
};
|
|
245
|
-
MDCSwitch.prototype.
|
|
246
|
-
|
|
247
|
-
this.ripple_.destroy();
|
|
248
|
-
this.nativeControl_.removeEventListener('change', this.changeHandler_);
|
|
585
|
+
MDCSwitch.prototype.initialize = function () {
|
|
586
|
+
this.ripple = new component$1.MDCRipple(this.root, this.createRippleFoundation());
|
|
249
587
|
};
|
|
250
588
|
MDCSwitch.prototype.initialSyncWithDOM = function () {
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
// Do an initial sync between the native control and the foundation.
|
|
264
|
-
this.checked = this.checked;
|
|
589
|
+
var rippleElement = this.root.querySelector(Selectors.RIPPLE);
|
|
590
|
+
if (!rippleElement) {
|
|
591
|
+
throw new Error("Switch " + Selectors.RIPPLE + " element is required.");
|
|
592
|
+
}
|
|
593
|
+
this.rippleElement = rippleElement;
|
|
594
|
+
this.root.addEventListener('click', this.foundation.handleClick);
|
|
595
|
+
this.foundation.initFromDOM();
|
|
596
|
+
};
|
|
597
|
+
MDCSwitch.prototype.destroy = function () {
|
|
598
|
+
_super.prototype.destroy.call(this);
|
|
599
|
+
this.ripple.destroy();
|
|
600
|
+
this.root.removeEventListener('click', this.foundation.handleClick);
|
|
265
601
|
};
|
|
266
602
|
MDCSwitch.prototype.getDefaultFoundation = function () {
|
|
603
|
+
return new MDCSwitchRenderFoundation(this.createAdapter());
|
|
604
|
+
};
|
|
605
|
+
MDCSwitch.prototype.createAdapter = function () {
|
|
267
606
|
var _this = this;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
addClass: function (className) { return _this.root.classList.add(className); },
|
|
272
|
-
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
273
|
-
setNativeControlChecked: function (checked) { return _this.nativeControl_.checked =
|
|
274
|
-
checked; },
|
|
275
|
-
setNativeControlDisabled: function (disabled) { return _this.nativeControl_.disabled =
|
|
276
|
-
disabled; },
|
|
277
|
-
setNativeControlAttr: function (attr, value) {
|
|
278
|
-
return _this.nativeControl_.setAttribute(attr, value);
|
|
607
|
+
return {
|
|
608
|
+
addClass: function (className) {
|
|
609
|
+
_this.root.classList.add(className);
|
|
279
610
|
},
|
|
611
|
+
hasClass: function (className) { return _this.root.classList.contains(className); },
|
|
612
|
+
isDisabled: function () { return _this.root.disabled; },
|
|
613
|
+
removeClass: function (className) {
|
|
614
|
+
_this.root.classList.remove(className);
|
|
615
|
+
},
|
|
616
|
+
setAriaChecked: function (ariaChecked) {
|
|
617
|
+
return _this.root.setAttribute('aria-checked', ariaChecked);
|
|
618
|
+
},
|
|
619
|
+
setDisabled: function (disabled) {
|
|
620
|
+
_this.root.disabled = disabled;
|
|
621
|
+
},
|
|
622
|
+
state: this,
|
|
280
623
|
};
|
|
281
|
-
return new MDCSwitchFoundation(adapter);
|
|
282
624
|
};
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
enumerable: false,
|
|
288
|
-
configurable: true
|
|
289
|
-
});
|
|
290
|
-
Object.defineProperty(MDCSwitch.prototype, "checked", {
|
|
291
|
-
get: function () {
|
|
292
|
-
return this.nativeControl_.checked;
|
|
293
|
-
},
|
|
294
|
-
set: function (checked) {
|
|
295
|
-
this.foundation.setChecked(checked);
|
|
296
|
-
},
|
|
297
|
-
enumerable: false,
|
|
298
|
-
configurable: true
|
|
299
|
-
});
|
|
300
|
-
Object.defineProperty(MDCSwitch.prototype, "disabled", {
|
|
301
|
-
get: function () {
|
|
302
|
-
return this.nativeControl_.disabled;
|
|
303
|
-
},
|
|
304
|
-
set: function (disabled) {
|
|
305
|
-
this.foundation.setDisabled(disabled);
|
|
306
|
-
},
|
|
307
|
-
enumerable: false,
|
|
308
|
-
configurable: true
|
|
309
|
-
});
|
|
310
|
-
MDCSwitch.prototype.createRipple_ = function () {
|
|
625
|
+
MDCSwitch.prototype.createRippleFoundation = function () {
|
|
626
|
+
return new component$1.MDCRippleFoundation(this.createRippleAdapter());
|
|
627
|
+
};
|
|
628
|
+
MDCSwitch.prototype.createRippleAdapter = function () {
|
|
311
629
|
var _this = this;
|
|
312
|
-
|
|
313
|
-
var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR);
|
|
314
|
-
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
315
|
-
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
316
|
-
var adapter = __assign(__assign({}, component$1.MDCRipple.createAdapter(this)), { addClass: function (className) { return rippleSurface.classList.add(className); }, computeBoundingRect: function () { return rippleSurface.getBoundingClientRect(); }, deregisterInteractionHandler: function (evtType, handler) {
|
|
317
|
-
_this.nativeControl_.removeEventListener(evtType, handler, component$1.applyPassive());
|
|
318
|
-
}, isSurfaceActive: function () { return ponyfill.matches(_this.nativeControl_, ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) {
|
|
319
|
-
_this.nativeControl_.addEventListener(evtType, handler, component$1.applyPassive());
|
|
320
|
-
}, removeClass: function (className) {
|
|
321
|
-
rippleSurface.classList.remove(className);
|
|
322
|
-
}, updateCssVariable: function (varName, value) {
|
|
323
|
-
rippleSurface.style.setProperty(varName, value);
|
|
324
|
-
} });
|
|
325
|
-
return new component$1.MDCRipple(this.root, new component$1.MDCRippleFoundation(adapter));
|
|
630
|
+
return __assign(__assign({}, component$1.MDCRipple.createAdapter(this)), { computeBoundingRect: function () { return _this.rippleElement.getBoundingClientRect(); }, isUnbounded: function () { return true; } });
|
|
326
631
|
};
|
|
327
|
-
Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
|
|
328
|
-
get: function () {
|
|
329
|
-
var NATIVE_CONTROL_SELECTOR = MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
|
|
330
|
-
return this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
|
331
|
-
},
|
|
332
|
-
enumerable: false,
|
|
333
|
-
configurable: true
|
|
334
|
-
});
|
|
335
632
|
return MDCSwitch;
|
|
336
633
|
}(component.MDCComponent));
|
|
337
634
|
|
|
338
|
-
const switchCss = ":host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n var(--lime-text-primary-on-background-color)\n )}.mdc-switch__thumb-underlay{left:-14px;right:initial;top:-17px;width:48px;height:48px}[dir=rtl] .mdc-switch__thumb-underlay,.mdc-switch__thumb-underlay[dir=rtl]{left:initial;right:-14px}.mdc-switch__native-control{width:64px;height:48px}.mdc-switch{display:inline-block;position:relative;outline:none;user-select:none}.mdc-switch.mdc-switch--checked .mdc-switch__track{background-color:#575756;background-color:var(--mdc-theme-secondary, #575756)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb{background-color:#575756;background-color:var(--mdc-theme-secondary, #575756);border-color:#575756;border-color:var(--mdc-theme-secondary, #575756)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__track{background-color:#000;background-color:var(--mdc-theme-on-surface, #000)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb{background-color:#fff;background-color:var(--mdc-theme-surface, #fff);border-color:#fff;border-color:var(--mdc-theme-surface, #fff)}.mdc-switch__native-control{left:0;right:initial;position:absolute;top:0;margin:0;opacity:0;cursor:pointer;pointer-events:auto;transition:transform 90ms cubic-bezier(0.4, 0, 0.2, 1)}[dir=rtl] .mdc-switch__native-control,.mdc-switch__native-control[dir=rtl]{left:initial;right:0}.mdc-switch__track{box-sizing:border-box;width:36px;height:14px;border:1px solid transparent;border-radius:7px;opacity:0.38;transition:opacity 90ms cubic-bezier(0.4, 0, 0.2, 1), background-color 90ms cubic-bezier(0.4, 0, 0.2, 1), border-color 90ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-switch__thumb-underlay{display:flex;position:absolute;align-items:center;justify-content:center;transform:translateX(0);transition:transform 90ms cubic-bezier(0.4, 0, 0.2, 1), background-color 90ms cubic-bezier(0.4, 0, 0.2, 1), border-color 90ms cubic-bezier(0.4, 0, 0.2, 1)}.mdc-switch__thumb{box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-sizing:border-box;width:20px;height:20px;border:10px solid;border-radius:50%;pointer-events:none;z-index:1}.mdc-switch--checked .mdc-switch__track{opacity:0.54}.mdc-switch--checked .mdc-switch__thumb-underlay{transform:translateX(16px)}[dir=rtl] .mdc-switch--checked .mdc-switch__thumb-underlay,.mdc-switch--checked .mdc-switch__thumb-underlay[dir=rtl]{transform:translateX(-16px)}.mdc-switch--checked .mdc-switch__native-control{transform:translateX(-16px)}[dir=rtl] .mdc-switch--checked .mdc-switch__native-control,.mdc-switch--checked .mdc-switch__native-control[dir=rtl]{transform:translateX(16px)}.mdc-switch--disabled{opacity:0.38;pointer-events:none}.mdc-switch--disabled .mdc-switch__thumb{border-width:1px}.mdc-switch--disabled .mdc-switch__native-control{cursor:default;pointer-events:none}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay::before,.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay::after{background-color:#9e9e9e;background-color:var(--mdc-ripple-color, #9e9e9e)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay:hover::before,.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay.mdc-ripple-surface--hover::before{opacity:0.08;opacity:var(--mdc-ripple-hover-opacity, 0.08)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay.mdc-ripple-upgraded--background-focused::before,.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb-underlay.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-switch__thumb-underlay{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity}.mdc-switch__thumb-underlay::before,.mdc-switch__thumb-underlay::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-switch__thumb-underlay::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-switch__thumb-underlay::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-switch__thumb-underlay.mdc-ripple-upgraded::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-switch__thumb-underlay.mdc-ripple-upgraded::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-switch__thumb-underlay.mdc-ripple-upgraded--unbounded::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-switch__thumb-underlay.mdc-ripple-upgraded--foreground-activation::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-switch__thumb-underlay.mdc-ripple-upgraded--foreground-deactivation::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-switch__thumb-underlay::before,.mdc-switch__thumb-underlay::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-switch__thumb-underlay.mdc-ripple-upgraded::before,.mdc-switch__thumb-underlay.mdc-ripple-upgraded::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-switch__thumb-underlay.mdc-ripple-upgraded::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-switch__thumb-underlay::before,.mdc-switch__thumb-underlay::after{background-color:#575756;background-color:var(--mdc-ripple-color, var(--mdc-theme-secondary, #575756))}.mdc-switch__thumb-underlay:hover::before,.mdc-switch__thumb-underlay.mdc-ripple-surface--hover::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-switch__thumb-underlay.mdc-ripple-upgraded--background-focused::before,.mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-switch__thumb-underlay.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}:host{display:inline-flex;align-items:center}.mdc-switch{margin-right:0.5rem}.mdc-switch.mdc-switch--checked .mdc-switch__track{background-color:#26a69a;background-color:var(--mdc-theme-primary, #26a69a)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb{background-color:#26a69a;background-color:var(--mdc-theme-primary, #26a69a);border-color:#26a69a;border-color:var(--mdc-theme-primary, #26a69a)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay::before,.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay::after{background-color:#26a69a;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #26a69a))}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay:hover::before,.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay.mdc-ripple-surface--hover::before{opacity:0.08;opacity:var(--mdc-ripple-hover-opacity, 0.08)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay.mdc-ripple-upgraded--background-focused::before,.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):focus::before{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-focus-opacity, 0.24)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded)::after{transition:opacity 150ms linear}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay:not(.mdc-ripple-upgraded):active::after{transition-duration:75ms;opacity:0.24;opacity:var(--mdc-ripple-press-opacity, 0.24)}.mdc-switch.mdc-switch--checked .mdc-switch__thumb-underlay.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.24)}label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.8125rem;font-size:var(--mdc-typography-body2-font-size, 0.8125rem);line-height:1.625rem;line-height:var(--mdc-typography-body2-line-height, 1.625rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);cursor:pointer}label.disabled{cursor:not-allowed;pointer-events:none;opacity:0.4}.mdc-switch.lime-switch--readonly{opacity:1}.mdc-switch.lime-switch--readonly .mdc-switch__track{opacity:1;border:none}.mdc-switch.lime-switch--readonly .mdc-switch__thumb{background-color:transparent !important;border:none;box-shadow:none}.mdc-switch.lime-switch--readonly .mdc-switch__thumb:after{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;opacity:0.8;background-repeat:no-repeat;background-position:center;background-size:0.5rem}.mdc-switch.lime-switch--readonly.mdc-switch--checked .mdc-switch__track{background-color:var(--mdc-theme-primary)}.mdc-switch.lime-switch--readonly.mdc-switch--checked .mdc-switch__thumb:after{background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path fill='none' stroke='rgb(255,255,255)' stroke-width='7' stroke-miterlimit='10' d='M29 7L11 25l-8-8'/></svg>\")}.mdc-switch.lime-switch--readonly:not(.mdc-switch--checked) .mdc-switch__track{background-color:rgb(var(--color-red-default))}.mdc-switch.lime-switch--readonly:not(.mdc-switch--checked) .mdc-switch__thumb:after{background-image:url(\"data:image/svg+xml; utf8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path fill='none' stroke='rgb(255,255,255)' stroke-width='7' stroke-miterlimit='10' d='M8 8l16 16M24 8L8 24'/></svg>\")}.mdc-switch.lime-switch--readonly+label.disabled{cursor:default;opacity:1}";
|
|
635
|
+
const switchCss = ":host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n var(--lime-text-primary-on-background-color)\n )}.mdc-elevation-overlay{position:absolute;border-radius:inherit;pointer-events:none;opacity:0;opacity:var(--mdc-elevation-overlay-opacity, 0);transition:opacity 280ms cubic-bezier(0.4, 0, 0.2, 1);background-color:#fff;background-color:var(--mdc-elevation-overlay-color, #fff)}.mdc-switch{align-items:center;background:none;border:none;cursor:pointer;display:inline-flex;flex-shrink:0;margin:0;outline:none;overflow:visible;padding:0;position:relative}.mdc-switch:disabled{cursor:default;pointer-events:none}.mdc-switch__track{overflow:hidden;position:relative;width:100%}.mdc-switch__track::before,.mdc-switch__track::after{border:1px solid transparent;border-radius:inherit;box-sizing:border-box;content:\"\";height:100%;left:0;position:absolute;width:100%}.mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);transform:translateX(0)}.mdc-switch__track::after{transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);transform:translateX(-100%)}[dir=rtl] .mdc-switch__track::after,.mdc-switch__track[dir=rtl]::after{transform:translateX(100%);}.mdc-switch--selected .mdc-switch__track::before{transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.6, 1);transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch__track::before,.mdc-switch--selected .mdc-switch__track[dir=rtl]::before{transform:translateX(-100%);}.mdc-switch--selected .mdc-switch__track::after{transition:transform 75ms 0ms cubic-bezier(0, 0, 0.2, 1);transform:translateX(0)}.mdc-switch__handle-track{height:100%;pointer-events:none;position:absolute;top:0;transition:transform 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);left:0;right:auto;transform:translateX(0)}[dir=rtl] .mdc-switch__handle-track,.mdc-switch__handle-track[dir=rtl]{left:auto;right:0;}.mdc-switch--selected .mdc-switch__handle-track{transform:translateX(100%)}[dir=rtl] .mdc-switch--selected .mdc-switch__handle-track,.mdc-switch--selected .mdc-switch__handle-track[dir=rtl]{transform:translateX(-100%);}.mdc-switch__handle{display:flex;pointer-events:auto;position:absolute;top:50%;transform:translateY(-50%);left:0;right:auto}[dir=rtl] .mdc-switch__handle,.mdc-switch__handle[dir=rtl]{left:auto;right:0;}.mdc-switch__handle::before,.mdc-switch__handle::after{border:1px solid transparent;border-radius:inherit;box-sizing:border-box;content:\"\";width:100%;height:100%;left:0;position:absolute;top:0;transition:background-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1), border-color 75ms 0ms cubic-bezier(0.4, 0, 0.2, 1);z-index:-1}.mdc-switch__shadow{border-radius:inherit;bottom:0;left:0;position:absolute;right:0;top:0}.mdc-elevation-overlay{bottom:0;left:0;right:0;top:0}.mdc-switch__ripple{left:50%;position:absolute;top:50%;transform:translate(-50%, -50%);z-index:-1}.mdc-switch:disabled .mdc-switch__ripple{display:none}.mdc-switch__icons{height:100%;position:relative;width:100%;z-index:1}.mdc-switch__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0;opacity:0;transition:opacity 30ms 0ms cubic-bezier(0.4, 0, 1, 1)}.mdc-switch--selected .mdc-switch__icon--on,.mdc-switch--unselected .mdc-switch__icon--off{opacity:1;transition:opacity 45ms 30ms cubic-bezier(0, 0, 0.2, 1)}.mdc-switch{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);will-change:transform, opacity}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-switch .mdc-switch__ripple::before,.mdc-switch .mdc-switch__ripple::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:\"\"}.mdc-switch .mdc-switch__ripple::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-switch .mdc-switch__ripple::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-switch.mdc-ripple-upgraded .mdc-switch__ripple::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-switch.mdc-ripple-upgraded .mdc-switch__ripple::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-switch.mdc-ripple-upgraded--unbounded .mdc-switch__ripple::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-switch.mdc-ripple-upgraded--foreground-activation .mdc-switch__ripple::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-switch.mdc-ripple-upgraded--foreground-deactivation .mdc-switch__ripple::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-switch .mdc-switch__ripple::before,.mdc-switch .mdc-switch__ripple::after{top:calc(50% - 50%);left:calc(50% - 50%);width:100%;height:100%}.mdc-switch.mdc-ripple-upgraded .mdc-switch__ripple::before,.mdc-switch.mdc-ripple-upgraded .mdc-switch__ripple::after{top:var(--mdc-ripple-top, calc(50% - 50%));left:var(--mdc-ripple-left, calc(50% - 50%));width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-switch.mdc-ripple-upgraded .mdc-switch__ripple::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-switch{width:36px;width:var(--mdc-switch-track-width, 36px)}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__handle::after{background:#26a69a;background:var(--mdc-switch-selected-handle-color, var(--mdc-theme-primary, #26a69a))}.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:#26534f;background:var(--mdc-switch-selected-hover-handle-color, #26534f)}.mdc-switch.mdc-switch--selected:enabled:focus:not(:active) .mdc-switch__handle::after{background:#26534f;background:var(--mdc-switch-selected-focus-handle-color, #26534f)}.mdc-switch.mdc-switch--selected:enabled:active .mdc-switch__handle::after{background:#26534f;background:var(--mdc-switch-selected-pressed-handle-color, #26534f)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__handle::after{background:#424242;background:var(--mdc-switch-disabled-selected-handle-color, #424242)}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__handle::after{background:#616161;background:var(--mdc-switch-unselected-handle-color, #616161)}.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus):not(:active) .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-hover-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:enabled:focus:not(:active) .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-focus-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:enabled:active .mdc-switch__handle::after{background:#212121;background:var(--mdc-switch-unselected-pressed-handle-color, #212121)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__handle::after{background:#424242;background:var(--mdc-switch-disabled-unselected-handle-color, #424242)}.mdc-switch .mdc-switch__handle::before{background:#fff;background:var(--mdc-switch-handle-surface-color, var(--mdc-theme-surface, #fff))}.mdc-switch:enabled .mdc-switch__shadow{box-shadow:0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-switch-handle-elevation, var(--mdc-elevation-box-shadow-for-gss));--mdc-elevation-box-shadow-for-gss:0px 2px 1px -1px rgba(0, 0, 0, 0.2), 0px 1px 1px 0px rgba(0, 0, 0, 0.14), 0px 1px 3px 0px rgba(0, 0, 0, 0.12)}.mdc-switch:disabled .mdc-switch__shadow{box-shadow:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12);box-shadow:var(--mdc-switch-disabled-handle-elevation, var(--mdc-elevation-box-shadow-for-gss));--mdc-elevation-box-shadow-for-gss:0px 0px 0px 0px rgba(0, 0, 0, 0.2), 0px 0px 0px 0px rgba(0, 0, 0, 0.14), 0px 0px 0px 0px rgba(0, 0, 0, 0.12)}.mdc-switch .mdc-switch__handle{height:20px;height:var(--mdc-switch-handle-height, 20px)}.mdc-switch:disabled .mdc-switch__handle::after{opacity:0.38;opacity:var(--mdc-switch-disabled-handle-opacity, 0.38)}.mdc-switch .mdc-switch__handle{border-radius:10px;border-radius:var(--mdc-switch-handle-shape, 10px)}.mdc-switch .mdc-switch__handle{width:20px;width:var(--mdc-switch-handle-width, 20px)}.mdc-switch .mdc-switch__handle-track{width:calc(100% - 20px);width:calc(100% - var(--mdc-switch-handle-width, 20px))}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-selected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-disabled-selected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-unselected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icon{fill:#fff;fill:var(--mdc-switch-disabled-unselected-icon-color, var(--mdc-theme-on-primary, #fff))}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icons{opacity:0.38;opacity:var(--mdc-switch-disabled-selected-icon-opacity, 0.38)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icons{opacity:0.38;opacity:var(--mdc-switch-disabled-unselected-icon-opacity, 0.38)}.mdc-switch.mdc-switch--selected .mdc-switch__icon{width:18px;width:var(--mdc-switch-selected-icon-size, 18px);height:18px;height:var(--mdc-switch-selected-icon-size, 18px)}.mdc-switch.mdc-switch--unselected .mdc-switch__icon{width:18px;width:var(--mdc-switch-unselected-icon-size, 18px);height:18px;height:var(--mdc-switch-unselected-icon-size, 18px)}.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus) .mdc-switch__ripple::before,.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus) .mdc-switch__ripple::after{background-color:#26a69a;background-color:var(--mdc-switch-selected-hover-state-layer-color, var(--mdc-theme-primary, #26a69a))}.mdc-switch.mdc-switch--selected:enabled:focus .mdc-switch__ripple::before,.mdc-switch.mdc-switch--selected:enabled:focus .mdc-switch__ripple::after{background-color:#26a69a;background-color:var(--mdc-switch-selected-focus-state-layer-color, var(--mdc-theme-primary, #26a69a))}.mdc-switch.mdc-switch--selected:enabled:active .mdc-switch__ripple::before,.mdc-switch.mdc-switch--selected:enabled:active .mdc-switch__ripple::after{background-color:#26a69a;background-color:var(--mdc-switch-selected-pressed-state-layer-color, var(--mdc-theme-primary, #26a69a))}.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus) .mdc-switch__ripple::before,.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus) .mdc-switch__ripple::after{background-color:#424242;background-color:var(--mdc-switch-unselected-hover-state-layer-color, #424242)}.mdc-switch.mdc-switch--unselected:enabled:focus .mdc-switch__ripple::before,.mdc-switch.mdc-switch--unselected:enabled:focus .mdc-switch__ripple::after{background-color:#424242;background-color:var(--mdc-switch-unselected-focus-state-layer-color, #424242)}.mdc-switch.mdc-switch--unselected:enabled:active .mdc-switch__ripple::before,.mdc-switch.mdc-switch--unselected:enabled:active .mdc-switch__ripple::after{background-color:#424242;background-color:var(--mdc-switch-unselected-pressed-state-layer-color, #424242)}.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus):hover .mdc-switch__ripple::before,.mdc-switch.mdc-switch--selected:enabled:hover:not(:focus).mdc-ripple-surface--hover .mdc-switch__ripple::before{opacity:0.04;opacity:var(--mdc-switch-selected-hover-state-layer-opacity, 0.04)}.mdc-switch.mdc-switch--selected:enabled:focus.mdc-ripple-upgraded--background-focused .mdc-switch__ripple::before,.mdc-switch.mdc-switch--selected:enabled:focus:not(.mdc-ripple-upgraded):focus .mdc-switch__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-switch-selected-focus-state-layer-opacity, 0.12)}.mdc-switch.mdc-switch--selected:enabled:active:not(.mdc-ripple-upgraded) .mdc-switch__ripple::after{transition:opacity 150ms linear}.mdc-switch.mdc-switch--selected:enabled:active:not(.mdc-ripple-upgraded):active .mdc-switch__ripple::after{transition-duration:75ms;opacity:0.1;opacity:var(--mdc-switch-selected-pressed-state-layer-opacity, 0.1)}.mdc-switch.mdc-switch--selected:enabled:active.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-switch-selected-pressed-state-layer-opacity, 0.1)}.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus):hover .mdc-switch__ripple::before,.mdc-switch.mdc-switch--unselected:enabled:hover:not(:focus).mdc-ripple-surface--hover .mdc-switch__ripple::before{opacity:0.04;opacity:var(--mdc-switch-unselected-hover-state-layer-opacity, 0.04)}.mdc-switch.mdc-switch--unselected:enabled:focus.mdc-ripple-upgraded--background-focused .mdc-switch__ripple::before,.mdc-switch.mdc-switch--unselected:enabled:focus:not(.mdc-ripple-upgraded):focus .mdc-switch__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-switch-unselected-focus-state-layer-opacity, 0.12)}.mdc-switch.mdc-switch--unselected:enabled:active:not(.mdc-ripple-upgraded) .mdc-switch__ripple::after{transition:opacity 150ms linear}.mdc-switch.mdc-switch--unselected:enabled:active:not(.mdc-ripple-upgraded):active .mdc-switch__ripple::after{transition-duration:75ms;opacity:0.1;opacity:var(--mdc-switch-unselected-pressed-state-layer-opacity, 0.1)}.mdc-switch.mdc-switch--unselected:enabled:active.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-switch-unselected-pressed-state-layer-opacity, 0.1)}.mdc-switch .mdc-switch__ripple{height:48px;height:var(--mdc-switch-state-layer-size, 48px);width:48px;width:var(--mdc-switch-state-layer-size, 48px)}.mdc-switch .mdc-switch__track{height:14px;height:var(--mdc-switch-track-height, 14px)}.mdc-switch:disabled .mdc-switch__track{opacity:0.12;opacity:var(--mdc-switch-disabled-track-opacity, 0.12)}.mdc-switch:enabled .mdc-switch__track::after{background:#c1f1ec;background:var(--mdc-switch-selected-track-color, #c1f1ec)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::after{background:#c1f1ec;background:var(--mdc-switch-selected-hover-track-color, #c1f1ec)}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::after{background:#c1f1ec;background:var(--mdc-switch-selected-focus-track-color, #c1f1ec)}.mdc-switch:enabled:active .mdc-switch__track::after{background:#c1f1ec;background:var(--mdc-switch-selected-pressed-track-color, #c1f1ec)}.mdc-switch:disabled .mdc-switch__track::after{background:#424242;background:var(--mdc-switch-disabled-selected-track-color, #424242)}.mdc-switch:enabled .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-track-color, #e0e0e0)}.mdc-switch:enabled:hover:not(:focus):not(:active) .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-hover-track-color, #e0e0e0)}.mdc-switch:enabled:focus:not(:active) .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-focus-track-color, #e0e0e0)}.mdc-switch:enabled:active .mdc-switch__track::before{background:#e0e0e0;background:var(--mdc-switch-unselected-pressed-track-color, #e0e0e0)}.mdc-switch:disabled .mdc-switch__track::before{background:#424242;background:var(--mdc-switch-disabled-unselected-track-color, #424242)}.mdc-switch .mdc-switch__track{border-radius:7px;border-radius:var(--mdc-switch-track-shape, 7px)}@media screen and (forced-colors: active), (-ms-high-contrast: active){.mdc-switch:enabled .mdc-switch__shadow{}.mdc-switch:disabled .mdc-switch__shadow{}.mdc-switch:disabled .mdc-switch__handle::after{opacity:1;opacity:var(--mdc-switch-disabled-handle-opacity, 1)}.mdc-switch.mdc-switch--selected:enabled .mdc-switch__icon{fill:ButtonText;fill:var(--mdc-switch-selected-icon-color, ButtonText)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icon{fill:GrayText;fill:var(--mdc-switch-disabled-selected-icon-color, GrayText)}.mdc-switch.mdc-switch--unselected:enabled .mdc-switch__icon{fill:ButtonText;fill:var(--mdc-switch-unselected-icon-color, ButtonText)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icon{fill:GrayText;fill:var(--mdc-switch-disabled-unselected-icon-color, GrayText)}.mdc-switch.mdc-switch--selected:disabled .mdc-switch__icons{opacity:1;opacity:var(--mdc-switch-disabled-selected-icon-opacity, 1)}.mdc-switch.mdc-switch--unselected:disabled .mdc-switch__icons{opacity:1;opacity:var(--mdc-switch-disabled-unselected-icon-opacity, 1)}.mdc-switch:disabled .mdc-switch__track{opacity:1;opacity:var(--mdc-switch-disabled-track-opacity, 1)}}:host{display:inline-flex;align-items:center;--mdc-switch-selected-icon-color:transparent;--mdc-switch-unselected-icon-color:transparent;--mdc-switch-disabled-selected-icon-opacity:1;--mdc-switch-disabled-unselected-icon-opacity:1;--mdc-switch-selected-icon-size:0.75rem;--mdc-switch-unselected-icon-size:0.75rem;--mdc-switch-track-height:1.25rem;--mdc-switch-track-shape:var(--mdc-switch-track-height)}.mdc-switch{margin-right:0.5rem}label{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-body2-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.8125rem;font-size:var(--mdc-typography-body2-font-size, 0.8125rem);line-height:1.625rem;line-height:var(--mdc-typography-body2-line-height, 1.625rem);font-weight:400;font-weight:var(--mdc-typography-body2-font-weight, 400);letter-spacing:0.0178571429em;letter-spacing:var(--mdc-typography-body2-letter-spacing, 0.0178571429em);text-decoration:inherit;text-decoration:var(--mdc-typography-body2-text-decoration, inherit);text-transform:inherit;text-transform:var(--mdc-typography-body2-text-transform, inherit);cursor:pointer}label.disabled{cursor:not-allowed;pointer-events:none;opacity:0.4}.mdc-switch.lime-switch--readonly{--mdc-switch-disabled-selected-track-color:var(--mdc-theme-primary);--mdc-switch-disabled-unselected-track-color:rgb(\n var(--color-red-default)\n );--mdc-switch-handle-surface-color:transparent;--mdc-switch-disabled-selected-handle-color:transparent;--mdc-switch-disabled-unselected-handle-color:transparent;--mdc-switch-disabled-track-opacity:1}.mdc-switch.lime-switch--readonly+label.disabled{cursor:default;opacity:1}";
|
|
339
636
|
|
|
340
|
-
|
|
637
|
+
const Switch = class {
|
|
341
638
|
constructor(hostRef) {
|
|
342
639
|
index.registerInstance(this, hostRef);
|
|
343
640
|
this.change = index.createEvent(this, "change", 7);
|
|
@@ -359,9 +656,9 @@ let Switch = class {
|
|
|
359
656
|
*/
|
|
360
657
|
this.value = false;
|
|
361
658
|
this.fieldId = randomString.createRandomString();
|
|
362
|
-
this.
|
|
659
|
+
this.handleClick = (event) => {
|
|
363
660
|
event.stopPropagation();
|
|
364
|
-
this.change.emit(
|
|
661
|
+
this.change.emit(!this.value);
|
|
365
662
|
};
|
|
366
663
|
}
|
|
367
664
|
connectedCallback() {
|
|
@@ -383,21 +680,20 @@ let Switch = class {
|
|
|
383
680
|
}
|
|
384
681
|
render() {
|
|
385
682
|
return [
|
|
386
|
-
index.h("
|
|
683
|
+
index.h("button", { id: this.fieldId, class: {
|
|
387
684
|
'mdc-switch': true,
|
|
388
|
-
'mdc-switch--disabled': this.disabled || this.readonly,
|
|
389
685
|
'lime-switch--readonly': this.readonly,
|
|
390
|
-
|
|
686
|
+
'mdc-switch--unselected': !this.value,
|
|
687
|
+
'mdc-switch--selected': this.value,
|
|
688
|
+
}, type: "button", role: "switch", "aria-checked": this.value, disabled: this.disabled || this.readonly, onClick: this.handleClick }, index.h("div", { class: "mdc-switch__track" }), index.h("div", { class: "mdc-switch__handle-track" }, index.h("div", { class: "mdc-switch__handle" }, index.h("div", { class: "mdc-switch__shadow" }, index.h("div", { class: "mdc-elevation-overlay" })), index.h("div", { class: "mdc-switch__ripple" }), index.h("div", { class: "mdc-switch__icons" }, index.h("svg", { class: "mdc-switch__icon mdc-switch__icon--on", viewBox: "0 0 24 24" }, index.h("path", { d: "M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z" })), index.h("svg", { class: "mdc-switch__icon mdc-switch__icon--off", viewBox: "0 0 24 24" }, index.h("path", { d: "M20 13H4v-2h16v2z" })))))),
|
|
391
689
|
index.h("label", { class: `${this.disabled || this.readonly ? 'disabled' : ''}`, htmlFor: this.fieldId }, this.label),
|
|
392
690
|
];
|
|
393
691
|
}
|
|
394
|
-
valueWatcher(newValue
|
|
692
|
+
valueWatcher(newValue) {
|
|
395
693
|
if (!this.mdcSwitch) {
|
|
396
694
|
return;
|
|
397
695
|
}
|
|
398
|
-
|
|
399
|
-
this.mdcSwitch.checked = newValue;
|
|
400
|
-
}
|
|
696
|
+
this.mdcSwitch.selected = newValue;
|
|
401
697
|
}
|
|
402
698
|
get host() { return index.getElement(this); }
|
|
403
699
|
static get watchers() { return {
|