@limetech/lime-elements 37.12.1 → 37.13.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/CHANGELOG.md +24 -0
- package/dist/cjs/{checkbox.template-e7aa89b5.js → checkbox.template-02070306.js} +15 -2
- package/dist/cjs/checkbox.template-02070306.js.map +1 -0
- package/dist/cjs/dom-ee8ee17d.js +244 -0
- package/dist/cjs/dom-ee8ee17d.js.map +1 -0
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js +7 -3
- package/dist/cjs/limel-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/{limel-helper-line.cjs.entry.js → limel-dynamic-label_2.cjs.entry.js} +47 -1
- package/dist/cjs/limel-dynamic-label_2.cjs.entry.js.map +1 -0
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +5 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +6 -3
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-input-field_3.cjs.entry.js +6 -212
- package/dist/cjs/limel-input-field_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +23 -237
- package/dist/cjs/limel-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js +24 -7
- package/dist/cjs/limel-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/checkbox/checkbox.css +0 -24
- package/dist/collection/components/checkbox/checkbox.js +33 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.template.js +14 -1
- package/dist/collection/components/checkbox/checkbox.template.js.map +1 -1
- package/dist/collection/components/dynamic-label/dynamic-label.css +84 -0
- package/dist/collection/components/dynamic-label/dynamic-label.js +142 -0
- package/dist/collection/components/dynamic-label/dynamic-label.js.map +1 -0
- package/dist/collection/components/dynamic-label/label.types.js +2 -0
- package/dist/collection/components/dynamic-label/label.types.js.map +1 -0
- package/dist/collection/components/form/widgets/checkbox.js +6 -3
- package/dist/collection/components/form/widgets/checkbox.js.map +1 -1
- package/dist/collection/components/list/list.css +0 -48
- package/dist/collection/components/menu-list/menu-list.css +0 -52
- package/dist/collection/components/picker/picker.js +18 -21
- package/dist/collection/components/picker/picker.js.map +1 -1
- package/dist/collection/components/switch/switch.css +0 -14
- package/dist/collection/components/switch/switch.js +52 -7
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/interface.js +2 -0
- package/dist/collection/interface.js.map +1 -1
- package/dist/esm/{checkbox.template-50268c7d.js → checkbox.template-10fda4a9.js} +15 -2
- package/dist/esm/checkbox.template-10fda4a9.js.map +1 -0
- package/dist/esm/dom-ae531ebc.js +241 -0
- package/dist/esm/dom-ae531ebc.js.map +1 -0
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-breadcrumbs_3.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_3.entry.js.map +1 -1
- package/dist/esm/limel-checkbox.entry.js +7 -3
- package/dist/esm/limel-checkbox.entry.js.map +1 -1
- package/dist/esm/{limel-helper-line.entry.js → limel-dynamic-label_2.entry.js} +47 -2
- package/dist/esm/limel-dynamic-label_2.entry.js.map +1 -0
- package/dist/esm/limel-flatpickr-adapter.entry.js +5 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js.map +1 -1
- package/dist/esm/limel-form.entry.js +6 -3
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/limel-input-field_3.entry.js +5 -211
- package/dist/esm/limel-input-field_3.entry.js.map +1 -1
- package/dist/esm/limel-picker.entry.js +23 -237
- package/dist/esm/limel-picker.entry.js.map +1 -1
- package/dist/esm/limel-switch.entry.js +25 -8
- package/dist/esm/limel-switch.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js.map +1 -1
- package/dist/lime-elements/{p-e5ca6c0c.entry.js → p-20d26cdf.entry.js} +6 -6
- package/dist/lime-elements/p-20d26cdf.entry.js.map +1 -0
- package/dist/lime-elements/p-714d6937.js +2 -0
- package/dist/lime-elements/p-714d6937.js.map +1 -0
- package/dist/lime-elements/{p-fb44db4d.entry.js → p-77a07224.entry.js} +2 -2
- package/dist/lime-elements/{p-fb44db4d.entry.js.map → p-77a07224.entry.js.map} +1 -1
- package/dist/lime-elements/{p-1b4d3901.entry.js → p-932185ef.entry.js} +2 -2
- package/dist/lime-elements/{p-1b4d3901.entry.js.map → p-932185ef.entry.js.map} +1 -1
- package/dist/lime-elements/p-9468b1b8.entry.js +2 -0
- package/dist/lime-elements/p-9468b1b8.entry.js.map +1 -0
- package/dist/lime-elements/p-9fd032ca.entry.js +2 -0
- package/dist/lime-elements/p-9fd032ca.entry.js.map +1 -0
- package/dist/lime-elements/p-a98c3ea7.entry.js +2 -0
- package/dist/lime-elements/p-a98c3ea7.entry.js.map +1 -0
- package/dist/lime-elements/{p-386d1c5a.entry.js → p-aa8befcd.entry.js} +7 -7
- package/dist/lime-elements/p-aa8befcd.entry.js.map +1 -0
- package/dist/lime-elements/p-d35e5b2f.js +2 -0
- package/dist/lime-elements/p-d35e5b2f.js.map +1 -0
- package/dist/lime-elements/p-ffe1fc16.entry.js +68 -0
- package/dist/lime-elements/{p-885274d9.entry.js.map → p-ffe1fc16.entry.js.map} +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +8 -0
- package/dist/types/components/checkbox/checkbox.template.d.ts +2 -0
- package/dist/types/components/dynamic-label/dynamic-label.d.ts +43 -0
- package/dist/types/components/dynamic-label/label.types.d.ts +20 -0
- package/dist/types/components/picker/picker.d.ts +1 -1
- package/dist/types/components/switch/switch.d.ts +9 -1
- package/dist/types/components.d.ts +123 -0
- package/dist/types/interface.d.ts +3 -1
- package/package.json +9 -10
- package/dist/cjs/checkbox.template-e7aa89b5.js.map +0 -1
- package/dist/cjs/dom-81eaa633.js +0 -34
- package/dist/cjs/dom-81eaa633.js.map +0 -1
- package/dist/cjs/limel-helper-line.cjs.entry.js.map +0 -1
- package/dist/esm/checkbox.template-50268c7d.js.map +0 -1
- package/dist/esm/dom-0b0170a0.js +0 -32
- package/dist/esm/dom-0b0170a0.js.map +0 -1
- package/dist/esm/limel-helper-line.entry.js.map +0 -1
- package/dist/lime-elements/p-042e5620.entry.js +0 -16
- package/dist/lime-elements/p-042e5620.entry.js.map +0 -1
- package/dist/lime-elements/p-27330d1d.entry.js +0 -2
- package/dist/lime-elements/p-27330d1d.entry.js.map +0 -1
- package/dist/lime-elements/p-386d1c5a.entry.js.map +0 -1
- package/dist/lime-elements/p-4015e8e9.entry.js +0 -2
- package/dist/lime-elements/p-4015e8e9.entry.js.map +0 -1
- package/dist/lime-elements/p-5e7b7b03.js +0 -2
- package/dist/lime-elements/p-5e7b7b03.js.map +0 -1
- package/dist/lime-elements/p-61aa37de.js +0 -2
- package/dist/lime-elements/p-61aa37de.js.map +0 -1
- package/dist/lime-elements/p-885274d9.entry.js +0 -68
- package/dist/lime-elements/p-e5ca6c0c.entry.js.map +0 -1
|
@@ -26,6 +26,7 @@ import { CheckboxTemplate } from './checkbox.template';
|
|
|
26
26
|
*
|
|
27
27
|
* @exampleComponent limel-example-checkbox
|
|
28
28
|
* @exampleComponent limel-example-checkbox-helper-text
|
|
29
|
+
* @exampleComponent limel-example-checkbox-readonly
|
|
29
30
|
*/
|
|
30
31
|
export class Checkbox {
|
|
31
32
|
constructor() {
|
|
@@ -64,9 +65,13 @@ export class Checkbox {
|
|
|
64
65
|
this.checked = false;
|
|
65
66
|
this.indeterminate = false;
|
|
66
67
|
this.required = false;
|
|
68
|
+
this.readonlyLabels = [];
|
|
67
69
|
this.modified = false;
|
|
68
70
|
}
|
|
69
71
|
handleCheckedChange(newValue) {
|
|
72
|
+
if (!this.mdcCheckbox) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
70
75
|
this.mdcCheckbox.checked = newValue;
|
|
71
76
|
}
|
|
72
77
|
handleIndeterminateChange(newValue) {
|
|
@@ -89,7 +94,7 @@ export class Checkbox {
|
|
|
89
94
|
}
|
|
90
95
|
}
|
|
91
96
|
render() {
|
|
92
|
-
return (h(CheckboxTemplate, { disabled: this.disabled || this.readonly, label: this.label, helperText: this.helperText, helperTextId: this.helperTextId, checked: this.checked || this.indeterminate, indeterminate: this.indeterminate, required: this.required, readonly: this.readonly, invalid: this.isInvalid(), onChange: this.onChange, id: this.id }));
|
|
97
|
+
return (h(CheckboxTemplate, { disabled: this.disabled || this.readonly, label: this.label, readonlyLabels: this.readonlyLabels, helperText: this.helperText, helperTextId: this.helperTextId, checked: this.checked || this.indeterminate, indeterminate: this.indeterminate, required: this.required, readonly: this.readonly, invalid: this.isInvalid(), onChange: this.onChange, id: this.id }));
|
|
93
98
|
}
|
|
94
99
|
static get is() { return "limel-checkbox"; }
|
|
95
100
|
static get encapsulation() { return "shadow"; }
|
|
@@ -245,6 +250,33 @@ export class Checkbox {
|
|
|
245
250
|
"attribute": "required",
|
|
246
251
|
"reflect": true,
|
|
247
252
|
"defaultValue": "false"
|
|
253
|
+
},
|
|
254
|
+
"readonlyLabels": {
|
|
255
|
+
"type": "unknown",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "Array<Label<boolean>>",
|
|
259
|
+
"resolved": "Label<boolean>[]",
|
|
260
|
+
"references": {
|
|
261
|
+
"Array": {
|
|
262
|
+
"location": "global"
|
|
263
|
+
},
|
|
264
|
+
"Label": {
|
|
265
|
+
"location": "import",
|
|
266
|
+
"path": "../dynamic-label/label.types"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"required": false,
|
|
271
|
+
"optional": true,
|
|
272
|
+
"docs": {
|
|
273
|
+
"tags": [{
|
|
274
|
+
"name": "beta",
|
|
275
|
+
"text": undefined
|
|
276
|
+
}],
|
|
277
|
+
"text": "The labels to use to clarify what kind of data is being visualized,\nwhen the component is `readonly`."
|
|
278
|
+
},
|
|
279
|
+
"defaultValue": "[]"
|
|
248
280
|
}
|
|
249
281
|
};
|
|
250
282
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACH,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,GACR,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,MAAM,OAAO,QAAQ;;IA0ET,OAAE,GAAW,kBAAkB,EAAE,CAAC;IA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CAAC,SAAS,EAAE,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,IAAI,CAAC,EAAE,GACb,CACL,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCJ","sourcesContent":["import { MDCCheckbox, cssClasses } from '@material/checkbox';\nimport { MDCFormField } from '@material/form-field';\nimport {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { createRandomString } from '../../util/random-string';\nimport { CheckboxTemplate } from './checkbox.template';\nimport { Label } from '../dynamic-label/label.types';\n\n/**\n * The Checkbox component is a classic and essential element in UI design that allows\n * users to make multiple selections from a predefined list of options. The Checkbox component is commonly used in forms and settings interfaces to enable users to\n * select one or more items from a list of choices.\n *\n * ## States of a Checkbox\n * When a user clicks or taps on the box, it toggles between two states:\n * Checked and Unchecked.\n *\n * However, a Checkbox can visualize a third state called the \"Indeterminate\" state.\n * In this state, the checkbox appears as a filled box with a horizontal line or dash inside it.\n *\n * The Indeterminate state is typically used when dealing with checkbox groups\n * that have hierarchical relationships or when the group contains sub-items.\n * This state is used to indicate that that some, but not all, of the items in a group are selected.\n *\n * :::important\n * Checkboxes are sometimes used interchangeably with switches in user interfaces.\n * But there is an important difference between the two! Please read our guidelines about\n * [Switch vs. Checkbox](/#/DesignGuidelines/switch-vs-checkbox.md/).\n *\n * @exampleComponent limel-example-checkbox\n * @exampleComponent limel-example-checkbox-helper-text\n * @exampleComponent limel-example-checkbox-readonly\n */\n@Component({\n tag: 'limel-checkbox',\n shadow: true,\n styleUrl: 'checkbox.scss',\n})\nexport class Checkbox {\n /**\n * Disables the checkbox when `true`. Works exactly the same as `readonly`.\n * If either property is `true`, the checkbox will be disabled.\n */\n @Prop({ reflect: true })\n public disabled = false;\n\n /**\n * Disables the checkbox when `true`. This visualizes the checkbox slightly differently.\n * But shows no visual sign indicating that the checkbox is disabled\n * or can ever become interactable.\n */\n @Prop({ reflect: true })\n public readonly = false;\n\n /**\n * Set to `true` to indicate that the current value is invalid.\n */\n @Prop({ reflect: true })\n public invalid: boolean;\n\n /**\n * The checkbox label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Optional helper text to display below the checkbox\n */\n @Prop({ reflect: true })\n public helperText: string;\n\n /**\n * The value of the checkbox. Set to `true` to make the checkbox checked.\n */\n @Prop({ reflect: true })\n public checked = false;\n\n /**\n * Enables indeterminate state. Set to `true` to signal indeterminate check.\n */\n @Prop({ reflect: true })\n public indeterminate = false;\n\n /**\n * Set to `true` to indicate that the checkbox must be checked.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * The labels to use to clarify what kind of data is being visualized,\n * when the component is `readonly`.\n * @beta\n */\n @Prop()\n public readonlyLabels?: Array<Label<boolean>> = [];\n\n @State()\n private modified = false;\n\n /**\n * Emitted when the input value is changed.\n */\n @Event()\n private change: EventEmitter<boolean>;\n\n @Element()\n private limelCheckbox: HTMLLimelCheckboxElement;\n\n private formField: MDCFormField;\n private mdcCheckbox: MDCCheckbox;\n private id: string = createRandomString();\n private helperTextId: string = createRandomString();\n\n @Watch('checked')\n protected handleCheckedChange(newValue: boolean) {\n if (!this.mdcCheckbox) {\n return;\n }\n\n this.mdcCheckbox.checked = newValue;\n }\n\n @Watch('indeterminate')\n protected handleIndeterminateChange(newValue: boolean) {\n this.mdcCheckbox.checked = this.checked;\n this.mdcCheckbox.indeterminate = newValue;\n }\n\n public connectedCallback() {\n this.initialize();\n }\n\n public componentDidLoad() {\n this.initialize();\n }\n\n public disconnectedCallback() {\n this.mdcCheckbox?.destroy();\n this.formField?.destroy();\n\n const checkboxElement = this.getCheckboxElement();\n if (checkboxElement) {\n checkboxElement.classList.remove(\n cssClasses.ANIM_CHECKED_INDETERMINATE,\n cssClasses.ANIM_CHECKED_UNCHECKED,\n cssClasses.ANIM_INDETERMINATE_CHECKED,\n cssClasses.ANIM_INDETERMINATE_UNCHECKED,\n cssClasses.ANIM_UNCHECKED_CHECKED,\n cssClasses.ANIM_UNCHECKED_INDETERMINATE,\n );\n }\n }\n\n public render() {\n return (\n <CheckboxTemplate\n disabled={this.disabled || this.readonly}\n label={this.label}\n readonlyLabels={this.readonlyLabels}\n helperText={this.helperText}\n helperTextId={this.helperTextId}\n checked={this.checked || this.indeterminate}\n indeterminate={this.indeterminate}\n required={this.required}\n readonly={this.readonly}\n invalid={this.isInvalid()}\n onChange={this.onChange}\n id={this.id}\n />\n );\n }\n\n private isInvalid = () => {\n if (this.invalid) {\n return true;\n }\n\n if (this.required && this.modified && !this.checked) {\n return true;\n }\n };\n\n private initialize = () => {\n const element =\n this.limelCheckbox.shadowRoot.querySelector('.mdc-form-field');\n if (!element) {\n return;\n }\n\n this.formField = new MDCFormField(element);\n this.mdcCheckbox = new MDCCheckbox(this.getCheckboxElement());\n this.formField.input = this.mdcCheckbox;\n };\n\n private getCheckboxElement = () => {\n return this.limelCheckbox.shadowRoot.querySelector('.mdc-checkbox');\n };\n\n private onChange = (event: Event) => {\n event.stopPropagation();\n this.change.emit(this.mdcCheckbox.checked);\n this.modified = true;\n };\n}\n"]}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
export const CheckboxTemplate = (props) => {
|
|
3
3
|
const inputProps = {};
|
|
4
|
+
if (props.readonly) {
|
|
5
|
+
let icon = 'minus';
|
|
6
|
+
if (props.checked) {
|
|
7
|
+
icon = {
|
|
8
|
+
name: 'ok',
|
|
9
|
+
color: 'var(--mdc-theme-primary)',
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return [
|
|
13
|
+
h("limel-dynamic-label", { value: props.checked, "aria-controls": props.helperTextId, defaultLabel: { text: props.label, icon: icon }, labels: props.readonlyLabels }),
|
|
14
|
+
h(HelperText, { text: props.helperText, helperTextId: props.helperTextId, invalid: props.invalid }),
|
|
15
|
+
];
|
|
16
|
+
}
|
|
4
17
|
if (props.indeterminate) {
|
|
5
18
|
inputProps['data-indeterminate'] = 'true';
|
|
6
19
|
}
|
|
@@ -19,7 +32,7 @@ export const CheckboxTemplate = (props) => {
|
|
|
19
32
|
'mdc-checkbox--indeterminate': props.indeterminate,
|
|
20
33
|
'lime-checkbox--readonly': props.readonly,
|
|
21
34
|
}, htmlFor: props.id }, props.label)),
|
|
22
|
-
h(HelperText, { text: props.helperText, helperTextId: props.helperTextId }),
|
|
35
|
+
h(HelperText, { text: props.helperText, helperTextId: props.helperTextId, invalid: props.invalid }),
|
|
23
36
|
];
|
|
24
37
|
};
|
|
25
38
|
const HelperText = (props) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.template.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"checkbox.template.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,CAAC,EAAE,MAAM,eAAe,CAAC;AAmBvD,MAAM,CAAC,MAAM,gBAAgB,GAA+C,CACxE,KAAK,EACP,EAAE;EACA,MAAM,UAAU,GAAG,EAAE,CAAC;EACtB,IAAI,KAAK,CAAC,QAAQ,EAAE;IAChB,IAAI,IAAI,GAAkB,OAAO,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,EAAE;MACf,IAAI,GAAG;QACH,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,0BAA0B;OACpC,CAAC;KACL;IAED,OAAO;MACH,2BACI,KAAK,EAAE,KAAK,CAAC,OAAO,mBACL,K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CACJ;MACN,aACI,KAAK,EAAE;UACH,uBAAuB,EAAE,KAAK,CAAC,OAAO;UACtC,wBAAwB,EAAE,KAAK,CAAC,QAAQ;UACxC,wBAAwB,EAAE,KAAK,CAAC,QAAQ;UACxC,6BAA6B,EAAE,KAAK,CAAC,aAAa;UAClD,yBAAyB,EAAE,KAAK,CAAC,QAAQ;SAC5C,EACD,OAAO,EAAE,KAAK,CAAC,EAAE,IAEhB,KAAK,CAAC,KAAK,CACR,CACN;IACN,EAAC,UAAU,IACP,IAAI,EAAE,KAAK,CAAC,UAAU,EACtB,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB;GACL,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,UAAU,GAIX,CAAC,KAAK,EAAE,EAAE;EACX,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;IAChC,OAAO;GACV;EAED,OAAO,CACH,yBACI,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAC7B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,OAAO,EAAE,KAAK,CAAC,OAAO,GACxB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { FunctionalComponent, h } from '@stencil/core';\nimport { Label } from '../dynamic-label/label.types';\nimport { Icon } from '../../interface';\n\ninterface CheckboxTemplateProps {\n disabled?: boolean;\n id: string;\n checked?: boolean;\n readonly?: boolean;\n indeterminate?: boolean;\n required?: boolean;\n invalid?: boolean;\n onChange?: (event: Event) => void;\n label?: string;\n helperText?: string;\n helperTextId?: string;\n readonlyLabels?: Array<Label<boolean>>;\n}\n\nexport const CheckboxTemplate: FunctionalComponent<CheckboxTemplateProps> = (\n props,\n) => {\n const inputProps = {};\n if (props.readonly) {\n let icon: string | Icon = 'minus';\n if (props.checked) {\n icon = {\n name: 'ok',\n color: 'var(--mdc-theme-primary)',\n };\n }\n\n return [\n <limel-dynamic-label\n value={props.checked}\n aria-controls={props.helperTextId}\n defaultLabel={{ text: props.label, icon: icon }}\n labels={props.readonlyLabels}\n />,\n <HelperText\n text={props.helperText}\n helperTextId={props.helperTextId}\n invalid={props.invalid}\n />,\n ];\n }\n\n if (props.indeterminate) {\n inputProps['data-indeterminate'] = 'true';\n }\n\n return [\n <div class=\"mdc-form-field \">\n <div\n class={{\n 'mdc-checkbox': true,\n 'mdc-checkbox--invalid': props.invalid,\n 'mdc-checkbox--disabled': props.disabled,\n 'mdc-checkbox--required': props.required,\n 'mdc-checkbox--indeterminate': props.indeterminate,\n 'lime-checkbox--readonly': props.readonly,\n }}\n >\n <input\n type=\"checkbox\"\n class=\"mdc-checkbox__native-control\"\n id={props.id}\n checked={props.checked}\n disabled={props.disabled || props.readonly}\n required={props.required}\n onChange={props.onChange}\n aria-controls={props.helperTextId}\n aria-describedby={props.helperTextId}\n {...inputProps}\n />\n <div class=\"mdc-checkbox__background\">\n <svg class=\"mdc-checkbox__checkmark\" viewBox=\"0 0 24 24\">\n <path\n class=\"mdc-checkbox__checkmark-path\"\n fill=\"none\"\n d=\"M1.73,12.91 8.1,19.28 22.79,4.59\"\n />\n </svg>\n <div class=\"mdc-checkbox__mixedmark\" />\n </div>\n </div>\n <label\n class={{\n 'mdc-checkbox--invalid': props.invalid,\n 'mdc-checkbox--disabled': props.disabled,\n 'mdc-checkbox--required': props.required,\n 'mdc-checkbox--indeterminate': props.indeterminate,\n 'lime-checkbox--readonly': props.readonly,\n }}\n htmlFor={props.id}\n >\n {props.label}\n </label>\n </div>,\n <HelperText\n text={props.helperText}\n helperTextId={props.helperTextId}\n invalid={props.invalid}\n />,\n ];\n};\n\nconst HelperText: FunctionalComponent<{\n helperTextId: string;\n text: string;\n invalid?: boolean;\n}> = (props) => {\n if (typeof props.text !== 'string') {\n return;\n }\n\n return (\n <limel-helper-line\n helperText={props.text.trim()}\n helperTextId={props.helperTextId}\n invalid={props.invalid}\n />\n );\n};\n"]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/**
|
|
3
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
4
|
+
* node module, for consumer projects to import.
|
|
5
|
+
* That means this file cannot import from any file that isn't
|
|
6
|
+
* also exported, keeping the same relative path.
|
|
7
|
+
*
|
|
8
|
+
* Or, just don't import anything, that works too.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* This can be used on a trigger element that opens a dropdown menu or a popover.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* This mixin will mask out the content that is close to
|
|
15
|
+
* the edges of a scrollable area.
|
|
16
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
17
|
+
* as an argument for `$direction`.
|
|
18
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
19
|
+
* as an argument for `$direction`.
|
|
20
|
+
*
|
|
21
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
22
|
+
* the size of the fade-out edge effect is the same as the
|
|
23
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
24
|
+
* scrollable area that does not have a padding will fade out before
|
|
25
|
+
* any scrolling has been done.
|
|
26
|
+
* This is why this mixin already adds paddings, which automatically
|
|
27
|
+
* default to the size of the fade-out effect.
|
|
28
|
+
* This size defaults to `1rem`, but to override the size use
|
|
29
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
30
|
+
* when `vertically` argument is set, and use
|
|
31
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
32
|
+
* when `horizontally` argument is set.
|
|
33
|
+
* Of course you can also programmatically increase and decrease the
|
|
34
|
+
* size of these variables for each edge, based on the amount of
|
|
35
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
36
|
+
* to add a custom padding where the mixin is used, to override
|
|
37
|
+
* the paddings that are automatically added by the mixin in the
|
|
38
|
+
* compiled CSS code.
|
|
39
|
+
*/
|
|
40
|
+
/**
|
|
41
|
+
* This mixin will add an animated underline to the bottom of an `a` elements.
|
|
42
|
+
* Note that you may need to add `all: unset;` –depending on your use case–
|
|
43
|
+
* before using this mixin.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* This mixin creates a cross-browser font stack.
|
|
47
|
+
* - `sans-serif` can be used for the UI of the components.
|
|
48
|
+
* - `monospace` can be used for code.
|
|
49
|
+
*
|
|
50
|
+
* ⚠️ If we change the font stacks, we need to update
|
|
51
|
+
* 1. the consumer documentation in `README.md`, and
|
|
52
|
+
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
53
|
+
* in the `<style>` tag of `index.html`.
|
|
54
|
+
*/
|
|
55
|
+
* {
|
|
56
|
+
box-sizing: border-box;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host(limel-dynamic-label) {
|
|
61
|
+
--limel-dynamic-label-min-height: 1.75rem;
|
|
62
|
+
display: flex;
|
|
63
|
+
gap: 0.5rem;
|
|
64
|
+
align-items: center;
|
|
65
|
+
border-radius: 0.5rem;
|
|
66
|
+
min-width: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
limel-icon {
|
|
70
|
+
--limel-icon-svg-margin: 0.125rem;
|
|
71
|
+
border-radius: 0.25rem;
|
|
72
|
+
flex-shrink: 0;
|
|
73
|
+
width: var(--limel-dynamic-label-min-height);
|
|
74
|
+
color: rgb(var(--contrast-900));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
span {
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
white-space: nowrap;
|
|
80
|
+
text-overflow: ellipsis;
|
|
81
|
+
flex-grow: 1;
|
|
82
|
+
font-size: 0.8125rem;
|
|
83
|
+
color: var(--mdc-theme-on-surface);
|
|
84
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { getIconName } from '../icon/get-icon-props';
|
|
2
|
+
import { h } from '@stencil/core';
|
|
3
|
+
/**
|
|
4
|
+
* This components displays a different label depending on the current given
|
|
5
|
+
* value. A label can consist of a text and an optional icon. If no matching
|
|
6
|
+
* label is found among the given `labels`, the `defaultLabel` will be displayed.
|
|
7
|
+
*
|
|
8
|
+
* One use case of the component is to enhance the visualization of a `boolean`
|
|
9
|
+
* field like a checkbox or switch in a `readonly` state.
|
|
10
|
+
*
|
|
11
|
+
* The reason we offer this component is that the default styling
|
|
12
|
+
* of the Checkbox or Toggle switch in the `readonly` state may not always
|
|
13
|
+
* provide the best way of _visualizing information_, potentially leading to
|
|
14
|
+
* confusion and negatively affecting the end-users' experience.
|
|
15
|
+
*
|
|
16
|
+
* @exampleComponent limel-example-dynamic-label
|
|
17
|
+
* @exampleComponent limel-example-dynamic-label-readonly-boolean
|
|
18
|
+
* @beta
|
|
19
|
+
*/
|
|
20
|
+
export class DynamicLabel {
|
|
21
|
+
constructor() {
|
|
22
|
+
this.value = undefined;
|
|
23
|
+
this.defaultLabel = {};
|
|
24
|
+
this.labels = [];
|
|
25
|
+
}
|
|
26
|
+
render() {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const label = this.labels.find((l) => l.value === this.value);
|
|
29
|
+
return [
|
|
30
|
+
this.renderIcon((_a = label === null || label === void 0 ? void 0 : label.icon) !== null && _a !== void 0 ? _a : this.defaultLabel.icon),
|
|
31
|
+
this.renderLabel((_b = label === null || label === void 0 ? void 0 : label.text) !== null && _b !== void 0 ? _b : this.defaultLabel.text),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
renderIcon(icon) {
|
|
35
|
+
const iconName = getIconName(icon);
|
|
36
|
+
if (!iconName) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
let iconColor;
|
|
40
|
+
let iconBackgroundColor;
|
|
41
|
+
if (typeof icon === 'object') {
|
|
42
|
+
iconColor = icon.color;
|
|
43
|
+
iconBackgroundColor = icon.backgroundColor;
|
|
44
|
+
}
|
|
45
|
+
const iconProps = {
|
|
46
|
+
role: 'presentation',
|
|
47
|
+
name: iconName,
|
|
48
|
+
style: {
|
|
49
|
+
color: iconColor,
|
|
50
|
+
'background-color': iconBackgroundColor,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
return h("limel-icon", Object.assign({}, iconProps));
|
|
54
|
+
}
|
|
55
|
+
renderLabel(label = '') {
|
|
56
|
+
return h("span", null, label);
|
|
57
|
+
}
|
|
58
|
+
static get is() { return "limel-dynamic-label"; }
|
|
59
|
+
static get encapsulation() { return "shadow"; }
|
|
60
|
+
static get originalStyleUrls() {
|
|
61
|
+
return {
|
|
62
|
+
"$": ["dynamic-label.scss"]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
static get styleUrls() {
|
|
66
|
+
return {
|
|
67
|
+
"$": ["dynamic-label.css"]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
static get properties() {
|
|
71
|
+
return {
|
|
72
|
+
"value": {
|
|
73
|
+
"type": "any",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "LabelValue",
|
|
77
|
+
"resolved": "boolean | number | string",
|
|
78
|
+
"references": {
|
|
79
|
+
"LabelValue": {
|
|
80
|
+
"location": "import",
|
|
81
|
+
"path": "./label.types"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"optional": false,
|
|
87
|
+
"docs": {
|
|
88
|
+
"tags": [],
|
|
89
|
+
"text": "The current value of the component which is used to match with the given\n`labels` to determine what label to display.\n\nIf not matching label is found, the `defaultLabel` is displayed."
|
|
90
|
+
},
|
|
91
|
+
"attribute": "value",
|
|
92
|
+
"reflect": false
|
|
93
|
+
},
|
|
94
|
+
"defaultLabel": {
|
|
95
|
+
"type": "unknown",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "Omit<Label, 'value'>",
|
|
99
|
+
"resolved": "{ text?: string; icon?: string | Icon; }",
|
|
100
|
+
"references": {
|
|
101
|
+
"Omit": {
|
|
102
|
+
"location": "global"
|
|
103
|
+
},
|
|
104
|
+
"Label": {
|
|
105
|
+
"location": "import",
|
|
106
|
+
"path": "./label.types"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"optional": false,
|
|
112
|
+
"docs": {
|
|
113
|
+
"tags": [],
|
|
114
|
+
"text": "The label to display when no matching value is found in the `labels`\narray. This is a fallback label that ensures there's always a label\ndisplayed for the component."
|
|
115
|
+
},
|
|
116
|
+
"defaultValue": "{}"
|
|
117
|
+
},
|
|
118
|
+
"labels": {
|
|
119
|
+
"type": "unknown",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "Label[]",
|
|
123
|
+
"resolved": "Label<LabelValue>[]",
|
|
124
|
+
"references": {
|
|
125
|
+
"Label": {
|
|
126
|
+
"location": "import",
|
|
127
|
+
"path": "./label.types"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": "A list of available labels. Each label has a corresponding value that\nwill be matched with the current `value` of the component to determine\nwhat label to display."
|
|
136
|
+
},
|
|
137
|
+
"defaultValue": "[]"
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=dynamic-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-label.js","sourceRoot":"","sources":["../../../src/components/dynamic-label/dynamic-label.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAInD;;;;;;;;;;;;;;;;GAgBG;AAMH,MAAM,OAAO,YAAY;;;wBAgBuB,EAAE;kBAQrB,EAAE;;EAEpB,MAAM;;IACT,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC;IAE9D,OAAO;MACH,IAAI,CAAC,UAAU,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,mCAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;MACtD,IAAI,CAAC,WAAW,CAAC,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,mCAAI,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC;KAC1D,CAAC;EACN,CAAC;EAEO,UAAU,CAAC,IAAoB;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,CAAC,QAAQ,EAAE;MACX,OAAO;KACV;IAED,IAAI,SAA6B,CAAC;IAClC,IAAI,mBAAuC,CAAC;IAE5C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;MAC1B,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;MACvB,mBAAmB,GAAG,IAAI,CAAC,eAAe,CAAC;KAC9C;IAED,MAAM,SAAS,GAAG;MACd,IAAI,EAAE,cAAc;MACpB,IAAI,EAAE,QAAQ;MACd,KAAK,EAAE;QACH,KAAK,EAAE,SAAS;QAChB,kBAAkB,EAAE,mBAAmB;OAC1C;KACJ,CAAC;IAEF,OAAO,kCAAgB,SAAS,EAAI,CAAC;EACzC,CAAC;EAEO,WAAW,CAAC,QAAgB,EAAE;IAClC,OAAO,gBAAO,KAAK,CAAQ,CAAC;EAChC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import { getIconName } from '../icon/get-icon-props';\nimport { Component, Prop, h } from '@stencil/core';\nimport { Label, LabelValue } from './label.types';\nimport { Icon } from '../../interface';\n\n/**\n * This components displays a different label depending on the current given\n * value. A label can consist of a text and an optional icon. If no matching\n * label is found among the given `labels`, the `defaultLabel` will be displayed.\n *\n * One use case of the component is to enhance the visualization of a `boolean`\n * field like a checkbox or switch in a `readonly` state.\n *\n * The reason we offer this component is that the default styling\n * of the Checkbox or Toggle switch in the `readonly` state may not always\n * provide the best way of _visualizing information_, potentially leading to\n * confusion and negatively affecting the end-users' experience.\n *\n * @exampleComponent limel-example-dynamic-label\n * @exampleComponent limel-example-dynamic-label-readonly-boolean\n * @beta\n */\n@Component({\n tag: 'limel-dynamic-label',\n shadow: true,\n styleUrl: 'dynamic-label.scss',\n})\nexport class DynamicLabel {\n /**\n * The current value of the component which is used to match with the given\n * `labels` to determine what label to display.\n *\n * If not matching label is found, the `defaultLabel` is displayed.\n */\n @Prop()\n public value: LabelValue;\n\n /**\n * The label to display when no matching value is found in the `labels`\n * array. This is a fallback label that ensures there's always a label\n * displayed for the component.\n */\n @Prop({ reflect: true })\n public defaultLabel: Omit<Label, 'value'> = {};\n\n /**\n * A list of available labels. Each label has a corresponding value that\n * will be matched with the current `value` of the component to determine\n * what label to display.\n */\n @Prop()\n public labels: Label[] = [];\n\n public render() {\n const label = this.labels.find((l) => l.value === this.value);\n\n return [\n this.renderIcon(label?.icon ?? this.defaultLabel.icon),\n this.renderLabel(label?.text ?? this.defaultLabel.text),\n ];\n }\n\n private renderIcon(icon?: string | Icon) {\n const iconName = getIconName(icon);\n if (!iconName) {\n return;\n }\n\n let iconColor: string | undefined;\n let iconBackgroundColor: string | undefined;\n\n if (typeof icon === 'object') {\n iconColor = icon.color;\n iconBackgroundColor = icon.backgroundColor;\n }\n\n const iconProps = {\n role: 'presentation',\n name: iconName,\n style: {\n color: iconColor,\n 'background-color': iconBackgroundColor,\n },\n };\n\n return <limel-icon {...iconProps} />;\n }\n\n private renderLabel(label: string = '') {\n return <span>{label}</span>;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.types.js","sourceRoot":"","sources":["../../../src/components/dynamic-label/label.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Icon } from '../../interface';\n\nexport type LabelValue = string | number | boolean | null | undefined;\n\n/**\n * @beta\n */\nexport interface Label<T = LabelValue> {\n /**\n * The value of the label\n */\n value: T;\n\n /**\n * Text to display when the label is active\n */\n text?: string;\n\n /**\n * Icon to display when the label is active\n */\n icon?: string | Icon;\n}\n"]}
|
|
@@ -8,13 +8,12 @@ export class Checkbox extends React.Component {
|
|
|
8
8
|
}
|
|
9
9
|
render() {
|
|
10
10
|
const props = this.props;
|
|
11
|
+
const additionalProps = getAdditionalProps(props.schema);
|
|
11
12
|
return React.createElement(LimeElementsWidgetAdapter, {
|
|
12
13
|
name: 'limel-checkbox',
|
|
13
14
|
value: props.value,
|
|
14
15
|
widgetProps: props,
|
|
15
|
-
extraProps: {
|
|
16
|
-
checked: !!props.value,
|
|
17
|
-
},
|
|
16
|
+
extraProps: Object.assign({ checked: !!props.value }, additionalProps),
|
|
18
17
|
events: {
|
|
19
18
|
change: this.handleChange,
|
|
20
19
|
},
|
|
@@ -29,4 +28,8 @@ export class Checkbox extends React.Component {
|
|
|
29
28
|
props.onChange(event.detail);
|
|
30
29
|
}
|
|
31
30
|
}
|
|
31
|
+
function getAdditionalProps(schema) {
|
|
32
|
+
var _a, _b, _c;
|
|
33
|
+
return (_c = (_b = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : {};
|
|
34
|
+
}
|
|
32
35
|
//# sourceMappingURL=checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../src/components/form/widgets/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAS;EAGzC,YAAmB,KAAkB;IACjC,KAAK,CAAC,KAAK,CAAC,CAAC;IADE,UAAK,GAAL,KAAK,CAAa;IAEjC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EACrD,CAAC;EAEM,MAAM;IACT,MAAM,KAAK,GAAgB,IAAI,CAAC,KAAK,CAAC;IACtC,MAAM,eAAe,GAAG,kBAAkB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,KAAK,CAAC,aAAa,CAAC,yBAAyB,EAAE;MAClD,IAAI,EAAE,gBAAgB;MACtB,KAAK,EAAE,KAAK,CAAC,KAAK;MAClB,WAAW,EAAE,KAAK;MAClB,UAAU,kBACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,IACnB,eAAe,CACrB;MACD,MAAM,EAAE;QACJ,MAAM,EAAE,IAAI,CAAC,YAAY;OAC5B;KACJ,CAAC,CAAC;EACP,CAAC;EAEO,YAAY,CAAC,KAA2B;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IACzB,KAAK,CAAC,eAAe,EAAE,CAAC;IAExB,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE;MACjB,OAAO;KACV;IAED,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;EACjC,CAAC;CACJ;AAED,SAAS,kBAAkB,CAAC,MAAkB;;EAC1C,OAAO,MAAA,MAAA,MAAA,MAAM,CAAC,IAAI,0CAAE,SAAS,0CAAE,KAAK,mCAAI,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["import React from 'react';\nimport { WidgetProps } from './types';\nimport { LimeElementsWidgetAdapter } from '../adapters';\nimport { FormSchema } from '../form.types';\n\nexport class Checkbox extends React.Component {\n public refs: any;\n\n constructor(public props: WidgetProps) {\n super(props);\n this.handleChange = this.handleChange.bind(this);\n }\n\n public render() {\n const props: WidgetProps = this.props;\n const additionalProps = getAdditionalProps(props.schema);\n\n return React.createElement(LimeElementsWidgetAdapter, {\n name: 'limel-checkbox',\n value: props.value,\n widgetProps: props,\n extraProps: {\n checked: !!props.value,\n ...additionalProps,\n },\n events: {\n change: this.handleChange,\n },\n });\n }\n\n private handleChange(event: CustomEvent<boolean>) {\n const props = this.props;\n event.stopPropagation();\n\n if (!props.onChange) {\n return;\n }\n\n props.onChange(event.detail);\n }\n}\n\nfunction getAdditionalProps(schema: FormSchema) {\n return schema.lime?.component?.props ?? {};\n}\n"]}
|
|
@@ -946,30 +946,6 @@
|
|
|
946
946
|
will-change: grid-template-rows;
|
|
947
947
|
}
|
|
948
948
|
|
|
949
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
950
|
-
opacity: 1;
|
|
951
|
-
--mdc-ripple-press-opacity: 1;
|
|
952
|
-
--mdc-checkbox-disabled-color: rgb(var(--contrast-1000));
|
|
953
|
-
--mdc-checkbox-ink-color: var(--mdc-theme-on-primary);
|
|
954
|
-
}
|
|
955
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__background {
|
|
956
|
-
border-radius: 50%;
|
|
957
|
-
}
|
|
958
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__checkmark {
|
|
959
|
-
scale: 0.8;
|
|
960
|
-
}
|
|
961
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
|
|
962
|
-
--mdc-checkbox-disabled-color: transparent;
|
|
963
|
-
--mdc-checkbox-ink-color: transparent;
|
|
964
|
-
--lime-checkbox-unchecked-color: rgb(var(--contrast-900));
|
|
965
|
-
}
|
|
966
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background:after {
|
|
967
|
-
content: "–";
|
|
968
|
-
color: var(--mdc-theme-on-primary);
|
|
969
|
-
font-size: 1.25rem;
|
|
970
|
-
position: absolute;
|
|
971
|
-
}
|
|
972
|
-
|
|
973
949
|
/**
|
|
974
950
|
* @prop --icon-background-color: Color to use for icon background when `badgeIcons=true`.
|
|
975
951
|
* @prop --icon-color: Color to use for icon. Defaults to grey when `badgeIcons=false`. Defaults to white when `badgeIcons=true`.
|
|
@@ -5421,30 +5397,6 @@ a.mdc-list-item {
|
|
|
5421
5397
|
will-change: grid-template-rows;
|
|
5422
5398
|
}
|
|
5423
5399
|
|
|
5424
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
5425
|
-
opacity: 1;
|
|
5426
|
-
--mdc-ripple-press-opacity: 1;
|
|
5427
|
-
--mdc-checkbox-disabled-color: rgb(var(--contrast-1000));
|
|
5428
|
-
--mdc-checkbox-ink-color: var(--mdc-theme-on-primary);
|
|
5429
|
-
}
|
|
5430
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__background {
|
|
5431
|
-
border-radius: 50%;
|
|
5432
|
-
}
|
|
5433
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__checkmark {
|
|
5434
|
-
scale: 0.8;
|
|
5435
|
-
}
|
|
5436
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
|
|
5437
|
-
--mdc-checkbox-disabled-color: transparent;
|
|
5438
|
-
--mdc-checkbox-ink-color: transparent;
|
|
5439
|
-
--lime-checkbox-unchecked-color: rgb(var(--contrast-900));
|
|
5440
|
-
}
|
|
5441
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background:after {
|
|
5442
|
-
content: "–";
|
|
5443
|
-
color: var(--mdc-theme-on-primary);
|
|
5444
|
-
font-size: 1.25rem;
|
|
5445
|
-
position: absolute;
|
|
5446
|
-
}
|
|
5447
|
-
|
|
5448
5400
|
.mdc-radio {
|
|
5449
5401
|
padding: calc((40px - 20px) / 2);
|
|
5450
5402
|
}
|
|
@@ -1016,34 +1016,6 @@
|
|
|
1016
1016
|
will-change: grid-template-rows;
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
1020
|
-
opacity: 1;
|
|
1021
|
-
--mdc-ripple-press-opacity: 1;
|
|
1022
|
-
--mdc-checkbox-disabled-color: rgb(var(--contrast-1000));
|
|
1023
|
-
--mdc-checkbox-ink-color: var(--mdc-theme-on-primary);
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__background {
|
|
1027
|
-
border-radius: 50%;
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__checkmark {
|
|
1031
|
-
scale: 0.8;
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
|
|
1035
|
-
--mdc-checkbox-disabled-color: transparent;
|
|
1036
|
-
--mdc-checkbox-ink-color: transparent;
|
|
1037
|
-
--lime-checkbox-unchecked-color: rgb(var(--contrast-900));
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background:after {
|
|
1041
|
-
content: "–";
|
|
1042
|
-
color: var(--mdc-theme-on-primary);
|
|
1043
|
-
font-size: 1.25rem;
|
|
1044
|
-
position: absolute;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
1019
|
/**
|
|
1048
1020
|
* @prop --icon-background-color: Color to use for icon background when `badgeIcons=true`.
|
|
1049
1021
|
* @prop --icon-color: Color to use for icon. Defaults to grey when `badgeIcons=false`. Defaults to white when `badgeIcons=true`.
|
|
@@ -5495,30 +5467,6 @@ a.mdc-list-item {
|
|
|
5495
5467
|
will-change: grid-template-rows;
|
|
5496
5468
|
}
|
|
5497
5469
|
|
|
5498
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
5499
|
-
opacity: 1;
|
|
5500
|
-
--mdc-ripple-press-opacity: 1;
|
|
5501
|
-
--mdc-checkbox-disabled-color: rgb(var(--contrast-1000));
|
|
5502
|
-
--mdc-checkbox-ink-color: var(--mdc-theme-on-primary);
|
|
5503
|
-
}
|
|
5504
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__background {
|
|
5505
|
-
border-radius: 50%;
|
|
5506
|
-
}
|
|
5507
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled .mdc-checkbox__checkmark {
|
|
5508
|
-
scale: 0.8;
|
|
5509
|
-
}
|
|
5510
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
|
|
5511
|
-
--mdc-checkbox-disabled-color: transparent;
|
|
5512
|
-
--mdc-checkbox-ink-color: transparent;
|
|
5513
|
-
--lime-checkbox-unchecked-color: rgb(var(--contrast-900));
|
|
5514
|
-
}
|
|
5515
|
-
.lime-checkbox--readonly.mdc-checkbox--disabled :not(:checked):not(:indeterminate) ~ .mdc-checkbox__background:after {
|
|
5516
|
-
content: "–";
|
|
5517
|
-
color: var(--mdc-theme-on-primary);
|
|
5518
|
-
font-size: 1.25rem;
|
|
5519
|
-
position: absolute;
|
|
5520
|
-
}
|
|
5521
|
-
|
|
5522
5470
|
.mdc-radio {
|
|
5523
5471
|
padding: calc((40px - 20px) / 2);
|
|
5524
5472
|
}
|