@limetech/lime-elements 35.0.0-next.9 → 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 +73 -13
- 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 +71 -20
- 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 +938 -93
- 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 +938 -93
- 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 +99 -15
- 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 +73 -13
- 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-887d5bda.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-3ae6bb75.entry.js +0 -82
- package/dist/lime-elements/p-3ae6dfba.entry.js +0 -73
- 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-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-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-be56ffab.entry.js +0 -1
- package/dist/lime-elements/p-c306c953.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
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-11cd0b60.js';
|
|
2
2
|
import { c as createRandomString } from './random-string-2246b81e.js';
|
|
3
|
-
import { M as MDCFoundation, a as MDCComponent } from './component-
|
|
4
|
-
import { M as MDCRipple,
|
|
5
|
-
import
|
|
3
|
+
import { _ as __assign$1, b as __values, c as __extends$1, d as __spreadArray, e as __read, M as MDCFoundation, a as MDCComponent } from './component-410aad5a.js';
|
|
4
|
+
import { M as MDCRipple, b as MDCRippleFoundation } from './component-5b4ac85a.js';
|
|
5
|
+
import './ponyfill-30263d5e.js';
|
|
6
6
|
|
|
7
7
|
/*! *****************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -44,38 +44,237 @@ var __assign = function() {
|
|
|
44
44
|
return t;
|
|
45
45
|
};
|
|
46
46
|
return __assign.apply(this, arguments);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @license
|
|
51
|
+
* Copyright 2021 Google Inc.
|
|
52
|
+
*
|
|
53
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
54
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
55
|
+
* in the Software without restriction, including without limitation the rights
|
|
56
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
57
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
58
|
+
* furnished to do so, subject to the following conditions:
|
|
59
|
+
*
|
|
60
|
+
* The above copyright notice and this permission notice shall be included in
|
|
61
|
+
* all copies or substantial portions of the Software.
|
|
62
|
+
*
|
|
63
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
64
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
65
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
66
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
67
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
68
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
69
|
+
* THE SOFTWARE.
|
|
70
|
+
*/
|
|
71
|
+
/**
|
|
72
|
+
* CSS classes used for switch.
|
|
73
|
+
*/
|
|
74
|
+
var CssClasses;
|
|
75
|
+
(function (CssClasses) {
|
|
76
|
+
CssClasses["PROCESSING"] = "mdc-switch--processing";
|
|
77
|
+
CssClasses["SELECTED"] = "mdc-switch--selected";
|
|
78
|
+
CssClasses["UNSELECTED"] = "mdc-switch--unselected";
|
|
79
|
+
})(CssClasses || (CssClasses = {}));
|
|
80
|
+
/**
|
|
81
|
+
* Query selectors used for switch.
|
|
82
|
+
*/
|
|
83
|
+
var Selectors;
|
|
84
|
+
(function (Selectors) {
|
|
85
|
+
Selectors["RIPPLE"] = ".mdc-switch__ripple";
|
|
86
|
+
})(Selectors || (Selectors = {}));
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @license
|
|
90
|
+
* Copyright 2021 Google Inc.
|
|
91
|
+
*
|
|
92
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
93
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
94
|
+
* in the Software without restriction, including without limitation the rights
|
|
95
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
96
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
97
|
+
* furnished to do so, subject to the following conditions:
|
|
98
|
+
*
|
|
99
|
+
* The above copyright notice and this permission notice shall be included in
|
|
100
|
+
* all copies or substantial portions of the Software.
|
|
101
|
+
*
|
|
102
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
103
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
104
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
105
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
106
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
107
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
108
|
+
* THE SOFTWARE.
|
|
109
|
+
*/
|
|
110
|
+
/**
|
|
111
|
+
* Observe a target's property for changes. When a property changes, the
|
|
112
|
+
* provided `Observer` function will be invoked with the properties current and
|
|
113
|
+
* previous values.
|
|
114
|
+
*
|
|
115
|
+
* The returned cleanup function will stop listening to changes for the
|
|
116
|
+
* provided `Observer`.
|
|
117
|
+
*
|
|
118
|
+
* @template T The observed target type.
|
|
119
|
+
* @template K The observed property.
|
|
120
|
+
* @param target - The target to observe.
|
|
121
|
+
* @param property - The property of the target to observe.
|
|
122
|
+
* @param observer - An observer function to invoke each time the property
|
|
123
|
+
* changes.
|
|
124
|
+
* @return A cleanup function that will stop observing changes for the provided
|
|
125
|
+
* `Observer`.
|
|
126
|
+
*/
|
|
127
|
+
function observeProperty(target, property, observer) {
|
|
128
|
+
var targetObservers = installObserver(target, property);
|
|
129
|
+
var observers = targetObservers.getObservers(property);
|
|
130
|
+
observers.push(observer);
|
|
131
|
+
return function () {
|
|
132
|
+
observers.splice(observers.indexOf(observer), 1);
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A Map of all `TargetObservers` that have been installed.
|
|
137
|
+
*/
|
|
138
|
+
var allTargetObservers = new WeakMap();
|
|
139
|
+
/**
|
|
140
|
+
* Installs a `TargetObservers` for the provided target (if not already
|
|
141
|
+
* installed), and replaces the given property with a getter and setter that
|
|
142
|
+
* will respond to changes and call `TargetObservers`.
|
|
143
|
+
*
|
|
144
|
+
* Subsequent calls to `installObserver()` with the same target and property
|
|
145
|
+
* will not override the property's previously installed getter/setter.
|
|
146
|
+
*
|
|
147
|
+
* @template T The observed target type.
|
|
148
|
+
* @template K The observed property to create a getter/setter for.
|
|
149
|
+
* @param target - The target to observe.
|
|
150
|
+
* @param property - The property to create a getter/setter for, if needed.
|
|
151
|
+
* @return The installed `TargetObservers` for the provided target.
|
|
152
|
+
*/
|
|
153
|
+
function installObserver(target, property) {
|
|
154
|
+
var observersMap = new Map();
|
|
155
|
+
if (!allTargetObservers.has(target)) {
|
|
156
|
+
allTargetObservers.set(target, {
|
|
157
|
+
isEnabled: true,
|
|
158
|
+
getObservers: function (key) {
|
|
159
|
+
var observers = observersMap.get(key) || [];
|
|
160
|
+
if (!observersMap.has(key)) {
|
|
161
|
+
observersMap.set(key, observers);
|
|
162
|
+
}
|
|
163
|
+
return observers;
|
|
164
|
+
},
|
|
165
|
+
installedProperties: new Set()
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
var targetObservers = allTargetObservers.get(target);
|
|
169
|
+
if (targetObservers.installedProperties.has(property)) {
|
|
170
|
+
// The getter/setter has already been replaced for this property
|
|
171
|
+
return targetObservers;
|
|
172
|
+
}
|
|
173
|
+
// Retrieve (or create if it's a plain property) the original descriptor from
|
|
174
|
+
// the target...
|
|
175
|
+
var descriptor = getDescriptor(target, property) || {
|
|
176
|
+
configurable: true,
|
|
177
|
+
enumerable: true,
|
|
178
|
+
value: target[property],
|
|
179
|
+
writable: true
|
|
180
|
+
};
|
|
181
|
+
// ...and create a copy that will be used for the observer.
|
|
182
|
+
var observedDescriptor = __assign$1({}, descriptor);
|
|
183
|
+
var descGet = descriptor.get, descSet = descriptor.set;
|
|
184
|
+
if ('value' in descriptor) {
|
|
185
|
+
// The descriptor is a simple value (not a getter/setter).
|
|
186
|
+
// For our observer descriptor that we copied, delete the value/writable
|
|
187
|
+
// properties, since they are incompatible with the get/set properties
|
|
188
|
+
// for descriptors.
|
|
189
|
+
delete observedDescriptor.value;
|
|
190
|
+
delete observedDescriptor.writable;
|
|
191
|
+
// Set up a simple getter...
|
|
192
|
+
var value_1 = descriptor.value;
|
|
193
|
+
descGet = function () { return value_1; };
|
|
194
|
+
// ...and setter (if the original property was writable).
|
|
195
|
+
if (descriptor.writable) {
|
|
196
|
+
descSet = function (newValue) {
|
|
197
|
+
value_1 = newValue;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (descGet) {
|
|
202
|
+
observedDescriptor.get = function () {
|
|
203
|
+
// `this as T` needed for closure conformance
|
|
204
|
+
return descGet.call(this);
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
if (descSet) {
|
|
208
|
+
observedDescriptor.set = function (newValue) {
|
|
209
|
+
var e_4, _a;
|
|
210
|
+
// `thus as T` needed for closure conformance
|
|
211
|
+
var previous = descGet ? descGet.call(this) : newValue;
|
|
212
|
+
descSet.call(this, newValue);
|
|
213
|
+
if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {
|
|
214
|
+
try {
|
|
215
|
+
for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
216
|
+
var observer = _c.value;
|
|
217
|
+
observer(newValue, previous);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
221
|
+
finally {
|
|
222
|
+
try {
|
|
223
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
224
|
+
}
|
|
225
|
+
finally { if (e_4) throw e_4.error; }
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
targetObservers.installedProperties.add(property);
|
|
231
|
+
Object.defineProperty(target, property, observedDescriptor);
|
|
232
|
+
return targetObservers;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Retrieves the descriptor for a property from the provided target. This
|
|
236
|
+
* function will walk up the target's prototype chain to search for the
|
|
237
|
+
* descriptor.
|
|
238
|
+
*
|
|
239
|
+
* @template T The target type.
|
|
240
|
+
* @template K The property type.
|
|
241
|
+
* @param target - The target to retrieve a descriptor from.
|
|
242
|
+
* @param property - The name of the property to retrieve a descriptor for.
|
|
243
|
+
* @return the descriptor, or undefined if it does not exist. Keep in mind that
|
|
244
|
+
* plain properties may not have a descriptor defined.
|
|
245
|
+
*/
|
|
246
|
+
function getDescriptor(target, property) {
|
|
247
|
+
var descriptorTarget = target;
|
|
248
|
+
var descriptor;
|
|
249
|
+
while (descriptorTarget) {
|
|
250
|
+
descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);
|
|
251
|
+
if (descriptor) {
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
// Walk up the instance's prototype chain in case the property is declared
|
|
255
|
+
// on a superclass.
|
|
256
|
+
descriptorTarget = Object.getPrototypeOf(descriptorTarget);
|
|
257
|
+
}
|
|
258
|
+
return descriptor;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Enables or disables all observers for a provided target. Changes to observed
|
|
262
|
+
* properties will not call any observers when disabled.
|
|
263
|
+
*
|
|
264
|
+
* @template T The observed target type.
|
|
265
|
+
* @param target - The target to enable or disable observers for.
|
|
266
|
+
* @param enabled - True to enable or false to disable observers.
|
|
267
|
+
*/
|
|
268
|
+
function setObserversEnabled(target, enabled) {
|
|
269
|
+
var targetObservers = allTargetObservers.get(target);
|
|
270
|
+
if (targetObservers) {
|
|
271
|
+
targetObservers.isEnabled = enabled;
|
|
272
|
+
}
|
|
74
273
|
}
|
|
75
274
|
|
|
76
275
|
/**
|
|
77
276
|
* @license
|
|
78
|
-
* Copyright
|
|
277
|
+
* Copyright 2021 Google Inc.
|
|
79
278
|
*
|
|
80
279
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
81
280
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -95,26 +294,124 @@ function __spreadArray(to, from, pack) {
|
|
|
95
294
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
96
295
|
* THE SOFTWARE.
|
|
97
296
|
*/
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
297
|
+
var MDCObserverFoundation = /** @class */ (function (_super) {
|
|
298
|
+
__extends$1(MDCObserverFoundation, _super);
|
|
299
|
+
function MDCObserverFoundation(adapter) {
|
|
300
|
+
var _this = _super.call(this, adapter) || this;
|
|
301
|
+
/** A set of cleanup functions to unobserve changes. */
|
|
302
|
+
_this.unobserves = new Set();
|
|
303
|
+
return _this;
|
|
304
|
+
}
|
|
305
|
+
MDCObserverFoundation.prototype.destroy = function () {
|
|
306
|
+
_super.prototype.destroy.call(this);
|
|
307
|
+
this.unobserve();
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Observe a target's properties for changes using the provided map of
|
|
311
|
+
* property names and observer functions.
|
|
312
|
+
*
|
|
313
|
+
* @template T The target type.
|
|
314
|
+
* @param target - The target to observe.
|
|
315
|
+
* @param observers - An object whose keys are target properties and values
|
|
316
|
+
* are observer functions that are called when the associated property
|
|
317
|
+
* changes.
|
|
318
|
+
* @return A cleanup function that can be called to unobserve the
|
|
319
|
+
* target.
|
|
320
|
+
*/
|
|
321
|
+
MDCObserverFoundation.prototype.observe = function (target, observers) {
|
|
322
|
+
var e_1, _a;
|
|
323
|
+
var _this = this;
|
|
324
|
+
var cleanup = [];
|
|
325
|
+
try {
|
|
326
|
+
for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
327
|
+
var property = _c.value;
|
|
328
|
+
var observer = observers[property].bind(this);
|
|
329
|
+
cleanup.push(this.observeProperty(target, property, observer));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
333
|
+
finally {
|
|
334
|
+
try {
|
|
335
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
336
|
+
}
|
|
337
|
+
finally { if (e_1) throw e_1.error; }
|
|
338
|
+
}
|
|
339
|
+
var unobserve = function () {
|
|
340
|
+
var e_2, _a;
|
|
341
|
+
try {
|
|
342
|
+
for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
|
343
|
+
var cleanupFn = cleanup_1_1.value;
|
|
344
|
+
cleanupFn();
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
348
|
+
finally {
|
|
349
|
+
try {
|
|
350
|
+
if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
|
351
|
+
}
|
|
352
|
+
finally { if (e_2) throw e_2.error; }
|
|
353
|
+
}
|
|
354
|
+
_this.unobserves.delete(unobserve);
|
|
355
|
+
};
|
|
356
|
+
this.unobserves.add(unobserve);
|
|
357
|
+
return unobserve;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Observe a target's property for changes. When a property changes, the
|
|
361
|
+
* provided `Observer` function will be invoked with the properties current
|
|
362
|
+
* and previous values.
|
|
363
|
+
*
|
|
364
|
+
* The returned cleanup function will stop listening to changes for the
|
|
365
|
+
* provided `Observer`.
|
|
366
|
+
*
|
|
367
|
+
* @template T The observed target type.
|
|
368
|
+
* @template K The observed property.
|
|
369
|
+
* @param target - The target to observe.
|
|
370
|
+
* @param property - The property of the target to observe.
|
|
371
|
+
* @param observer - An observer function to invoke each time the property
|
|
372
|
+
* changes.
|
|
373
|
+
* @return A cleanup function that will stop observing changes for the
|
|
374
|
+
* provided `Observer`.
|
|
375
|
+
*/
|
|
376
|
+
MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {
|
|
377
|
+
return observeProperty(target, property, observer);
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Enables or disables all observers for the provided target. Disabling
|
|
381
|
+
* observers will prevent them from being called until they are re-enabled.
|
|
382
|
+
*
|
|
383
|
+
* @param target - The target to enable or disable observers for.
|
|
384
|
+
* @param enabled - Whether or not observers should be called.
|
|
385
|
+
*/
|
|
386
|
+
MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {
|
|
387
|
+
setObserversEnabled(target, enabled);
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* Clean up all observers and stop listening for property changes.
|
|
391
|
+
*/
|
|
392
|
+
MDCObserverFoundation.prototype.unobserve = function () {
|
|
393
|
+
var e_3, _a;
|
|
394
|
+
try {
|
|
395
|
+
// Iterate over a copy since unobserve() will remove themselves from the set
|
|
396
|
+
for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
397
|
+
var unobserve = _c.value;
|
|
398
|
+
unobserve();
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
402
|
+
finally {
|
|
403
|
+
try {
|
|
404
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
405
|
+
}
|
|
406
|
+
finally { if (e_3) throw e_3.error; }
|
|
407
|
+
}
|
|
408
|
+
};
|
|
409
|
+
return MDCObserverFoundation;
|
|
410
|
+
}(MDCFoundation));
|
|
114
411
|
|
|
115
412
|
/**
|
|
116
413
|
* @license
|
|
117
|
-
* Copyright
|
|
414
|
+
* Copyright 2021 Google Inc.
|
|
118
415
|
*
|
|
119
416
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
120
417
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -134,81 +431,116 @@ var strings = {
|
|
|
134
431
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
135
432
|
* THE SOFTWARE.
|
|
136
433
|
*/
|
|
434
|
+
/**
|
|
435
|
+
* `MDCSwitchFoundation` provides a state-only foundation for a switch
|
|
436
|
+
* component.
|
|
437
|
+
*
|
|
438
|
+
* State observers and event handler entrypoints update a component's adapter's
|
|
439
|
+
* state with the logic needed for switch to function.
|
|
440
|
+
*/
|
|
137
441
|
var MDCSwitchFoundation = /** @class */ (function (_super) {
|
|
138
442
|
__extends(MDCSwitchFoundation, _super);
|
|
139
443
|
function MDCSwitchFoundation(adapter) {
|
|
140
|
-
|
|
444
|
+
var _this = _super.call(this, adapter) || this;
|
|
445
|
+
_this.handleClick = _this.handleClick.bind(_this);
|
|
446
|
+
return _this;
|
|
141
447
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
|
|
151
|
-
/** The CSS classes used by the switch. */
|
|
152
|
-
get: function () {
|
|
153
|
-
return cssClasses;
|
|
154
|
-
},
|
|
155
|
-
enumerable: false,
|
|
156
|
-
configurable: true
|
|
157
|
-
});
|
|
158
|
-
Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
|
|
159
|
-
/** The default Adapter for the switch. */
|
|
160
|
-
get: function () {
|
|
161
|
-
return {
|
|
162
|
-
addClass: function () { return undefined; },
|
|
163
|
-
removeClass: function () { return undefined; },
|
|
164
|
-
setNativeControlChecked: function () { return undefined; },
|
|
165
|
-
setNativeControlDisabled: function () { return undefined; },
|
|
166
|
-
setNativeControlAttr: function () { return undefined; },
|
|
167
|
-
};
|
|
168
|
-
},
|
|
169
|
-
enumerable: false,
|
|
170
|
-
configurable: true
|
|
171
|
-
});
|
|
172
|
-
/** Sets the checked state of the switch. */
|
|
173
|
-
MDCSwitchFoundation.prototype.setChecked = function (checked) {
|
|
174
|
-
this.adapter.setNativeControlChecked(checked);
|
|
175
|
-
this.updateAriaChecked_(checked);
|
|
176
|
-
this.updateCheckedStyling_(checked);
|
|
448
|
+
/**
|
|
449
|
+
* Initializes the foundation and starts observing state changes.
|
|
450
|
+
*/
|
|
451
|
+
MDCSwitchFoundation.prototype.init = function () {
|
|
452
|
+
this.observe(this.adapter.state, {
|
|
453
|
+
disabled: this.stopProcessingIfDisabled,
|
|
454
|
+
processing: this.stopProcessingIfDisabled,
|
|
455
|
+
});
|
|
177
456
|
};
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
457
|
+
/**
|
|
458
|
+
* Event handler for switch click events. Clicking on a switch will toggle its
|
|
459
|
+
* selected state.
|
|
460
|
+
*/
|
|
461
|
+
MDCSwitchFoundation.prototype.handleClick = function () {
|
|
462
|
+
if (this.adapter.state.disabled) {
|
|
463
|
+
return;
|
|
183
464
|
}
|
|
184
|
-
|
|
185
|
-
|
|
465
|
+
this.adapter.state.selected = !this.adapter.state.selected;
|
|
466
|
+
};
|
|
467
|
+
MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {
|
|
468
|
+
if (this.adapter.state.disabled) {
|
|
469
|
+
this.adapter.state.processing = false;
|
|
186
470
|
}
|
|
187
471
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
472
|
+
return MDCSwitchFoundation;
|
|
473
|
+
}(MDCObserverFoundation));
|
|
474
|
+
/**
|
|
475
|
+
* `MDCSwitchRenderFoundation` provides a state and rendering foundation for a
|
|
476
|
+
* switch component.
|
|
477
|
+
*
|
|
478
|
+
* State observers and event handler entrypoints update a component's
|
|
479
|
+
* adapter's state with the logic needed for switch to function.
|
|
480
|
+
*
|
|
481
|
+
* In response to state changes, the rendering foundation uses the component's
|
|
482
|
+
* render adapter to keep the component's DOM updated with the state.
|
|
483
|
+
*/
|
|
484
|
+
var MDCSwitchRenderFoundation = /** @class */ (function (_super) {
|
|
485
|
+
__extends(MDCSwitchRenderFoundation, _super);
|
|
486
|
+
function MDCSwitchRenderFoundation() {
|
|
487
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Initializes the foundation and starts observing state changes.
|
|
491
|
+
*/
|
|
492
|
+
MDCSwitchRenderFoundation.prototype.init = function () {
|
|
493
|
+
_super.prototype.init.call(this);
|
|
494
|
+
this.observe(this.adapter.state, {
|
|
495
|
+
disabled: this.onDisabledChange,
|
|
496
|
+
processing: this.onProcessingChange,
|
|
497
|
+
selected: this.onSelectedChange,
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
/**
|
|
501
|
+
* Initializes the foundation from a server side rendered (SSR) component.
|
|
502
|
+
* This will sync the adapter's state with the current state of the DOM.
|
|
503
|
+
*
|
|
504
|
+
* This method should be called after `init()`.
|
|
505
|
+
*/
|
|
506
|
+
MDCSwitchRenderFoundation.prototype.initFromDOM = function () {
|
|
507
|
+
// Turn off observers while setting state
|
|
508
|
+
this.setObserversEnabled(this.adapter.state, false);
|
|
509
|
+
this.adapter.state.selected = this.adapter.hasClass(CssClasses.SELECTED);
|
|
510
|
+
// Ensure aria-checked is set if attribute is not present
|
|
511
|
+
this.onSelectedChange();
|
|
512
|
+
this.adapter.state.disabled = this.adapter.isDisabled();
|
|
513
|
+
this.adapter.state.processing =
|
|
514
|
+
this.adapter.hasClass(CssClasses.PROCESSING);
|
|
515
|
+
// Re-observe state
|
|
516
|
+
this.setObserversEnabled(this.adapter.state, true);
|
|
517
|
+
this.stopProcessingIfDisabled();
|
|
518
|
+
};
|
|
519
|
+
MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {
|
|
520
|
+
this.adapter.setDisabled(this.adapter.state.disabled);
|
|
521
|
+
};
|
|
522
|
+
MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {
|
|
523
|
+
this.toggleClass(this.adapter.state.processing, CssClasses.PROCESSING);
|
|
193
524
|
};
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
525
|
+
MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {
|
|
526
|
+
this.adapter.setAriaChecked(String(this.adapter.state.selected));
|
|
527
|
+
this.toggleClass(this.adapter.state.selected, CssClasses.SELECTED);
|
|
528
|
+
this.toggleClass(!this.adapter.state.selected, CssClasses.UNSELECTED);
|
|
529
|
+
};
|
|
530
|
+
MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {
|
|
531
|
+
if (addClass) {
|
|
532
|
+
this.adapter.addClass(className);
|
|
198
533
|
}
|
|
199
534
|
else {
|
|
200
|
-
this.adapter.removeClass(
|
|
535
|
+
this.adapter.removeClass(className);
|
|
201
536
|
}
|
|
202
537
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
};
|
|
206
|
-
return MDCSwitchFoundation;
|
|
207
|
-
}(MDCFoundation));
|
|
538
|
+
return MDCSwitchRenderFoundation;
|
|
539
|
+
}(MDCSwitchFoundation));
|
|
208
540
|
|
|
209
541
|
/**
|
|
210
542
|
* @license
|
|
211
|
-
* Copyright
|
|
543
|
+
* Copyright 2021 Google Inc.
|
|
212
544
|
*
|
|
213
545
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
214
546
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -228,112 +560,77 @@ var MDCSwitchFoundation = /** @class */ (function (_super) {
|
|
|
228
560
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
229
561
|
* THE SOFTWARE.
|
|
230
562
|
*/
|
|
563
|
+
/**
|
|
564
|
+
* `MDCSwitch` provides a component implementation of a Material Design switch.
|
|
565
|
+
*/
|
|
231
566
|
var MDCSwitch = /** @class */ (function (_super) {
|
|
232
567
|
__extends(MDCSwitch, _super);
|
|
233
|
-
function MDCSwitch() {
|
|
234
|
-
var _this = _super
|
|
235
|
-
_this.
|
|
568
|
+
function MDCSwitch(root, foundation) {
|
|
569
|
+
var _this = _super.call(this, root, foundation) || this;
|
|
570
|
+
_this.root = root;
|
|
236
571
|
return _this;
|
|
237
572
|
}
|
|
573
|
+
/**
|
|
574
|
+
* Creates a new `MDCSwitch` and attaches it to the given root element.
|
|
575
|
+
* @param root The root to attach to.
|
|
576
|
+
* @return the new component instance.
|
|
577
|
+
*/
|
|
238
578
|
MDCSwitch.attachTo = function (root) {
|
|
239
579
|
return new MDCSwitch(root);
|
|
240
580
|
};
|
|
241
|
-
MDCSwitch.prototype.
|
|
242
|
-
|
|
243
|
-
this.ripple_.destroy();
|
|
244
|
-
this.nativeControl_.removeEventListener('change', this.changeHandler_);
|
|
581
|
+
MDCSwitch.prototype.initialize = function () {
|
|
582
|
+
this.ripple = new MDCRipple(this.root, this.createRippleFoundation());
|
|
245
583
|
};
|
|
246
584
|
MDCSwitch.prototype.initialSyncWithDOM = function () {
|
|
247
|
-
var
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// Do an initial sync between the native control and the foundation.
|
|
260
|
-
this.checked = this.checked;
|
|
585
|
+
var rippleElement = this.root.querySelector(Selectors.RIPPLE);
|
|
586
|
+
if (!rippleElement) {
|
|
587
|
+
throw new Error("Switch " + Selectors.RIPPLE + " element is required.");
|
|
588
|
+
}
|
|
589
|
+
this.rippleElement = rippleElement;
|
|
590
|
+
this.root.addEventListener('click', this.foundation.handleClick);
|
|
591
|
+
this.foundation.initFromDOM();
|
|
592
|
+
};
|
|
593
|
+
MDCSwitch.prototype.destroy = function () {
|
|
594
|
+
_super.prototype.destroy.call(this);
|
|
595
|
+
this.ripple.destroy();
|
|
596
|
+
this.root.removeEventListener('click', this.foundation.handleClick);
|
|
261
597
|
};
|
|
262
598
|
MDCSwitch.prototype.getDefaultFoundation = function () {
|
|
599
|
+
return new MDCSwitchRenderFoundation(this.createAdapter());
|
|
600
|
+
};
|
|
601
|
+
MDCSwitch.prototype.createAdapter = function () {
|
|
263
602
|
var _this = this;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
addClass: function (className) { return _this.root.classList.add(className); },
|
|
268
|
-
removeClass: function (className) { return _this.root.classList.remove(className); },
|
|
269
|
-
setNativeControlChecked: function (checked) { return _this.nativeControl_.checked =
|
|
270
|
-
checked; },
|
|
271
|
-
setNativeControlDisabled: function (disabled) { return _this.nativeControl_.disabled =
|
|
272
|
-
disabled; },
|
|
273
|
-
setNativeControlAttr: function (attr, value) {
|
|
274
|
-
return _this.nativeControl_.setAttribute(attr, value);
|
|
603
|
+
return {
|
|
604
|
+
addClass: function (className) {
|
|
605
|
+
_this.root.classList.add(className);
|
|
275
606
|
},
|
|
607
|
+
hasClass: function (className) { return _this.root.classList.contains(className); },
|
|
608
|
+
isDisabled: function () { return _this.root.disabled; },
|
|
609
|
+
removeClass: function (className) {
|
|
610
|
+
_this.root.classList.remove(className);
|
|
611
|
+
},
|
|
612
|
+
setAriaChecked: function (ariaChecked) {
|
|
613
|
+
return _this.root.setAttribute('aria-checked', ariaChecked);
|
|
614
|
+
},
|
|
615
|
+
setDisabled: function (disabled) {
|
|
616
|
+
_this.root.disabled = disabled;
|
|
617
|
+
},
|
|
618
|
+
state: this,
|
|
276
619
|
};
|
|
277
|
-
return new MDCSwitchFoundation(adapter);
|
|
278
620
|
};
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
enumerable: false,
|
|
284
|
-
configurable: true
|
|
285
|
-
});
|
|
286
|
-
Object.defineProperty(MDCSwitch.prototype, "checked", {
|
|
287
|
-
get: function () {
|
|
288
|
-
return this.nativeControl_.checked;
|
|
289
|
-
},
|
|
290
|
-
set: function (checked) {
|
|
291
|
-
this.foundation.setChecked(checked);
|
|
292
|
-
},
|
|
293
|
-
enumerable: false,
|
|
294
|
-
configurable: true
|
|
295
|
-
});
|
|
296
|
-
Object.defineProperty(MDCSwitch.prototype, "disabled", {
|
|
297
|
-
get: function () {
|
|
298
|
-
return this.nativeControl_.disabled;
|
|
299
|
-
},
|
|
300
|
-
set: function (disabled) {
|
|
301
|
-
this.foundation.setDisabled(disabled);
|
|
302
|
-
},
|
|
303
|
-
enumerable: false,
|
|
304
|
-
configurable: true
|
|
305
|
-
});
|
|
306
|
-
MDCSwitch.prototype.createRipple_ = function () {
|
|
621
|
+
MDCSwitch.prototype.createRippleFoundation = function () {
|
|
622
|
+
return new MDCRippleFoundation(this.createRippleAdapter());
|
|
623
|
+
};
|
|
624
|
+
MDCSwitch.prototype.createRippleAdapter = function () {
|
|
307
625
|
var _this = this;
|
|
308
|
-
|
|
309
|
-
var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR);
|
|
310
|
-
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
|
|
311
|
-
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
|
|
312
|
-
var adapter = __assign(__assign({}, MDCRipple.createAdapter(this)), { addClass: function (className) { return rippleSurface.classList.add(className); }, computeBoundingRect: function () { return rippleSurface.getBoundingClientRect(); }, deregisterInteractionHandler: function (evtType, handler) {
|
|
313
|
-
_this.nativeControl_.removeEventListener(evtType, handler, applyPassive());
|
|
314
|
-
}, isSurfaceActive: function () { return matches(_this.nativeControl_, ':active'); }, isUnbounded: function () { return true; }, registerInteractionHandler: function (evtType, handler) {
|
|
315
|
-
_this.nativeControl_.addEventListener(evtType, handler, applyPassive());
|
|
316
|
-
}, removeClass: function (className) {
|
|
317
|
-
rippleSurface.classList.remove(className);
|
|
318
|
-
}, updateCssVariable: function (varName, value) {
|
|
319
|
-
rippleSurface.style.setProperty(varName, value);
|
|
320
|
-
} });
|
|
321
|
-
return new MDCRipple(this.root, new MDCRippleFoundation(adapter));
|
|
626
|
+
return __assign(__assign({}, MDCRipple.createAdapter(this)), { computeBoundingRect: function () { return _this.rippleElement.getBoundingClientRect(); }, isUnbounded: function () { return true; } });
|
|
322
627
|
};
|
|
323
|
-
Object.defineProperty(MDCSwitch.prototype, "nativeControl_", {
|
|
324
|
-
get: function () {
|
|
325
|
-
var NATIVE_CONTROL_SELECTOR = MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
|
|
326
|
-
return this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
|
327
|
-
},
|
|
328
|
-
enumerable: false,
|
|
329
|
-
configurable: true
|
|
330
|
-
});
|
|
331
628
|
return MDCSwitch;
|
|
332
629
|
}(MDCComponent));
|
|
333
630
|
|
|
334
|
-
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}";
|
|
631
|
+
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}";
|
|
335
632
|
|
|
336
|
-
|
|
633
|
+
const Switch = class {
|
|
337
634
|
constructor(hostRef) {
|
|
338
635
|
registerInstance(this, hostRef);
|
|
339
636
|
this.change = createEvent(this, "change", 7);
|
|
@@ -355,9 +652,9 @@ let Switch = class {
|
|
|
355
652
|
*/
|
|
356
653
|
this.value = false;
|
|
357
654
|
this.fieldId = createRandomString();
|
|
358
|
-
this.
|
|
655
|
+
this.handleClick = (event) => {
|
|
359
656
|
event.stopPropagation();
|
|
360
|
-
this.change.emit(
|
|
657
|
+
this.change.emit(!this.value);
|
|
361
658
|
};
|
|
362
659
|
}
|
|
363
660
|
connectedCallback() {
|
|
@@ -379,21 +676,20 @@ let Switch = class {
|
|
|
379
676
|
}
|
|
380
677
|
render() {
|
|
381
678
|
return [
|
|
382
|
-
h("
|
|
679
|
+
h("button", { id: this.fieldId, class: {
|
|
383
680
|
'mdc-switch': true,
|
|
384
|
-
'mdc-switch--disabled': this.disabled || this.readonly,
|
|
385
681
|
'lime-switch--readonly': this.readonly,
|
|
386
|
-
|
|
682
|
+
'mdc-switch--unselected': !this.value,
|
|
683
|
+
'mdc-switch--selected': this.value,
|
|
684
|
+
}, type: "button", role: "switch", "aria-checked": this.value, disabled: this.disabled || this.readonly, onClick: this.handleClick }, h("div", { class: "mdc-switch__track" }), h("div", { class: "mdc-switch__handle-track" }, h("div", { class: "mdc-switch__handle" }, h("div", { class: "mdc-switch__shadow" }, h("div", { class: "mdc-elevation-overlay" })), h("div", { class: "mdc-switch__ripple" }), h("div", { class: "mdc-switch__icons" }, h("svg", { class: "mdc-switch__icon mdc-switch__icon--on", viewBox: "0 0 24 24" }, h("path", { d: "M19.69,5.23L8.96,15.96l-4.23-4.23L2.96,13.5l6,6L21.46,7L19.69,5.23z" })), h("svg", { class: "mdc-switch__icon mdc-switch__icon--off", viewBox: "0 0 24 24" }, h("path", { d: "M20 13H4v-2h16v2z" })))))),
|
|
387
685
|
h("label", { class: `${this.disabled || this.readonly ? 'disabled' : ''}`, htmlFor: this.fieldId }, this.label),
|
|
388
686
|
];
|
|
389
687
|
}
|
|
390
|
-
valueWatcher(newValue
|
|
688
|
+
valueWatcher(newValue) {
|
|
391
689
|
if (!this.mdcSwitch) {
|
|
392
690
|
return;
|
|
393
691
|
}
|
|
394
|
-
|
|
395
|
-
this.mdcSwitch.checked = newValue;
|
|
396
|
-
}
|
|
692
|
+
this.mdcSwitch.selected = newValue;
|
|
397
693
|
}
|
|
398
694
|
get host() { return getElement(this); }
|
|
399
695
|
static get watchers() { return {
|