actual-css 0.16.1 → 0.17.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 +64 -0
- package/README.md +8 -4
- package/components.json +19 -4
- package/dist/actual.full.css +393 -69
- package/dist/actual.full.js +2 -1
- package/dist/actual.full.min.css +1 -1
- package/docs/design-notes/app-ui.md +37 -3
- package/docs/design-notes/enhancement-contract.md +3 -1
- package/docs/navigation.json +14 -1
- package/docs/pages/components/alert.md +45 -17
- package/docs/pages/components/button.md +3 -0
- package/docs/pages/components/dialog.md +36 -0
- package/docs/pages/components/drawer.md +52 -8
- package/docs/pages/components/navbar.md +26 -2
- package/docs/pages/components/rating.md +111 -12
- package/docs/pages/components/segmented.md +36 -1
- package/docs/pages/components/spinner.md +2 -0
- package/docs/pages/components/table.md +77 -0
- package/docs/pages/components/timeline.md +3 -1
- package/docs/pages/enhancements/flyout.md +83 -14
- package/docs/pages/enhancements/tabs.md +5 -0
- package/docs/pages/examples/overview.md +5 -1
- package/docs/pages/forms/ajax.md +101 -0
- package/docs/pages/forms/color-swatches.md +31 -2
- package/docs/pages/forms/joined-controls.md +8 -3
- package/docs/pages/forms/overview.md +1 -1
- package/docs/pages/forms/unsaved-changes.md +198 -0
- package/docs/pages/foundations/philosophy.md +2 -1
- package/docs/pages/foundations/theming.md +2 -1
- package/docs/pages/foundations/tokens.md +1 -1
- package/docs/pages/guides/introduction.md +1 -1
- package/docs/pages/guides/progressive-enhancement.md +30 -49
- package/docs/pages/guides/upgrading.md +15 -2
- package/docs/pages/layout/choosing.md +5 -0
- package/docs/pages/layout/column-layout.md +22 -8
- package/docs/pages/layout/sidebar-shell.md +68 -0
- package/docs/pages/patterns/empty-state.md +74 -0
- package/docs/pages/patterns/hierarchical-nav.md +40 -19
- package/docs/pages/patterns/navigation-list.md +3 -60
- package/docs/pages/patterns/stat.md +61 -0
- package/docs/pages/utilities/accessibility.md +32 -10
- package/package.json +4 -1
- package/reserved-classes.json +2 -0
- package/src/css/components/busy.css +25 -0
- package/src/css/components/button.css +3 -0
- package/src/css/components/drawer.css +37 -3
- package/src/css/components/flyout.css +37 -0
- package/src/css/components/modal.css +3 -0
- package/src/css/components/navbar.css +99 -38
- package/src/css/components/rating.css +50 -5
- package/src/css/components/segmented.css +25 -2
- package/src/css/forms/color-swatch.css +38 -19
- package/src/css/forms/custom-select.css +5 -0
- package/src/css/layout/index.css +2 -0
- package/src/css/layout/sidebar-shell.css +67 -0
- package/src/js/ajax.js +148 -0
- package/src/js/dialog.js +59 -2
- package/src/js/dirty.js +140 -0
- package/src/js/dismiss.js +25 -0
- package/src/js/events.js +17 -0
- package/src/js/focus.js +12 -0
- package/src/js/form-submission.js +34 -0
- package/src/js/full.js +2 -0
- package/src/js/tab.js +16 -2
- package/src/js/validation.js +12 -4
- package/src/tooling/theme-contrast.js +3 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Form submission settings as the browser resolves them.
|
|
3
|
+
*
|
|
4
|
+
* A control named "action", "method", "enctype" or "target" shadows the
|
|
5
|
+
* form's own property (form.action returns the <input>), so the values are
|
|
6
|
+
* read through the HTMLFormElement prototype, never as form[name].
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
function formProperty(form, name) {
|
|
10
|
+
return Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, name).get.call(form);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Reads action, method, enctype or target: a submitter's form* attribute
|
|
15
|
+
* overrides the form's own, as natively. Reflected values, so method and
|
|
16
|
+
* enctype come back lowercase and action as an absolute URL.
|
|
17
|
+
*/
|
|
18
|
+
export function submissionSetting(form, submitter, name) {
|
|
19
|
+
return submitter?.hasAttribute(`form${name}`)
|
|
20
|
+
? submitter[`form${name[0].toUpperCase()}${name.slice(1)}`]
|
|
21
|
+
: formProperty(form, name);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The browsing context name the submission goes to, "" for the page itself.
|
|
26
|
+
* Without a target attribute the form falls back to <base target>; an empty
|
|
27
|
+
* formtarget="" is still an attribute and means the page itself.
|
|
28
|
+
*/
|
|
29
|
+
export function submissionTarget(form, submitter) {
|
|
30
|
+
if (submitter?.hasAttribute("formtarget") || form.hasAttribute("target")) {
|
|
31
|
+
return submissionSetting(form, submitter, "target");
|
|
32
|
+
}
|
|
33
|
+
return form.ownerDocument.querySelector("base[target]")?.target ?? "";
|
|
34
|
+
}
|
package/src/js/full.js
CHANGED
package/src/js/tab.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* [hidden], disabled and panel-less tabs are skipped
|
|
12
12
|
* Overflow: a horizontal strip shows its whole selected tab, at connect and
|
|
13
13
|
* on every selection
|
|
14
|
+
* Event: actual:tab-change bubbles from the tablist when the selection
|
|
15
|
+
* changes, not at connect
|
|
14
16
|
*
|
|
15
17
|
* Self-registers via registerEnhancement: injected tablists wire automatically.
|
|
16
18
|
* The tab→panel map is rebuilt from the live tablist on each interaction,
|
|
@@ -19,6 +21,7 @@
|
|
|
19
21
|
*/
|
|
20
22
|
|
|
21
23
|
import { registerEnhancement } from "./enhance.js";
|
|
24
|
+
import { EVENTS } from "./events.js";
|
|
22
25
|
import { ensureInlineVisible } from "./inline-visible.js";
|
|
23
26
|
import { itemForKey, shouldIgnoreKey } from "./keys.js";
|
|
24
27
|
import { afterParse } from "./parsed.js";
|
|
@@ -68,12 +71,16 @@ function makePanelFocusable(panel) {
|
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
|
|
71
|
-
|
|
74
|
+
/* Every selection path runs through here, so the change event cannot be
|
|
75
|
+
forgotten by one of them. Initialization passes notify: false: it settles
|
|
76
|
+
the markup's state, it is not a transition; read aria-selected for that. */
|
|
77
|
+
function activate(tab, { notify = true } = {}) {
|
|
72
78
|
if (!tab || isTabDisabled(tab) || !panelFor(tab)) return;
|
|
73
79
|
const list = tab.closest(TABLIST_SELECTOR);
|
|
74
80
|
if (!list) return;
|
|
75
81
|
const tabs = tabsOf(list);
|
|
76
82
|
const panels = panelsOf(tabs);
|
|
83
|
+
const previousTab = tabs.find((t) => t.getAttribute("aria-selected") === "true") ?? null;
|
|
77
84
|
|
|
78
85
|
for (const t of tabs) {
|
|
79
86
|
t.setAttribute("aria-selected", "false");
|
|
@@ -89,6 +96,13 @@ function activate(tab) {
|
|
|
89
96
|
makePanelFocusable(panel);
|
|
90
97
|
panel.hidden = false;
|
|
91
98
|
}
|
|
99
|
+
|
|
100
|
+
// After the DOM update, so a listener reads the new state.
|
|
101
|
+
if (notify && tab !== previousTab) {
|
|
102
|
+
list.dispatchEvent(
|
|
103
|
+
new CustomEvent(EVENTS.tabChange, { bubbles: true, detail: { tab, panel, previousTab } }),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
92
106
|
}
|
|
93
107
|
|
|
94
108
|
/* An overflowing horizontal strip shows the whole tab. At connect a
|
|
@@ -110,7 +124,7 @@ function initialize(list) {
|
|
|
110
124
|
const tabs = activatableTabs(list);
|
|
111
125
|
if (!tabs.length) return;
|
|
112
126
|
const selected = tabs.find((tab) => tab.getAttribute("aria-selected") === "true") || tabs[0];
|
|
113
|
-
activate(selected);
|
|
127
|
+
activate(selected, { notify: false });
|
|
114
128
|
reveal(list, selected);
|
|
115
129
|
}
|
|
116
130
|
|
package/src/js/validation.js
CHANGED
|
@@ -269,13 +269,21 @@ function validateField(el, trigger) {
|
|
|
269
269
|
|
|
270
270
|
if (!wantsTrigger && !alreadyInvalid) return;
|
|
271
271
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
markInvalid(
|
|
272
|
+
const valid = checkRules(el);
|
|
273
|
+
for (const member of radioGroup(el)) {
|
|
274
|
+
if (valid) markValid(member);
|
|
275
|
+
else markInvalid(member);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
+
// A radio's validity is its group's: picking one fills a required group, so
|
|
280
|
+
// the result applies to every radio of the name. Marking only the picked one
|
|
281
|
+
// left its siblings aria-invalid and the field error showing.
|
|
282
|
+
function radioGroup(el) {
|
|
283
|
+
if (el.type !== "radio" || !el.name || !el.form) return [el];
|
|
284
|
+
return [...el.form.elements].filter((other) => other.type === "radio" && other.name === el.name);
|
|
285
|
+
}
|
|
286
|
+
|
|
279
287
|
function connectForm(form) {
|
|
280
288
|
const existing = connectedForms.get(form);
|
|
281
289
|
if (existing) return existing;
|
|
@@ -210,8 +210,9 @@ export async function measureContrast({ css, themes, label = "default" }) {
|
|
|
210
210
|
intent,
|
|
211
211
|
value: solid[intent] ? ratio(solid[intent].fg, solid[intent].bg) : null,
|
|
212
212
|
})),
|
|
213
|
-
// Selected ink on a regular surface (--state-selected-text
|
|
214
|
-
//
|
|
213
|
+
// Selected ink on a regular surface (--state-selected-text for tab and
|
|
214
|
+
// step; --text on its tint for the current nav link): text needs 4.5:1,
|
|
215
|
+
// the current step's ring is a non-text accent at 3:1.
|
|
215
216
|
selected: SURFACES.flatMap((surface) => {
|
|
216
217
|
const { selected } = soft[surface];
|
|
217
218
|
return [
|