@usefillo/dom 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -10
- package/dist/standalone.global.js +1 -1
- package/dist/styles.css +37 -34
- package/dist/styles.unlayered.css +37 -34
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -134,6 +134,24 @@ function optionIcon(icon) {
|
|
|
134
134
|
svg.appendChild(path);
|
|
135
135
|
return svg;
|
|
136
136
|
}
|
|
137
|
+
function selectionCheck() {
|
|
138
|
+
const svg = document.createElementNS(SVG_NS, "svg");
|
|
139
|
+
svg.setAttribute("class", "fillo-option-check");
|
|
140
|
+
svg.setAttribute("width", "1em");
|
|
141
|
+
svg.setAttribute("height", "1em");
|
|
142
|
+
svg.setAttribute("viewBox", "0 0 24 24");
|
|
143
|
+
svg.setAttribute("fill", "none");
|
|
144
|
+
svg.setAttribute("stroke", "currentColor");
|
|
145
|
+
svg.setAttribute("stroke-width", "2");
|
|
146
|
+
svg.setAttribute("stroke-linecap", "square");
|
|
147
|
+
svg.setAttribute("stroke-linejoin", "miter");
|
|
148
|
+
svg.setAttribute("aria-hidden", "true");
|
|
149
|
+
svg.setAttribute("focusable", "false");
|
|
150
|
+
const path = document.createElementNS(SVG_NS, "path");
|
|
151
|
+
path.setAttribute("d", "M4 12l5 5L20 6");
|
|
152
|
+
svg.appendChild(path);
|
|
153
|
+
return svg;
|
|
154
|
+
}
|
|
137
155
|
function applyFieldAria(node, field, error, ids, opts = {}) {
|
|
138
156
|
if (error) node.setAttribute("aria-invalid", "true");
|
|
139
157
|
if ((opts.requiredSupported ?? true) && field.required)
|
|
@@ -627,11 +645,7 @@ function singleChoice(context) {
|
|
|
627
645
|
// was the only selected-state signal — add a decorative shape signal
|
|
628
646
|
// that survives forced-colors (audit P1.2; state still lives on the
|
|
629
647
|
// input, this marker is non-authoritative).
|
|
630
|
-
option.icon && value === option.id ?
|
|
631
|
-
className: "fillo-option-check",
|
|
632
|
-
text: "\u2713",
|
|
633
|
-
attrs: { "aria-hidden": "true" }
|
|
634
|
-
}) : null
|
|
648
|
+
option.icon && value === option.id ? selectionCheck() : null
|
|
635
649
|
]);
|
|
636
650
|
wrap.appendChild(label);
|
|
637
651
|
}
|
|
@@ -721,11 +735,7 @@ function multiChoice(context) {
|
|
|
721
735
|
text: option.label,
|
|
722
736
|
attrs: { "data-fillo": "optionLabel" }
|
|
723
737
|
}),
|
|
724
|
-
option.icon && selected.includes(option.id) ?
|
|
725
|
-
className: "fillo-option-check",
|
|
726
|
-
text: "\u2713",
|
|
727
|
-
attrs: { "aria-hidden": "true" }
|
|
728
|
-
}) : null
|
|
738
|
+
option.icon && selected.includes(option.id) ? selectionCheck() : null
|
|
729
739
|
]);
|
|
730
740
|
wrap.appendChild(label);
|
|
731
741
|
}
|