@apliteni/apliteni-ui 0.62.0 → 0.64.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/README.md +3 -0
- package/package.json +1 -1
- package/react/README.md +39 -1
- package/react/dist/index.css +254 -235
- package/react/dist/index.d.ts +37 -17
- package/react/dist/index.js +400 -352
- package/src/components/index.js +2 -2
- package/src/styles/input.css +23 -1
package/src/components/index.js
CHANGED
|
@@ -210,8 +210,8 @@ export function select({ options = [], value, name, id, ariaLabel, disabled } =
|
|
|
210
210
|
}).join('');
|
|
211
211
|
return `<select class="ui-select"${id ? ` id="${esc(id)}"` : ''}${name ? ` name="${esc(name)}"` : ''}${ariaLabel ? ` aria-label="${esc(ariaLabel)}"` : ''}${disabled ? ' disabled' : ''}>${opts}</select>`;
|
|
212
212
|
}
|
|
213
|
-
export function checkbox({ label, checked, type = 'checkbox', name } = {}) {
|
|
214
|
-
return `<label class="ui-check"><input type="${esc(type)}"${name ? ` name="${esc(name)}"` : ''}${checked ? ' checked' : ''}><span>${label}</span></label>`;
|
|
213
|
+
export function checkbox({ label, checked, type = 'checkbox', name, disabled = false } = {}) {
|
|
214
|
+
return `<label class="ui-check"><input type="${esc(type)}"${name ? ` name="${esc(name)}"` : ''}${checked ? ' checked' : ''}${disabled ? ' disabled' : ''}><span>${label}</span></label>`;
|
|
215
215
|
}
|
|
216
216
|
// `label` becomes the input's accessible name (a bare switch has no visible text,
|
|
217
217
|
// so it needs one). Defaults to "Toggle" so a control is never left unlabelled.
|
package/src/styles/input.css
CHANGED
|
@@ -157,7 +157,9 @@
|
|
|
157
157
|
transform: translate(-50%, -50%);
|
|
158
158
|
}
|
|
159
159
|
.ui-check input[type="radio"] { border-radius: 50%; }
|
|
160
|
-
|
|
160
|
+
/* :enabled, or the accent lights the border of a box that cannot be clicked —
|
|
161
|
+
the same "press me" a disabled control has to stop making. #429 */
|
|
162
|
+
.ui-check input:enabled:hover { border-color: var(--accent); }
|
|
161
163
|
.ui-check input:checked { background: var(--accent); border-color: var(--accent); }
|
|
162
164
|
.ui-check input[type="checkbox"]:checked::after {
|
|
163
165
|
content: "";
|
|
@@ -177,6 +179,26 @@
|
|
|
177
179
|
}
|
|
178
180
|
.ui-check input:focus-visible { outline: 2px solid transparent; box-shadow: var(--ring); }
|
|
179
181
|
|
|
182
|
+
/* Off. `.ui-check` had no disabled rule at all until #429 put a disabled checkbox
|
|
183
|
+
on screen: the box kept --surface-2 and --border-strong, its words kept --text,
|
|
184
|
+
and it was the word "unavailable" in the label that carried the state. The same
|
|
185
|
+
flat pair the fields and the buttons take (#220, #273) — a paint on the box and
|
|
186
|
+
quiet ink on the words, never an `opacity`, which drags label and box toward the
|
|
187
|
+
ground together. A checked box drops the accent for the reason a disabled primary
|
|
188
|
+
button does: the accent IS the "press me". Its mark inverts to --disabled-surface,
|
|
189
|
+
so the tick and the dot keep the measured --disabled-ink pair in both themes. */
|
|
190
|
+
.ui-check input:disabled {
|
|
191
|
+
background: var(--disabled-surface); /* ring-gap: inherit — control paint; its focus indicator uses the containing surface. */
|
|
192
|
+
border-color: var(--disabled-border);
|
|
193
|
+
cursor: not-allowed;
|
|
194
|
+
}
|
|
195
|
+
.ui-check input:disabled:checked { background: var(--disabled-ink); border-color: var(--disabled-ink); }
|
|
196
|
+
.ui-check input[type="checkbox"]:disabled:checked::after { border-color: var(--disabled-surface); }
|
|
197
|
+
.ui-check input[type="radio"]:disabled:checked::after { background: var(--disabled-surface); /* ring-gap: inherit — the mark inside the box; the box carries the focus indicator. */ }
|
|
198
|
+
/* The label is the click target, so the cursor belongs on it, and the words it
|
|
199
|
+
holds go quiet with the box beside them. */
|
|
200
|
+
.ui-check:has(input:disabled) { /* muted-ink: state — unavailable control */ color: var(--disabled-ink); cursor: not-allowed; }
|
|
201
|
+
|
|
180
202
|
/* Toggle switch */
|
|
181
203
|
.ui-switch {
|
|
182
204
|
--sw-w: 44px;
|