@fieldia/widgets 0.10.0 → 0.11.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 +2 -1
- package/package.json +2 -2
- package/src/lib/files.js +67 -9
- package/src/lib/files.js.map +1 -1
- package/src/lib/files.mjs +67 -9
- package/src/lib/files.mjs.map +1 -1
- package/src/lib/labels.d.mts +5 -0
- package/src/lib/labels.d.ts +5 -0
- package/src/lib/labels.js +4 -0
- package/src/lib/labels.js.map +1 -1
- package/src/lib/labels.mjs +4 -0
- package/src/lib/labels.mjs.map +1 -1
- package/src/lib/layout-styles.d.mts +1 -1
- package/src/lib/layout-styles.d.ts +1 -1
- package/src/lib/layout-styles.js +2 -0
- package/src/lib/layout-styles.js.map +1 -1
- package/src/lib/layout-styles.mjs +2 -0
- package/src/lib/layout-styles.mjs.map +1 -1
- package/src/lib/locales/ar.js +4 -0
- package/src/lib/locales/ar.js.map +1 -1
- package/src/lib/locales/ar.mjs +4 -0
- package/src/lib/locales/ar.mjs.map +1 -1
- package/src/lib/locales/de.js +4 -0
- package/src/lib/locales/de.js.map +1 -1
- package/src/lib/locales/de.mjs +4 -0
- package/src/lib/locales/de.mjs.map +1 -1
- package/src/lib/locales/fr.js +4 -0
- package/src/lib/locales/fr.js.map +1 -1
- package/src/lib/locales/fr.mjs +4 -0
- package/src/lib/locales/fr.mjs.map +1 -1
- package/src/lib/styles-parts.d.mts +16 -0
- package/src/lib/styles-parts.d.ts +16 -0
- package/src/lib/styles-parts.js +69 -0
- package/src/lib/styles-parts.js.map +1 -0
- package/src/lib/styles-parts.mjs +66 -0
- package/src/lib/styles-parts.mjs.map +1 -0
- package/src/lib/styles.d.mts +10 -0
- package/src/lib/styles.d.ts +10 -0
- package/src/lib/styles.js +95 -12
- package/src/lib/styles.js.map +1 -1
- package/src/lib/styles.mjs +94 -11
- package/src/lib/styles.mjs.map +1 -1
package/src/lib/styles.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIELDIA_CSS = void 0;
|
|
3
|
+
exports.FIELDIA_CSS = exports.FORM_WIDTHS = void 0;
|
|
4
4
|
exports.installStyles = installStyles;
|
|
5
5
|
const styles_kinds_1 = require("./styles-kinds");
|
|
6
6
|
const styles_choices_1 = require("./styles-choices");
|
|
7
7
|
const styles_inputs_1 = require("./styles-inputs");
|
|
8
|
+
const styles_parts_1 = require("./styles-parts");
|
|
8
9
|
/**
|
|
9
10
|
* Fieldia's stylesheet: two skins and the layout chrome, all scoped to the
|
|
10
11
|
* form's own root (`.fd-form[data-fd-skin=…]`), so two forms on one page can
|
|
@@ -19,6 +20,13 @@ const styles_inputs_1 = require("./styles-inputs");
|
|
|
19
20
|
* form mirrors without a second stylesheet.
|
|
20
21
|
*/
|
|
21
22
|
const layout_styles_1 = require("./layout-styles");
|
|
23
|
+
/**
|
|
24
|
+
* The widths of a form at which its groups take their medium and their narrow
|
|
25
|
+
* columns: up to 760px and up to 520px of the form's own width, as the
|
|
26
|
+
* stylesheet's @container rules say (a spec holds the two together). What
|
|
27
|
+
* shows a form at a width — the designer's canvas — asks these.
|
|
28
|
+
*/
|
|
29
|
+
exports.FORM_WIDTHS = { medium: 760, narrow: 520 };
|
|
22
30
|
/** The skins and the parts' chrome. One literal, so the script bundle can minify it as CSS. */
|
|
23
31
|
const SKINS_CSS = /* css */ `
|
|
24
32
|
/* .fd-theme carries the same tokens for things outside a form, such as a dialog over the page. One inside a form
|
|
@@ -350,25 +358,46 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
350
358
|
.fd-file-confirm:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
|
|
351
359
|
.fd-file-note:empty { display: none; }
|
|
352
360
|
.fd-file-note { color: var(--fd-warning); }
|
|
361
|
+
/* Over the files: how many, and the switch between a list and pictures, at the end. */
|
|
362
|
+
.fd-file-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; justify-self: stretch; }
|
|
363
|
+
.fd-file-views { display: flex; gap: 2px; margin-inline-start: auto; padding: 2px; border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-page); }
|
|
364
|
+
.fd-file-views button {
|
|
365
|
+
display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; font: inherit; font-size: 13px; color: var(--fd-muted); cursor: pointer;
|
|
366
|
+
border: none; border-radius: calc(var(--fd-control-radius) - 2px); background: none;
|
|
367
|
+
}
|
|
368
|
+
.fd-file-views [aria-pressed="true"] { color: var(--fd-text); background: var(--fd-surface); box-shadow: 0 0 0 1px var(--fd-border); }
|
|
353
369
|
/* Thumbnails: tiles in a row that wraps, the picker the last of them. */
|
|
354
370
|
.fd-files-thumbs { display: flex; flex-wrap: wrap; align-items: flex-start; }
|
|
355
|
-
.fd-files-thumbs > * { flex-basis: 100%;
|
|
356
|
-
.fd-files-thumbs > .fd-files { display: contents; }
|
|
357
|
-
.fd-files-thumbs .fd-file-item, .fd-image-pick { flex: none; width: 96px; height: 96px;
|
|
358
|
-
.fd-files-thumbs > .fd-file-count { order: -1; }
|
|
371
|
+
.fd-files-thumbs > * { flex-basis: 100%; }
|
|
372
|
+
:is(.fd-files-thumbs, .fd-files-cards) > .fd-files { display: contents; }
|
|
373
|
+
.fd-files-thumbs .fd-file-item, .fd-image-pick { flex: none; width: 96px; height: 96px; }
|
|
359
374
|
.fd-files-thumbs .fd-file-open { height: 100%; padding: 6px; flex-direction: column; justify-content: center; gap: 4px; overflow: hidden; font-size: 12px; }
|
|
360
|
-
.fd-files-thumbs .fd-file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
|
|
375
|
+
:is(.fd-files-thumbs, .fd-files-cards) .fd-file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
|
|
361
376
|
.fd-files-thumbs .fd-file-name { flex: none; max-width: 100%; }
|
|
362
377
|
.fd-files-thumbs .fd-file-size, .fd-files-thumbs .fd-file-thumb ~ * { display: none; }
|
|
363
|
-
.fd-files-thumbs .fd-file-remove {
|
|
378
|
+
:is(.fd-files-thumbs, .fd-files-cards) .fd-file-remove {
|
|
364
379
|
position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 26px; height: 26px; font-size: 17px;
|
|
365
380
|
background: rgba(15, 20, 25, 0.62); color: #fff; opacity: 0;
|
|
366
381
|
}
|
|
367
382
|
.fd-file-item:is(:hover, :focus-within) .fd-file-remove { opacity: 1; }
|
|
383
|
+
/* A screen with no pointer to hover with shows each tile's remove. */
|
|
384
|
+
@media (hover: none) { .fd-file-item .fd-file-remove { opacity: 1; } }
|
|
368
385
|
.fd-image-pick {
|
|
369
|
-
|
|
386
|
+
display: grid; place-content: center; justify-items: center; gap: 2px; padding: 6px; text-align: center; font-size: 12px;
|
|
370
387
|
border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius); background: var(--fd-page);
|
|
371
388
|
}
|
|
389
|
+
/* Cards: a picture over each file's name, in two lines at most, and its size; as many to a row as fit. */
|
|
390
|
+
.fd-files-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
|
|
391
|
+
.fd-files-cards > * { grid-column: 1 / -1; }
|
|
392
|
+
.fd-files-cards > .fd-image-pick { grid-column: auto; justify-self: stretch; width: auto; height: auto; min-height: 96px; }
|
|
393
|
+
.fd-files-cards .fd-file-item { justify-self: stretch; align-items: stretch; }
|
|
394
|
+
.fd-files-cards .fd-file-open { flex-direction: column; align-items: stretch; gap: 2px; padding: 0 0 8px; overflow: hidden; }
|
|
395
|
+
/* The picture fills its box; with none, the kind's page, large, on the box's ground. */
|
|
396
|
+
.fd-file-picture { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; margin-block-end: 6px; background: var(--fd-page); border-block-end: 1px solid var(--fd-border); }
|
|
397
|
+
.fd-file-picture .fd-file-icon { width: 44px; height: 56px; padding-block-end: 8px; font-size: 12px; }
|
|
398
|
+
.fd-files-cards :is(.fd-file-name, .fd-file-size) { padding-inline: 8px; }
|
|
399
|
+
.fd-files-cards .fd-file-name { flex: none; flex-wrap: wrap; font-size: 13px; line-height: 1.35; }
|
|
400
|
+
.fd-files-cards .fd-file-name > span { max-width: 100%; }
|
|
372
401
|
.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; font-size: 13px; }
|
|
373
402
|
/* A file open to look at: its name and tools over it, the image whole, a PDF or text filling the box. */
|
|
374
403
|
.fd-file-viewer { max-width: 1000px; height: min(88vh, 100%); background: var(--fd-surface); }
|
|
@@ -433,6 +462,9 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
433
462
|
.fd-form[data-fd-skin="outlined"] :is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page]) {
|
|
434
463
|
background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: var(--fd-group-pad, 20px 24px);
|
|
435
464
|
}
|
|
465
|
+
/* A saved form placed in another: a quiet line while its page comes, and words in a dashed box when it cannot be shown. */
|
|
466
|
+
.fd-form-part-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
|
|
467
|
+
.fd-form-part-problem { padding: 10px 12px; border: 1px dashed var(--fd-border); border-radius: var(--fd-radius); }
|
|
436
468
|
.fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }
|
|
437
469
|
.fd-tab {
|
|
438
470
|
font: inherit; background: none; border: none; cursor: pointer; padding: 8px 14px; color: var(--fd-muted);
|
|
@@ -700,8 +732,34 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
700
732
|
.fd-dialog {
|
|
701
733
|
background: var(--fd-surface); color: var(--fd-text); border-radius: max(var(--fd-radius), 6px); max-width: 420px; width: 100%;
|
|
702
734
|
padding: 20px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-family: var(--fd-font);
|
|
735
|
+
/* An edge of its own: in the dark scheme a shadow is lost on the dimmed page, so the box would barely stand out. */
|
|
736
|
+
border: 1px solid var(--fd-edge, transparent);
|
|
703
737
|
}
|
|
704
738
|
.fd-dialog p { margin: 0; }
|
|
739
|
+
/* Words a step says: toasts at the foot of the screen, one over another, each in its tone; over the page, under a dialog. */
|
|
740
|
+
.fd-says {
|
|
741
|
+
position: fixed; inset-inline: 16px; inset-block-end: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 990;
|
|
742
|
+
display: grid; justify-items: center; gap: 8px; pointer-events: none;
|
|
743
|
+
}
|
|
744
|
+
.fd-say {
|
|
745
|
+
pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 420px;
|
|
746
|
+
padding-block: 8px; padding-inline: 14px 6px; border: 1px solid var(--fd-border); border-inline-start: 4px solid var(--fd-tone);
|
|
747
|
+
border-radius: max(var(--fd-control-radius), 6px); background: var(--fd-surface); color: var(--fd-text);
|
|
748
|
+
box-shadow: 0 8px 24px rgba(15, 20, 25, 0.25); font-size: 13.5px;
|
|
749
|
+
}
|
|
750
|
+
.fd-say > span { flex: 1 1 auto; min-width: 0; }
|
|
751
|
+
/* A button whose steps are running: busy, a turning ring beside its words, not pressed again. */
|
|
752
|
+
.fd-button[aria-busy="true"], .fd-stat[aria-busy="true"] { cursor: progress; }
|
|
753
|
+
.fd-button[aria-busy="true"]::after {
|
|
754
|
+
content: ""; width: 0.85em; height: 0.85em; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
|
|
755
|
+
animation: fd-spin 0.8s linear infinite;
|
|
756
|
+
}
|
|
757
|
+
@keyframes fd-spin { to { rotate: 1turn; } }
|
|
758
|
+
/* A page opened in a form's place: Back over it, the way the page reads. */
|
|
759
|
+
.fd-back { margin: 8px 12px; }
|
|
760
|
+
.fd-back::before { content: "←"; }
|
|
761
|
+
.fd-back:dir(rtl)::before { content: "→"; }
|
|
762
|
+
.fd-form[data-scheme] > .fd-back { margin: 12px 20px 0; }
|
|
705
763
|
/* A page in a dialog: a head with its title and ×, a body that scrolls, a foot with Discard and Save & Close. */
|
|
706
764
|
.fd-form-dialog {
|
|
707
765
|
display: flex; flex-direction: column; width: 100%; max-height: min(90vh, 100%); min-height: 0;
|
|
@@ -712,8 +770,10 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
712
770
|
.fd-form-dialog.fd-size-small { max-width: 440px; }
|
|
713
771
|
.fd-form-dialog.fd-size-medium { max-width: 760px; }
|
|
714
772
|
.fd-form-dialog.fd-size-large { max-width: 1080px; }
|
|
715
|
-
|
|
716
|
-
.fd-form-dialog.fd-size-full
|
|
773
|
+
/* A dialog of the full size, and a panel (below): the whole height, square, nothing round it. */
|
|
774
|
+
.fd-form-dialog-backdrop:has(> .fd-size-full), .fd-form-panel-backdrop { padding: 0; }
|
|
775
|
+
.fd-form-dialog:is(.fd-size-full, .fd-form-panel) { max-height: none; height: 100%; border-radius: 0; }
|
|
776
|
+
.fd-size-full { max-width: none; }
|
|
717
777
|
.fd-form-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-block-end: 1px solid var(--fd-border); background: var(--fd-surface); }
|
|
718
778
|
.fd-form-dialog-title { margin: 0; font-size: 16px; font-weight: 600; }
|
|
719
779
|
.fd-dialog-close { border: none; background: none; cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 4px; color: var(--fd-muted); }
|
|
@@ -734,10 +794,33 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
734
794
|
/* A page with no sheet of its own sits on the dialog's surface, clear of its edges. */
|
|
735
795
|
.fd-form-dialog-body:not(:has(.fd-sheet-layout)) { background: var(--fd-surface); padding: 16px 20px 20px; }
|
|
736
796
|
.fd-form-dialog-foot { padding: 12px 16px; border-block-start: 1px solid var(--fd-border); background: var(--fd-surface); margin: 0; }
|
|
737
|
-
|
|
797
|
+
/* A page in a side panel: at the inline-end edge unless it names another, the page behind dimmed, sliding in from its edge; on a phone, the whole screen. */
|
|
798
|
+
.fd-form-panel-backdrop { justify-items: end; }
|
|
799
|
+
.fd-form-panel { max-width: 560px; position: relative; }
|
|
800
|
+
/* Its question before changes are dropped sits over the panel, not over the page. */
|
|
801
|
+
.fd-form-panel > .fd-dialog-backdrop { position: absolute; }
|
|
802
|
+
.fd-width-narrow { max-width: 420px; }
|
|
803
|
+
.fd-width-wide { max-width: 720px; }
|
|
804
|
+
/* The other edges: the start of the line as the page reads; the left, right, top or bottom whatever it reads, the top and bottom the whole width.
|
|
805
|
+
Each says where its slide starts (--fd-from) and which edge it steps back from (--fd-back): the right unless told. */
|
|
806
|
+
.fd-form-panel[data-side="start"] { justify-self: start; }
|
|
807
|
+
.fd-form-panel[data-side="left"] { justify-self: left; }
|
|
808
|
+
.fd-form-panel[data-side="right"] { justify-self: right; }
|
|
809
|
+
.fd-form-panel[data-side="top"] { align-self: start; --fd-from: 0 -100%; --fd-back: 48px 0 0; }
|
|
810
|
+
.fd-form-panel[data-side="bottom"] { align-self: end; --fd-from: 0 100%; --fd-back: 0 0 48px; }
|
|
811
|
+
.fd-form-panel[data-side="end"]:dir(rtl), .fd-form-panel[data-side="start"]:dir(ltr), .fd-form-panel[data-side="left"] { --fd-from: -100% 0; --fd-back: 0 0 0 48px; }
|
|
812
|
+
.fd-form-panel:is([data-side="top"], [data-side="bottom"]) { max-width: none; height: 60%; }
|
|
813
|
+
.fd-form-panel.fd-height-short { height: 40%; }
|
|
814
|
+
.fd-form-panel.fd-height-tall { height: 85%; }
|
|
815
|
+
/* A panel opened from another: the older one steps back from its own edge, still in sight. */
|
|
816
|
+
.fd-form-panel[data-behind] { margin: var(--fd-back, 0 48px 0 0); }
|
|
817
|
+
@media (max-width: 600px) { .fd-form-dialog.fd-form-panel[data-side] { max-width: none; height: 100%; margin: 0; --fd-from: 0 100%; } .fd-form-dialog.fd-form-panel[data-side="top"] { --fd-from: 0 -100%; } }
|
|
818
|
+
@media (prefers-reduced-motion: no-preference) { .fd-form-panel { animation: fd-slide 0.25s ease-out; transition: margin 0.2s; } }
|
|
819
|
+
@keyframes fd-slide { from { translate: var(--fd-from, 100% 0); } }
|
|
820
|
+
@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } .fd-button[aria-busy="true"]::after { animation: none; } }
|
|
738
821
|
`;
|
|
739
822
|
/** Fieldia's whole stylesheet: the skins, then the layout over them, the inputs' details, the question kinds and the choices' details. */
|
|
740
|
-
exports.FIELDIA_CSS = SKINS_CSS + layout_styles_1.LAYOUT_CSS + styles_inputs_1.INPUTS_CSS + styles_kinds_1.KINDS_CSS + styles_choices_1.CHOICES_CSS;
|
|
823
|
+
exports.FIELDIA_CSS = SKINS_CSS + layout_styles_1.LAYOUT_CSS + styles_inputs_1.INPUTS_CSS + styles_kinds_1.KINDS_CSS + styles_choices_1.CHOICES_CSS + styles_parts_1.PARTS_CSS;
|
|
741
824
|
const STYLE_ID = 'fieldia-styles';
|
|
742
825
|
/** Add Fieldia's stylesheet to a document, once. */
|
|
743
826
|
function installStyles(document) {
|
package/src/lib/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/styles.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/styles.ts"],"names":[],"mappings":";;;AA2zBA,sCAMC;AAj0BD,iDAA2C;AAC3C,qDAA+C;AAC/C,mDAA6C;AAC7C,iDAA2C;AAE3C;;;;;;;;;;;;GAYG;AACH,mDAA6C;AAE7C;;;;;GAKG;AACU,QAAA,WAAW,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAW,CAAC;AAEjE,+FAA+F;AAC/F,MAAM,SAAS,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;IAC9C,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,mBAAW,CAAC;IAChC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
package/src/lib/styles.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { KINDS_CSS } from './styles-kinds.mjs';
|
|
2
2
|
import { CHOICES_CSS } from './styles-choices.mjs';
|
|
3
3
|
import { INPUTS_CSS } from './styles-inputs.mjs';
|
|
4
|
+
import { PARTS_CSS } from './styles-parts.mjs';
|
|
4
5
|
/**
|
|
5
6
|
* Fieldia's stylesheet: two skins and the layout chrome, all scoped to the
|
|
6
7
|
* form's own root (`.fd-form[data-fd-skin=…]`), so two forms on one page can
|
|
@@ -15,6 +16,13 @@ import { INPUTS_CSS } from './styles-inputs.mjs';
|
|
|
15
16
|
* form mirrors without a second stylesheet.
|
|
16
17
|
*/
|
|
17
18
|
import { LAYOUT_CSS } from './layout-styles.mjs';
|
|
19
|
+
/**
|
|
20
|
+
* The widths of a form at which its groups take their medium and their narrow
|
|
21
|
+
* columns: up to 760px and up to 520px of the form's own width, as the
|
|
22
|
+
* stylesheet's @container rules say (a spec holds the two together). What
|
|
23
|
+
* shows a form at a width — the designer's canvas — asks these.
|
|
24
|
+
*/
|
|
25
|
+
export const FORM_WIDTHS = { medium: 760, narrow: 520 };
|
|
18
26
|
/** The skins and the parts' chrome. One literal, so the script bundle can minify it as CSS. */
|
|
19
27
|
const SKINS_CSS = /* css */ `
|
|
20
28
|
/* .fd-theme carries the same tokens for things outside a form, such as a dialog over the page. One inside a form
|
|
@@ -346,25 +354,46 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
346
354
|
.fd-file-confirm:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
|
|
347
355
|
.fd-file-note:empty { display: none; }
|
|
348
356
|
.fd-file-note { color: var(--fd-warning); }
|
|
357
|
+
/* Over the files: how many, and the switch between a list and pictures, at the end. */
|
|
358
|
+
.fd-file-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; justify-self: stretch; }
|
|
359
|
+
.fd-file-views { display: flex; gap: 2px; margin-inline-start: auto; padding: 2px; border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-page); }
|
|
360
|
+
.fd-file-views button {
|
|
361
|
+
display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px; font: inherit; font-size: 13px; color: var(--fd-muted); cursor: pointer;
|
|
362
|
+
border: none; border-radius: calc(var(--fd-control-radius) - 2px); background: none;
|
|
363
|
+
}
|
|
364
|
+
.fd-file-views [aria-pressed="true"] { color: var(--fd-text); background: var(--fd-surface); box-shadow: 0 0 0 1px var(--fd-border); }
|
|
349
365
|
/* Thumbnails: tiles in a row that wraps, the picker the last of them. */
|
|
350
366
|
.fd-files-thumbs { display: flex; flex-wrap: wrap; align-items: flex-start; }
|
|
351
|
-
.fd-files-thumbs > * { flex-basis: 100%;
|
|
352
|
-
.fd-files-thumbs > .fd-files { display: contents; }
|
|
353
|
-
.fd-files-thumbs .fd-file-item, .fd-image-pick { flex: none; width: 96px; height: 96px;
|
|
354
|
-
.fd-files-thumbs > .fd-file-count { order: -1; }
|
|
367
|
+
.fd-files-thumbs > * { flex-basis: 100%; }
|
|
368
|
+
:is(.fd-files-thumbs, .fd-files-cards) > .fd-files { display: contents; }
|
|
369
|
+
.fd-files-thumbs .fd-file-item, .fd-image-pick { flex: none; width: 96px; height: 96px; }
|
|
355
370
|
.fd-files-thumbs .fd-file-open { height: 100%; padding: 6px; flex-direction: column; justify-content: center; gap: 4px; overflow: hidden; font-size: 12px; }
|
|
356
|
-
.fd-files-thumbs .fd-file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
|
|
371
|
+
:is(.fd-files-thumbs, .fd-files-cards) .fd-file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
|
|
357
372
|
.fd-files-thumbs .fd-file-name { flex: none; max-width: 100%; }
|
|
358
373
|
.fd-files-thumbs .fd-file-size, .fd-files-thumbs .fd-file-thumb ~ * { display: none; }
|
|
359
|
-
.fd-files-thumbs .fd-file-remove {
|
|
374
|
+
:is(.fd-files-thumbs, .fd-files-cards) .fd-file-remove {
|
|
360
375
|
position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 26px; height: 26px; font-size: 17px;
|
|
361
376
|
background: rgba(15, 20, 25, 0.62); color: #fff; opacity: 0;
|
|
362
377
|
}
|
|
363
378
|
.fd-file-item:is(:hover, :focus-within) .fd-file-remove { opacity: 1; }
|
|
379
|
+
/* A screen with no pointer to hover with shows each tile's remove. */
|
|
380
|
+
@media (hover: none) { .fd-file-item .fd-file-remove { opacity: 1; } }
|
|
364
381
|
.fd-image-pick {
|
|
365
|
-
|
|
382
|
+
display: grid; place-content: center; justify-items: center; gap: 2px; padding: 6px; text-align: center; font-size: 12px;
|
|
366
383
|
border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius); background: var(--fd-page);
|
|
367
384
|
}
|
|
385
|
+
/* Cards: a picture over each file's name, in two lines at most, and its size; as many to a row as fit. */
|
|
386
|
+
.fd-files-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
|
|
387
|
+
.fd-files-cards > * { grid-column: 1 / -1; }
|
|
388
|
+
.fd-files-cards > .fd-image-pick { grid-column: auto; justify-self: stretch; width: auto; height: auto; min-height: 96px; }
|
|
389
|
+
.fd-files-cards .fd-file-item { justify-self: stretch; align-items: stretch; }
|
|
390
|
+
.fd-files-cards .fd-file-open { flex-direction: column; align-items: stretch; gap: 2px; padding: 0 0 8px; overflow: hidden; }
|
|
391
|
+
/* The picture fills its box; with none, the kind's page, large, on the box's ground. */
|
|
392
|
+
.fd-file-picture { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; margin-block-end: 6px; background: var(--fd-page); border-block-end: 1px solid var(--fd-border); }
|
|
393
|
+
.fd-file-picture .fd-file-icon { width: 44px; height: 56px; padding-block-end: 8px; font-size: 12px; }
|
|
394
|
+
.fd-files-cards :is(.fd-file-name, .fd-file-size) { padding-inline: 8px; }
|
|
395
|
+
.fd-files-cards .fd-file-name { flex: none; flex-wrap: wrap; font-size: 13px; line-height: 1.35; }
|
|
396
|
+
.fd-files-cards .fd-file-name > span { max-width: 100%; }
|
|
368
397
|
.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; font-size: 13px; }
|
|
369
398
|
/* A file open to look at: its name and tools over it, the image whole, a PDF or text filling the box. */
|
|
370
399
|
.fd-file-viewer { max-width: 1000px; height: min(88vh, 100%); background: var(--fd-surface); }
|
|
@@ -429,6 +458,9 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
429
458
|
.fd-form[data-fd-skin="outlined"] :is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page]) {
|
|
430
459
|
background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: var(--fd-group-pad, 20px 24px);
|
|
431
460
|
}
|
|
461
|
+
/* A saved form placed in another: a quiet line while its page comes, and words in a dashed box when it cannot be shown. */
|
|
462
|
+
.fd-form-part-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
|
|
463
|
+
.fd-form-part-problem { padding: 10px 12px; border: 1px dashed var(--fd-border); border-radius: var(--fd-radius); }
|
|
432
464
|
.fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }
|
|
433
465
|
.fd-tab {
|
|
434
466
|
font: inherit; background: none; border: none; cursor: pointer; padding: 8px 14px; color: var(--fd-muted);
|
|
@@ -696,8 +728,34 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
696
728
|
.fd-dialog {
|
|
697
729
|
background: var(--fd-surface); color: var(--fd-text); border-radius: max(var(--fd-radius), 6px); max-width: 420px; width: 100%;
|
|
698
730
|
padding: 20px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-family: var(--fd-font);
|
|
731
|
+
/* An edge of its own: in the dark scheme a shadow is lost on the dimmed page, so the box would barely stand out. */
|
|
732
|
+
border: 1px solid var(--fd-edge, transparent);
|
|
699
733
|
}
|
|
700
734
|
.fd-dialog p { margin: 0; }
|
|
735
|
+
/* Words a step says: toasts at the foot of the screen, one over another, each in its tone; over the page, under a dialog. */
|
|
736
|
+
.fd-says {
|
|
737
|
+
position: fixed; inset-inline: 16px; inset-block-end: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 990;
|
|
738
|
+
display: grid; justify-items: center; gap: 8px; pointer-events: none;
|
|
739
|
+
}
|
|
740
|
+
.fd-say {
|
|
741
|
+
pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 420px;
|
|
742
|
+
padding-block: 8px; padding-inline: 14px 6px; border: 1px solid var(--fd-border); border-inline-start: 4px solid var(--fd-tone);
|
|
743
|
+
border-radius: max(var(--fd-control-radius), 6px); background: var(--fd-surface); color: var(--fd-text);
|
|
744
|
+
box-shadow: 0 8px 24px rgba(15, 20, 25, 0.25); font-size: 13.5px;
|
|
745
|
+
}
|
|
746
|
+
.fd-say > span { flex: 1 1 auto; min-width: 0; }
|
|
747
|
+
/* A button whose steps are running: busy, a turning ring beside its words, not pressed again. */
|
|
748
|
+
.fd-button[aria-busy="true"], .fd-stat[aria-busy="true"] { cursor: progress; }
|
|
749
|
+
.fd-button[aria-busy="true"]::after {
|
|
750
|
+
content: ""; width: 0.85em; height: 0.85em; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
|
|
751
|
+
animation: fd-spin 0.8s linear infinite;
|
|
752
|
+
}
|
|
753
|
+
@keyframes fd-spin { to { rotate: 1turn; } }
|
|
754
|
+
/* A page opened in a form's place: Back over it, the way the page reads. */
|
|
755
|
+
.fd-back { margin: 8px 12px; }
|
|
756
|
+
.fd-back::before { content: "←"; }
|
|
757
|
+
.fd-back:dir(rtl)::before { content: "→"; }
|
|
758
|
+
.fd-form[data-scheme] > .fd-back { margin: 12px 20px 0; }
|
|
701
759
|
/* A page in a dialog: a head with its title and ×, a body that scrolls, a foot with Discard and Save & Close. */
|
|
702
760
|
.fd-form-dialog {
|
|
703
761
|
display: flex; flex-direction: column; width: 100%; max-height: min(90vh, 100%); min-height: 0;
|
|
@@ -708,8 +766,10 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
708
766
|
.fd-form-dialog.fd-size-small { max-width: 440px; }
|
|
709
767
|
.fd-form-dialog.fd-size-medium { max-width: 760px; }
|
|
710
768
|
.fd-form-dialog.fd-size-large { max-width: 1080px; }
|
|
711
|
-
|
|
712
|
-
.fd-form-dialog.fd-size-full
|
|
769
|
+
/* A dialog of the full size, and a panel (below): the whole height, square, nothing round it. */
|
|
770
|
+
.fd-form-dialog-backdrop:has(> .fd-size-full), .fd-form-panel-backdrop { padding: 0; }
|
|
771
|
+
.fd-form-dialog:is(.fd-size-full, .fd-form-panel) { max-height: none; height: 100%; border-radius: 0; }
|
|
772
|
+
.fd-size-full { max-width: none; }
|
|
713
773
|
.fd-form-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-block-end: 1px solid var(--fd-border); background: var(--fd-surface); }
|
|
714
774
|
.fd-form-dialog-title { margin: 0; font-size: 16px; font-weight: 600; }
|
|
715
775
|
.fd-dialog-close { border: none; background: none; cursor: pointer; font-size: 22px; line-height: 1; padding: 2px 8px; border-radius: 4px; color: var(--fd-muted); }
|
|
@@ -730,10 +790,33 @@ button.fd-chip-label:hover { text-decoration: underline; }
|
|
|
730
790
|
/* A page with no sheet of its own sits on the dialog's surface, clear of its edges. */
|
|
731
791
|
.fd-form-dialog-body:not(:has(.fd-sheet-layout)) { background: var(--fd-surface); padding: 16px 20px 20px; }
|
|
732
792
|
.fd-form-dialog-foot { padding: 12px 16px; border-block-start: 1px solid var(--fd-border); background: var(--fd-surface); margin: 0; }
|
|
733
|
-
|
|
793
|
+
/* A page in a side panel: at the inline-end edge unless it names another, the page behind dimmed, sliding in from its edge; on a phone, the whole screen. */
|
|
794
|
+
.fd-form-panel-backdrop { justify-items: end; }
|
|
795
|
+
.fd-form-panel { max-width: 560px; position: relative; }
|
|
796
|
+
/* Its question before changes are dropped sits over the panel, not over the page. */
|
|
797
|
+
.fd-form-panel > .fd-dialog-backdrop { position: absolute; }
|
|
798
|
+
.fd-width-narrow { max-width: 420px; }
|
|
799
|
+
.fd-width-wide { max-width: 720px; }
|
|
800
|
+
/* The other edges: the start of the line as the page reads; the left, right, top or bottom whatever it reads, the top and bottom the whole width.
|
|
801
|
+
Each says where its slide starts (--fd-from) and which edge it steps back from (--fd-back): the right unless told. */
|
|
802
|
+
.fd-form-panel[data-side="start"] { justify-self: start; }
|
|
803
|
+
.fd-form-panel[data-side="left"] { justify-self: left; }
|
|
804
|
+
.fd-form-panel[data-side="right"] { justify-self: right; }
|
|
805
|
+
.fd-form-panel[data-side="top"] { align-self: start; --fd-from: 0 -100%; --fd-back: 48px 0 0; }
|
|
806
|
+
.fd-form-panel[data-side="bottom"] { align-self: end; --fd-from: 0 100%; --fd-back: 0 0 48px; }
|
|
807
|
+
.fd-form-panel[data-side="end"]:dir(rtl), .fd-form-panel[data-side="start"]:dir(ltr), .fd-form-panel[data-side="left"] { --fd-from: -100% 0; --fd-back: 0 0 0 48px; }
|
|
808
|
+
.fd-form-panel:is([data-side="top"], [data-side="bottom"]) { max-width: none; height: 60%; }
|
|
809
|
+
.fd-form-panel.fd-height-short { height: 40%; }
|
|
810
|
+
.fd-form-panel.fd-height-tall { height: 85%; }
|
|
811
|
+
/* A panel opened from another: the older one steps back from its own edge, still in sight. */
|
|
812
|
+
.fd-form-panel[data-behind] { margin: var(--fd-back, 0 48px 0 0); }
|
|
813
|
+
@media (max-width: 600px) { .fd-form-dialog.fd-form-panel[data-side] { max-width: none; height: 100%; margin: 0; --fd-from: 0 100%; } .fd-form-dialog.fd-form-panel[data-side="top"] { --fd-from: 0 -100%; } }
|
|
814
|
+
@media (prefers-reduced-motion: no-preference) { .fd-form-panel { animation: fd-slide 0.25s ease-out; transition: margin 0.2s; } }
|
|
815
|
+
@keyframes fd-slide { from { translate: var(--fd-from, 100% 0); } }
|
|
816
|
+
@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } .fd-button[aria-busy="true"]::after { animation: none; } }
|
|
734
817
|
`;
|
|
735
818
|
/** Fieldia's whole stylesheet: the skins, then the layout over them, the inputs' details, the question kinds and the choices' details. */
|
|
736
|
-
export const FIELDIA_CSS = SKINS_CSS + LAYOUT_CSS + INPUTS_CSS + KINDS_CSS + CHOICES_CSS;
|
|
819
|
+
export const FIELDIA_CSS = SKINS_CSS + LAYOUT_CSS + INPUTS_CSS + KINDS_CSS + CHOICES_CSS + PARTS_CSS;
|
|
737
820
|
const STYLE_ID = 'fieldia-styles';
|
|
738
821
|
/** Add Fieldia's stylesheet to a document, once. */
|
|
739
822
|
export function installStyles(document) {
|
package/src/lib/styles.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.mjs","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"styles.mjs","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,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