@cahyo-dimas/freeday 3.21.0 → 3.23.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 +108 -0
- package/COMPONENTS.md +98 -3
- package/README.id.md +2 -2
- package/README.md +2 -2
- package/USAGE.md +47 -11
- package/adapters/react/useFreeday.js +31 -0
- package/adapters/vue/useFreeday.js +32 -1
- package/dist/freeday-tabs.js +76 -0
- package/dist/freeday.bundle.css +471 -1
- package/dist/freeday.css +133 -1
- package/dist/freeday.js +76 -0
- package/dist/freeday.tokens.css +338 -0
- package/docs/agent-onboarding.md +4 -4
- package/docs/getting-started.md +2 -2
- package/docs/reference-screen.html +1 -1
- package/package.json +2 -2
- package/src/components/actionbar.css +68 -0
- package/src/components/bottomnav.css +11 -1
- package/src/components/link.css +14 -0
- package/src/components/tabs.css +38 -0
- package/tokens/tokens.json +30 -19
package/dist/freeday.css
CHANGED
|
@@ -89,6 +89,75 @@ a { color: var(--color-primary-strong); }
|
|
|
89
89
|
* browser without JS, so we animate the revealed panel instead, cheap, safe, reduced-motion gated. */
|
|
90
90
|
@media (prefers-reduced-motion:no-preference){.fdy-accordion__item[open] > .fdy-accordion__panel{animation:fdy-combo-in var(--dur-base) var(--ease-standard);}}
|
|
91
91
|
|
|
92
|
+
/* Freeday. Action bar
|
|
93
|
+
*
|
|
94
|
+
* One to three actions pinned to the bottom of the screen, where a thumb reaches them on a phone:
|
|
95
|
+
* the sign-in button, approve and reject on a document, save on a long form. Before this, an app
|
|
96
|
+
* either put its primary action mid-page, where it scrolled away, or hand-wrote a fixed bar that
|
|
97
|
+
* sat on top of the bottom nav.
|
|
98
|
+
*
|
|
99
|
+
* Sticky, not fixed: the bar keeps its place in the flow, so the last row above it is never
|
|
100
|
+
* covered and the page needs no extra reservation. In a shell with a bottom nav it rests on top of
|
|
101
|
+
* the nav; anywhere else it clears the home indicator itself. */
|
|
102
|
+
.fdy-actionbar{
|
|
103
|
+
position:sticky;bottom:0;z-index:40;
|
|
104
|
+
display:flex;gap:var(--space-2);
|
|
105
|
+
padding:var(--space-3) var(--space-4);
|
|
106
|
+
padding-bottom:calc(var(--space-3) + env(safe-area-inset-bottom,0px));
|
|
107
|
+
background:var(--color-surface-raised);
|
|
108
|
+
backdrop-filter:var(--surface-filter);
|
|
109
|
+
-webkit-backdrop-filter:var(--surface-filter);
|
|
110
|
+
border-top:var(--bw) solid var(--color-border);
|
|
111
|
+
}
|
|
112
|
+
/* The buttons share the width; the primary action goes last, nearest the thumb. */
|
|
113
|
+
.fdy-actionbar > .fdy-btn{flex:1 1 0;min-width:0;}
|
|
114
|
+
/* Sticky is bounded by its parent, and `.fdy-app__main` has bottom padding that sits below the bar,
|
|
115
|
+
* so at the end of the page the bar would stop short of the edge by that padding. A negative bottom
|
|
116
|
+
* margin cancels it when the bar is the last child (no :has(), the support floor includes iOS 15).
|
|
117
|
+
* The bar may also sit one wrapper down, in a page wrapper such as `.fdy-page`. Sticky is then
|
|
118
|
+
* bounded by the wrapper, so the wrapper must be the last in-flow content of main and its content
|
|
119
|
+
* box must end where main's does: no bottom padding, border or margin of its own (`.fdy-page` has
|
|
120
|
+
* none). A closed dialog and the fixed bottom nav take no room in the flow, so they may follow it.
|
|
121
|
+
* A dialog or drawer is not a wrapper: a bar inside a modal is not offset at any depth.
|
|
122
|
+
* Values mirror app-shell.css: main's padding is --space-8, and --space-5 at max-width 720px. */
|
|
123
|
+
.fdy-app__main > .fdy-actionbar:last-child,
|
|
124
|
+
.fdy-app__main > :not(dialog):not(.fdy-drawer) > .fdy-actionbar:last-child{margin-bottom:calc(-1 * var(--space-8));}
|
|
125
|
+
@media (max-width:720px){
|
|
126
|
+
.fdy-app__main > .fdy-actionbar:last-child,
|
|
127
|
+
.fdy-app__main > :not(dialog):not(.fdy-drawer) > .fdy-actionbar:last-child{margin-bottom:calc(-1 * var(--space-5));}
|
|
128
|
+
/* On a phone the bar runs edge to edge, like the nav it rests on: inset by main's side padding
|
|
129
|
+
* it would leave a strip of scrolling content showing on either side. The same depth rule
|
|
130
|
+
* holds: a wrapper between main and the bar must add no side padding, border or margin. The
|
|
131
|
+
* landscape notch is cleared by the bar's own padding. */
|
|
132
|
+
.fdy-app__main > .fdy-actionbar,
|
|
133
|
+
.fdy-app__main > :not(dialog):not(.fdy-drawer) > .fdy-actionbar{
|
|
134
|
+
margin-inline:calc(-1 * var(--space-5));
|
|
135
|
+
padding-left:calc(var(--space-4) + env(safe-area-inset-left,0px));
|
|
136
|
+
padding-right:calc(var(--space-4) + env(safe-area-inset-right,0px));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/* Above the bottom nav: --fdy-bottomnav-h is declared, and obeyed, in bottomnav.css. The nav adds
|
|
140
|
+
* the safe-area inset itself, so the bar rests on all of it and does not add the inset twice. */
|
|
141
|
+
@media (max-width:720px){
|
|
142
|
+
.fdy-app--has-bottomnav .fdy-app__main .fdy-actionbar{
|
|
143
|
+
bottom:calc(var(--fdy-bottomnav-h) + env(safe-area-inset-bottom,0px));
|
|
144
|
+
padding-bottom:var(--space-3);
|
|
145
|
+
}
|
|
146
|
+
/* A modal or drawer is its own screen: its bar sits at its own bottom, whatever the depth. */
|
|
147
|
+
.fdy-app--has-bottomnav .fdy-app__main :is(dialog, .fdy-drawer) .fdy-actionbar{
|
|
148
|
+
bottom:0;
|
|
149
|
+
padding-bottom:calc(var(--space-3) + env(safe-area-inset-bottom,0px));
|
|
150
|
+
}
|
|
151
|
+
/* In the nav shell main's padding is --space-20 + inset (bottomnav.css) and the nav is
|
|
152
|
+
* --fdy-bottomnav-h + inset tall. What must remain below the bar is exactly the nav, so the
|
|
153
|
+
* bar ends on the nav at the end of the page and is not pushed up over the last row. The
|
|
154
|
+
* insets cancel. */
|
|
155
|
+
.fdy-app--has-bottomnav .fdy-app__main > .fdy-actionbar:last-child,
|
|
156
|
+
.fdy-app--has-bottomnav .fdy-app__main > :not(dialog):not(.fdy-drawer) > .fdy-actionbar:last-child{
|
|
157
|
+
margin-bottom:calc(var(--fdy-bottomnav-h) - var(--space-20));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
92
161
|
/* Freeday. Alert (inline) */
|
|
93
162
|
.fdy-alert{display:flex;gap:var(--space-3);padding:var(--space-3) var(--space-4);border-radius:var(--radius-md);border:var(--bw) solid var(--color-border);font-size:var(--text-sm);color:var(--color-text);background:var(--color-surface-2);}
|
|
94
163
|
.fdy-alert__icon{flex:none;display:inline-flex;align-items:center;justify-content:center;width:1.25rem;height:1.25rem;margin-top:.05rem;}
|
|
@@ -427,8 +496,16 @@ a { color: var(--color-primary-strong); }
|
|
|
427
496
|
*
|
|
428
497
|
* Deliberately NOT part of `.fdy-app`'s markup: it is `position:fixed`, so it works from
|
|
429
498
|
* anywhere inside the shell's content slot, and an application that does not want one
|
|
430
|
-
* pays nothing. `.fdy-app--has-bottomnav` on the shell is what reserves room for it
|
|
499
|
+
* pays nothing. `.fdy-app--has-bottomnav` on the shell is what reserves room for it and states
|
|
500
|
+
* the bar's height, `--fdy-bottomnav-h`, which the bar is sized by. */
|
|
431
501
|
.fdy-bottomnav{display:none;}
|
|
502
|
+
/* The bar's height, stated once so anything resting on the bar (the action bar) reads the same
|
|
503
|
+
* number the bar is drawn with: a 44px item, the vertical padding, the top hairline. Before this
|
|
504
|
+
* the height was only implied, and an item's icon and label made it 0.39px taller than the sum,
|
|
505
|
+
* more with a taller app font. The safe-area inset is added where it is used, not here. The
|
|
506
|
+
* price of a stated height: with a taller app font the label may overflow into the nav's bottom
|
|
507
|
+
* padding instead of growing it. */
|
|
508
|
+
.fdy-app--has-bottomnav{--fdy-bottomnav-h:calc(2.75rem + 2 * var(--space-2) + var(--bw));}
|
|
432
509
|
@media (max-width:720px){
|
|
433
510
|
.fdy-bottomnav{
|
|
434
511
|
display:flex;position:fixed;left:0;right:0;bottom:0;z-index:50;
|
|
@@ -442,6 +519,8 @@ a { color: var(--color-primary-strong); }
|
|
|
442
519
|
backdrop-filter:var(--surface-filter);
|
|
443
520
|
-webkit-backdrop-filter:var(--surface-filter);
|
|
444
521
|
border-top:var(--bw) solid var(--color-border);
|
|
522
|
+
box-sizing:border-box;
|
|
523
|
+
height:calc(var(--fdy-bottomnav-h,auto) + env(safe-area-inset-bottom,0px));
|
|
445
524
|
}
|
|
446
525
|
/* Room for the bar, or the last row of every list on every screen sits under it -- and
|
|
447
526
|
a row you cannot scroll to is a row nobody knows is there. */
|
|
@@ -1574,6 +1653,21 @@ fieldset.fdy-field>legend{padding:0;float:none;margin-bottom:var(--space-2);}
|
|
|
1574
1653
|
/* Freeday. Keyboard key */
|
|
1575
1654
|
.fdy-kbd{display:inline-flex;align-items:center;justify-content:center;min-width:1.5rem;height:1.5rem;padding:0 var(--space-2);font-family:var(--font-mono);font-size:var(--text-xs);color:var(--color-text);background:var(--color-surface-2);border:var(--bw) solid var(--color-border-strong);border-bottom-width:2px;border-radius:var(--radius-sm);}
|
|
1576
1655
|
|
|
1656
|
+
/* Freeday. Text link
|
|
1657
|
+
* A bare `<a>` is already a link here: base.css paints it `--color-primary-strong` and the browser
|
|
1658
|
+
* underlines it. `.fdy-link` names that look so it can be found in COMPONENTS.md, sets the underline
|
|
1659
|
+
* the same way in every browser, and is the base the muted variant modifies.
|
|
1660
|
+
*
|
|
1661
|
+
* The underline stays in both, at rest. A link told apart by colour alone fails WCAG 1.4.1, and in
|
|
1662
|
+
* the muted variant there is no colour to tell it by. Hover thickens it; focus is base.css's ring. */
|
|
1663
|
+
.fdy-link{color:var(--color-primary-strong);text-decoration-line:underline;text-underline-offset:.2em;text-decoration-thickness:.06em;}
|
|
1664
|
+
.fdy-link:hover{text-decoration-thickness:.12em;}
|
|
1665
|
+
/* For a column of names that each open their own record: a table of accounts, each linking to its
|
|
1666
|
+
ledger. Twenty primary-coloured links in one column outweigh the numbers beside them. The text
|
|
1667
|
+
ink with a muted underline keeps every name reading as a link without competing with the data. */
|
|
1668
|
+
.fdy-link--muted{color:var(--color-text);text-decoration-color:var(--color-text-muted);}
|
|
1669
|
+
.fdy-link--muted:hover{color:var(--color-primary-strong);text-decoration-color:currentColor;}
|
|
1670
|
+
|
|
1577
1671
|
/* Freeday. List: the FLAT row container.
|
|
1578
1672
|
*
|
|
1579
1673
|
* USAGE.md §3 puts list rows among the surfaces that should be flat, but until now the only
|
|
@@ -2108,6 +2202,44 @@ fieldset.fdy-field>legend{padding:0;float:none;margin-bottom:var(--space-2);}
|
|
|
2108
2202
|
.fdy-tabs--vertical .fdy-tabs__tab[aria-selected="true"],.fdy-tabs--vertical .fdy-tabs__tab[aria-current="page"]{background:var(--color-primary-soft);color:var(--color-primary-strong);font-weight:var(--weight-semibold);}
|
|
2109
2203
|
.fdy-tabs--vertical .fdy-tabs__panel{flex:1;min-width:0;padding:0;}
|
|
2110
2204
|
|
|
2205
|
+
/* PICKER IN A NARROW CONTAINER: `.fdy-tabs--picker-narrow`, opt-in, on either variant.
|
|
2206
|
+
*
|
|
2207
|
+
* At 40rem of its own width or less, the tab list gives way to `.fdy-tabs__picker`, a wrapper
|
|
2208
|
+
* holding one combo of the same sections. Six tabs with real labels do not fit a phone as a strip,
|
|
2209
|
+
* and as a column they fill the screen before the panel starts. A container query rather than a
|
|
2210
|
+
* viewport one, because the same tabs can sit in a page or in a 20rem drawer.
|
|
2211
|
+
*
|
|
2212
|
+
* The list is hidden only through `.fdy-tabs__picker ~ .fdy-tabs__list`, so the picker has to come
|
|
2213
|
+
* BEFORE the list, and tabs with no picker in them keep their list at every width: the class alone
|
|
2214
|
+
* can never leave a screen with no way between its sections. On the raw path freeday-tabs.js builds
|
|
2215
|
+
* the picker; in a typed stack it is a `FdyCombo` bound to the same state as the tabs.
|
|
2216
|
+
*
|
|
2217
|
+
* `flex-wrap` is what makes the vertical variant work: a container query styles what is inside the
|
|
2218
|
+
* container, never the container itself, so `.fdy-tabs--vertical` stays a flex row. The picker takes
|
|
2219
|
+
* a whole line and the panel wraps under it. While the list shows, the panel's `min-width:0` means it
|
|
2220
|
+
* never wraps.
|
|
2221
|
+
*
|
|
2222
|
+
* 40rem: a column of labels and a panel worth reading do not both fit under it. Below Safari 16
|
|
2223
|
+
* there are no container queries, and the same body applies by viewport width instead; that answers
|
|
2224
|
+
* every phone, and leaves tabs in a narrow drawer on a wide screen as lists. The two bodies are
|
|
2225
|
+
* copies, compared in test/baseline.test.mjs. */
|
|
2226
|
+
.fdy-tabs__picker{display:none;}
|
|
2227
|
+
.fdy-tabs--picker-narrow{flex-wrap:wrap;}
|
|
2228
|
+
.fdy-tabs__picker > .fdy-combo{max-width:none;}
|
|
2229
|
+
@supports (container-type:inline-size){
|
|
2230
|
+
.fdy-tabs--picker-narrow{container:fdy-tabs / inline-size;}
|
|
2231
|
+
@container fdy-tabs (max-width: 40rem){
|
|
2232
|
+
.fdy-tabs--picker-narrow > .fdy-tabs__picker{display:block;flex:0 0 100%;}
|
|
2233
|
+
.fdy-tabs--picker-narrow > .fdy-tabs__picker ~ .fdy-tabs__list{display:none;}
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
@supports not (container-type:inline-size){
|
|
2237
|
+
@media (max-width:40rem){
|
|
2238
|
+
.fdy-tabs--picker-narrow > .fdy-tabs__picker{display:block;flex:0 0 100%;}
|
|
2239
|
+
.fdy-tabs--picker-narrow > .fdy-tabs__picker ~ .fdy-tabs__list{display:none;}
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
|
|
2111
2243
|
/* Freeday. Timeline (vertical event feed: dot markers on a connector line). Pure CSS. */
|
|
2112
2244
|
.fdy-timeline{list-style:none;margin:0;padding:0;}
|
|
2113
2245
|
.fdy-timeline__item{position:relative;padding:0 0 var(--space-5) var(--space-6);border-left:2px solid var(--color-border);}
|
package/dist/freeday.js
CHANGED
|
@@ -5361,10 +5361,73 @@
|
|
|
5361
5361
|
* other pair is left entirely alone rather than bound as a second axis: Left and Right over a
|
|
5362
5362
|
* column of tabs belong to whatever else is on the page, and a widget that preventDefaults a key
|
|
5363
5363
|
* it has no meaning for has taken it from the page silently. Home/End answer on both.
|
|
5364
|
+
*
|
|
5365
|
+
* `.fdy-tabs--picker-narrow` on the root: this builds a `.fdy-tabs__picker` holding one combo of
|
|
5366
|
+
* the same tabs, first in the root, and keeps the two in step both ways. tabs.css shows it instead
|
|
5367
|
+
* of the list in a container of 40rem or less. It needs freeday-select.js (FreedayCombo), which
|
|
5368
|
+
* dist/freeday.js carries; without it the list simply stays. A picker the author wrote is left alone.
|
|
5364
5369
|
*/
|
|
5365
5370
|
(function () {
|
|
5366
5371
|
'use strict';
|
|
5367
5372
|
|
|
5373
|
+
/* The picker's accessible name when the tablist has none of its own to lend it. */
|
|
5374
|
+
var TEXT = {
|
|
5375
|
+
picker: 'Section'
|
|
5376
|
+
};
|
|
5377
|
+
function textOf(root, key) {
|
|
5378
|
+
var kebab = key.replace(/[A-Z]/g, function (c) { return '-' + c.toLowerCase(); });
|
|
5379
|
+
var custom = root.getAttribute('data-fdy-text-' + kebab);
|
|
5380
|
+
return custom != null && custom !== '' ? custom : TEXT[key];
|
|
5381
|
+
}
|
|
5382
|
+
var uidSeq = 0;
|
|
5383
|
+
function uid(p) { uidSeq += 1; return p + '-' + uidSeq; }
|
|
5384
|
+
|
|
5385
|
+
/* The combo freeday-select.js reads, built from the tabs themselves: one option per tab, its value
|
|
5386
|
+
the tab's id. Named by the tablist's own label when it has one, so the two read as one control. */
|
|
5387
|
+
function buildPicker(root, list, tabs) {
|
|
5388
|
+
var wrap = document.createElement('div');
|
|
5389
|
+
wrap.className = 'fdy-tabs__picker';
|
|
5390
|
+
var combo = document.createElement('div');
|
|
5391
|
+
combo.className = 'fdy-combo';
|
|
5392
|
+
combo.setAttribute('data-fdy-combo', '');
|
|
5393
|
+
var button = document.createElement('button');
|
|
5394
|
+
button.type = 'button';
|
|
5395
|
+
button.className = 'fdy-combo__button';
|
|
5396
|
+
button.setAttribute('role', 'combobox');
|
|
5397
|
+
button.setAttribute('aria-haspopup', 'listbox');
|
|
5398
|
+
button.setAttribute('aria-expanded', 'false');
|
|
5399
|
+
var value = document.createElement('span');
|
|
5400
|
+
value.className = 'fdy-combo__value';
|
|
5401
|
+
value.id = uid('fdy-tabs-picker-value');
|
|
5402
|
+
button.appendChild(value);
|
|
5403
|
+
var labelledby = list ? list.getAttribute('aria-labelledby') : null;
|
|
5404
|
+
var label = list ? list.getAttribute('aria-label') : null;
|
|
5405
|
+
if (labelledby) button.setAttribute('aria-labelledby', labelledby + ' ' + value.id);
|
|
5406
|
+
else button.setAttribute('aria-label', label || textOf(root, 'picker'));
|
|
5407
|
+
var listbox = document.createElement('ul');
|
|
5408
|
+
listbox.className = 'fdy-combo__listbox';
|
|
5409
|
+
listbox.setAttribute('role', 'listbox');
|
|
5410
|
+
listbox.hidden = true;
|
|
5411
|
+
tabs.forEach(function (tab) {
|
|
5412
|
+
if (!tab.id) tab.id = uid('fdy-tab');
|
|
5413
|
+
var opt = document.createElement('li');
|
|
5414
|
+
opt.className = 'fdy-combo__option';
|
|
5415
|
+
opt.setAttribute('role', 'option');
|
|
5416
|
+
opt.setAttribute('data-value', tab.id);
|
|
5417
|
+
opt.setAttribute('aria-selected', 'false');
|
|
5418
|
+
var check = document.createElement('span');
|
|
5419
|
+
check.className = 'fdy-combo__check';
|
|
5420
|
+
opt.appendChild(check);
|
|
5421
|
+
opt.appendChild(document.createTextNode((tab.textContent || '').replace(/\s+/g, ' ').trim()));
|
|
5422
|
+
listbox.appendChild(opt);
|
|
5423
|
+
});
|
|
5424
|
+
combo.appendChild(button);
|
|
5425
|
+
combo.appendChild(listbox);
|
|
5426
|
+
wrap.appendChild(combo);
|
|
5427
|
+
root.insertBefore(wrap, root.firstChild);
|
|
5428
|
+
return combo;
|
|
5429
|
+
}
|
|
5430
|
+
|
|
5368
5431
|
function initTabs(root) {
|
|
5369
5432
|
if (root.dataset.fdyTabsReady === '1') return;
|
|
5370
5433
|
if (root.closest('[data-fdy-ignore]')) return;
|
|
@@ -5382,6 +5445,17 @@
|
|
|
5382
5445
|
list.setAttribute('aria-orientation', 'vertical');
|
|
5383
5446
|
}
|
|
5384
5447
|
var vertical = list !== null && list.getAttribute('aria-orientation') === 'vertical';
|
|
5448
|
+
var picker = null;
|
|
5449
|
+
if (root.classList.contains('fdy-tabs--picker-narrow') && window.FreedayCombo
|
|
5450
|
+
&& root.querySelector(':scope > .fdy-tabs__picker') === null) {
|
|
5451
|
+
picker = buildPicker(root, list, tabs);
|
|
5452
|
+
window.FreedayCombo.init(picker);
|
|
5453
|
+
picker.addEventListener('fdy-change', function (e) {
|
|
5454
|
+
var id = e.detail && e.detail.value;
|
|
5455
|
+
var tab = tabs.filter(function (t) { return t.id === id; })[0];
|
|
5456
|
+
if (tab) select(tab, false);
|
|
5457
|
+
});
|
|
5458
|
+
}
|
|
5385
5459
|
var NEXT_KEY = vertical ? 'ArrowDown' : 'ArrowRight';
|
|
5386
5460
|
var PREV_KEY = vertical ? 'ArrowUp' : 'ArrowLeft';
|
|
5387
5461
|
|
|
@@ -5397,6 +5471,8 @@
|
|
|
5397
5471
|
var panel = panelFor(t);
|
|
5398
5472
|
if (panel) panel.hidden = !on;
|
|
5399
5473
|
});
|
|
5474
|
+
/* Silent: setValue raises no fdy-change, so the picker cannot echo a pick back here. */
|
|
5475
|
+
if (picker) window.FreedayCombo.setValue(picker, tab.id);
|
|
5400
5476
|
if (focus) tab.focus();
|
|
5401
5477
|
}
|
|
5402
5478
|
|