@ewc-lib/ewc-icon-button-group 1.0.1-alpha
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/2025-03-26_15-03-1742997749.png +0 -0
- package/notes.txt +90 -0
- package/package.json +19 -0
- package/readme.md +36 -0
- package/screenshot.png +0 -0
- package/src/main.js +182 -0
- package/usage-example/vanilla/custom-props.css +233 -0
- package/usage-example/vanilla/index.html +71 -0
- package/usage-example/vanilla/readme.md +1 -0
- package/usage-example/webpack/dist/ewc_usage.js +267 -0
- package/usage-example/webpack/dist/index.html +48 -0
- package/usage-example/webpack/index.html +48 -0
- package/usage-example/webpack/main.js +21 -0
- package/usage-example/webpack/package-lock.json +4425 -0
- package/usage-example/webpack/package.json +29 -0
- package/usage-example/webpack/readme.md +5 -0
- package/usage-example/webpack/webpack.config.js +31 -0
|
Binary file
|
package/notes.txt
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
width: 125px;
|
|
2
|
+
height: 45px;
|
|
3
|
+
/* UI Properties */
|
|
4
|
+
background: #FFFFFF 0% 0% no-repeat padding-box;
|
|
5
|
+
border: 1px solid #0D40B7;
|
|
6
|
+
border-radius: 0px 200px 200px 0px;
|
|
7
|
+
opacity: 1;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<ewc-icon-button-group id="g">
|
|
11
|
+
<ewc-icon-button icon="linechart" label="Line chart"></ewc-icon-button>
|
|
12
|
+
<ewc-icon-button icon="barchart" label="Bar chart"></ewc-icon-button>
|
|
13
|
+
<ewc-icon-button icon="table" label="Table"></ewc-icon-button>
|
|
14
|
+
</ewc-icon-button-group>
|
|
15
|
+
|
|
16
|
+
<ewc-icon-button-group id="g" buttons="linechart,barchart,table"></ewc-icon-button-group>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
allow to pass an array with objects holding id, text and icon name per item (order to be preserved)
|
|
22
|
+
should be possible to preselect one item
|
|
23
|
+
callback event for clicked item
|
|
24
|
+
it should be possible to change the selection programmatically
|
|
25
|
+
needs to be "responsive"
|
|
26
|
+
with smaller screens (or even based on available container width) it should remove the text and only keep the icon
|
|
27
|
+
@JAURENA Marc (ESTAT-EXT): please check with Federico, if the pill should reduce the width of the pill based on the text (and reduce it if text is removed)
|
|
28
|
+
needs to follow basic a11y requirements => The group should be one "tabbable" element and selection could be done via left-right, space => as with radio button groups
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
semantic HTML or not?
|
|
33
|
+
|
|
34
|
+
WCAG / APG says:
|
|
35
|
+
|
|
36
|
+
"Robust accessibility can be further optimized by choosing implementation patterns that maximize use of semantic HTML and heeding the warning that No ARIA is better than Bad ARIA."
|
|
37
|
+
https://www.w3.org/WAI/ARIA/apg/patterns/radio/examples/radio-activedescendant/
|
|
38
|
+
|
|
39
|
+
semantic would be:
|
|
40
|
+
|
|
41
|
+
<form method="get">
|
|
42
|
+
<fieldset>
|
|
43
|
+
|
|
44
|
+
but in our situation, it's not applicable - there is nothing to submit - hence form is inappropriate and fieldset makes only sense within form.
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
<div role="radiogroup"
|
|
48
|
+
aria-labelledby="group_label_1"
|
|
49
|
+
id="rg1">
|
|
50
|
+
<h3 id="group_label_1">
|
|
51
|
+
Pizza Crust
|
|
52
|
+
</h3>
|
|
53
|
+
<div role="radio"
|
|
54
|
+
aria-checked="false"
|
|
55
|
+
tabindex="0">
|
|
56
|
+
Regular crust
|
|
57
|
+
</div>
|
|
58
|
+
<div role="radio"
|
|
59
|
+
aria-checked="false"
|
|
60
|
+
tabindex="-1">
|
|
61
|
+
Deep dish
|
|
62
|
+
</div>
|
|
63
|
+
<div role="radio"
|
|
64
|
+
aria-checked="false"
|
|
65
|
+
tabindex="-1">
|
|
66
|
+
Thin crust
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
<div role="radiogroup"
|
|
70
|
+
aria-labelledby="group_label_2"
|
|
71
|
+
id="rg2">
|
|
72
|
+
<h3 id="group_label_2">
|
|
73
|
+
Pizza Delivery
|
|
74
|
+
</h3>
|
|
75
|
+
<div role="radio"
|
|
76
|
+
aria-checked="false"
|
|
77
|
+
tabindex="0">
|
|
78
|
+
Pickup
|
|
79
|
+
</div>
|
|
80
|
+
<div role="radio"
|
|
81
|
+
aria-checked="false"
|
|
82
|
+
tabindex="-1">
|
|
83
|
+
Home Delivery
|
|
84
|
+
</div>
|
|
85
|
+
<div role="radio"
|
|
86
|
+
aria-checked="false"
|
|
87
|
+
tabindex="-1">
|
|
88
|
+
Dine in
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ewc-lib/ewc-icon-button-group",
|
|
3
|
+
"//": "please always keep version in sync with constructor in main.js",
|
|
4
|
+
"version": "1.0.1-alpha",
|
|
5
|
+
"basedOnStandard": "3.0.1",
|
|
6
|
+
"description": "",
|
|
7
|
+
"main": "src/main.js",
|
|
8
|
+
"scripts": {
|
|
9
|
+
},
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "EUPL v.1.1",
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@ewc-lib/ewc-css-common": "0.1.0",
|
|
17
|
+
"@ewc-lib/ewc-icon-button": "1.0.0-alpha"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Screenshot
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
# Description
|
|
6
|
+
|
|
7
|
+
A group of icon-buttons, displayed in "pill-"design and behaving like radio-buttons - i.e. only one button can be in "pressed" state at any time.
|
|
8
|
+
|
|
9
|
+
The ewc-icon-button-group HTML tag encloses ewc-icon-buttons. It modifies their style, handles events and implements the logic.
|
|
10
|
+
|
|
11
|
+
Note that adding/removing children at runtime is not supported.
|
|
12
|
+
|
|
13
|
+
Regarding focus, arrow keys work analoguous to tab key.
|
|
14
|
+
|
|
15
|
+
Within a button-group, only buttons that are not currently pressed can be focussed.
|
|
16
|
+
|
|
17
|
+
# API
|
|
18
|
+
|
|
19
|
+
## Properties
|
|
20
|
+
|
|
21
|
+
There are no properties.
|
|
22
|
+
|
|
23
|
+
## Attributes
|
|
24
|
+
|
|
25
|
+
- **selectedIndex** - the 0-based index of the currently pressed button.
|
|
26
|
+
|
|
27
|
+
# Events
|
|
28
|
+
|
|
29
|
+
- When a user attempts to press a button, a custom event named "action" is dispatched.
|
|
30
|
+
- The event detail contains the 0-based index of the button which was pressed.
|
|
31
|
+
- It's the component user's responsability to actually set it pressed.
|
|
32
|
+
- This is for two reasons:
|
|
33
|
+
- the developer has a possibility to prevent the button from being pressed
|
|
34
|
+
- to be consistent with the usage of the ewc-icon-button
|
|
35
|
+
|
|
36
|
+
Please see usage-examples/ directory which contains working source-code demonstrating how this works.
|
package/screenshot.png
ADDED
|
Binary file
|
package/src/main.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/*
|
|
2
|
+
button-group: min 1 and max 1 button can be in pressed down state.
|
|
3
|
+
|
|
4
|
+
keyboard navigation:
|
|
5
|
+
- a group can't get a focus
|
|
6
|
+
- buttons in the group can get a focus
|
|
7
|
+
- only not-pressed buttons can get a focus
|
|
8
|
+
- left/up and right/down keys move the focus
|
|
9
|
+
- enter and space key presses a button, releases the currently pressed button
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ButtonGroup {
|
|
14
|
+
#pressedBtnElement = null
|
|
15
|
+
#pressedBtnElementIcon = null
|
|
16
|
+
#currentIndex
|
|
17
|
+
|
|
18
|
+
#storeCurrentBtn(el) {
|
|
19
|
+
if(el) {
|
|
20
|
+
this.#pressedBtnElement=el
|
|
21
|
+
this.#pressedBtnElementIcon=el.getAttribute("icon")
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#restoreCurrent() {
|
|
26
|
+
if(this.#pressedBtnElement) {
|
|
27
|
+
this.#pressedBtnElement.setAttribute("icon", this.#pressedBtnElementIcon)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setPressed(allElements, selectedElIdx) {
|
|
32
|
+
this.#restoreCurrent()
|
|
33
|
+
for(let i=0;i<allElements.length;i++) {
|
|
34
|
+
const el = allElements[i]
|
|
35
|
+
if(i===selectedElIdx){
|
|
36
|
+
el.setAttribute("tabindex","-1")
|
|
37
|
+
el.setAttribute("state","true")
|
|
38
|
+
this.#storeCurrentBtn(el)
|
|
39
|
+
el.setAttribute("icon","check")
|
|
40
|
+
} else {
|
|
41
|
+
el.setAttribute("tabindex","0")
|
|
42
|
+
el.setAttribute("state","false")
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
this.#currentIndex = Number(selectedElIdx)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
getCurrentIndex() {
|
|
49
|
+
return this.#currentIndex
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getCurrentElement() {
|
|
53
|
+
return this.#pressedBtnElement
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class Element extends HTMLElement {
|
|
59
|
+
// only affect ewc-icon-buttons which are children of this element
|
|
60
|
+
#cssClassPrefix = "css-scope-"+ (Math.random() + 1).toString(36).substring(2)
|
|
61
|
+
|
|
62
|
+
#buttonGroup = new ButtonGroup()
|
|
63
|
+
|
|
64
|
+
getAttr(name, _default) {
|
|
65
|
+
const r = this.hasAttribute(name) ? this.getAttribute(name) : _default
|
|
66
|
+
return r
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
connectedCallback() {
|
|
70
|
+
this.setAttribute("ewc-version", "1.0.1-alpha") // please always keep in sync with version in package.json
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
constructor() {
|
|
74
|
+
super()
|
|
75
|
+
|
|
76
|
+
this.classList.add(this.#cssClassPrefix)
|
|
77
|
+
|
|
78
|
+
const s = getStyleTag(`
|
|
79
|
+
.${this.#cssClassPrefix} {
|
|
80
|
+
height: 40px;
|
|
81
|
+
display: flex;
|
|
82
|
+
}
|
|
83
|
+
.${this.#cssClassPrefix} ewc-icon-button::part(button) {
|
|
84
|
+
display:flex;
|
|
85
|
+
align-items:center;
|
|
86
|
+
border: solid 1px var(--c-p);
|
|
87
|
+
padding: 0 5px;
|
|
88
|
+
color: var(--icon-color);
|
|
89
|
+
margin-left: -1px; /* thin 1px separation between the buttons */
|
|
90
|
+
max-width: 125px;
|
|
91
|
+
min-width: 125px;
|
|
92
|
+
}
|
|
93
|
+
.${this.#cssClassPrefix} ewc-icon-button:first-of-type::part(button) {
|
|
94
|
+
border-bottom-left-radius: 50px;
|
|
95
|
+
border-top-left-radius: 50px;
|
|
96
|
+
}
|
|
97
|
+
.${this.#cssClassPrefix} ewc-icon-button:last-of-type::part(button) {
|
|
98
|
+
border-bottom-right-radius: 50px;
|
|
99
|
+
border-top-right-radius: 50px;
|
|
100
|
+
}
|
|
101
|
+
`)
|
|
102
|
+
|
|
103
|
+
this.appendChild(s)
|
|
104
|
+
this.#installEventHandlers()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static observedAttributes = ["selectedindex"]
|
|
108
|
+
|
|
109
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
110
|
+
if (name==="selectedindex") {
|
|
111
|
+
//console.log(Number(newValue),this.#buttonGroup.getCurrentIndex())
|
|
112
|
+
if(Number(newValue)!==this.#buttonGroup.getCurrentIndex()) {
|
|
113
|
+
this.#buttonGroup.setPressed(this.querySelectorAll("ewc-icon-button"), Number(newValue))
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#installEventHandlers() {
|
|
119
|
+
|
|
120
|
+
const nodes = this.querySelectorAll("ewc-icon-button")
|
|
121
|
+
|
|
122
|
+
// relay click/enter presses
|
|
123
|
+
for(let i=0;i<nodes.length;i++) {
|
|
124
|
+
nodes[i].addEventListener("action", (ev) => {
|
|
125
|
+
ev.stopPropagation()
|
|
126
|
+
if(this.#buttonGroup.getCurrentIndex() !== i) {
|
|
127
|
+
const event = new CustomEvent("action", { detail: i});
|
|
128
|
+
this.dispatchEvent(event)
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
nodes[i].setAttribute("__index", i)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// move focus w/ tab. TODO: make the code elegant
|
|
135
|
+
this.addEventListener("keydown", function(ev) {
|
|
136
|
+
let idx = Number(document.activeElement.getAttribute("__index"))
|
|
137
|
+
const nodes = this.querySelectorAll("ewc-icon-button")
|
|
138
|
+
|
|
139
|
+
if(ev.key=="ArrowLeft" || ev.key=="ArrowUp") {
|
|
140
|
+
idx-=1
|
|
141
|
+
if(idx<0) {idx=nodes.length-1}
|
|
142
|
+
if(nodes[idx].getAttribute("tabindex")=="-1") {
|
|
143
|
+
idx-=1
|
|
144
|
+
if(idx<0) {idx=nodes.length-1}
|
|
145
|
+
}
|
|
146
|
+
nodes[idx].focus()
|
|
147
|
+
}
|
|
148
|
+
if(ev.key=="ArrowRight" || ev.key=="ArrowDown") {
|
|
149
|
+
idx+=1
|
|
150
|
+
if(idx>nodes.length-1) {idx=0}
|
|
151
|
+
if(nodes[idx].getAttribute("tabindex")=="-1") {
|
|
152
|
+
idx+=1
|
|
153
|
+
if(idx>nodes.length-1) {idx=0}
|
|
154
|
+
}
|
|
155
|
+
nodes[idx].focus()
|
|
156
|
+
}
|
|
157
|
+
}.bind(this))
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getCurrentlySelectedIndex() {
|
|
161
|
+
return this.#buttonGroup.getCurrentIndex()
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
getCurrentlySelectedElement() {
|
|
165
|
+
return this.#buttonGroup.getCurrentElement()
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
// helper
|
|
171
|
+
function getStyleTag(source) {
|
|
172
|
+
const t = document.createElement('style')
|
|
173
|
+
t.innerHTML = source
|
|
174
|
+
return t
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
if (window.customElements.get("ewc-icon-button-group")) {
|
|
179
|
+
console.warn("ewc-icon-button-group: custom element is already defined")
|
|
180
|
+
} else {
|
|
181
|
+
window.customElements.define("ewc-icon-button-group", Element);
|
|
182
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
Based on @ewc/preset-eu - 4.8.1 Built on 2024-10-17T09:38:44.856Z.
|
|
3
|
+
Note: all CSS Custom Properties defined on :root are available within shadow DOM.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@charset "UTF-8";
|
|
7
|
+
|
|
8
|
+
:root{
|
|
9
|
+
--ewc-color-primary: #0e47cb;
|
|
10
|
+
--ewc-color-primary-180: #082b7a;
|
|
11
|
+
--ewc-color-primary-160: #0a328e;
|
|
12
|
+
--ewc-color-primary-140: #0b39a2;
|
|
13
|
+
--ewc-color-primary-120: #0d40b7;
|
|
14
|
+
--ewc-color-primary-100: #0e47cb;
|
|
15
|
+
--ewc-color-primary-80: #3e6cd5;
|
|
16
|
+
--ewc-color-primary-60: #6e91e0;
|
|
17
|
+
--ewc-color-primary-40: #9fb5ea;
|
|
18
|
+
--ewc-color-primary-20: #cfdaf5;
|
|
19
|
+
--ewc-color-primary-10: #e7edfa;
|
|
20
|
+
--ewc-color-primary-5: #f3f6fc;
|
|
21
|
+
--ewc-color-secondary: #fc0;
|
|
22
|
+
--ewc-color-secondary-180: #997a00;
|
|
23
|
+
--ewc-color-secondary-160: #b38f00;
|
|
24
|
+
--ewc-color-secondary-140: #cca300;
|
|
25
|
+
--ewc-color-secondary-120: #e6b800;
|
|
26
|
+
--ewc-color-secondary-100: #fc0;
|
|
27
|
+
--ewc-color-secondary-80: #ffd633;
|
|
28
|
+
--ewc-color-secondary-60: #ffe066;
|
|
29
|
+
--ewc-color-secondary-40: #ffeb99;
|
|
30
|
+
--ewc-color-secondary-20: #fff5cc;
|
|
31
|
+
--ewc-color-dark: #262b38;
|
|
32
|
+
--ewc-color-dark-100: #262b38;
|
|
33
|
+
--ewc-color-dark-80: #515560;
|
|
34
|
+
--ewc-color-dark-60: #7d8088;
|
|
35
|
+
--ewc-color-dark-40: #a8aaaf;
|
|
36
|
+
--ewc-color-dark-20: #d4d5d7;
|
|
37
|
+
--ewc-color-dark-10: #e9eaeb;
|
|
38
|
+
--ewc-color-dark-5: #f4f5f5;
|
|
39
|
+
--ewc-color-info: #0e47cb;
|
|
40
|
+
--ewc-color-info-100: #0e47cb;
|
|
41
|
+
--ewc-color-info-5: #f3f6fc;
|
|
42
|
+
--ewc-color-success: #00a174;
|
|
43
|
+
--ewc-color-success-100: #00a174;
|
|
44
|
+
--ewc-color-success-5: #f2fcf9;
|
|
45
|
+
--ewc-color-warning: #ff8133;
|
|
46
|
+
--ewc-color-warning-100: #ff8133;
|
|
47
|
+
--ewc-color-warning-5: #fff7f2;
|
|
48
|
+
--ewc-color-error: #d7003d;
|
|
49
|
+
--ewc-color-error-100: #d7003d;
|
|
50
|
+
--ewc-color-error-5: #fef2f5;
|
|
51
|
+
--ewc-color-accent: #00e9ff;
|
|
52
|
+
--ewc-color-accent-100: #00e9ff;
|
|
53
|
+
--ewc-color-accent-30: #b3f8ff;
|
|
54
|
+
--ewc-color-overlay-light: color-mix(in srgb, var(--c-d) 70%, transparent);
|
|
55
|
+
--ewc-color-overlay-dark: color-mix(in srgb, var(--c-d) 90%, transparent);
|
|
56
|
+
--ewc-font-family-default: arial, sans-serif;
|
|
57
|
+
--ewc-font-family-print-default: verdana, sans-serif;
|
|
58
|
+
--ewc-font-family-print-alt: arial, sans-serif;
|
|
59
|
+
--ewc-font-xs: normal normal 400 0.75rem/1.125rem arial, sans-serif;
|
|
60
|
+
--ewc-font-s: normal normal 400 0.875rem/1.125rem arial, sans-serif;
|
|
61
|
+
--ewc-font-m: normal normal 400 1rem/1.5rem arial, sans-serif;
|
|
62
|
+
--ewc-font-l: normal normal 400 1.25rem/1.75rem arial, sans-serif;
|
|
63
|
+
--ewc-font-xl: normal normal 400 1.5rem/1.75rem arial, sans-serif;
|
|
64
|
+
--ewc-font-2xl: normal normal 400 1.75rem/2rem arial, sans-serif;
|
|
65
|
+
--ewc-font-3xl: normal normal 400 2rem/2.5rem arial, sans-serif;
|
|
66
|
+
--ewc-font-4xl: normal normal 400 2.25rem/2.75rem arial, sans-serif;
|
|
67
|
+
--ewc-font-5xl: normal normal 400 2.625rem/3.25rem arial, sans-serif;
|
|
68
|
+
--ewc-font-ui-s: normal normal 400 0.875rem/1.5rem arial, sans-serif;
|
|
69
|
+
--ewc-font-ui-m: normal normal 400 1rem/1.75rem arial, sans-serif;
|
|
70
|
+
--ewc-spacing-2xs: 0.25rem;
|
|
71
|
+
--ewc-spacing-xs: 0.5rem;
|
|
72
|
+
--ewc-spacing-s: 0.75rem;
|
|
73
|
+
--ewc-spacing-m: 1rem;
|
|
74
|
+
--ewc-spacing-l: 1.5rem;
|
|
75
|
+
--ewc-spacing-xl: 2rem;
|
|
76
|
+
--ewc-spacing-2xl: 2.5rem;
|
|
77
|
+
--ewc-spacing-3xl: 3rem;
|
|
78
|
+
--ewc-spacing-4xl: 4rem;
|
|
79
|
+
--ewc-shadow-1: 0 2px 4px rgba(9, 49, 142, 0.08),
|
|
80
|
+
0 0 10px rgba(9, 49, 142, 0.04), 0 4px 5px rgba(9, 49, 142, 0.04),
|
|
81
|
+
0 -4px 4px rgba(9, 49, 142, 0.04);
|
|
82
|
+
--ewc-shadow-2: 0 3px 5px rgba(9, 49, 142, 0.04),
|
|
83
|
+
0 0 18px rgba(9, 49, 142, 0.04), 0 6px 10px rgba(9, 49, 142, 0.04),
|
|
84
|
+
0 -4px 4px rgba(9, 49, 142, 0.04);
|
|
85
|
+
--ewc-shadow-3: 0 7px 8px rgba(9, 49, 142, 0.08),
|
|
86
|
+
0 0 22px rgba(9, 49, 142, 0.04), 0 12px 17px rgba(9, 49, 142, 0.04),
|
|
87
|
+
0 -4px 4px rgba(9, 49, 142, 0.04);
|
|
88
|
+
--ewc-shadow-4: 0 11px 15px rgba(9, 49, 142, 0.08),
|
|
89
|
+
0 9px 46px rgba(9, 49, 142, 0.04), 0 24px 38px rgba(9, 49, 142, 0.04),
|
|
90
|
+
0 -4px 4px rgba(9, 49, 142, 0.04);
|
|
91
|
+
--ewc-shadow-inner-1: 0 2px 4px rgba(9, 49, 142, 0.08) inset,
|
|
92
|
+
0 0 10px rgba(9, 49, 142, 0.04) inset,
|
|
93
|
+
0 4px 5px rgba(9, 49, 142, 0.04) inset,
|
|
94
|
+
0 -4px 4px rgba(9, 49, 142, 0.04) inset;
|
|
95
|
+
--ewc-shadow-inner-2: 0 3px 5px rgba(9, 49, 142, 0.04) inset,
|
|
96
|
+
0 0 18px rgba(9, 49, 142, 0.04) inset,
|
|
97
|
+
0 6px 10px rgba(9, 49, 142, 0.04) inset,
|
|
98
|
+
0 -4px 4px rgba(9, 49, 142, 0.04) inset;
|
|
99
|
+
--ewc-shadow-negative-1: 0 2px 4px hsla(0, 0%, 100%, 0.08),
|
|
100
|
+
0 0 10px hsla(0, 0%, 100%, 0.04), 0 4px 5px hsla(0, 0%, 100%, 0.04),
|
|
101
|
+
0 -4px 4px hsla(0, 0%, 100%, 0.04);
|
|
102
|
+
--ewc-shadow-negative-2: 0 3px 5px hsla(0, 0%, 100%, 0.04),
|
|
103
|
+
0 0 18px hsla(0, 0%, 100%, 0.04), 0 6px 10px hsla(0, 0%, 100%, 0.04),
|
|
104
|
+
0 -4px 4px hsla(0, 0%, 100%, 0.04);
|
|
105
|
+
--ewc-shadow-negative-3: 0 7px 8px hsla(0, 0%, 100%, 0.08),
|
|
106
|
+
0 0 22px hsla(0, 0%, 100%, 0.04), 0 12px 17px hsla(0, 0%, 100%, 0.04),
|
|
107
|
+
0 -4px 4px hsla(0, 0%, 100%, 0.04);
|
|
108
|
+
--ewc-shadow-negative-4: 0 11px 15px rgba(9, 49, 142, 0.08),
|
|
109
|
+
0 9px 46px rgba(9, 49, 142, 0.04), 0 24px 38px rgba(9, 49, 142, 0.04),
|
|
110
|
+
0 -4px 4px rgba(9, 49, 142, 0.04);
|
|
111
|
+
--ewc-shadow-negative-inner-1: 0 2px 4px hsla(0, 0%, 100%, 0.08) inset,
|
|
112
|
+
0 0 10px hsla(0, 0%, 100%, 0.04) inset,
|
|
113
|
+
0 4px 5px hsla(0, 0%, 100%, 0.04) inset,
|
|
114
|
+
0 -4px 4px hsla(0, 0%, 100%, 0.04) inset;
|
|
115
|
+
--ewc-shadow-negative-inner-2: 0 3px 5px hsla(0, 0%, 100%, 0.04) inset,
|
|
116
|
+
0 0 18px hsla(0, 0%, 100%, 0.04) inset,
|
|
117
|
+
0 6px 10px hsla(0, 0%, 100%, 0.04) inset,
|
|
118
|
+
0 -4px 4px hsla(0, 0%, 100%, 0.04) inset;
|
|
119
|
+
--ewc-max-width: 80ch;
|
|
120
|
+
--c-p: var(--ewc-color-primary);
|
|
121
|
+
--c-p-180: var(--ewc-color-primary-180);
|
|
122
|
+
--c-p-160: var(--ewc-color-primary-160);
|
|
123
|
+
--c-p-140: var(--ewc-color-primary-140);
|
|
124
|
+
--c-p-120: var(--ewc-color-primary-120);
|
|
125
|
+
--c-p-100: var(--ewc-color-primary-100);
|
|
126
|
+
--c-p-80: var(--ewc-color-primary-80);
|
|
127
|
+
--c-p-60: var(--ewc-color-primary-60);
|
|
128
|
+
--c-p-40: var(--ewc-color-primary-40);
|
|
129
|
+
--c-p-20: var(--ewc-color-primary-20);
|
|
130
|
+
--c-p-10: var(--ewc-color-primary-10);
|
|
131
|
+
--c-p-5: var(--ewc-color-primary-5);
|
|
132
|
+
--c-s: var(--ewc-color-secondary);
|
|
133
|
+
--c-s-180: var(--ewc-color-secondary-180);
|
|
134
|
+
--c-s-160: var(--ewc-color-secondary-160);
|
|
135
|
+
--c-s-140: var(--ewc-color-secondary-140);
|
|
136
|
+
--c-s-120: var(--ewc-color-secondary-120);
|
|
137
|
+
--c-s-100: var(--ewc-color-secondary-100);
|
|
138
|
+
--c-s-80: var(--ewc-color-secondary-80);
|
|
139
|
+
--c-s-60: var(--ewc-color-secondary-60);
|
|
140
|
+
--c-s-40: var(--ewc-color-secondary-40);
|
|
141
|
+
--c-s-20: var(--ewc-color-secondary-20);
|
|
142
|
+
--c-d: var(--ewc-color-dark);
|
|
143
|
+
--c-d-100: var(--ewc-color-dark-100);
|
|
144
|
+
--c-d-80: var(--ewc-color-dark-80);
|
|
145
|
+
--c-d-60: var(--ewc-color-dark-60);
|
|
146
|
+
--c-d-40: var(--ewc-color-dark-40);
|
|
147
|
+
--c-d-20: var(--ewc-color-dark-20);
|
|
148
|
+
--c-d-10: var(--ewc-color-dark-10);
|
|
149
|
+
--c-d-5: var(--ewc-color-dark-5);
|
|
150
|
+
--c-in: var(--ewc-color-info);
|
|
151
|
+
--c-in-100: var(--ewc-color-info-100);
|
|
152
|
+
--c-in-5: var(--ewc-color-info-5);
|
|
153
|
+
--c-su: var(--ewc-color-success);
|
|
154
|
+
--c-su-100: var(--ewc-color-success-100);
|
|
155
|
+
--c-su-5: var(--ewc-color-success-5);
|
|
156
|
+
--c-wa: var(--ewc-color-warning);
|
|
157
|
+
--c-wa-100: var(--ewc-color-warning-100);
|
|
158
|
+
--c-wa-5: var(--ewc-color-warning-5);
|
|
159
|
+
--c-er: var(--ewc-color-error);
|
|
160
|
+
--c-er-100: var(--ewc-color-error-100);
|
|
161
|
+
--c-er-5: var(--ewc-color-error-5);
|
|
162
|
+
--c-a: var(--ewc-color-accent);
|
|
163
|
+
--c-a-100: var(--ewc-color-accent-100);
|
|
164
|
+
--c-a-30: var(--ewc-color-accent-30);
|
|
165
|
+
--c-ov-l: var(--ewc-color-overlay-light);
|
|
166
|
+
--c-ov-d: var(--ewc-color-overlay-dark);
|
|
167
|
+
--ff-d: var(--ewc-font-family-default);
|
|
168
|
+
--f-xs: var(--ewc-font-xs);
|
|
169
|
+
--f-s: var(--ewc-font-s);
|
|
170
|
+
--f-m: var(--ewc-font-m);
|
|
171
|
+
--f-l: var(--ewc-font-l);
|
|
172
|
+
--f-xl: var(--ewc-font-xl);
|
|
173
|
+
--f-2xl: var(--ewc-font-2xl);
|
|
174
|
+
--f-3xl: var(--ewc-font-3xl);
|
|
175
|
+
--f-4xl: var(--ewc-font-4xl);
|
|
176
|
+
--f-5xl: var(--ewc-font-5xl);
|
|
177
|
+
--f-ui-s: var(--ewc-font-ui-s);
|
|
178
|
+
--f-ui-m: var(--ewc-font-ui-m);
|
|
179
|
+
--s-2xs: var(--ewc-spacing-2xs);
|
|
180
|
+
--s-xs: var(--ewc-spacing-xs);
|
|
181
|
+
--s-s: var(--ewc-spacing-s);
|
|
182
|
+
--s-m: var(--ewc-spacing-m);
|
|
183
|
+
--s-l: var(--ewc-spacing-l);
|
|
184
|
+
--s-xl: var(--ewc-spacing-xl);
|
|
185
|
+
--s-2xl: var(--ewc-spacing-2xl);
|
|
186
|
+
--s-3xl: var(--ewc-spacing-3xl);
|
|
187
|
+
--s-4xl: var(--ewc-spacing-4xl);
|
|
188
|
+
--sh-1: var(--ewc-shadow-1);
|
|
189
|
+
--sh-2: var(--ewc-shadow-2);
|
|
190
|
+
--sh-3: var(--ewc-shadow-3);
|
|
191
|
+
--sh-4: var(--ewc-shadow-4);
|
|
192
|
+
--sh-i-1: var(--ewc-shadow-inner-1);
|
|
193
|
+
--sh-i-2: var(--ewc-shadow-inner-2);
|
|
194
|
+
--sh-n-1: var(--ewc-shadow-negative-1);
|
|
195
|
+
--sh-n-2: var(--ewc-shadow-negative-2);
|
|
196
|
+
--sh-n-3: var(--ewc-shadow-negative-3);
|
|
197
|
+
--sh-n-4: var(--ewc-shadow-negative-4);
|
|
198
|
+
--sh-n-i-1: var(--ewc-shadow-negative-inner-1);
|
|
199
|
+
--sh-n-i-2: var(--ewc-shadow-negative-inner-2);
|
|
200
|
+
--max-w: var(--ewc-max-width);
|
|
201
|
+
--ewc-color-primary-130: #0a328e;
|
|
202
|
+
--c-p-130: var(--ewc-color-primary-130);
|
|
203
|
+
--ewc-color-secondary-10: #fffae6;
|
|
204
|
+
--c-s-10: var(--ewc-color-secondary-10);
|
|
205
|
+
--ewc-color-dark-140: #171a22;
|
|
206
|
+
--c-d-140: var(--ewc-color-dark-140);
|
|
207
|
+
--ewc-color-dark-120: #1e222d;
|
|
208
|
+
--c-d-120: var(--ewc-color-dark-120);
|
|
209
|
+
--ewc-color-error-80: #ef0044;
|
|
210
|
+
--c-er-80: var(--ewc-color-error-80);
|
|
211
|
+
--ewc-color-branding: #0e47cb;
|
|
212
|
+
--c-br: var(--ewc-color-branding);
|
|
213
|
+
--ewc-color-visited: #510dcd;
|
|
214
|
+
--c-v: var(--ewc-color-visited);
|
|
215
|
+
--ewc-color-visited-100: #510dcd;
|
|
216
|
+
--c-v-100: var(--ewc-color-visited-100);
|
|
217
|
+
--ewc-color-visited-40: #bf9af1;
|
|
218
|
+
--c-v-40: var(--ewc-color-visited-40);
|
|
219
|
+
--ewc-font-2xs: normal normal 400 0.625rem/1rem arial, sans-serif;
|
|
220
|
+
--f-2xs: var(--ewc-font-2xs);
|
|
221
|
+
--ewc-font-6xl: normal normal 400 2.625rem/3.25rem arial, sans-serif;
|
|
222
|
+
--f-6xl: var(--ewc-font-6xl);
|
|
223
|
+
--ewc-font-prolonged-xs: normal normal 400 0.75rem/1.25rem arial, sans-serif;
|
|
224
|
+
--f-p-xs: var(--ewc-font-prolonged-xs);
|
|
225
|
+
--ewc-font-prolonged-s: normal normal 400 0.875rem/1.25rem arial, sans-serif;
|
|
226
|
+
--f-p-s: var(--ewc-font-prolonged-s);
|
|
227
|
+
--ewc-font-prolonged-m: normal normal 400 1rem/1.5rem arial, sans-serif;
|
|
228
|
+
--f-p-m: var(--ewc-font-prolonged-m);
|
|
229
|
+
--ewc-font-prolonged-l: normal normal 400 1.25rem/1.75rem arial, sans-serif;
|
|
230
|
+
--f-p-l: var(--ewc-font-prolonged-l);
|
|
231
|
+
--ewc-font-prolonged-xl: normal normal 400 1.5rem/1.75rem arial, sans-serif;
|
|
232
|
+
--f-p-xl: var(--ewc-font-prolonged-xl);
|
|
233
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<style>
|
|
7
|
+
body{
|
|
8
|
+
font-family: 'Arial', sans-serif;
|
|
9
|
+
margin:0;
|
|
10
|
+
padding:100px;
|
|
11
|
+
}
|
|
12
|
+
#container {
|
|
13
|
+
width: 650px;
|
|
14
|
+
justify-self: center;
|
|
15
|
+
margin-top: 100px;
|
|
16
|
+
outline:2px solid darkblue;
|
|
17
|
+
outline-offset: 5px;
|
|
18
|
+
}
|
|
19
|
+
</style>
|
|
20
|
+
<link rel="stylesheet" href="./custom-props.css">
|
|
21
|
+
</head>
|
|
22
|
+
|
|
23
|
+
<body>
|
|
24
|
+
<script src="./ewc-icon-button/src/main.js" type="module"></script>
|
|
25
|
+
<script src="./ewc-icon-button-group/src/main.js" type="module"></script>
|
|
26
|
+
|
|
27
|
+
<div id="container">
|
|
28
|
+
<p style="margin-bottom: 50px;">Buttons available, on light and dark background</p>
|
|
29
|
+
|
|
30
|
+
<div style="margin:20px; padding:20px;">
|
|
31
|
+
<ewc-icon-button-group style="width:600px;" selectedIndex="0" id="one">
|
|
32
|
+
<ewc-icon-button icon="linechart" use-config="grp-linechart" label="Line chart"></ewc-icon-button>
|
|
33
|
+
<ewc-icon-button icon="barchart" use-config="grp-barchart" label="Bar chart"></ewc-icon-button>
|
|
34
|
+
<ewc-icon-button icon="dotplot" use-config="grp-dotplot" label="Dot plot"></ewc-icon-button>
|
|
35
|
+
<ewc-icon-button icon="table" use-config="grp-table" label="Table"></ewc-icon-button>
|
|
36
|
+
</ewc-icon-button-group>
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
<div style="margin:20px; padding:20px; background: darkblue;">
|
|
40
|
+
<ewc-icon-button-group style="width:600px;" selectedIndex="3" id="two">
|
|
41
|
+
<ewc-icon-button state="disabled" icon="linechart" background="dark" use-config="grp-linechart" label="Line chart"></ewc-icon-button>
|
|
42
|
+
<ewc-icon-button icon="barchart" background="dark" use-config="grp-barchart" label="Bar chart"></ewc-icon-button>
|
|
43
|
+
<ewc-icon-button icon="dotplot" background="dark" use-config="grp-dotplot" label="Dot plot"></ewc-icon-button>
|
|
44
|
+
<ewc-icon-button icon="table" background="dark" use-config="grp-table" label="Table"></ewc-icon-button>
|
|
45
|
+
</ewc-icon-button-group>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
window.addEventListener('DOMContentLoaded',function () {
|
|
51
|
+
// catch events of all buttons at once
|
|
52
|
+
document.getElementById("one").addEventListener("action",(e)=>{
|
|
53
|
+
document.getElementById("one").setAttribute("selectedIndex",e.detail)
|
|
54
|
+
const el = document.getElementById("one").getCurrentlySelectedElement()
|
|
55
|
+
console.log("button clicked or selected w/ kdb: ", e.detail, el)
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
window.addEventListener('DOMContentLoaded',function () {
|
|
60
|
+
// catch events of all buttons at once
|
|
61
|
+
document.getElementById("two").addEventListener("action",(e)=>{
|
|
62
|
+
document.getElementById("two").setAttribute("selectedIndex",e.detail)
|
|
63
|
+
const el = document.getElementById("two").getCurrentlySelectedElement()
|
|
64
|
+
console.log("button clicked or selected w/ kdb: ", e.detail, el)
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
</body>
|
|
70
|
+
|
|
71
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Serve this directory - e.g. with "python3 -m http.server 8080". Note that a filesystem supporting links is assumed.
|