@dnncommunity/dnn-elements 0.13.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +24 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/css-shim-3bfdba4f.js +8 -0
- package/dist/cjs/css-shim-3bfdba4f.js.map +1 -0
- package/dist/cjs/debounce-1de79bc7.js +24 -0
- package/dist/cjs/debounce-1de79bc7.js.map +1 -0
- package/dist/cjs/dnn-button.cjs.entry.js +88 -0
- package/dist/cjs/dnn-button.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-button_14.cjs.entry.js +1580 -0
- package/dist/cjs/dnn-button_14.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-checkbox.cjs.entry.js +58 -0
- package/dist/cjs/dnn-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-chevron.cjs.entry.js +34 -0
- package/dist/cjs/dnn-chevron.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-collapsible.cjs.entry.js +112 -0
- package/dist/cjs/dnn-collapsible.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-color-picker.cjs.entry.js +508 -0
- package/dist/cjs/dnn-color-picker.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-dropzone.cjs.entry.js +153 -0
- package/dist/cjs/dnn-dropzone.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-image-cropper.cjs.entry.js +424 -0
- package/dist/cjs/dnn-image-cropper.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-modal.cjs.entry.js +62 -0
- package/dist/cjs/dnn-modal.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-searchbox.cjs.entry.js +66 -0
- package/dist/cjs/dnn-searchbox.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-sort-icon.cjs.entry.js +43 -0
- package/dist/cjs/dnn-sort-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-tab.cjs.entry.js +31 -0
- package/dist/cjs/dnn-tab.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-tabs.cjs.entry.js +50 -0
- package/dist/cjs/dnn-tabs.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-toggle.cjs.entry.js +37 -0
- package/dist/cjs/dnn-toggle.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn-treeview-item.cjs.entry.js +48 -0
- package/dist/cjs/dnn-treeview-item.cjs.entry.js.map +1 -0
- package/dist/cjs/dnn.cjs.js +129 -0
- package/dist/cjs/dnn.cjs.js.map +1 -0
- package/dist/cjs/dom-8ac1ad03.js +77 -0
- package/dist/cjs/dom-8ac1ad03.js.map +1 -0
- package/dist/cjs/index-e85ec026.js +1327 -0
- package/dist/cjs/index-e85ec026.js.map +1 -0
- package/dist/cjs/index-eede7745.js +3069 -0
- package/dist/cjs/index-eede7745.js.map +1 -0
- package/dist/cjs/index.cjs.js +52 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +39 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/shadow-css-41d9783d.js +392 -0
- package/dist/cjs/shadow-css-41d9783d.js.map +1 -0
- package/dist/collection/collection-manifest.json +25 -0
- package/dist/collection/components/dnn-button/dnn-button.css +87 -0
- package/dist/collection/components/dnn-button/dnn-button.js +272 -0
- package/dist/collection/components/dnn-button/dnn-button.js.map +1 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.css +27 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.js +140 -0
- package/dist/collection/components/dnn-checkbox/dnn-checkbox.js.map +1 -0
- package/dist/collection/components/dnn-chevron/dnn-chevron.css +30 -0
- package/dist/collection/components/dnn-chevron/dnn-chevron.js +107 -0
- package/dist/collection/components/dnn-chevron/dnn-chevron.js.map +1 -0
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.css +8 -0
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.js +188 -0
- package/dist/collection/components/dnn-collapsible/dnn-collapsible.js.map +1 -0
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.css +225 -0
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.js +434 -0
- package/dist/collection/components/dnn-color-picker/dnn-color-picker.js.map +1 -0
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.css +62 -0
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.js +266 -0
- package/dist/collection/components/dnn-dropzone/dnn-dropzone.js.map +1 -0
- package/dist/collection/components/dnn-image-cropper/CornerType.js +9 -0
- package/dist/collection/components/dnn-image-cropper/CornerType.js.map +1 -0
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.css +80 -0
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js +539 -0
- package/dist/collection/components/dnn-image-cropper/dnn-image-cropper.js.map +1 -0
- package/dist/collection/components/dnn-modal/dnn-modal.css +67 -0
- package/dist/collection/components/dnn-modal/dnn-modal.js +173 -0
- package/dist/collection/components/dnn-modal/dnn-modal.js.map +1 -0
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.css +48 -0
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.js +137 -0
- package/dist/collection/components/dnn-searchbox/dnn-searchbox.js.map +1 -0
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.css +32 -0
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js +81 -0
- package/dist/collection/components/dnn-sort-icon/dnn-sort-icon.js.map +1 -0
- package/dist/collection/components/dnn-tab/dnn-tab.css +0 -0
- package/dist/collection/components/dnn-tab/dnn-tab.js +84 -0
- package/dist/collection/components/dnn-tab/dnn-tab.js.map +1 -0
- package/dist/collection/components/dnn-tabs/dnn-tabs.css +40 -0
- package/dist/collection/components/dnn-tabs/dnn-tabs.js +53 -0
- package/dist/collection/components/dnn-tabs/dnn-tabs.js.map +1 -0
- package/dist/collection/components/dnn-toggle/dnn-toggle.css +52 -0
- package/dist/collection/components/dnn-toggle/dnn-toggle.js +94 -0
- package/dist/collection/components/dnn-toggle/dnn-toggle.js.map +1 -0
- package/dist/collection/components/dnn-toggle/toggle-interface.js +2 -0
- package/dist/collection/components/dnn-toggle/toggle-interface.js.map +1 -0
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.css +47 -0
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js +77 -0
- package/dist/collection/components/dnn-treeview-item/dnn-treeview-item.js.map +1 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/utilities/colorInfo.js +191 -0
- package/dist/collection/utilities/colorInfo.js.map +1 -0
- package/dist/collection/utilities/debounce.js +19 -0
- package/dist/collection/utilities/debounce.js.map +1 -0
- package/dist/collection/utilities/dnnServicesFramework.js +42 -0
- package/dist/collection/utilities/dnnServicesFramework.js.map +1 -0
- package/dist/dnn/app-globals-0f993ce5.js +5 -0
- package/dist/dnn/app-globals-0f993ce5.js.map +1 -0
- package/dist/dnn/css-shim-20dbffa5.js +6 -0
- package/dist/dnn/css-shim-20dbffa5.js.map +1 -0
- package/dist/dnn/debounce-06f55268.js +22 -0
- package/dist/dnn/debounce-06f55268.js.map +1 -0
- package/dist/dnn/dnn-button.entry.js +84 -0
- package/dist/dnn/dnn-button.entry.js.map +1 -0
- package/dist/dnn/dnn-checkbox.entry.js +54 -0
- package/dist/dnn/dnn-checkbox.entry.js.map +1 -0
- package/dist/dnn/dnn-chevron.entry.js +30 -0
- package/dist/dnn/dnn-chevron.entry.js.map +1 -0
- package/dist/dnn/dnn-collapsible.entry.js +108 -0
- package/dist/dnn/dnn-collapsible.entry.js.map +1 -0
- package/dist/dnn/dnn-color-picker.entry.js +504 -0
- package/dist/dnn/dnn-color-picker.entry.js.map +1 -0
- package/dist/dnn/dnn-dropzone.entry.js +149 -0
- package/dist/dnn/dnn-dropzone.entry.js.map +1 -0
- package/dist/dnn/dnn-image-cropper.entry.js +420 -0
- package/dist/dnn/dnn-image-cropper.entry.js.map +1 -0
- package/dist/dnn/dnn-modal.entry.js +58 -0
- package/dist/dnn/dnn-modal.entry.js.map +1 -0
- package/dist/dnn/dnn-searchbox.entry.js +62 -0
- package/dist/dnn/dnn-searchbox.entry.js.map +1 -0
- package/dist/dnn/dnn-sort-icon.entry.js +39 -0
- package/dist/dnn/dnn-sort-icon.entry.js.map +1 -0
- package/dist/dnn/dnn-tab.entry.js +27 -0
- package/dist/dnn/dnn-tab.entry.js.map +1 -0
- package/dist/dnn/dnn-tabs.entry.js +46 -0
- package/dist/dnn/dnn-tabs.entry.js.map +1 -0
- package/dist/dnn/dnn-toggle.entry.js +33 -0
- package/dist/dnn/dnn-toggle.entry.js.map +1 -0
- package/dist/dnn/dnn-treeview-item.entry.js +44 -0
- package/dist/dnn/dnn-treeview-item.entry.js.map +1 -0
- package/dist/dnn/dnn.esm.js +127 -0
- package/dist/dnn/dnn.esm.js.map +1 -0
- package/dist/dnn/dom-c5ed0ba5.js +75 -0
- package/dist/dnn/dom-c5ed0ba5.js.map +1 -0
- package/dist/dnn/index-6c0764e5.js +3033 -0
- package/dist/dnn/index-6c0764e5.js.map +1 -0
- package/dist/dnn/index.esm.js +47 -0
- package/dist/dnn/index.esm.js.map +1 -0
- package/dist/dnn/p-0e94f5ee.js +2 -0
- package/dist/dnn/p-0e94f5ee.js.map +1 -0
- package/dist/dnn/p-7acf3104.entry.js +11 -0
- package/dist/dnn/p-7acf3104.entry.js.map +1 -0
- package/dist/dnn/p-bd3d3361.js +2 -0
- package/dist/dnn/p-bd3d3361.js.map +1 -0
- package/dist/dnn/shadow-css-8c625855.js +390 -0
- package/dist/dnn/shadow-css-8c625855.js.map +1 -0
- package/dist/esm/app-globals-0f993ce5.js +5 -0
- package/dist/esm/app-globals-0f993ce5.js.map +1 -0
- package/dist/esm/css-shim-20dbffa5.js +6 -0
- package/dist/esm/css-shim-20dbffa5.js.map +1 -0
- package/dist/esm/debounce-06f55268.js +22 -0
- package/dist/esm/debounce-06f55268.js.map +1 -0
- package/dist/esm/dnn-button.entry.js +84 -0
- package/dist/esm/dnn-button.entry.js.map +1 -0
- package/dist/esm/dnn-button_14.entry.js +1563 -0
- package/dist/esm/dnn-button_14.entry.js.map +1 -0
- package/dist/esm/dnn-checkbox.entry.js +54 -0
- package/dist/esm/dnn-checkbox.entry.js.map +1 -0
- package/dist/esm/dnn-chevron.entry.js +30 -0
- package/dist/esm/dnn-chevron.entry.js.map +1 -0
- package/dist/esm/dnn-collapsible.entry.js +108 -0
- package/dist/esm/dnn-collapsible.entry.js.map +1 -0
- package/dist/esm/dnn-color-picker.entry.js +504 -0
- package/dist/esm/dnn-color-picker.entry.js.map +1 -0
- package/dist/esm/dnn-dropzone.entry.js +149 -0
- package/dist/esm/dnn-dropzone.entry.js.map +1 -0
- package/dist/esm/dnn-image-cropper.entry.js +420 -0
- package/dist/esm/dnn-image-cropper.entry.js.map +1 -0
- package/dist/esm/dnn-modal.entry.js +58 -0
- package/dist/esm/dnn-modal.entry.js.map +1 -0
- package/dist/esm/dnn-searchbox.entry.js +62 -0
- package/dist/esm/dnn-searchbox.entry.js.map +1 -0
- package/dist/esm/dnn-sort-icon.entry.js +39 -0
- package/dist/esm/dnn-sort-icon.entry.js.map +1 -0
- package/dist/esm/dnn-tab.entry.js +27 -0
- package/dist/esm/dnn-tab.entry.js.map +1 -0
- package/dist/esm/dnn-tabs.entry.js +46 -0
- package/dist/esm/dnn-tabs.entry.js.map +1 -0
- package/dist/esm/dnn-toggle.entry.js +33 -0
- package/dist/esm/dnn-toggle.entry.js.map +1 -0
- package/dist/esm/dnn-treeview-item.entry.js +44 -0
- package/dist/esm/dnn-treeview-item.entry.js.map +1 -0
- package/dist/esm/dnn.js +127 -0
- package/dist/esm/dnn.js.map +1 -0
- package/dist/esm/dom-c5ed0ba5.js +75 -0
- package/dist/esm/dom-c5ed0ba5.js.map +1 -0
- package/dist/esm/index-6c0764e5.js +3033 -0
- package/dist/esm/index-6c0764e5.js.map +1 -0
- package/dist/esm/index-f79d9e82.js +1299 -0
- package/dist/esm/index-f79d9e82.js.map +1 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +35 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/shadow-css-8c625855.js +390 -0
- package/dist/esm/shadow-css-8c625855.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/dnn-button/dnn-button.d.ts +55 -0
- package/dist/types/components/dnn-checkbox/dnn-checkbox.d.ts +16 -0
- package/dist/types/components/dnn-chevron/dnn-chevron.d.ts +13 -0
- package/dist/types/components/dnn-collapsible/dnn-collapsible.d.ts +22 -0
- package/dist/types/components/dnn-color-picker/dnn-color-picker.d.ts +46 -0
- package/dist/types/components/dnn-dropzone/dnn-dropzone.d.ts +45 -0
- package/dist/types/components/dnn-image-cropper/CornerType.d.ts +6 -0
- package/dist/types/components/dnn-image-cropper/dnn-image-cropper.d.ts +62 -0
- package/dist/types/components/dnn-modal/dnn-modal.d.ts +35 -0
- package/dist/types/components/dnn-searchbox/dnn-searchbox.d.ts +22 -0
- package/dist/types/components/dnn-sort-icon/dnn-sort-icon.d.ts +9 -0
- package/dist/types/components/dnn-tab/dnn-tab.d.ts +11 -0
- package/dist/types/components/dnn-tabs/dnn-tabs.d.ts +11 -0
- package/dist/types/components/dnn-toggle/dnn-toggle.d.ts +13 -0
- package/dist/types/components/dnn-toggle/toggle-interface.d.ts +3 -0
- package/dist/types/components/dnn-treeview-item/dnn-treeview-item.d.ts +16 -0
- package/dist/types/components.d.ts +611 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utilities/colorInfo.d.ts +52 -0
- package/dist/types/utilities/debounce.d.ts +5 -0
- package/dist/types/utilities/dnnServicesFramework.d.ts +19 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +48 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--background-color: transparent;
|
|
3
|
+
--color: #333;
|
|
4
|
+
--border-size: 1px;
|
|
5
|
+
--border-color: var(--backround-color);
|
|
6
|
+
--border-radius: var(--dnn-controls-radius, 5px);
|
|
7
|
+
--padding: var(--dnn-controls-padding, 5px);
|
|
8
|
+
display: inline-block;
|
|
9
|
+
width: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:host(.disabled) {
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host(.primary) {
|
|
17
|
+
--background-color: var(--dnn-color-primary, blue);
|
|
18
|
+
--color: var(--dnn-color-primary-contrast, white);
|
|
19
|
+
--focus-color: var(--background-color);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:host(.primary.reversed) {
|
|
23
|
+
--background-color: var(--dnn-color-primary-contrast, white);
|
|
24
|
+
--color: var(--dnn-color-primary, blue);
|
|
25
|
+
--border-color: var(--dnn-color-primary, blue);
|
|
26
|
+
--focus-color: var(--color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:host(.secondary) {
|
|
30
|
+
--background-color: var(--dnn-color-secondary, green);
|
|
31
|
+
--color: var(--dnn-color-secondary-contrast, white);
|
|
32
|
+
--focus-color: var(--background-color);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host(.secondary.reversed) {
|
|
36
|
+
--background-color: var(--dnn-color-secondary-contrast, white);
|
|
37
|
+
--color: var(--dnn-color-secondary, blue);
|
|
38
|
+
--border-color: var(--dnn-color-secondary, blue);
|
|
39
|
+
--focus-color: var(--color);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host(.tertiary) {
|
|
43
|
+
--background-color: var(--dnn-color-tertiary, yellow);
|
|
44
|
+
--color: var(--dnn-color-tertiary-contrast, black);
|
|
45
|
+
--focus-color: var(--background-color);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
:host(.tertiary.reversed) {
|
|
49
|
+
--background-color: var(--dnn-color-tertiary-contrast, white);
|
|
50
|
+
--color: var(--dnn-color-tertiary, blue);
|
|
51
|
+
--border-color: var(--dnn-color-tertiary, blue);
|
|
52
|
+
--focus-color: var(--color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:host(.hydrated) button {
|
|
56
|
+
border: var(--border-size) solid var(--border-color);
|
|
57
|
+
border-radius: var(--border-radius);
|
|
58
|
+
padding: var(--padding) calc(var(--padding) * 2);
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
background-color: var(--background-color);
|
|
61
|
+
color: var(--color);
|
|
62
|
+
outline: none;
|
|
63
|
+
}
|
|
64
|
+
:host(.hydrated) button:focus, :host(.hydrated) button:hover {
|
|
65
|
+
box-shadow: 0 0 2px 2px var(--focus-color);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
:host(:disabled, [disabled]) button {
|
|
69
|
+
pointer-events: none;
|
|
70
|
+
opacity: 0.5;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
:host(.small) button {
|
|
74
|
+
padding: calc(var(--padding) / 2) var(--padding);
|
|
75
|
+
font-size: 0.7em;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
:host(.large) button {
|
|
79
|
+
padding: calc(var(--padding) * 1.5) calc(var(--padding) * 3);
|
|
80
|
+
font-size: 1.2em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
button {
|
|
84
|
+
height: 100%;
|
|
85
|
+
width: 100%;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { Component, Element, Host, h, Prop, State, Event } from '@stencil/core';
|
|
2
|
+
/**
|
|
3
|
+
* @slot Content of the button
|
|
4
|
+
*/
|
|
5
|
+
export class DnnButton {
|
|
6
|
+
constructor() {
|
|
7
|
+
/**
|
|
8
|
+
* Optional button style,
|
|
9
|
+
* can be either primary, secondary or tertiary and defaults to primary if not specified
|
|
10
|
+
*/
|
|
11
|
+
this.type = 'primary';
|
|
12
|
+
/**
|
|
13
|
+
* Optionally reverses the button style.
|
|
14
|
+
*/
|
|
15
|
+
this.reversed = false;
|
|
16
|
+
/**
|
|
17
|
+
* Optionally sets the button size, small normal or large, defaults to normal
|
|
18
|
+
*/
|
|
19
|
+
this.size = 'normal';
|
|
20
|
+
/**
|
|
21
|
+
* Optionally add a confirmation dialog before firing the action.
|
|
22
|
+
*/
|
|
23
|
+
this.confirm = false;
|
|
24
|
+
/**
|
|
25
|
+
* The text of the yes button for confirmation.
|
|
26
|
+
*/
|
|
27
|
+
this.confirmYesText = "Yes";
|
|
28
|
+
/**
|
|
29
|
+
* The text of the no button for confirmation.
|
|
30
|
+
*/
|
|
31
|
+
this.confirmNoText = "No";
|
|
32
|
+
/**
|
|
33
|
+
* The text of the confirmation message;
|
|
34
|
+
*/
|
|
35
|
+
this.confirmMessage = "Are you sure ?";
|
|
36
|
+
/**
|
|
37
|
+
* Disables the button
|
|
38
|
+
*/
|
|
39
|
+
this.disabled = false;
|
|
40
|
+
this.modalVisible = false;
|
|
41
|
+
}
|
|
42
|
+
componentDidLoad() {
|
|
43
|
+
this.el.classList.add(this.type);
|
|
44
|
+
if (this.reversed) {
|
|
45
|
+
this.el.classList.add('reversed');
|
|
46
|
+
}
|
|
47
|
+
if (this.size !== 'normal') {
|
|
48
|
+
this.el.classList.add(this.size);
|
|
49
|
+
}
|
|
50
|
+
this.modal = this.el.shadowRoot.querySelector('dnn-modal');
|
|
51
|
+
}
|
|
52
|
+
handleConfirm() {
|
|
53
|
+
this.modal.hide();
|
|
54
|
+
this.modalVisible = false;
|
|
55
|
+
this.confirmed.emit();
|
|
56
|
+
}
|
|
57
|
+
handleCancel() {
|
|
58
|
+
this.modal.hide();
|
|
59
|
+
this.modalVisible = false;
|
|
60
|
+
this.canceled.emit();
|
|
61
|
+
}
|
|
62
|
+
handleClick() {
|
|
63
|
+
if (this.confirm && !this.modalVisible) {
|
|
64
|
+
this.modal.show();
|
|
65
|
+
this.modalVisible = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
render() {
|
|
69
|
+
return (h(Host, { disabled: this.disabled, style: { 'pointer-events': this.disabled ? 'none' : 'all' } },
|
|
70
|
+
h("button", { class: "button", onClick: () => this.handleClick(), disabled: this.disabled },
|
|
71
|
+
h("slot", null)),
|
|
72
|
+
this.confirm &&
|
|
73
|
+
h("dnn-modal", { showCloseButton: false, backdropDismiss: false },
|
|
74
|
+
h("p", null, this.confirmMessage),
|
|
75
|
+
h("div", { style: {
|
|
76
|
+
display: 'flex',
|
|
77
|
+
justifyContent: 'flex-end'
|
|
78
|
+
} },
|
|
79
|
+
h("dnn-button", { type: 'primary', style: { margin: '5px' }, onClick: () => this.handleConfirm() }, this.confirmYesText),
|
|
80
|
+
h("dnn-button", { type: 'secondary', style: { margin: '5px' }, onClick: () => this.handleCancel() }, this.confirmNoText)))));
|
|
81
|
+
}
|
|
82
|
+
static get is() { return "dnn-button"; }
|
|
83
|
+
static get encapsulation() { return "shadow"; }
|
|
84
|
+
static get originalStyleUrls() { return {
|
|
85
|
+
"$": ["dnn-button.scss"]
|
|
86
|
+
}; }
|
|
87
|
+
static get styleUrls() { return {
|
|
88
|
+
"$": ["dnn-button.css"]
|
|
89
|
+
}; }
|
|
90
|
+
static get properties() { return {
|
|
91
|
+
"type": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"mutable": false,
|
|
94
|
+
"complexType": {
|
|
95
|
+
"original": "'primary' | 'secondary' | 'tertiary'",
|
|
96
|
+
"resolved": "\"primary\" | \"secondary\" | \"tertiary\"",
|
|
97
|
+
"references": {}
|
|
98
|
+
},
|
|
99
|
+
"required": false,
|
|
100
|
+
"optional": false,
|
|
101
|
+
"docs": {
|
|
102
|
+
"tags": [],
|
|
103
|
+
"text": "Optional button style,\r\ncan be either primary, secondary or tertiary and defaults to primary if not specified"
|
|
104
|
+
},
|
|
105
|
+
"attribute": "type",
|
|
106
|
+
"reflect": false,
|
|
107
|
+
"defaultValue": "'primary'"
|
|
108
|
+
},
|
|
109
|
+
"reversed": {
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "boolean",
|
|
114
|
+
"resolved": "boolean",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "Optionally reverses the button style."
|
|
122
|
+
},
|
|
123
|
+
"attribute": "reversed",
|
|
124
|
+
"reflect": false,
|
|
125
|
+
"defaultValue": "false"
|
|
126
|
+
},
|
|
127
|
+
"size": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"mutable": false,
|
|
130
|
+
"complexType": {
|
|
131
|
+
"original": "'small' | 'normal' | 'large'",
|
|
132
|
+
"resolved": "\"large\" | \"normal\" | \"small\"",
|
|
133
|
+
"references": {}
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"optional": true,
|
|
137
|
+
"docs": {
|
|
138
|
+
"tags": [],
|
|
139
|
+
"text": "Optionally sets the button size, small normal or large, defaults to normal"
|
|
140
|
+
},
|
|
141
|
+
"attribute": "size",
|
|
142
|
+
"reflect": false,
|
|
143
|
+
"defaultValue": "'normal'"
|
|
144
|
+
},
|
|
145
|
+
"confirm": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "boolean",
|
|
150
|
+
"resolved": "boolean",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": true,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": "Optionally add a confirmation dialog before firing the action."
|
|
158
|
+
},
|
|
159
|
+
"attribute": "confirm",
|
|
160
|
+
"reflect": false,
|
|
161
|
+
"defaultValue": "false"
|
|
162
|
+
},
|
|
163
|
+
"confirmYesText": {
|
|
164
|
+
"type": "string",
|
|
165
|
+
"mutable": false,
|
|
166
|
+
"complexType": {
|
|
167
|
+
"original": "string",
|
|
168
|
+
"resolved": "string",
|
|
169
|
+
"references": {}
|
|
170
|
+
},
|
|
171
|
+
"required": false,
|
|
172
|
+
"optional": true,
|
|
173
|
+
"docs": {
|
|
174
|
+
"tags": [],
|
|
175
|
+
"text": "The text of the yes button for confirmation."
|
|
176
|
+
},
|
|
177
|
+
"attribute": "confirm-yes-text",
|
|
178
|
+
"reflect": false,
|
|
179
|
+
"defaultValue": "\"Yes\""
|
|
180
|
+
},
|
|
181
|
+
"confirmNoText": {
|
|
182
|
+
"type": "string",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "string",
|
|
186
|
+
"resolved": "string",
|
|
187
|
+
"references": {}
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"optional": true,
|
|
191
|
+
"docs": {
|
|
192
|
+
"tags": [],
|
|
193
|
+
"text": "The text of the no button for confirmation."
|
|
194
|
+
},
|
|
195
|
+
"attribute": "confirm-no-text",
|
|
196
|
+
"reflect": false,
|
|
197
|
+
"defaultValue": "\"No\""
|
|
198
|
+
},
|
|
199
|
+
"confirmMessage": {
|
|
200
|
+
"type": "string",
|
|
201
|
+
"mutable": false,
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "string",
|
|
204
|
+
"resolved": "string",
|
|
205
|
+
"references": {}
|
|
206
|
+
},
|
|
207
|
+
"required": false,
|
|
208
|
+
"optional": true,
|
|
209
|
+
"docs": {
|
|
210
|
+
"tags": [],
|
|
211
|
+
"text": "The text of the confirmation message;"
|
|
212
|
+
},
|
|
213
|
+
"attribute": "confirm-message",
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"defaultValue": "\"Are you sure ?\""
|
|
216
|
+
},
|
|
217
|
+
"disabled": {
|
|
218
|
+
"type": "boolean",
|
|
219
|
+
"mutable": false,
|
|
220
|
+
"complexType": {
|
|
221
|
+
"original": "boolean",
|
|
222
|
+
"resolved": "boolean",
|
|
223
|
+
"references": {}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": false,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Disables the button"
|
|
230
|
+
},
|
|
231
|
+
"attribute": "disabled",
|
|
232
|
+
"reflect": false,
|
|
233
|
+
"defaultValue": "false"
|
|
234
|
+
}
|
|
235
|
+
}; }
|
|
236
|
+
static get states() { return {
|
|
237
|
+
"modalVisible": {}
|
|
238
|
+
}; }
|
|
239
|
+
static get events() { return [{
|
|
240
|
+
"method": "confirmed",
|
|
241
|
+
"name": "confirmed",
|
|
242
|
+
"bubbles": false,
|
|
243
|
+
"cancelable": true,
|
|
244
|
+
"composed": true,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "Fires when confirm is true and the user confirms the action."
|
|
248
|
+
},
|
|
249
|
+
"complexType": {
|
|
250
|
+
"original": "any",
|
|
251
|
+
"resolved": "any",
|
|
252
|
+
"references": {}
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
"method": "canceled",
|
|
256
|
+
"name": "canceled",
|
|
257
|
+
"bubbles": false,
|
|
258
|
+
"cancelable": true,
|
|
259
|
+
"composed": true,
|
|
260
|
+
"docs": {
|
|
261
|
+
"tags": [],
|
|
262
|
+
"text": "Fires when confirm is true and the user cancels the action."
|
|
263
|
+
},
|
|
264
|
+
"complexType": {
|
|
265
|
+
"original": "any",
|
|
266
|
+
"resolved": "any",
|
|
267
|
+
"references": {}
|
|
268
|
+
}
|
|
269
|
+
}]; }
|
|
270
|
+
static get elementRef() { return "el"; }
|
|
271
|
+
}
|
|
272
|
+
//# sourceMappingURL=dnn-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnn-button.js","sourceRoot":"","sources":["../../../src/components/dnn-button/dnn-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAE9F;;GAEG;AAMH,MAAM,OAAO,SAAS;EALtB;IAOE;;;OAGG;IACK,SAAI,GAAyC,SAAS,CAAC;IAE/D;;OAEG;IACK,aAAQ,GAAY,KAAK,CAAC;IAElC;;OAEG;IACK,SAAI,GAAkC,QAAQ,CAAC;IAEvD;;OAEG;IACK,YAAO,GAAa,KAAK,CAAC;IAElC;;OAEG;IACK,mBAAc,GAAY,KAAK,CAAC;IAExC;;OAEG;IACK,kBAAa,GAAY,IAAI,CAAC;IAEtC;;OAEG;IACK,mBAAc,GAAY,gBAAgB,CAAC;IAEnD;;OAEG;IACK,aAAQ,GAAY,KAAK,CAAC;IAEzB,iBAAY,GAAY,KAAK,CAAC;GA+ExC;EA1DC,gBAAgB;IACd,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEjC,IAAI,IAAI,CAAC,QAAQ,EAAC;MAChB,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;KACnC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAC;MACzB,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClC;IAED,IAAI,CAAC,KAAK,GAA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E,CAAC,IAAI,CAAC,aAAa,EAAE,IAAG,IAAI,CAAC,cAAc,CAAc;YAC1H,kBAAY,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,aAAa,CAAc,CACtH,CACI,CAEX,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGF","sourcesContent":["import { Component, Element, Host, h, Prop, State, Event, EventEmitter } from '@stencil/core';\r\n\r\n/**\r\n * @slot Content of the button\r\n */\r\n@Component({\r\n tag: 'dnn-button',\r\n styleUrl: 'dnn-button.scss',\r\n shadow: true\r\n})\r\nexport class DnnButton {\r\n\r\n /**\r\n * Optional button style,\r\n * can be either primary, secondary or tertiary and defaults to primary if not specified\r\n */\r\n @Prop() type: 'primary' | 'secondary' | 'tertiary' = 'primary';\r\n\r\n /**\r\n * Optionally reverses the button style.\r\n */\r\n @Prop() reversed: boolean = false;\r\n\r\n /**\r\n * Optionally sets the button size, small normal or large, defaults to normal\r\n */\r\n @Prop() size?: 'small' | 'normal' | 'large' = 'normal';\r\n\r\n /**\r\n * Optionally add a confirmation dialog before firing the action.\r\n */\r\n @Prop() confirm?: boolean = false;\r\n\r\n /**\r\n * The text of the yes button for confirmation.\r\n */\r\n @Prop() confirmYesText?: string = \"Yes\";\r\n\r\n /**\r\n * The text of the no button for confirmation.\r\n */\r\n @Prop() confirmNoText?: string = \"No\";\r\n\r\n /**\r\n * The text of the confirmation message;\r\n */\r\n @Prop() confirmMessage?: string = \"Are you sure ?\";\r\n \r\n /**\r\n * Disables the button\r\n */\r\n @Prop() disabled: boolean = false;\r\n\r\n @State() modalVisible: boolean = false;\r\n\r\n @Element() el!: HTMLDnnButtonElement;\r\n\r\n private modal!: HTMLDnnModalElement;\r\n\r\n /** \r\n * Fires when confirm is true and the user confirms the action.\r\n */\r\n @Event({\r\n eventName: 'confirmed',\r\n bubbles: false,\r\n cancelable: true,\r\n composed: true\r\n }) confirmed: EventEmitter;\r\n\r\n /**\r\n * Fires when confirm is true and the user cancels the action.\r\n */\r\n @Event({bubbles: false}) canceled: EventEmitter;\r\n\r\n componentDidLoad(){\r\n this.el.classList.add(this.type);\r\n \r\n if (this.reversed){\r\n this.el.classList.add('reversed');\r\n }\r\n\r\n if (this.size !== 'normal'){\r\n this.el.classList.add(this.size);\r\n }\r\n\r\n this.modal = this.el.shadowRoot.querySelector('dnn-modal');\r\n }\r\n\r\n private handleConfirm(){\r\n this.modal.hide();\r\n this.modalVisible = false;\r\n this.confirmed.emit();\r\n }\r\n\r\n private handleCancel(){\r\n this.modal.hide();\r\n this.modalVisible = false;\r\n this.canceled.emit();\r\n }\r\n \r\n private handleClick(): void {\r\n if (this.confirm && !this.modalVisible){\r\n this.modal.show();\r\n this.modalVisible = true;\r\n }\r\n }\r\n\r\n render() {\r\n return (\r\n <Host disabled={this.disabled} style={{'pointer-events': this.disabled ? 'none' : 'all'}}>\r\n <button class=\"button\" onClick={() => this.handleClick()} disabled={this.disabled}>\r\n <slot></slot>\r\n </button>\r\n {this.confirm &&\r\n <dnn-modal showCloseButton={false} backdropDismiss={false}>\r\n <p>{this.confirmMessage}</p>\r\n <div style={\r\n {\r\n display: 'flex',\r\n justifyContent: 'flex-end'\r\n }\r\n }>\r\n <dnn-button type='primary' style={{margin: '5px'}} onClick={() => this.handleConfirm()}>{this.confirmYesText}</dnn-button>\r\n <dnn-button type='secondary' style={{margin: '5px'}} onClick={() => this.handleCancel()}>{this.confirmNoText}</dnn-button>\r\n </div>\r\n </dnn-modal>\r\n }\r\n </Host>\r\n );\r\n }\r\n \r\n\r\n}\r\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/**
|
|
3
|
+
* @prop --focus-color: The color to outline the checkbox when hovered or focused, default to the dnn primary color.
|
|
4
|
+
*/
|
|
5
|
+
--focus-color: var(--dnn-color-primary, #3792ED);
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 0.25rem;
|
|
9
|
+
margin: 3px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
button {
|
|
13
|
+
background-color: transparent;
|
|
14
|
+
border: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
outline: none;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
}
|
|
22
|
+
button svg.undefined {
|
|
23
|
+
opacity: 0.45;
|
|
24
|
+
}
|
|
25
|
+
button:focus {
|
|
26
|
+
box-shadow: 0 0 2px 2px var(--focus-color);
|
|
27
|
+
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { Component, Element, Host, h, Prop, Event } from '@stencil/core';
|
|
2
|
+
export class DnnCheckbox {
|
|
3
|
+
constructor() {
|
|
4
|
+
/** Defines if the checkbox is checked (true) or unchecked (false) or in an intermediate state (undefined) */
|
|
5
|
+
this.checked = false;
|
|
6
|
+
/** Defines if clicking the checkbox will go through the intermediate state between checked and unchecked (tri-state) */
|
|
7
|
+
this.useIntermediate = false;
|
|
8
|
+
}
|
|
9
|
+
changeState() {
|
|
10
|
+
if (!this.useIntermediate) {
|
|
11
|
+
this.checked = !this.checked;
|
|
12
|
+
this.emitEvents();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (this.checked === true) {
|
|
16
|
+
this.checked = false;
|
|
17
|
+
this.button.classList.remove("undefined");
|
|
18
|
+
this.emitEvents();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (this.checked === undefined) {
|
|
22
|
+
this.checked = true;
|
|
23
|
+
this.button.classList.remove("undefined");
|
|
24
|
+
this.emitEvents();
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (this.checked === false) {
|
|
28
|
+
this.checked = undefined;
|
|
29
|
+
this.button.classList.add("undefined");
|
|
30
|
+
this.emitEvents();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
emitEvents() {
|
|
35
|
+
this.checkedchange.emit(this.checked);
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return (h(Host, null,
|
|
39
|
+
h("button", { class: "icon", onClick: () => this.changeState(), ref: el => this.button = el },
|
|
40
|
+
this.checked === false &&
|
|
41
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
42
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
43
|
+
h("path", { d: "M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z" })),
|
|
44
|
+
this.checked === true &&
|
|
45
|
+
h("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
46
|
+
h("path", { d: "M0 0h24v24H0z", fill: "none" }),
|
|
47
|
+
h("path", { d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" })),
|
|
48
|
+
this.checked === undefined &&
|
|
49
|
+
h("svg", { class: "undefined", xmlns: "http://www.w3.org/2000/svg", "enable-background": "new 0 0 24 24", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000" },
|
|
50
|
+
h("g", null,
|
|
51
|
+
h("rect", { fill: "none", height: "24", width: "24" })),
|
|
52
|
+
h("g", null,
|
|
53
|
+
h("g", null,
|
|
54
|
+
h("g", null,
|
|
55
|
+
h("path", { d: "M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z" })))))),
|
|
56
|
+
h("label", { htmlFor: this.el.id, onClick: () => this.changeState() },
|
|
57
|
+
h("slot", null))));
|
|
58
|
+
}
|
|
59
|
+
static get is() { return "dnn-checkbox"; }
|
|
60
|
+
static get encapsulation() { return "shadow"; }
|
|
61
|
+
static get originalStyleUrls() { return {
|
|
62
|
+
"$": ["dnn-checkbox.scss"]
|
|
63
|
+
}; }
|
|
64
|
+
static get styleUrls() { return {
|
|
65
|
+
"$": ["dnn-checkbox.css"]
|
|
66
|
+
}; }
|
|
67
|
+
static get properties() { return {
|
|
68
|
+
"checked": {
|
|
69
|
+
"type": "boolean",
|
|
70
|
+
"mutable": true,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "boolean | undefined",
|
|
73
|
+
"resolved": "boolean",
|
|
74
|
+
"references": {}
|
|
75
|
+
},
|
|
76
|
+
"required": false,
|
|
77
|
+
"optional": false,
|
|
78
|
+
"docs": {
|
|
79
|
+
"tags": [],
|
|
80
|
+
"text": "Defines if the checkbox is checked (true) or unchecked (false) or in an intermediate state (undefined)"
|
|
81
|
+
},
|
|
82
|
+
"attribute": "checked",
|
|
83
|
+
"reflect": false,
|
|
84
|
+
"defaultValue": "false"
|
|
85
|
+
},
|
|
86
|
+
"useIntermediate": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"mutable": false,
|
|
89
|
+
"complexType": {
|
|
90
|
+
"original": "boolean",
|
|
91
|
+
"resolved": "boolean",
|
|
92
|
+
"references": {}
|
|
93
|
+
},
|
|
94
|
+
"required": false,
|
|
95
|
+
"optional": false,
|
|
96
|
+
"docs": {
|
|
97
|
+
"tags": [],
|
|
98
|
+
"text": "Defines if clicking the checkbox will go through the intermediate state between checked and unchecked (tri-state)"
|
|
99
|
+
},
|
|
100
|
+
"attribute": "use-intermediate",
|
|
101
|
+
"reflect": false,
|
|
102
|
+
"defaultValue": "false"
|
|
103
|
+
},
|
|
104
|
+
"value": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"mutable": false,
|
|
107
|
+
"complexType": {
|
|
108
|
+
"original": "string",
|
|
109
|
+
"resolved": "string",
|
|
110
|
+
"references": {}
|
|
111
|
+
},
|
|
112
|
+
"required": false,
|
|
113
|
+
"optional": false,
|
|
114
|
+
"docs": {
|
|
115
|
+
"tags": [],
|
|
116
|
+
"text": "The value for this checkbox (not to be confused with its checked state)."
|
|
117
|
+
},
|
|
118
|
+
"attribute": "value",
|
|
119
|
+
"reflect": false
|
|
120
|
+
}
|
|
121
|
+
}; }
|
|
122
|
+
static get events() { return [{
|
|
123
|
+
"method": "checkedchange",
|
|
124
|
+
"name": "checkedchange",
|
|
125
|
+
"bubbles": true,
|
|
126
|
+
"cancelable": true,
|
|
127
|
+
"composed": true,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Fires up when the checkbox checked property changes."
|
|
131
|
+
},
|
|
132
|
+
"complexType": {
|
|
133
|
+
"original": "boolean | undefined",
|
|
134
|
+
"resolved": "boolean",
|
|
135
|
+
"references": {}
|
|
136
|
+
}
|
|
137
|
+
}]; }
|
|
138
|
+
static get elementRef() { return "el"; }
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=dnn-checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnn-checkbox.js","sourceRoot":"","sources":["../../../src/components/dnn-checkbox/dnn-checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAOvF,MAAM,OAAO,WAAW;EALxB;IAQE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/core';\r\n\r\n@Component({\r\n tag: 'dnn-checkbox',\r\n styleUrl: 'dnn-checkbox.scss',\r\n shadow: true,\r\n})\r\nexport class DnnCheckbox {\r\n @Element() el: HTMLDnnCheckboxElement;\r\n\r\n /** Defines if the checkbox is checked (true) or unchecked (false) or in an intermediate state (undefined) */\r\n @Prop({mutable: true}) checked: boolean | undefined = false;\r\n\r\n /** Defines if clicking the checkbox will go through the intermediate state between checked and unchecked (tri-state) */\r\n @Prop() useIntermediate: boolean = false;\r\n\r\n /** The value for this checkbox (not to be confused with its checked state). */\r\n @Prop() value: string;\r\n\r\n /** Fires up when the checkbox checked property changes. */\r\n @Event() checkedchange: EventEmitter<boolean | undefined>;\r\n \r\n private button: HTMLButtonElement;\r\n\r\n private changeState(): void {\r\n if (!this.useIntermediate){\r\n this.checked = !this.checked;\r\n this.emitEvents();\r\n return;\r\n }\r\n if (this.checked === true){\r\n this.checked = false;\r\n this.button.classList.remove(\"undefined\");\r\n this.emitEvents();\r\n return;\r\n }\r\n if (this.checked === undefined){\r\n this.checked = true;\r\n this.button.classList.remove(\"undefined\");\r\n this.emitEvents();\r\n return;\r\n }\r\n if (this.checked === false){\r\n this.checked = undefined;\r\n this.button.classList.add(\"undefined\");\r\n this.emitEvents();\r\n return;\r\n }\r\n }\r\n\r\n private emitEvents() {\r\n this.checkedchange.emit(this.checked);\r\n }\r\n\r\n render() {\r\n return (\r\n <Host>\r\n <button class=\"icon\" onClick={() => this.changeState()} ref={el => this.button = el}>\r\n {this.checked === false &&\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"#000000\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z\"/></svg>\r\n }\r\n {this.checked === true &&\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"#000000\"><path d=\"M0 0h24v24H0z\" fill=\"none\"/><path d=\"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\"/></svg>\r\n }\r\n {this.checked === undefined &&\r\n <svg class=\"undefined\" xmlns=\"http://www.w3.org/2000/svg\" enable-background=\"new 0 0 24 24\" height=\"24px\" viewBox=\"0 0 24 24\" width=\"24px\" fill=\"#000000\"><g><rect fill=\"none\" height=\"24\" width=\"24\"/></g><g><g><g><path d=\"M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z\"/></g></g></g></svg>\r\n }\r\n </button>\r\n <label htmlFor={this.el.id} onClick={() => this.changeState()}><slot></slot></label>\r\n </Host>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
button {
|
|
6
|
+
border: none;
|
|
7
|
+
padding: 0px;
|
|
8
|
+
margin: 0px;
|
|
9
|
+
min-width: 15px;
|
|
10
|
+
min-height: 15px;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
outline: none;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
height: 2em;
|
|
20
|
+
width: 2em;
|
|
21
|
+
transition: all 300ms ease-in-out;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
button:focus svg, button:hover svg {
|
|
25
|
+
color: var(--dnn-color-primary);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host([expanded]) svg {
|
|
29
|
+
transform: rotate(90deg);
|
|
30
|
+
}
|