@webtides/element-library 0.1.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 +109 -0
- package/LICENSE +21 -0
- package/README.md +125 -0
- package/all.js +26 -0
- package/custom-elements.json +7683 -0
- package/index.js +3 -0
- package/package.json +132 -0
- package/patches/@glidejs+glide+3.6.2.patch +11 -0
- package/src/components/accordion/accordion.changelog.md +47 -0
- package/src/components/accordion/accordion.define.js +3 -0
- package/src/components/accordion/accordion.events.js +3 -0
- package/src/components/accordion/accordion.js +144 -0
- package/src/components/accordion/accordion.readme.md +71 -0
- package/src/components/accordion/accordion.style.js +64 -0
- package/src/components/accordion-group/accordion-group.changelog.md +35 -0
- package/src/components/accordion-group/accordion-group.define.js +3 -0
- package/src/components/accordion-group/accordion-group.js +63 -0
- package/src/components/accordion-group/accordion-group.readme.md +56 -0
- package/src/components/amount-field/amount-field.changelog.md +40 -0
- package/src/components/amount-field/amount-field.define.js +3 -0
- package/src/components/amount-field/amount-field.js +91 -0
- package/src/components/amount-field/amount-field.readme.md +65 -0
- package/src/components/amount-field/amount-field.style.js +58 -0
- package/src/components/button/button.changelog.md +19 -0
- package/src/components/button/button.define.js +3 -0
- package/src/components/button/button.js +174 -0
- package/src/components/button/button.readme.md +91 -0
- package/src/components/button/button.style.js +251 -0
- package/src/components/carousel/carousel.changelog.md +58 -0
- package/src/components/carousel/carousel.define.js +3 -0
- package/src/components/carousel/carousel.events.js +3 -0
- package/src/components/carousel/carousel.js +232 -0
- package/src/components/carousel/carousel.readme.md +78 -0
- package/src/components/carousel/carousel.style.js +142 -0
- package/src/components/carousel/glide/components/ShadowAnchors.js +12 -0
- package/src/components/carousel/glide/components/ShadowClones.js +41 -0
- package/src/components/carousel/glide/components/ShadowGaps.js +28 -0
- package/src/components/carousel/glide/components/ShadowHtml.js +32 -0
- package/src/components/checkbox-field/checkbox-field.changelog.md +47 -0
- package/src/components/checkbox-field/checkbox-field.define.js +3 -0
- package/src/components/checkbox-field/checkbox-field.js +102 -0
- package/src/components/checkbox-field/checkbox-field.readme.md +66 -0
- package/src/components/checkbox-field/checkbox-field.style.js +69 -0
- package/src/components/dialog/dialog.changelog.md +24 -0
- package/src/components/dialog/dialog.define.js +3 -0
- package/src/components/dialog/dialog.events.js +8 -0
- package/src/components/dialog/dialog.js +271 -0
- package/src/components/dialog/dialog.readme.md +122 -0
- package/src/components/dialog/dialog.style.js +124 -0
- package/src/components/dropdown/dropdown.changelog.md +39 -0
- package/src/components/dropdown/dropdown.define.js +3 -0
- package/src/components/dropdown/dropdown.js +98 -0
- package/src/components/dropdown/dropdown.readme.md +69 -0
- package/src/components/dropdown/dropdown.style.js +17 -0
- package/src/components/form-field/form-field.changelog.md +35 -0
- package/src/components/form-field/form-field.define.js +3 -0
- package/src/components/form-field/form-field.events.js +4 -0
- package/src/components/form-field/form-field.js +210 -0
- package/src/components/form-field/form-field.readme.md +80 -0
- package/src/components/form-field/form-field.style.js +25 -0
- package/src/components/input-field/input-field.changelog.md +39 -0
- package/src/components/input-field/input-field.define.js +3 -0
- package/src/components/input-field/input-field.js +71 -0
- package/src/components/input-field/input-field.readme.md +90 -0
- package/src/components/input-field/input-field.style.js +33 -0
- package/src/components/lazy-src/lazy-src.changelog.md +57 -0
- package/src/components/lazy-src/lazy-src.define.js +3 -0
- package/src/components/lazy-src/lazy-src.events.js +5 -0
- package/src/components/lazy-src/lazy-src.js +100 -0
- package/src/components/lazy-src/lazy-src.readme.md +63 -0
- package/src/components/notification/notification.changelog.md +22 -0
- package/src/components/notification/notification.define.js +3 -0
- package/src/components/notification/notification.events.js +6 -0
- package/src/components/notification/notification.js +280 -0
- package/src/components/notification/notification.readme.md +98 -0
- package/src/components/notification/notification.style.js +113 -0
- package/src/components/password-field/password-field.changelog.md +22 -0
- package/src/components/password-field/password-field.define.js +3 -0
- package/src/components/password-field/password-field.js +113 -0
- package/src/components/password-field/password-field.readme.md +60 -0
- package/src/components/password-field/password-field.style.js +62 -0
- package/src/components/radio-field/radio-field.changelog.md +21 -0
- package/src/components/radio-field/radio-field.define.js +3 -0
- package/src/components/radio-field/radio-field.js +140 -0
- package/src/components/radio-field/radio-field.readme.md +72 -0
- package/src/components/radio-field/radio-field.style.js +108 -0
- package/src/components/scroll-to/scroll-to.changelog.md +39 -0
- package/src/components/scroll-to/scroll-to.define.js +3 -0
- package/src/components/scroll-to/scroll-to.js +40 -0
- package/src/components/scroll-to/scroll-to.readme.md +50 -0
- package/src/components/scroll-to-top/scroll-to-top.changelog.md +39 -0
- package/src/components/scroll-to-top/scroll-to-top.define.js +3 -0
- package/src/components/scroll-to-top/scroll-to-top.js +78 -0
- package/src/components/scroll-to-top/scroll-to-top.readme.md +48 -0
- package/src/components/scroll-to-top/scroll-to-top.style.js +9 -0
- package/src/components/select-field/select-field.changelog.md +30 -0
- package/src/components/select-field/select-field.define.js +3 -0
- package/src/components/select-field/select-field.js +83 -0
- package/src/components/select-field/select-field.readme.md +131 -0
- package/src/components/select-field/select-field.style.js +24 -0
- package/src/components/slider/slider.changelog.md +177 -0
- package/src/components/slider/slider.define.js +3 -0
- package/src/components/slider/slider.events.js +4 -0
- package/src/components/slider/slider.js +338 -0
- package/src/components/slider/slider.readme.md +87 -0
- package/src/components/slider/slider.style.js +107 -0
- package/src/components/sticky/sticky.changelog.md +43 -0
- package/src/components/sticky/sticky.define.js +3 -0
- package/src/components/sticky/sticky.js +105 -0
- package/src/components/sticky/sticky.readme.md +63 -0
- package/src/components/sticky/sticky.style.js +21 -0
- package/src/components/svg-use/svg-use.changelog.md +41 -0
- package/src/components/svg-use/svg-use.define.js +3 -0
- package/src/components/svg-use/svg-use.js +39 -0
- package/src/components/svg-use/svg-use.readme.md +50 -0
- package/src/components/svg-use/svg-use.style.js +20 -0
- package/src/components/switch-field/switch-field.changelog.md +21 -0
- package/src/components/switch-field/switch-field.define.js +3 -0
- package/src/components/switch-field/switch-field.js +99 -0
- package/src/components/switch-field/switch-field.readme.md +58 -0
- package/src/components/switch-field/switch-field.style.js +98 -0
- package/src/components/tab-group/tab-group.changelog.md +35 -0
- package/src/components/tab-group/tab-group.define.js +3 -0
- package/src/components/tab-group/tab-group.js +109 -0
- package/src/components/tab-group/tab-group.readme.md +61 -0
- package/src/components/tab-group/tab-group.style.js +7 -0
- package/src/components/tab-link/tab-link.changelog.md +35 -0
- package/src/components/tab-link/tab-link.define.js +3 -0
- package/src/components/tab-link/tab-link.js +50 -0
- package/src/components/tab-link/tab-link.readme.md +66 -0
- package/src/components/tab-link/tab-link.style.js +32 -0
- package/src/components/tab-panel/tab-panel.changelog.md +39 -0
- package/src/components/tab-panel/tab-panel.define.js +3 -0
- package/src/components/tab-panel/tab-panel.js +30 -0
- package/src/components/tab-panel/tab-panel.readme.md +57 -0
- package/src/components/tab-panel/tab-panel.style.js +7 -0
- package/src/components/textarea-field/textarea-field.changelog.md +39 -0
- package/src/components/textarea-field/textarea-field.define.js +3 -0
- package/src/components/textarea-field/textarea-field.js +62 -0
- package/src/components/textarea-field/textarea-field.readme.md +102 -0
- package/src/components/textarea-field/textarea-field.style.js +7 -0
- package/src/components/transition-classes/transition-classes.changelog.md +39 -0
- package/src/components/transition-classes/transition-classes.define.js +3 -0
- package/src/components/transition-classes/transition-classes.js +154 -0
- package/src/components/transition-classes/transition-classes.readme.md +71 -0
- package/src/themes/default.css +165 -0
- package/src/themes/high-contrast.css +147 -0
- package/src/themes/sketchy.css +238 -0
- package/types/all.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/src/components/accordion/accordion.d.ts +60 -0
- package/types/src/components/accordion/accordion.define.d.ts +1 -0
- package/types/src/components/accordion/accordion.events.d.ts +4 -0
- package/types/src/components/accordion/accordion.style.d.ts +2 -0
- package/types/src/components/accordion-group/accordion-group.d.ts +28 -0
- package/types/src/components/accordion-group/accordion-group.define.d.ts +1 -0
- package/types/src/components/amount-field/amount-field.d.ts +53 -0
- package/types/src/components/amount-field/amount-field.define.d.ts +1 -0
- package/types/src/components/amount-field/amount-field.style.d.ts +2 -0
- package/types/src/components/button/button.d.ts +73 -0
- package/types/src/components/button/button.define.d.ts +1 -0
- package/types/src/components/button/button.style.d.ts +2 -0
- package/types/src/components/carousel/carousel.d.ts +79 -0
- package/types/src/components/carousel/carousel.define.d.ts +1 -0
- package/types/src/components/carousel/carousel.events.d.ts +4 -0
- package/types/src/components/carousel/carousel.style.d.ts +2 -0
- package/types/src/components/carousel/glide/components/ShadowAnchors.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowClones.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowGaps.d.ts +1 -0
- package/types/src/components/carousel/glide/components/ShadowHtml.d.ts +1 -0
- package/types/src/components/checkbox-field/checkbox-field.d.ts +69 -0
- package/types/src/components/checkbox-field/checkbox-field.define.d.ts +1 -0
- package/types/src/components/checkbox-field/checkbox-field.style.d.ts +2 -0
- package/types/src/components/dialog/dialog.d.ts +103 -0
- package/types/src/components/dialog/dialog.define.d.ts +1 -0
- package/types/src/components/dialog/dialog.events.d.ts +9 -0
- package/types/src/components/dialog/dialog.style.d.ts +2 -0
- package/types/src/components/dropdown/dropdown.d.ts +45 -0
- package/types/src/components/dropdown/dropdown.define.d.ts +1 -0
- package/types/src/components/dropdown/dropdown.style.d.ts +2 -0
- package/types/src/components/form-field/form-field.d.ts +110 -0
- package/types/src/components/form-field/form-field.define.d.ts +1 -0
- package/types/src/components/form-field/form-field.events.d.ts +5 -0
- package/types/src/components/form-field/form-field.style.d.ts +2 -0
- package/types/src/components/input-field/input-field.d.ts +38 -0
- package/types/src/components/input-field/input-field.define.d.ts +1 -0
- package/types/src/components/input-field/input-field.style.d.ts +2 -0
- package/types/src/components/lazy-src/lazy-src.d.ts +46 -0
- package/types/src/components/lazy-src/lazy-src.define.d.ts +1 -0
- package/types/src/components/lazy-src/lazy-src.events.d.ts +6 -0
- package/types/src/components/notification/notification.d.ts +92 -0
- package/types/src/components/notification/notification.define.d.ts +1 -0
- package/types/src/components/notification/notification.events.d.ts +7 -0
- package/types/src/components/notification/notification.style.d.ts +2 -0
- package/types/src/components/password-field/password-field.d.ts +66 -0
- package/types/src/components/password-field/password-field.define.d.ts +1 -0
- package/types/src/components/password-field/password-field.style.d.ts +2 -0
- package/types/src/components/radio-field/radio-field.d.ts +62 -0
- package/types/src/components/radio-field/radio-field.define.d.ts +1 -0
- package/types/src/components/radio-field/radio-field.style.d.ts +2 -0
- package/types/src/components/scroll-to/scroll-to.d.ts +24 -0
- package/types/src/components/scroll-to/scroll-to.define.d.ts +1 -0
- package/types/src/components/scroll-to-top/scroll-to-top.d.ts +32 -0
- package/types/src/components/scroll-to-top/scroll-to-top.define.d.ts +1 -0
- package/types/src/components/scroll-to-top/scroll-to-top.style.d.ts +2 -0
- package/types/src/components/select-field/select-field.d.ts +39 -0
- package/types/src/components/select-field/select-field.define.d.ts +1 -0
- package/types/src/components/select-field/select-field.style.d.ts +2 -0
- package/types/src/components/slider/slider.d.ts +129 -0
- package/types/src/components/slider/slider.define.d.ts +1 -0
- package/types/src/components/slider/slider.events.d.ts +5 -0
- package/types/src/components/slider/slider.style.d.ts +2 -0
- package/types/src/components/sticky/sticky.d.ts +47 -0
- package/types/src/components/sticky/sticky.define.d.ts +1 -0
- package/types/src/components/sticky/sticky.style.d.ts +2 -0
- package/types/src/components/svg-use/svg-use.d.ts +18 -0
- package/types/src/components/svg-use/svg-use.define.d.ts +1 -0
- package/types/src/components/svg-use/svg-use.style.d.ts +2 -0
- package/types/src/components/switch-field/switch-field.d.ts +67 -0
- package/types/src/components/switch-field/switch-field.define.d.ts +1 -0
- package/types/src/components/switch-field/switch-field.style.d.ts +2 -0
- package/types/src/components/tab-group/tab-group.d.ts +48 -0
- package/types/src/components/tab-group/tab-group.define.d.ts +1 -0
- package/types/src/components/tab-group/tab-group.style.d.ts +2 -0
- package/types/src/components/tab-link/tab-link.d.ts +30 -0
- package/types/src/components/tab-link/tab-link.define.d.ts +1 -0
- package/types/src/components/tab-link/tab-link.style.d.ts +2 -0
- package/types/src/components/tab-panel/tab-panel.d.ts +18 -0
- package/types/src/components/tab-panel/tab-panel.define.d.ts +1 -0
- package/types/src/components/tab-panel/tab-panel.style.d.ts +2 -0
- package/types/src/components/textarea-field/textarea-field.d.ts +34 -0
- package/types/src/components/textarea-field/textarea-field.define.d.ts +1 -0
- package/types/src/components/textarea-field/textarea-field.style.d.ts +2 -0
- package/types/src/components/transition-classes/transition-classes.d.ts +52 -0
- package/types/src/components/transition-classes/transition-classes.define.d.ts +1 -0
- package/types/src/utils/body-scroll.d.ts +4 -0
- package/types/src/utils/transitions.d.ts +9 -0
- package/web-types.json +3956 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
// Glide's core + theme CSS is inlined here rather than `@import`-ed, because element-js
|
|
4
|
+
// applies component styles as constructed/adopted stylesheets, where `@import` is not
|
|
5
|
+
// allowed. Sourced from @glidejs/glide@3.6.x dist/css/glide.{core,theme}.css.
|
|
6
|
+
export default css`
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* --- Glide core --- */
|
|
12
|
+
.glide {
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
.glide * {
|
|
18
|
+
box-sizing: inherit;
|
|
19
|
+
}
|
|
20
|
+
.glide__track {
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
.glide__slides {
|
|
24
|
+
position: relative;
|
|
25
|
+
width: 100%;
|
|
26
|
+
list-style: none;
|
|
27
|
+
backface-visibility: hidden;
|
|
28
|
+
transform-style: preserve-3d;
|
|
29
|
+
touch-action: pan-Y;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-wrap: nowrap;
|
|
36
|
+
will-change: transform;
|
|
37
|
+
}
|
|
38
|
+
.glide__slides--dragging {
|
|
39
|
+
user-select: none;
|
|
40
|
+
}
|
|
41
|
+
.glide__arrows,
|
|
42
|
+
.glide__bullets {
|
|
43
|
+
-webkit-touch-callout: none;
|
|
44
|
+
user-select: none;
|
|
45
|
+
}
|
|
46
|
+
.glide--rtl {
|
|
47
|
+
direction: rtl;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Slotted slides stand in for .glide__slide — the real slides are projected light-DOM children. */
|
|
51
|
+
::slotted(*) {
|
|
52
|
+
width: 100%;
|
|
53
|
+
height: 100%;
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
white-space: normal;
|
|
56
|
+
user-select: none;
|
|
57
|
+
-webkit-touch-callout: none;
|
|
58
|
+
-webkit-tap-highlight-color: transparent;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* --- Glide theme: arrows --- */
|
|
62
|
+
.glide__arrow {
|
|
63
|
+
position: absolute;
|
|
64
|
+
display: block;
|
|
65
|
+
top: 50%;
|
|
66
|
+
z-index: 2;
|
|
67
|
+
color: white;
|
|
68
|
+
text-transform: uppercase;
|
|
69
|
+
padding: 9px 12px;
|
|
70
|
+
background-color: transparent;
|
|
71
|
+
border: 2px solid rgba(255, 255, 255, 0.5);
|
|
72
|
+
border-radius: 4px;
|
|
73
|
+
box-shadow: 0 0.25em 0.5em 0 rgba(0, 0, 0, 0.1);
|
|
74
|
+
text-shadow: 0 0.25em 0.5em rgba(0, 0, 0, 0.1);
|
|
75
|
+
opacity: 1;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
transition:
|
|
78
|
+
opacity 150ms ease,
|
|
79
|
+
border 300ms ease-in-out;
|
|
80
|
+
transform: translateY(-50%);
|
|
81
|
+
line-height: 1;
|
|
82
|
+
}
|
|
83
|
+
.glide__arrow:focus {
|
|
84
|
+
outline: none;
|
|
85
|
+
}
|
|
86
|
+
.glide__arrow:hover {
|
|
87
|
+
border-color: white;
|
|
88
|
+
}
|
|
89
|
+
.glide__arrow--left {
|
|
90
|
+
left: 2em;
|
|
91
|
+
}
|
|
92
|
+
.glide__arrow--right {
|
|
93
|
+
right: 2em;
|
|
94
|
+
}
|
|
95
|
+
.glide__arrow--disabled {
|
|
96
|
+
opacity: 0.33;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* --- Glide theme: bullets --- */
|
|
100
|
+
.glide__bullets {
|
|
101
|
+
position: absolute;
|
|
102
|
+
z-index: 2;
|
|
103
|
+
bottom: 2em;
|
|
104
|
+
left: 50%;
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
list-style: none;
|
|
107
|
+
transform: translateX(-50%);
|
|
108
|
+
}
|
|
109
|
+
.glide__bullet {
|
|
110
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
111
|
+
width: 13px;
|
|
112
|
+
height: 13px;
|
|
113
|
+
padding: 0;
|
|
114
|
+
border-radius: 50%;
|
|
115
|
+
border: 2px solid transparent;
|
|
116
|
+
transition: all 300ms ease-in-out;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
line-height: 0;
|
|
119
|
+
box-shadow: 0 0.25em 0.5em 0 rgba(0, 0, 0, 0.1);
|
|
120
|
+
margin: 0 0.25em;
|
|
121
|
+
}
|
|
122
|
+
.glide__bullet:focus {
|
|
123
|
+
outline: none;
|
|
124
|
+
}
|
|
125
|
+
.glide__bullet:hover,
|
|
126
|
+
.glide__bullet:focus {
|
|
127
|
+
border: 2px solid white;
|
|
128
|
+
background-color: rgba(255, 255, 255, 0.5);
|
|
129
|
+
}
|
|
130
|
+
/* Active bullet. The component marks it with the selected-dot part (Glide's Controls
|
|
131
|
+
component, which would add .glide__bullet--active, is not mounted). */
|
|
132
|
+
.glide__bullet[part~='selected-dot'] {
|
|
133
|
+
background-color: white;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.glide--swipeable {
|
|
137
|
+
cursor: grab;
|
|
138
|
+
}
|
|
139
|
+
.glide--dragging {
|
|
140
|
+
cursor: grabbing;
|
|
141
|
+
}
|
|
142
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import GlideAnchorComponent from '@glidejs/glide/src/components/anchors';
|
|
2
|
+
|
|
3
|
+
export default function (Glide, Components, Events) {
|
|
4
|
+
const glideAnchors = GlideAnchorComponent(Glide, Components, Events);
|
|
5
|
+
|
|
6
|
+
glideAnchors.mount = function () {
|
|
7
|
+
this._a = Components.Html.host.querySelectorAll('a');
|
|
8
|
+
this.bind();
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
return glideAnchors;
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import GlideClonesComponent from '@glidejs/glide/src/components/clones';
|
|
2
|
+
|
|
3
|
+
export default function (Glide, Components, Events) {
|
|
4
|
+
const glideClones = GlideClonesComponent(Glide, Components, Events);
|
|
5
|
+
|
|
6
|
+
glideClones.append = () => {
|
|
7
|
+
const wrapper = Components.Html.host;
|
|
8
|
+
|
|
9
|
+
let { items } = glideClones;
|
|
10
|
+
let { slides } = Components.Html;
|
|
11
|
+
|
|
12
|
+
let half = Math.floor(items.length / 2);
|
|
13
|
+
let prepend = items.slice(0, half).reverse();
|
|
14
|
+
let append = items.slice(half, items.length);
|
|
15
|
+
let width = `${Components.Sizes.slideWidth}px`;
|
|
16
|
+
|
|
17
|
+
for (let i = 0; i < append.length; i++) {
|
|
18
|
+
wrapper.appendChild(append[i]);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
for (let i = 0; i < prepend.length; i++) {
|
|
22
|
+
wrapper.insertBefore(prepend[i], slides[0]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < items.length; i++) {
|
|
26
|
+
items[i].style.width = width;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
glideClones.remove = () => {
|
|
30
|
+
const wrapper = Components.Html.host;
|
|
31
|
+
let { items } = glideClones;
|
|
32
|
+
|
|
33
|
+
for (let i = 0; i < items.length; i++) {
|
|
34
|
+
try {
|
|
35
|
+
wrapper.removeChild(items[i]);
|
|
36
|
+
} catch (e) {}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return glideClones;
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import GlideGapsComponent from '@glidejs/glide/src/components/gaps';
|
|
2
|
+
import { throttle } from '@glidejs/glide/src/utils/wait';
|
|
3
|
+
|
|
4
|
+
export default function (Glide, Components, Events) {
|
|
5
|
+
const Gaps = GlideGapsComponent(Glide, Components, Events);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Apply calculated gaps:
|
|
9
|
+
* - after building, so slides (including clones) will receive proper margins
|
|
10
|
+
* - on updating via API, to recalculate gaps with new options
|
|
11
|
+
*/
|
|
12
|
+
Events.on(
|
|
13
|
+
['build.after', 'update'],
|
|
14
|
+
throttle(() => {
|
|
15
|
+
Gaps.apply(Components.Html.host.children);
|
|
16
|
+
}, 30),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Remove gaps:
|
|
21
|
+
* - on destroying to bring markup to its inital state
|
|
22
|
+
*/
|
|
23
|
+
Events.on('destroy', () => {
|
|
24
|
+
Gaps.remove(Components.Html.host.children);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return Gaps;
|
|
28
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import GlideHTMLComponent from '@glidejs/glide/src/components/html';
|
|
2
|
+
import { define } from '@glidejs/glide/src/utils/object';
|
|
3
|
+
|
|
4
|
+
const TRACK_SELECTOR = '[data-glide-el="track"]';
|
|
5
|
+
|
|
6
|
+
export default function (Glide, Components, Events) {
|
|
7
|
+
// Glide passes (glide, components, events) to every component factory; html.js needs
|
|
8
|
+
// Events to register its `update` handler, so forward it like the sibling Shadow* wrappers.
|
|
9
|
+
const glideHtml = GlideHTMLComponent(Glide, Components, Events);
|
|
10
|
+
|
|
11
|
+
define(glideHtml, 'host', {
|
|
12
|
+
/**
|
|
13
|
+
* Exposes light DOM Host or default wrapper
|
|
14
|
+
*
|
|
15
|
+
* @return {Object}
|
|
16
|
+
*/
|
|
17
|
+
get() {
|
|
18
|
+
return glideHtml.root.getRootNode().host ? glideHtml.root.getRootNode().host : glideHtml.wrapper;
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
glideHtml.mount = function () {
|
|
23
|
+
this.root = Glide.selector;
|
|
24
|
+
this.track = this.root.querySelector(TRACK_SELECTOR);
|
|
25
|
+
|
|
26
|
+
this.slides = Array.prototype.slice.call(this.host.children).filter((slide) => {
|
|
27
|
+
return !slide.classList.contains(Glide.settings.classes.cloneSlide) && !slide.hasAttribute('slot');
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return glideHtml;
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-06-03
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `checked` custom state on the host. Style with `el-checkbox-field:state(checked) { … }`. The reflected `checked` attribute is unchanged. Inherits the `touched / valid / invalid` states from `FormField`.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- The native `<input type="checkbox">` is now visually hidden (kept focusable and in the accessibility tree) instead of rendering alongside the custom `.checked-indicator`, which previously showed two boxes — most visibly once a theme styled both the native control and the indicator.
|
|
24
|
+
- The label is no longer rendered twice: the checkbox suppresses the base `FormField` label and keeps its own inline label next to the box (`labelTemplate()` now returns `null`).
|
|
25
|
+
- `.checked-indicator` now has `currentColor`-based fallbacks (border + checked fill) so an unthemed checkbox still renders a usable box now that the native input is hidden; the checkmark glyph is toggled via `opacity` instead of `color: transparent`, and gains keyboard focus styling via `input:focus-visible + .checked-indicator`.
|
|
26
|
+
|
|
27
|
+
## Legacy (pre-merge)
|
|
28
|
+
|
|
29
|
+
The version numbers below predate the single-package merge and refer to the component's former standalone npm package, not the current `@webtides/element-library` version. Kept for historical reference.
|
|
30
|
+
|
|
31
|
+
## 0.1.1 (2021-07-21)
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
update element-js version
|
|
36
|
+
|
|
37
|
+
## [0.1.1] - 2020-08-13
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- wrong package dependency to @webtides/form-field
|
|
42
|
+
|
|
43
|
+
## [0.1.0] - 2020-03-15
|
|
44
|
+
|
|
45
|
+
### Added
|
|
46
|
+
|
|
47
|
+
- initial release
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { html, defineElement, classMap, unsafeHTML } from '@webtides/element-js';
|
|
2
|
+
import FormField, { FormFieldEvents } from '../form-field/form-field.js';
|
|
3
|
+
import style from './checkbox-field.style.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Styled checkbox input with a custom checkmark indicator, label, and validation. Extends
|
|
7
|
+
* `FormField` and inherits its label / help / error / required surface.
|
|
8
|
+
*
|
|
9
|
+
* @element el-checkbox-field
|
|
10
|
+
*
|
|
11
|
+
* @fires {CustomEvent<string>} input-change - Fired when the checked state changes.
|
|
12
|
+
* `detail` is the input's `value`. Bubbles.
|
|
13
|
+
*
|
|
14
|
+
* @cssstate checked - Set on the host while the checkbox is checked. Style with
|
|
15
|
+
* `el-checkbox-field:state(checked) { … }`. Inherits `touched`, `valid` and `invalid`
|
|
16
|
+
* from `FormField`.
|
|
17
|
+
*
|
|
18
|
+
* @property {boolean} checked - Whether the checkbox is checked. Reflected to the `checked`
|
|
19
|
+
* attribute.
|
|
20
|
+
*/
|
|
21
|
+
export default class CheckboxField extends FormField {
|
|
22
|
+
/** @private */
|
|
23
|
+
uuid = Math.random().toString(36).substr(2, 5);
|
|
24
|
+
|
|
25
|
+
constructor(options) {
|
|
26
|
+
super({ shadowRender: false, styles: [style], ...options });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
properties() {
|
|
30
|
+
return {
|
|
31
|
+
...super.properties(),
|
|
32
|
+
checked: false,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
connected() {
|
|
36
|
+
this.setAttribute('checked', this.checked === true ? 'true' : 'false');
|
|
37
|
+
if (this.checked) this._internals.states.add('checked');
|
|
38
|
+
this.syncValidationStates();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
watch() {
|
|
42
|
+
return {
|
|
43
|
+
...super.watch(),
|
|
44
|
+
checked: (checked) => {
|
|
45
|
+
this.setAttribute('checked', checked ? 'true' : 'false');
|
|
46
|
+
if (checked) this._internals.states.add('checked');
|
|
47
|
+
else this._internals.states.delete('checked');
|
|
48
|
+
this.dispatch(FormFieldEvents.INPUT_CHANGE, this.$refs.input.value);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
events() {
|
|
54
|
+
return {
|
|
55
|
+
...super.events(),
|
|
56
|
+
input: {
|
|
57
|
+
change: () => {
|
|
58
|
+
this.checked = this.$refs.input.checked;
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The checkbox renders its label inline next to the box (see `fieldTemplate`), so the base
|
|
66
|
+
* FormField label is suppressed.
|
|
67
|
+
* @returns {null}
|
|
68
|
+
*/
|
|
69
|
+
labelTemplate() {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
fieldTemplate() {
|
|
74
|
+
const classes = { 'is-checked': !!this.checked };
|
|
75
|
+
return html`
|
|
76
|
+
<label for="checkbox-${this.uuid}">
|
|
77
|
+
<input
|
|
78
|
+
ref="input"
|
|
79
|
+
type="checkbox"
|
|
80
|
+
id="checkbox-${this.uuid}"
|
|
81
|
+
aria-describedby="checkbox-${this.uuid}"
|
|
82
|
+
value="${this.value}"
|
|
83
|
+
name="${this.name}"
|
|
84
|
+
?disabled="${this.disabled}"
|
|
85
|
+
?checked="${this.checked}"
|
|
86
|
+
?required="${this.required}"
|
|
87
|
+
/>
|
|
88
|
+
<div class="checked-indicator ${classMap(classes)}">${this.selectedIndicatorTemplate()}</div>
|
|
89
|
+
<div class="label">${this.label ? unsafeHTML(this.label) : ''}</div>
|
|
90
|
+
</label>
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** @private */
|
|
95
|
+
selectedIndicatorTemplate() {
|
|
96
|
+
return html` <div class="checked">✓</div> `;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function define() {
|
|
101
|
+
defineElement('el-checkbox-field', CheckboxField);
|
|
102
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# CheckboxField
|
|
2
|
+
|
|
3
|
+
`checkbox-field` is a form input component that extends the base `form-field` component to provide a styled checkbox input with label, validation, and state management. It includes a custom checkmark indicator and supports all standard form field features.
|
|
4
|
+
|
|
5
|
+
## How to use
|
|
6
|
+
|
|
7
|
+
#### Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i --save @webtides/element-library
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
#### Use
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import '@webtides/element-library/checkbox-field/define';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<el-checkbox-field name="terms" value="accepted" label="I agree to the terms and conditions" required="true">
|
|
21
|
+
</el-checkbox-field>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## API
|
|
25
|
+
|
|
26
|
+
#### Properties/Attribute
|
|
27
|
+
|
|
28
|
+
| Name | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| `checked` | `boolean` | `false` | Controls whether the checkbox is checked or unchecked. |
|
|
31
|
+
| `name` | `string` | `''` | The name attribute for the checkbox input. |
|
|
32
|
+
| `value` | `string` | `null` | The value attribute for the checkbox input. |
|
|
33
|
+
| `label` | `string` | `''` | The label text displayed next to the checkbox. |
|
|
34
|
+
| `required` | `boolean` | `false` | Whether the checkbox is required for form submission. |
|
|
35
|
+
| `disabled` | `boolean` | `false` | Whether the checkbox is disabled. |
|
|
36
|
+
| `valid` | `boolean` | `true` | Whether the checkbox passes validation. |
|
|
37
|
+
| `touched` | `boolean` | `false` | Whether the checkbox has been interacted with. |
|
|
38
|
+
| `errorMessage` | `string` | `''` | Error message to display when validation fails. |
|
|
39
|
+
| `helpMessage` | `string` | `''` | Helper text to display below the checkbox. |
|
|
40
|
+
| `labelScreenReaderOnly` | `boolean` | `false` | Whether to hide the label visually (but keep it accessible to screen readers). |
|
|
41
|
+
|
|
42
|
+
#### Methods
|
|
43
|
+
|
|
44
|
+
_Inherits methods from FormField component_
|
|
45
|
+
|
|
46
|
+
#### Events
|
|
47
|
+
|
|
48
|
+
| Name | Detail | Description |
|
|
49
|
+
| -------------- | ------- | ---------------------------------------------------------------------------- |
|
|
50
|
+
| `input-change` | `value` | Fired when the checkbox state changes. The event bubbles up through the DOM. |
|
|
51
|
+
|
|
52
|
+
#### CSS States
|
|
53
|
+
|
|
54
|
+
| Name | Description |
|
|
55
|
+
| --------- | ------------------------------------------------------------------------------------- |
|
|
56
|
+
| `checked` | Present while the checkbox is checked. Style with `el-checkbox-field:state(checked)`. |
|
|
57
|
+
|
|
58
|
+
Also inherits the `valid` / `invalid` / `touched` states from [`form-field`](../form-field/form-field.readme.md).
|
|
59
|
+
|
|
60
|
+
#### CSS Custom Properties
|
|
61
|
+
|
|
62
|
+
This component is headless by default and reads the library's `--el-*` design tokens (e.g. `--el-color-accent`, `--el-color-border`, `--el-radius-sm`, `--el-focus-ring-width`). Skin it by setting these via a theme — see the Storybook _Docs / Theming_ page.
|
|
63
|
+
|
|
64
|
+
#### Slots
|
|
65
|
+
|
|
66
|
+
_None_
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const css = String.raw;
|
|
2
|
+
|
|
3
|
+
export default css`
|
|
4
|
+
el-checkbox-field {
|
|
5
|
+
display: block;
|
|
6
|
+
|
|
7
|
+
.field > label {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--el-space-2, 0.5em);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/* The native checkbox is replaced by .checked-indicator; hide it visually but keep it
|
|
15
|
+
in the accessibility tree and focusable. */
|
|
16
|
+
input[type='checkbox'] {
|
|
17
|
+
position: absolute;
|
|
18
|
+
width: 1px;
|
|
19
|
+
height: 1px;
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
border: 0;
|
|
23
|
+
opacity: 0;
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
clip: rect(0 0 0 0);
|
|
27
|
+
clip-path: inset(50%);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Reflect keyboard focus onto the custom indicator. */
|
|
31
|
+
input[type='checkbox']:focus-visible + .checked-indicator {
|
|
32
|
+
outline: var(--el-focus-ring-width, 2px) solid var(--el-color-accent, currentColor);
|
|
33
|
+
outline-offset: 2px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.checked-indicator {
|
|
37
|
+
display: inline-flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: center;
|
|
40
|
+
flex: none;
|
|
41
|
+
/* Fallbacks render a usable box even without a theme, since the native input is hidden. */
|
|
42
|
+
width: var(--el-space-4, 1em);
|
|
43
|
+
height: var(--el-space-4, 1em);
|
|
44
|
+
border: var(--el-border-width, 1px) solid var(--el-color-border, currentColor);
|
|
45
|
+
border-radius: var(--el-radius-sm, 0);
|
|
46
|
+
background: var(--el-color-bg, transparent);
|
|
47
|
+
transition: background var(--el-duration-md, 0s) var(--el-ease, linear);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Hide the checkmark glyph via opacity (not color: transparent) so the indicator's
|
|
51
|
+
currentColor border stays visible while unchecked. */
|
|
52
|
+
.checked-indicator > .checked {
|
|
53
|
+
opacity: 0;
|
|
54
|
+
line-height: 1;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:state(checked) .checked-indicator {
|
|
58
|
+
background: var(--el-color-accent, currentColor);
|
|
59
|
+
border-color: var(--el-color-accent, currentColor);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Checkmark contrasts against the filled box. Set on the glyph (not the indicator) so
|
|
63
|
+
the indicator's currentColor-based fill above keeps resolving to the text color. */
|
|
64
|
+
&:state(checked) .checked-indicator > .checked {
|
|
65
|
+
opacity: 1;
|
|
66
|
+
color: var(--el-color-bg, Canvas);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this component live here. Versions refer to the parent `@webtides/element-library` release (see root [`CHANGELOG.md`](../../../CHANGELOG.md)); components no longer version independently.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
When your PR touches this component, add an entry under Unreleased and
|
|
9
|
+
mirror it (prefixed with the component name) in root CHANGELOG.md.
|
|
10
|
+
Uncomment headings as needed.
|
|
11
|
+
-->
|
|
12
|
+
|
|
13
|
+
## Unreleased
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-06-03
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- Initial release of `el-dialog` — a modal dialog built on the native `<dialog>` element. The platform provides focus trapping, background `inert`, top-layer rendering, focus restoration and `<form method="dialog">` auto-close; the component adds an animated, cancelable open/close lifecycle and ref-counted body-scroll locking that compensates for the removed scrollbar width (no layout shift on open). API modelled on Shoelace's `<sl-dialog>`.
|
|
20
|
+
- Properties `open` (reflected), `label`, `no-header` (reflected) and `close-label`.
|
|
21
|
+
- Methods `show()` / `hide()` (both resolve after their transition) and `requestClose(source)`.
|
|
22
|
+
- Events `dialog-show`, `dialog-after-show`, `dialog-hide`, `dialog-after-hide`, the cancelable `dialog-initial-focus`, and the cancelable `dialog-request-close` (with `detail.source` of `'close-button' | 'keyboard' | 'overlay'`).
|
|
23
|
+
- Slots: default (body), `label`, `header-actions` and `footer` (collapses when empty).
|
|
24
|
+
- CSS parts `base`, `header`, `title`, `header-actions`, `close-button`, `body`, `footer`; the `open` custom state; and the `--el-dialog-width`, `--el-dialog-overlay-background` and `--el-dialog-enter-offset` tokens on top of the shared `--el-*` vocabulary.
|