@fieldia/widgets 0.3.0 → 0.4.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/package.json +2 -2
- package/src/index.d.mts +6 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +6 -0
- package/src/index.js.map +1 -1
- package/src/index.mjs +6 -0
- package/src/index.mjs.map +1 -1
- package/src/lib/calendar.d.mts +11 -0
- package/src/lib/calendar.d.ts +11 -0
- package/src/lib/calendar.js +242 -0
- package/src/lib/calendar.js.map +1 -0
- package/src/lib/calendar.mjs +238 -0
- package/src/lib/calendar.mjs.map +1 -0
- package/src/lib/display.d.mts +2 -2
- package/src/lib/display.d.ts +2 -2
- package/src/lib/display.js +5 -4
- package/src/lib/display.js.map +1 -1
- package/src/lib/display.mjs +5 -4
- package/src/lib/display.mjs.map +1 -1
- package/src/lib/extras.d.mts +3 -1
- package/src/lib/extras.d.ts +3 -1
- package/src/lib/extras.js +187 -5
- package/src/lib/extras.js.map +1 -1
- package/src/lib/extras.mjs +186 -5
- package/src/lib/extras.mjs.map +1 -1
- package/src/lib/label.d.mts +2 -0
- package/src/lib/label.d.ts +2 -0
- package/src/lib/label.js +47 -0
- package/src/lib/label.js.map +1 -0
- package/src/lib/label.mjs +43 -0
- package/src/lib/label.mjs.map +1 -0
- package/src/lib/labels.d.mts +27 -0
- package/src/lib/labels.d.ts +27 -0
- package/src/lib/labels.js +92 -0
- package/src/lib/labels.js.map +1 -1
- package/src/lib/labels.mjs +92 -0
- package/src/lib/labels.mjs.map +1 -1
- package/src/lib/lines.js +5 -3
- package/src/lib/lines.js.map +1 -1
- package/src/lib/lines.mjs +5 -3
- package/src/lib/lines.mjs.map +1 -1
- package/src/lib/numbers.d.mts +8 -0
- package/src/lib/numbers.d.ts +8 -0
- package/src/lib/numbers.js +47 -0
- package/src/lib/numbers.js.map +1 -0
- package/src/lib/numbers.mjs +43 -0
- package/src/lib/numbers.mjs.map +1 -0
- package/src/lib/progress.d.mts +2 -0
- package/src/lib/progress.d.ts +2 -0
- package/src/lib/progress.js +73 -0
- package/src/lib/progress.js.map +1 -0
- package/src/lib/progress.mjs +69 -0
- package/src/lib/progress.mjs.map +1 -0
- package/src/lib/properties.d.mts +2 -0
- package/src/lib/properties.d.ts +2 -0
- package/src/lib/properties.js +86 -0
- package/src/lib/properties.js.map +1 -0
- package/src/lib/properties.mjs +82 -0
- package/src/lib/properties.mjs.map +1 -0
- package/src/lib/relations.d.mts +7 -0
- package/src/lib/relations.d.ts +7 -0
- package/src/lib/relations.js +139 -22
- package/src/lib/relations.js.map +1 -1
- package/src/lib/relations.mjs +137 -21
- package/src/lib/relations.mjs.map +1 -1
- package/src/lib/statusbar.d.mts +2 -0
- package/src/lib/statusbar.d.ts +2 -0
- package/src/lib/statusbar.js +61 -0
- package/src/lib/statusbar.js.map +1 -0
- package/src/lib/statusbar.mjs +57 -0
- package/src/lib/statusbar.mjs.map +1 -0
- package/src/lib/styles.d.mts +1 -1
- package/src/lib/styles.d.ts +1 -1
- package/src/lib/styles.js +72 -0
- package/src/lib/styles.js.map +1 -1
- package/src/lib/styles.mjs +72 -0
- package/src/lib/styles.mjs.map +1 -1
- package/src/lib/widgets.d.mts +3 -1
- package/src/lib/widgets.d.ts +3 -1
- package/src/lib/widgets.js +57 -12
- package/src/lib/widgets.js.map +1 -1
- package/src/lib/widgets.mjs +58 -13
- package/src/lib/widgets.mjs.map +1 -1
package/src/lib/styles.d.ts
CHANGED
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
* Written with logical properties (inline/block, start/end), so a right-to-left
|
|
12
12
|
* form mirrors without a second stylesheet.
|
|
13
13
|
*/
|
|
14
|
-
export declare const FIELDIA_CSS = "\n.fd-form {\n --fd-font: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Noto Sans\", \"Noto Sans Arabic\", sans-serif;\n --fd-text: #212529;\n --fd-muted: #6b7280;\n --fd-page: #f2f3f5;\n --fd-surface: #ffffff;\n --fd-border: #cfd4da;\n --fd-border-strong: #9aa3ad;\n --fd-accent: #002855;\n --fd-accent-text: #ffffff;\n --fd-accent-soft: #e6ebf2;\n --fd-focus: #002855;\n --fd-focus-ring: none;\n --fd-error: #c62828;\n --fd-error-soft: #fdecea;\n --fd-success: #2e7d32;\n --fd-success-soft: #e8f5e9;\n --fd-warning: #8a5300;\n --fd-warning-soft: #fff4e0;\n --fd-info: #0b5cad;\n --fd-info-soft: #e7f0fb;\n --fd-radius: 0px;\n --fd-control-radius: 0px;\n --fd-pad-y: 3px;\n --fd-pad-x: 4px;\n --fd-input-border: 0 0 1px 0;\n --fd-label-weight: 600;\n --fd-gap-x: 32px;\n --fd-gap-y: 14px;\n container-type: inline-size;\n font-family: var(--fd-font);\n font-size: 14px;\n line-height: 1.45;\n color: var(--fd-text);\n -webkit-text-size-adjust: 100%;\n}\n.fd-form[data-fd-skin=\"outlined\"] {\n --fd-text: rgba(0, 0, 0, 0.88);\n --fd-muted: rgba(0, 0, 0, 0.55);\n --fd-page: #f5f5f5;\n --fd-border: #d9d9d9;\n --fd-border-strong: #bfbfbf;\n --fd-accent: #1677ff;\n --fd-accent-soft: #e6f4ff;\n --fd-focus: #1677ff;\n --fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, 0.12);\n --fd-error: #ff4d4f;\n --fd-error-soft: #fff2f0;\n --fd-radius: 8px;\n --fd-control-radius: 6px;\n --fd-pad-y: 4px;\n --fd-pad-x: 11px;\n --fd-input-border: 1px;\n --fd-label-weight: 400;\n --fd-gap-x: 24px;\n --fd-gap-y: 18px;\n}\n.fd-form *, .fd-form *::before, .fd-form *::after { box-sizing: border-box; }\n.fd-form [hidden] { display: none !important; }\n\n/* ---- page frame ---------------------------------------------------------- */\n.fd-page-head { display: grid; gap: 4px; margin-block-end: 20px; }\n.fd-page-title { font-size: 22px; font-weight: 650; margin: 0; line-height: 1.25; }\n.fd-page-description { color: var(--fd-muted); margin: 0; }\n\n/* ---- fields ---------------------------------------------------------------- */\n.fd-grid {\n display: grid;\n grid-template-columns: repeat(var(--fd-columns, 1), minmax(0, 1fr));\n gap: var(--fd-gap-y) var(--fd-gap-x);\n align-items: start;\n}\n.fd-field { display: grid; gap: 4px; min-width: 0; grid-column: span min(var(--fd-span, 1), var(--fd-columns, 1)); }\n.fd-label { font-weight: var(--fd-label-weight); color: var(--fd-text); }\n.fd-field.fd-required > .fd-label::after { content: \" *\"; color: var(--fd-error); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-field.fd-required > .fd-label::after { content: \"\"; }\n.fd-form[data-fd-skin=\"outlined\"] .fd-field.fd-required > .fd-label::before { content: \"* \"; color: var(--fd-error); }\n.fd-help { color: var(--fd-muted); font-size: 12.5px; }\n.fd-error { color: var(--fd-error); font-size: 12.5px; }\n.fd-warning {\n color: var(--fd-warning); background: var(--fd-warning-soft); font-size: 12.5px;\n padding: 3px 8px; border-radius: var(--fd-control-radius); justify-self: start;\n}\n\n/* underline: label beside the value, the way a Flectra sheet reads */\n.fd-form[data-fd-skin=\"underline\"] .fd-field {\n /* One label width for every field, so a field spanning two columns lines up with its neighbours. */\n grid-template-columns: var(--fd-label-width, 11em) minmax(0, 1fr);\n column-gap: 12px;\n align-items: baseline;\n}\n.fd-form[data-fd-skin=\"underline\"] .fd-field > .fd-label { grid-column: 1; }\n/* A table of lines needs the full width: its label sits above it. */\n.fd-form[data-fd-skin=\"underline\"] .fd-field[data-type=\"one2many\"] { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-field[data-type=\"one2many\"] > * { grid-column: 1 !important; }\n.fd-form[data-fd-skin=\"underline\"] .fd-field > :not(.fd-label) { grid-column: 2; }\n/* A label beside every value needs room twice over: the underline skin stacks its columns sooner. */\n@container (max-width: 760px) {\n .fd-form[data-fd-skin=\"underline\"] .fd-grid { grid-template-columns: minmax(0, 1fr); }\n .fd-form[data-fd-skin=\"underline\"] .fd-field { grid-column: auto; }\n}\n@container (max-width: 520px) {\n .fd-grid { grid-template-columns: minmax(0, 1fr); }\n .fd-field { grid-column: auto; }\n .fd-form[data-fd-skin=\"underline\"] .fd-field { grid-template-columns: minmax(0, 1fr); }\n .fd-form[data-fd-skin=\"underline\"] .fd-field > * { grid-column: 1 !important; }\n}\n\n/* ---- inputs ---------------------------------------------------------------- */\n.fd-input {\n width: 100%;\n min-width: 0;\n font: inherit;\n color: inherit;\n background: var(--fd-surface);\n border: solid var(--fd-border);\n border-width: var(--fd-input-border);\n border-radius: var(--fd-control-radius);\n padding: var(--fd-pad-y) var(--fd-pad-x);\n min-height: 30px;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.fd-input::placeholder { color: var(--fd-muted); opacity: 0.8; }\n.fd-input:hover { border-color: var(--fd-border-strong); }\n.fd-input:focus { outline: none; border-color: var(--fd-focus); box-shadow: var(--fd-focus-ring); }\n.fd-form[data-fd-skin=\"underline\"] .fd-input { background: transparent; }\n.fd-form[data-fd-skin=\"underline\"] .fd-input:focus { box-shadow: 0 1px 0 0 var(--fd-focus); }\n.fd-form[data-fd-skin=\"underline\"] .fd-field.fd-required .fd-input { border-color: var(--fd-accent); }\n.fd-input[readonly] { background: transparent; border-color: transparent; padding-inline: 0; }\n.fd-form[data-fd-skin=\"outlined\"] .fd-input[readonly] { background: rgba(0, 0, 0, 0.04); border-color: var(--fd-border); padding-inline: var(--fd-pad-x); color: var(--fd-muted); }\n.fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-input[aria-invalid=\"true\"]:focus { box-shadow: 0 0 0 2px rgba(255, 38, 5, 0.06); }\n.fd-textarea { resize: vertical; min-height: 64px; }\n.fd-select { appearance: auto; }\n.fd-number { display: flex; align-items: baseline; gap: 6px; }\n.fd-number-input { font-variant-numeric: tabular-nums; }\n.fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }\n.fd-pending { color: var(--fd-muted); font-style: italic; }\n.fd-pending:empty::before { content: \"\u2014\"; }\n\n.fd-checkbox, .fd-choice input { width: 16px; height: 16px; accent-color: var(--fd-accent); margin: 0; }\n.fd-switch {\n appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 999px; position: relative;\n background: var(--fd-border-strong); cursor: pointer; transition: background 0.2s ease;\n}\n.fd-switch::after {\n content: \"\"; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 16px; height: 16px;\n border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.25);\n}\n.fd-switch:checked { background: var(--fd-accent); }\n.fd-switch:checked::after { transform: translateX(14px); }\n[dir=\"rtl\"] .fd-switch:checked::after { transform: translateX(-14px); }\n.fd-choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }\n.fd-choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }\n.fd-points { display: flex; flex-wrap: wrap; gap: 6px; }\n.fd-points button {\n font: inherit; cursor: pointer; border: 1px solid var(--fd-border); background: var(--fd-surface);\n color: var(--fd-text); border-radius: var(--fd-control-radius); min-width: 34px; height: 34px; padding: 0 8px;\n}\n.fd-points button.fd-on { background: var(--fd-accent); color: var(--fd-accent-text); border-color: var(--fd-accent); }\n.fd-rating button { border: none; background: none; font-size: 24px; color: var(--fd-border-strong); padding: 0 2px; min-width: 0; }\n.fd-rating button.fd-on { background: none; color: #f5a623; }\n.fd-points button:disabled, .fd-choice input:disabled { cursor: default; }\n.fd-form :focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; }\n.fd-form .fd-input:focus-visible { outline: none; }\n\n/* ---- pickers: many2one, many2many, reference ------------------------------ */\n.fd-combo { position: relative; display: flex; align-items: center; min-width: 0; }\n.fd-combo-input { padding-inline-end: 28px; }\n.fd-combo-clear {\n position: absolute; inset-inline-end: 4px; border: none; background: none; cursor: pointer; color: var(--fd-muted);\n font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px;\n}\n.fd-combo-clear:hover { color: var(--fd-text); background: var(--fd-page); }\n.fd-listbox {\n position: absolute; inset-inline: 0; inset-block-start: calc(100% + 2px); z-index: 20; margin: 0; padding: 4px 0;\n list-style: none; background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 4px);\n box-shadow: 0 8px 24px rgba(15, 20, 25, 0.12); max-height: 240px; overflow-y: auto;\n}\n.fd-option { padding: 6px 12px; cursor: pointer; }\n.fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }\n.fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }\n.fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }\n.fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }\n.fd-chip {\n display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; border-radius: 999px;\n background: var(--fd-accent-soft); color: var(--fd-text); font-size: 13px; line-height: 22px;\n}\n.fd-chip-remove { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 999px; }\n.fd-chip-remove:hover { color: var(--fd-error); }\n.fd-tags .fd-combo { flex: 1 1 140px; }\n.fd-reference { display: grid; grid-template-columns: minmax(7em, 34%) minmax(0, 1fr); gap: 8px; }\n\n/* ---- one2many lines ------------------------------------------------------- */\n.fd-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }\n/* The table scrolls sideways inside its own box; the grid around it must not grow to the table's width. */\n/* position: relative keeps the cells' hidden labels inside the scroll box; without it they widen the page. */\n.fd-lines-scroll { overflow-x: auto; min-width: 0; position: relative; }\n.fd-lines-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }\n.fd-lines-table th { text-align: start; font-weight: 600; color: var(--fd-muted); font-size: 12.5px; padding: 6px 8px; border-block-end: 1px solid var(--fd-border); white-space: nowrap; }\n.fd-lines-table td { padding: 4px 8px; border-block-end: 1px solid var(--fd-border); vertical-align: top; min-width: 7em; }\n.fd-lines-table td.fd-lines-tools, .fd-lines-table th.fd-lines-tools { width: 32px; min-width: 32px; padding-inline: 0; text-align: center; }\n.fd-lines-table .fd-input { min-height: 28px; }\n/* A yes/no cell sits level with the inputs beside it. */\n.fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }\n.fd-line-delete { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px; }\n.fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }\n.fd-lines-totals td { padding: 8px; font-weight: 600; border-block-start: 1px solid var(--fd-border); font-variant-numeric: tabular-nums; }\n.fd-lines-adds { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-self: start; }\n/* A section heads the lines below it; a note reads as a remark between them. */\n.fd-line-section td { background: var(--fd-page); }\n.fd-line-section .fd-input { font-weight: 600; }\n.fd-line-note .fd-input { font-style: italic; }\n.fd-cell-error { color: var(--fd-error); font-size: 12px; }\n.fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n/* ---- files, images, rich text, json ------------------------------------ */\n.fd-file { display: grid; gap: 8px; justify-items: start; padding: 6px 0; border-radius: var(--fd-control-radius); }\n.fd-file.fd-dragging { outline: 2px dashed var(--fd-accent); outline-offset: 4px; }\n.fd-file-pick { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }\n.fd-file-chosen { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }\n.fd-file-name { font-variant-numeric: tabular-nums; }\n.fd-image-pick {\n width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);\n display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);\n}\n.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }\n.fd-image-pick:hover { border-color: var(--fd-accent); }\n.fd-avatar .fd-image-pick { width: 88px; height: 88px; }\n.fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }\n.fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }\n.fd-richtext[contenteditable=\"false\"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }\n.fd-richtext p { margin: 0 0 6px; }\n.fd-code { font-family: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }\n\n/* ---- sections, tabs ---------------------------------------------------- */\n.fd-sections { display: grid; gap: 24px; }\n.fd-section { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }\n.fd-section-title { font-size: 15px; font-weight: 650; padding: 0; margin: 0; float: inline-start; width: 100%; }\n.fd-section-title + * { clear: both; }\n.fd-form[data-fd-skin=\"underline\"] .fd-section-title {\n text-transform: uppercase; letter-spacing: 0.05em; font-size: 12.5px; color: var(--fd-muted);\n border-block-end: 1px solid var(--fd-border); padding-block-end: 6px; width: 100%;\n}\n.fd-section-description { color: var(--fd-muted); margin: 0; }\n.fd-section-toggle {\n font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;\n display: inline-flex; align-items: center; gap: 8px; text-align: start;\n}\n.fd-section-toggle:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 2px; }\n.fd-section-chevron {\n width: 0.5em; height: 0.5em; border: solid currentColor; border-width: 0 2px 2px 0;\n transform: rotate(45deg); margin-block-start: -0.2em; transition: transform 0.15s ease; flex: none;\n}\n.fd-section-folded .fd-section-chevron { transform: rotate(-45deg); margin-block-start: 0; }\n[dir=\"rtl\"] .fd-section-folded .fd-section-chevron { transform: rotate(135deg); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-sections > .fd-section {\n background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;\n}\n.fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }\n.fd-tab {\n font: inherit; background: none; border: none; cursor: pointer; padding: 8px 14px; color: var(--fd-muted);\n border-block-end: 2px solid transparent; margin-block-end: -1px; white-space: nowrap;\n}\n.fd-tab[aria-selected=\"true\"] { color: var(--fd-accent); border-block-end-color: var(--fd-accent); font-weight: 600; }\n.fd-tabpanel { padding-block: 16px; display: grid; gap: 16px; }\n\n/* ---- buttons ---------------------------------------------------------- */\n.fd-button {\n font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center;\n min-height: 32px; padding: 4px 14px; border-radius: var(--fd-control-radius);\n border: 1px solid var(--fd-border); background: var(--fd-surface); color: var(--fd-text);\n}\n.fd-button:hover { border-color: var(--fd-accent); color: var(--fd-accent); }\n.fd-button-primary { background: var(--fd-accent); border-color: var(--fd-accent); color: var(--fd-accent-text); }\n.fd-button-primary:hover { color: var(--fd-accent-text); filter: brightness(1.12); }\n.fd-button-danger { color: var(--fd-error); border-color: var(--fd-error); }\n.fd-button-danger:hover { background: var(--fd-error); color: #fff; }\n.fd-button-link { border-color: transparent; background: none; color: var(--fd-accent); padding-inline: 4px; }\n.fd-form[data-fd-skin=\"underline\"] .fd-button { border-radius: 3px; }\n.fd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }\n.fd-actions-end { justify-content: flex-end; margin-block-start: 24px; }\n\n/* ---- record sheet --------------------------------------------------------- */\n.fd-sheet-page { background: var(--fd-page); padding: 0 0 32px; min-width: 0; }\n.fd-header {\n display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;\n background: var(--fd-surface); border-block-end: 1px solid var(--fd-border); padding: 8px 16px;\n}\n.fd-statusbar { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; }\n.fd-statusbar li { display: flex; }\n.fd-statusbar button, .fd-statusbar span {\n font: inherit; font-size: 13px; border: none; background: var(--fd-page); color: var(--fd-muted);\n padding: 5px 18px 5px 22px; margin-inline-start: -6px; white-space: nowrap;\n clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);\n}\n.fd-statusbar li:first-child button, .fd-statusbar li:first-child span { margin-inline-start: 0; padding-inline-start: 14px;\n clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }\n.fd-statusbar button { cursor: pointer; }\n.fd-statusbar [aria-current=\"step\"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }\n[dir=\"rtl\"] .fd-statusbar button, [dir=\"rtl\"] .fd-statusbar span { transform: scaleX(-1); }\n[dir=\"rtl\"] .fd-statusbar button > *, [dir=\"rtl\"] .fd-statusbar span > * { display: inline-block; transform: scaleX(-1); }\n.fd-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1180px; margin: 16px auto 0; padding-inline: 16px; }\n.fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }\n@container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }\n.fd-card {\n position: relative; background: var(--fd-surface); border: 1px solid var(--fd-border);\n border-radius: var(--fd-radius); padding: 24px 28px 28px; display: grid; gap: 18px; min-width: 0;\n}\n.fd-ribbon-frame { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }\n.fd-ribbon {\n position: absolute; inset-block-start: 18px; inset-inline-end: -42px; transform: rotate(45deg); width: 160px;\n text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: #fff; background: var(--fd-muted);\n text-transform: uppercase; letter-spacing: 0.06em; pointer-events: none;\n}\n[dir=\"rtl\"] .fd-ribbon { transform: rotate(-45deg); }\n.fd-ribbon.fd-tone-danger { background: var(--fd-error); }\n.fd-ribbon.fd-tone-success { background: var(--fd-success); }\n.fd-ribbon.fd-tone-warning { background: #d97706; }\n.fd-ribbon.fd-tone-info { background: var(--fd-info); }\n.fd-alert { padding: 10px 14px; border-radius: var(--fd-control-radius); border: 1px solid; font-size: 13.5px; }\n.fd-alert.fd-tone-warning { background: var(--fd-warning-soft); border-color: #f0c47a; color: var(--fd-warning); }\n.fd-alert.fd-tone-danger { background: var(--fd-error-soft); border-color: #f1a7a7; color: var(--fd-error); }\n.fd-alert.fd-tone-success { background: var(--fd-success-soft); border-color: #a7d7ab; color: var(--fd-success); }\n.fd-alert.fd-tone-info, .fd-alert:not([class*=\"fd-tone-\"]) { background: var(--fd-info-soft); border-color: #a9c8ef; color: var(--fd-info); }\n.fd-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0; margin: -24px -28px 0; border-block-end: 1px solid var(--fd-border); }\n.fd-stats:empty { display: none; }\n/* A visible ribbon owns the corner: stat buttons keep clear of it. */\n.fd-card:has(> .fd-ribbon-frame > .fd-ribbon:not([hidden])) .fd-stats { padding-inline-end: 104px; }\n.fd-stat {\n font: inherit; background: none; border: none; border-inline-start: 1px solid var(--fd-border); cursor: pointer;\n padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;\n}\n.fd-stat:hover { background: var(--fd-page); }\n.fd-stat-value { font-weight: 700; font-size: 15px; color: var(--fd-accent); font-variant-numeric: tabular-nums; }\n.fd-stat-label { font-size: 12.5px; color: var(--fd-muted); }\n.fd-title-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }\n.fd-title { display: grid; gap: 4px; flex: 1 1 auto; min-width: 0; }\n.fd-avatar { flex: none; }\n.fd-avatar > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.fd-form[data-fd-skin=\"underline\"] .fd-avatar { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-avatar > * { grid-column: 1 !important; }\n.fd-avatar .fd-image-pick {\n width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);\n display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);\n}\n.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }\n.fd-image-pick:hover { border-color: var(--fd-accent); }\n.fd-avatar .fd-image-pick { width: 88px; height: 88px; }\n.fd-image-preview { width: 88px; height: 88px; }\n.fd-avatar .fd-file-pick .fd-help { display: none; }\n.fd-avatar .fd-file-name { display: none; }\n.fd-avatar .fd-file { justify-items: center; gap: 2px; padding: 0; }\n.fd-avatar .fd-file-chosen { gap: 2px 8px; justify-content: center; font-size: 12.5px; }\n.fd-title .fd-input { font-size: 24px; font-weight: 600; min-height: 40px; }\n.fd-form[data-fd-skin=\"underline\"] .fd-title .fd-field { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-title .fd-field > * { grid-column: 1; }\n.fd-title .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.fd-side { display: grid; gap: 12px; align-content: start; min-width: 0; }\n\n/* ---- wizard -------------------------------------------------------------- */\n.fd-wizard { display: grid; gap: 20px; }\n.fd-progress { display: grid; gap: 8px; }\n.fd-progress-text { color: var(--fd-muted); font-size: 13px; }\n.fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }\n.fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }\n.fd-step { display: grid; gap: 18px; }\n.fd-step-title { font-size: 18px; font-weight: 650; margin: 0; }\n.fd-wizard-nav { display: flex; gap: 8px; justify-content: space-between; }\n.fd-wizard-nav .fd-spacer { flex: 1; }\n\n/* ---- text, status, dialog ------------------------------------------------- */\n.fd-text-heading { font-size: 16px; font-weight: 650; margin: 0; }\n.fd-text-paragraph { margin: 0; }\n.fd-text-note { margin: 0; color: var(--fd-muted); font-size: 13px; }\n.fd-status { min-height: 1.4em; color: var(--fd-muted); font-size: 13px; }\n.fd-status.fd-status-error { color: var(--fd-error); }\n.fd-status.fd-status-saved { color: var(--fd-success); }\n.fd-draft { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; margin-block-end: 16px;\n background: var(--fd-info-soft); border: 1px solid #a9c8ef; border-radius: var(--fd-control-radius); }\n.fd-done { padding: 40px 0; text-align: center; display: grid; gap: 12px; justify-items: center; }\n.fd-done-title { font-size: 20px; font-weight: 650; margin: 0; }\n.fd-dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); display: grid; place-items: center; z-index: 1000; padding: 16px; }\n.fd-dialog {\n background: var(--fd-surface); color: var(--fd-text); border-radius: max(var(--fd-radius), 6px); max-width: 420px; width: 100%;\n padding: 20px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-family: var(--fd-font);\n}\n.fd-dialog p { margin: 0; }\n@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }\n";
|
|
14
|
+
export declare const FIELDIA_CSS = "\n.fd-form {\n --fd-font: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Noto Sans\", \"Noto Sans Arabic\", sans-serif;\n --fd-text: #212529;\n --fd-muted: #6b7280;\n --fd-page: #f2f3f5;\n --fd-surface: #ffffff;\n --fd-border: #cfd4da;\n --fd-border-strong: #9aa3ad;\n --fd-accent: #002855;\n --fd-accent-text: #ffffff;\n --fd-accent-soft: #e6ebf2;\n --fd-focus: #002855;\n --fd-focus-ring: none;\n --fd-error: #c62828;\n --fd-error-soft: #fdecea;\n --fd-success: #2e7d32;\n --fd-success-soft: #e8f5e9;\n --fd-warning: #8a5300;\n --fd-warning-soft: #fff4e0;\n --fd-info: #0b5cad;\n --fd-info-soft: #e7f0fb;\n --fd-radius: 0px;\n --fd-control-radius: 0px;\n --fd-pad-y: 3px;\n --fd-pad-x: 4px;\n --fd-input-border: 0 0 1px 0;\n --fd-label-weight: 600;\n --fd-gap-x: 32px;\n --fd-gap-y: 14px;\n container-type: inline-size;\n font-family: var(--fd-font);\n font-size: 14px;\n line-height: 1.45;\n color: var(--fd-text);\n -webkit-text-size-adjust: 100%;\n}\n.fd-form[data-fd-skin=\"outlined\"] {\n --fd-text: rgba(0, 0, 0, 0.88);\n --fd-muted: rgba(0, 0, 0, 0.55);\n --fd-page: #f5f5f5;\n --fd-border: #d9d9d9;\n --fd-border-strong: #bfbfbf;\n --fd-accent: #1677ff;\n --fd-accent-soft: #e6f4ff;\n --fd-focus: #1677ff;\n --fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, 0.12);\n --fd-error: #ff4d4f;\n --fd-error-soft: #fff2f0;\n --fd-radius: 8px;\n --fd-control-radius: 6px;\n --fd-pad-y: 4px;\n --fd-pad-x: 11px;\n --fd-input-border: 1px;\n --fd-label-weight: 400;\n --fd-gap-x: 24px;\n --fd-gap-y: 18px;\n}\n.fd-form *, .fd-form *::before, .fd-form *::after { box-sizing: border-box; }\n.fd-form [hidden] { display: none !important; }\n\n/* ---- page frame ---------------------------------------------------------- */\n.fd-page-head { display: grid; gap: 4px; margin-block-end: 20px; }\n.fd-page-title { font-size: 22px; font-weight: 650; margin: 0; line-height: 1.25; }\n.fd-page-description { color: var(--fd-muted); margin: 0; }\n\n/* ---- fields ---------------------------------------------------------------- */\n.fd-grid {\n display: grid;\n grid-template-columns: repeat(var(--fd-columns, 1), minmax(0, 1fr));\n gap: var(--fd-gap-y) var(--fd-gap-x);\n align-items: start;\n}\n.fd-field { display: grid; gap: 4px; min-width: 0; grid-column: span min(var(--fd-span, 1), var(--fd-columns, 1)); }\n.fd-label { font-weight: var(--fd-label-weight); color: var(--fd-text); }\n.fd-field.fd-required > .fd-label::after { content: \" *\"; color: var(--fd-error); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-field.fd-required > .fd-label::after { content: \"\"; }\n.fd-form[data-fd-skin=\"outlined\"] .fd-field.fd-required > .fd-label::before { content: \"* \"; color: var(--fd-error); }\n.fd-help { color: var(--fd-muted); font-size: 12.5px; }\n.fd-error { color: var(--fd-error); font-size: 12.5px; }\n.fd-warning {\n color: var(--fd-warning); background: var(--fd-warning-soft); font-size: 12.5px;\n padding: 3px 8px; border-radius: var(--fd-control-radius); justify-self: start;\n}\n\n/* underline: label beside the value, the way a Flectra sheet reads */\n.fd-form[data-fd-skin=\"underline\"] .fd-field {\n /* One label width for every field, so a field spanning two columns lines up with its neighbours. */\n grid-template-columns: var(--fd-label-width, 11em) minmax(0, 1fr);\n column-gap: 12px;\n align-items: baseline;\n}\n.fd-form[data-fd-skin=\"underline\"] .fd-field > .fd-label { grid-column: 1; }\n/* A table of lines needs the full width: its label sits above it. */\n.fd-form[data-fd-skin=\"underline\"] .fd-field[data-type=\"one2many\"] { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-field[data-type=\"one2many\"] > * { grid-column: 1 !important; }\n.fd-form[data-fd-skin=\"underline\"] .fd-field > :not(.fd-label) { grid-column: 2; }\n/* A label beside every value needs room twice over: the underline skin stacks its columns sooner. */\n@container (max-width: 760px) {\n .fd-form[data-fd-skin=\"underline\"] .fd-grid { grid-template-columns: minmax(0, 1fr); }\n .fd-form[data-fd-skin=\"underline\"] .fd-field { grid-column: auto; }\n}\n@container (max-width: 520px) {\n .fd-grid { grid-template-columns: minmax(0, 1fr); }\n .fd-field { grid-column: auto; }\n .fd-form[data-fd-skin=\"underline\"] .fd-field { grid-template-columns: minmax(0, 1fr); }\n .fd-form[data-fd-skin=\"underline\"] .fd-field > * { grid-column: 1 !important; }\n}\n\n/* ---- inputs ---------------------------------------------------------------- */\n.fd-input {\n width: 100%;\n min-width: 0;\n font: inherit;\n color: inherit;\n background: var(--fd-surface);\n border: solid var(--fd-border);\n border-width: var(--fd-input-border);\n border-radius: var(--fd-control-radius);\n padding: var(--fd-pad-y) var(--fd-pad-x);\n min-height: 30px;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.fd-input::placeholder { color: var(--fd-muted); opacity: 0.8; }\n.fd-input:hover { border-color: var(--fd-border-strong); }\n.fd-input:focus { outline: none; border-color: var(--fd-focus); box-shadow: var(--fd-focus-ring); }\n.fd-form[data-fd-skin=\"underline\"] .fd-input { background: transparent; }\n.fd-form[data-fd-skin=\"underline\"] .fd-input:focus { box-shadow: 0 1px 0 0 var(--fd-focus); }\n.fd-form[data-fd-skin=\"underline\"] .fd-field.fd-required .fd-input { border-color: var(--fd-accent); }\n.fd-input[readonly] { background: transparent; border-color: transparent; padding-inline: 0; }\n.fd-form[data-fd-skin=\"outlined\"] .fd-input[readonly] { background: rgba(0, 0, 0, 0.04); border-color: var(--fd-border); padding-inline: var(--fd-pad-x); color: var(--fd-muted); }\n.fd-input[aria-invalid=\"true\"] { border-color: var(--fd-error); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-input[aria-invalid=\"true\"]:focus { box-shadow: 0 0 0 2px rgba(255, 38, 5, 0.06); }\n.fd-textarea { resize: vertical; min-height: 64px; }\n.fd-select { appearance: auto; }\n.fd-number { display: flex; align-items: baseline; gap: 6px; }\n.fd-number-input { font-variant-numeric: tabular-nums; }\n.fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }\n/* With the currency after it, the amount ends right beside it. */\n.fd-currency-after > .fd-number-input { text-align: end; }\n/* A picked currency is a small box of its own beside the amount. */\n.fd-currency-picked { align-items: center; }\n.fd-currency-picked > :not(.fd-number-input) { flex: 0 0 104px; min-width: 0; }\n.fd-currency-picked > .fd-number-input { flex: 1 1 auto; min-width: 0; }\n.fd-pending { color: var(--fd-muted); font-style: italic; }\n.fd-pending:empty::before { content: \"\u2014\"; }\n\n.fd-checkbox, .fd-choice input { width: 16px; height: 16px; accent-color: var(--fd-accent); margin: 0; }\n.fd-switch {\n appearance: none; width: 34px; height: 20px; margin: 0; border-radius: 999px; position: relative;\n background: var(--fd-border-strong); cursor: pointer; transition: background 0.2s ease;\n}\n.fd-switch::after {\n content: \"\"; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; width: 16px; height: 16px;\n border-radius: 50%; background: #fff; transition: transform 0.2s ease; box-shadow: 0 1px 2px rgba(0,0,0,0.25);\n}\n.fd-switch:checked { background: var(--fd-accent); }\n.fd-switch:checked::after { transform: translateX(14px); }\n[dir=\"rtl\"] .fd-switch:checked::after { transform: translateX(-14px); }\n.fd-choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }\n.fd-choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }\n.fd-points { display: flex; flex-wrap: wrap; gap: 6px; }\n.fd-points button {\n font: inherit; cursor: pointer; border: 1px solid var(--fd-border); background: var(--fd-surface);\n color: var(--fd-text); border-radius: var(--fd-control-radius); min-width: 34px; height: 34px; padding: 0 8px;\n}\n.fd-points button.fd-on { background: var(--fd-accent); color: var(--fd-accent-text); border-color: var(--fd-accent); }\n.fd-rating button { border: none; background: none; font-size: 24px; color: var(--fd-border-strong); padding: 0 2px; min-width: 0; }\n.fd-rating button.fd-on { background: none; color: #f5a623; }\n.fd-points button:disabled, .fd-choice input:disabled { cursor: default; }\n.fd-form :focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; }\n.fd-form .fd-input:focus-visible { outline: none; }\n\n/* ---- pickers: many2one, many2many, reference ------------------------------ */\n.fd-combo { position: relative; display: flex; align-items: center; min-width: 0; }\n.fd-combo-input { padding-inline-end: 28px; }\n.fd-combo-clear {\n position: absolute; inset-inline-end: 4px; border: none; background: none; cursor: pointer; color: var(--fd-muted);\n font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px;\n}\n.fd-combo-clear:hover { color: var(--fd-text); background: var(--fd-page); }\n.fd-listbox {\n position: absolute; inset-inline: 0; inset-block-start: calc(100% + 2px); z-index: 20; margin: 0; padding: 4px 0;\n list-style: none; background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 4px);\n box-shadow: 0 8px 24px rgba(15, 20, 25, 0.12); max-height: 240px; overflow-y: auto;\n}\n.fd-option { padding: 6px 12px; cursor: pointer; }\n.fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }\n.fd-option-create { color: var(--fd-accent); border-block-start: 1px solid var(--fd-border); }\n.fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }\n.fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }\n.fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }\n.fd-chip {\n display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; border-radius: 999px;\n background: var(--fd-accent-soft); color: var(--fd-text); font-size: 13px; line-height: 22px;\n}\n.fd-chip-remove { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 999px; }\n.fd-chip-remove:hover { color: var(--fd-error); }\n.fd-tags .fd-combo { flex: 1 1 140px; }\n.fd-reference { display: grid; grid-template-columns: minmax(7em, 34%) minmax(0, 1fr); gap: 8px; }\n\n/* ---- one2many lines ------------------------------------------------------- */\n.fd-lines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }\n/* The table scrolls sideways inside its own box; the grid around it must not grow to the table's width. */\n/* position: relative keeps the cells' hidden labels inside the scroll box; without it they widen the page. */\n.fd-lines-scroll { overflow-x: auto; min-width: 0; position: relative; }\n.fd-lines-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }\n.fd-lines-table th { text-align: start; font-weight: 600; color: var(--fd-muted); font-size: 12.5px; padding: 6px 8px; border-block-end: 1px solid var(--fd-border); white-space: nowrap; }\n.fd-lines-table td { padding: 4px 8px; border-block-end: 1px solid var(--fd-border); vertical-align: top; min-width: 7em; }\n.fd-lines-table td.fd-lines-tools, .fd-lines-table th.fd-lines-tools { width: 32px; min-width: 32px; padding-inline: 0; text-align: center; }\n.fd-lines-table .fd-input { min-height: 28px; }\n/* A yes/no cell sits level with the inputs beside it. */\n.fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }\n.fd-line-delete { border: none; background: none; cursor: pointer; color: var(--fd-muted); font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 4px; }\n.fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }\n.fd-lines-totals td { padding: 8px; font-weight: 600; border-block-start: 1px solid var(--fd-border); font-variant-numeric: tabular-nums; }\n.fd-lines-adds { display: flex; flex-wrap: wrap; gap: 4px 16px; justify-self: start; }\n/* A section heads the lines below it; a note reads as a remark between them. */\n.fd-line-section td { background: var(--fd-page); }\n.fd-line-section .fd-input { font-weight: 600; }\n.fd-line-note .fd-input { font-style: italic; }\n.fd-cell-error { color: var(--fd-error); font-size: 12px; }\n.fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n/* ---- files, images, rich text, json ------------------------------------ */\n.fd-file { display: grid; gap: 8px; justify-items: start; padding: 6px 0; border-radius: var(--fd-control-radius); }\n.fd-file.fd-dragging { outline: 2px dashed var(--fd-accent); outline-offset: 4px; }\n.fd-file-pick { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }\n.fd-file-chosen { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }\n.fd-file-name { font-variant-numeric: tabular-nums; }\n.fd-image-pick {\n width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);\n display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);\n}\n.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }\n.fd-image-pick:hover { border-color: var(--fd-accent); }\n.fd-avatar .fd-image-pick { width: 88px; height: 88px; }\n.fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }\n.fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }\n.fd-richtext-box { display: grid; gap: 0; min-width: 0; }\n.fd-richtext-box > .fd-richtext { border-start-start-radius: 0; border-start-end-radius: 0; }\n.fd-richtext-bar {\n display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; min-width: 0;\n border: 1px solid var(--fd-border); border-block-end: none; border-start-start-radius: var(--fd-control-radius); border-start-end-radius: var(--fd-control-radius);\n background: var(--fd-page);\n}\n.fd-richtext-style { font: inherit; font-size: 12.5px; padding: 3px 6px; margin-inline-end: 4px; border: 1px solid var(--fd-border); border-radius: 4px; background: var(--fd-surface); color: var(--fd-text); }\n.fd-richtext-tool {\n display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 4px;\n background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 14px;\n}\n.fd-richtext-tool:hover { background: var(--fd-surface); }\n.fd-richtext-tool[aria-pressed=\"true\"] { background: var(--fd-accent-soft); color: var(--fd-accent); }\n.fd-richtext-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }\n.fd-richtext-tool svg circle { fill: currentColor; stroke: none; }\n.fd-link-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--fd-border); border-block-end: none; background: var(--fd-surface); }\n.fd-link-row > .fd-input { flex: 1 1 200px; min-width: 0; }\n.fd-richtext[contenteditable=\"false\"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }\n.fd-richtext p { margin: 0 0 6px; }\n.fd-code { font-family: ui-monospace, \"SF Mono\", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }\n\n/* ---- sections, tabs ---------------------------------------------------- */\n.fd-sections { display: grid; gap: 24px; }\n.fd-section { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }\n.fd-section-title { font-size: 15px; font-weight: 650; padding: 0; margin: 0; float: inline-start; width: 100%; }\n.fd-section-title + * { clear: both; }\n.fd-form[data-fd-skin=\"underline\"] .fd-section-title {\n text-transform: uppercase; letter-spacing: 0.05em; font-size: 12.5px; color: var(--fd-muted);\n border-block-end: 1px solid var(--fd-border); padding-block-end: 6px; width: 100%;\n}\n.fd-section-description { color: var(--fd-muted); margin: 0; }\n.fd-section-toggle {\n font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer;\n display: inline-flex; align-items: center; gap: 8px; text-align: start;\n}\n.fd-section-toggle:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 2px; border-radius: 2px; }\n.fd-section-chevron {\n width: 0.5em; height: 0.5em; border: solid currentColor; border-width: 0 2px 2px 0;\n transform: rotate(45deg); margin-block-start: -0.2em; transition: transform 0.15s ease; flex: none;\n}\n.fd-section-folded .fd-section-chevron { transform: rotate(-45deg); margin-block-start: 0; }\n[dir=\"rtl\"] .fd-section-folded .fd-section-chevron { transform: rotate(135deg); }\n.fd-form[data-fd-skin=\"outlined\"] .fd-sections > .fd-section {\n background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;\n}\n.fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }\n.fd-tab {\n font: inherit; background: none; border: none; cursor: pointer; padding: 8px 14px; color: var(--fd-muted);\n border-block-end: 2px solid transparent; margin-block-end: -1px; white-space: nowrap;\n}\n.fd-tab[aria-selected=\"true\"] { color: var(--fd-accent); border-block-end-color: var(--fd-accent); font-weight: 600; }\n.fd-tabpanel { padding-block: 16px; display: grid; gap: 16px; }\n\n/* ---- buttons ---------------------------------------------------------- */\n.fd-button {\n font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center;\n min-height: 32px; padding: 4px 14px; border-radius: var(--fd-control-radius);\n border: 1px solid var(--fd-border); background: var(--fd-surface); color: var(--fd-text);\n}\n.fd-button:hover { border-color: var(--fd-accent); color: var(--fd-accent); }\n.fd-button-primary { background: var(--fd-accent); border-color: var(--fd-accent); color: var(--fd-accent-text); }\n.fd-button-primary:hover { color: var(--fd-accent-text); filter: brightness(1.12); }\n.fd-button-danger { color: var(--fd-error); border-color: var(--fd-error); }\n.fd-button-danger:hover { background: var(--fd-error); color: #fff; }\n.fd-button-link { border-color: transparent; background: none; color: var(--fd-accent); padding-inline: 4px; }\n.fd-form[data-fd-skin=\"underline\"] .fd-button { border-radius: 3px; }\n.fd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }\n.fd-actions-end { justify-content: flex-end; margin-block-start: 24px; }\n\n/* ---- record sheet --------------------------------------------------------- */\n.fd-sheet-page { background: var(--fd-page); padding: 0 0 32px; min-width: 0; }\n.fd-header {\n display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between;\n background: var(--fd-surface); border-block-end: 1px solid var(--fd-border); padding: 8px 16px;\n}\n.fd-statusbar { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; }\n.fd-statusbar li { display: flex; }\n.fd-statusbar button, .fd-statusbar span {\n font: inherit; font-size: 13px; border: none; background: var(--fd-page); color: var(--fd-muted);\n padding: 5px 18px 5px 22px; margin-inline-start: -6px; white-space: nowrap;\n clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);\n}\n.fd-statusbar li:first-child button, .fd-statusbar li:first-child span { margin-inline-start: 0; padding-inline-start: 14px;\n clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }\n.fd-statusbar button { cursor: pointer; }\n.fd-statusbar [aria-current=\"step\"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }\n[dir=\"rtl\"] .fd-statusbar button, [dir=\"rtl\"] .fd-statusbar span { transform: scaleX(-1); }\n[dir=\"rtl\"] .fd-statusbar button > *, [dir=\"rtl\"] .fd-statusbar span > * { display: inline-block; transform: scaleX(-1); }\n.fd-sheet-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 1180px; margin: 16px auto 0; padding-inline: 16px; }\n.fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); }\n@container (max-width: 860px) { .fd-sheet-layout.fd-has-side { grid-template-columns: minmax(0, 1fr); } }\n.fd-card {\n position: relative; background: var(--fd-surface); border: 1px solid var(--fd-border);\n border-radius: var(--fd-radius); padding: 24px 28px 28px; display: grid; gap: 18px; min-width: 0;\n}\n.fd-ribbon-frame { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }\n.fd-ribbon {\n position: absolute; inset-block-start: 18px; inset-inline-end: -42px; transform: rotate(45deg); width: 160px;\n text-align: center; font-size: 12px; font-weight: 700; padding: 4px 0; color: #fff; background: var(--fd-muted);\n text-transform: uppercase; letter-spacing: 0.06em; pointer-events: none;\n}\n[dir=\"rtl\"] .fd-ribbon { transform: rotate(-45deg); }\n.fd-ribbon.fd-tone-danger { background: var(--fd-error); }\n.fd-ribbon.fd-tone-success { background: var(--fd-success); }\n.fd-ribbon.fd-tone-warning { background: #d97706; }\n.fd-ribbon.fd-tone-info { background: var(--fd-info); }\n.fd-alert { padding: 10px 14px; border-radius: var(--fd-control-radius); border: 1px solid; font-size: 13.5px; }\n.fd-alert.fd-tone-warning { background: var(--fd-warning-soft); border-color: #f0c47a; color: var(--fd-warning); }\n.fd-alert.fd-tone-danger { background: var(--fd-error-soft); border-color: #f1a7a7; color: var(--fd-error); }\n.fd-alert.fd-tone-success { background: var(--fd-success-soft); border-color: #a7d7ab; color: var(--fd-success); }\n.fd-alert.fd-tone-info, .fd-alert:not([class*=\"fd-tone-\"]) { background: var(--fd-info-soft); border-color: #a9c8ef; color: var(--fd-info); }\n.fd-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0; margin: -24px -28px 0; border-block-end: 1px solid var(--fd-border); }\n.fd-stats:empty { display: none; }\n/* A visible ribbon owns the corner: stat buttons keep clear of it. */\n.fd-card:has(> .fd-ribbon-frame > .fd-ribbon:not([hidden])) .fd-stats { padding-inline-end: 104px; }\n.fd-stat {\n font: inherit; background: none; border: none; border-inline-start: 1px solid var(--fd-border); cursor: pointer;\n padding: 8px 18px; display: grid; justify-items: start; line-height: 1.2; color: var(--fd-text); min-width: 120px;\n}\n.fd-stat:hover { background: var(--fd-page); }\n.fd-stat-value { font-weight: 700; font-size: 15px; color: var(--fd-accent); font-variant-numeric: tabular-nums; }\n.fd-stat-label { font-size: 12.5px; color: var(--fd-muted); }\n.fd-title-row { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }\n.fd-title { display: grid; gap: 4px; flex: 1 1 auto; min-width: 0; }\n.fd-avatar { flex: none; }\n.fd-avatar > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.fd-form[data-fd-skin=\"underline\"] .fd-avatar { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-avatar > * { grid-column: 1 !important; }\n.fd-avatar .fd-image-pick {\n width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);\n display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);\n}\n.fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }\n.fd-image-pick:hover { border-color: var(--fd-accent); }\n.fd-avatar .fd-image-pick { width: 88px; height: 88px; }\n.fd-image-preview { width: 88px; height: 88px; }\n.fd-avatar .fd-file-pick .fd-help { display: none; }\n.fd-avatar .fd-file-name { display: none; }\n.fd-avatar .fd-file { justify-items: center; gap: 2px; padding: 0; }\n.fd-avatar .fd-file-chosen { gap: 2px 8px; justify-content: center; font-size: 12.5px; }\n.fd-title .fd-input { font-size: 24px; font-weight: 600; min-height: 40px; }\n.fd-form[data-fd-skin=\"underline\"] .fd-title .fd-field { grid-template-columns: minmax(0, 1fr); }\n.fd-form[data-fd-skin=\"underline\"] .fd-title .fd-field > * { grid-column: 1; }\n.fd-title .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n.fd-side { display: grid; gap: 12px; align-content: start; min-width: 0; }\n\n/* ---- wizard -------------------------------------------------------------- */\n.fd-wizard { display: grid; gap: 20px; }\n.fd-progress { display: grid; gap: 8px; }\n.fd-progress-text { color: var(--fd-muted); font-size: 13px; }\n.fd-value-text { display: block; padding-block: 6px; font-variant-numeric: tabular-nums; }\n.fd-date-pick { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }\n.fd-date-pick > .fd-input { flex: 1 1 auto; min-width: 0; }\n.fd-calendar-button {\n flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;\n border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-surface); color: var(--fd-muted);\n}\n.fd-calendar-button:hover, .fd-calendar-button[aria-expanded=\"true\"] { color: var(--fd-text); background: var(--fd-page); }\n.fd-calendar-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }\n.fd-calendar {\n position: absolute; inset-block-start: calc(100% + 4px); inset-inline-end: 0; z-index: 30; padding: 8px;\n background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 6px);\n box-shadow: 0 8px 24px rgba(15, 20, 25, 0.14);\n}\n.fd-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 6px; }\n.fd-calendar-head button { border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 4px; color: var(--fd-text); }\n.fd-calendar-head button:hover { background: var(--fd-page); }\n.fd-calendar-title { font-weight: 600; }\n.fd-calendar-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }\n.fd-calendar-grid th { font-size: 11.5px; font-weight: 600; color: var(--fd-muted); padding: 4px 0; width: 34px; text-align: center; }\n.fd-calendar-grid .fd-week { color: var(--fd-accent); font-weight: 600; border-inline-end: 1px solid var(--fd-border); }\n.fd-calendar-grid td { padding: 1px; }\n.fd-calendar-grid td button {\n width: 32px; height: 30px; border: none; border-radius: 4px; background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 13px;\n}\n.fd-calendar-grid td button:hover { background: var(--fd-accent-soft); }\n.fd-calendar-grid td button.fd-outside { color: var(--fd-muted); opacity: 0.6; }\n.fd-calendar-grid td button[aria-current=\"date\"] { box-shadow: inset 0 0 0 1px var(--fd-accent); }\n.fd-calendar-grid td button[aria-selected=\"true\"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }\n.fd-calendar-grid td button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }\n.fd-properties { display: grid; gap: 8px; min-width: 0; }\n.fd-property { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }\n.fd-property > label { color: var(--fd-muted); font-size: 13px; }\n.fd-property[data-type=\"boolean\"] > :last-child { justify-self: start; }\n@container (max-width: 520px) { .fd-property { grid-template-columns: minmax(0, 1fr); gap: 4px; } }\n.fd-progressbar {\n position: relative; height: 22px; min-width: 120px; border-radius: 999px; overflow: hidden;\n background: var(--fd-page); border: 1px solid var(--fd-border); font-variant-numeric: tabular-nums;\n}\n.fd-progressbar-fill { height: 100%; background: var(--fd-success); transition: width 0.2s ease; }\n.fd-progressbar[data-tone=\"warning\"] .fd-progressbar-fill { background: #d97706; }\n.fd-progressbar[data-tone=\"danger\"] .fd-progressbar-fill { background: var(--fd-error); }\n.fd-progressbar[data-tone=\"info\"] .fd-progressbar-fill { background: var(--fd-info); }\n.fd-progressbar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fd-text); }\n.fd-progressbar-edit { display: flex; align-items: center; gap: 12px; min-width: 0; }\n.fd-progressbar-edit > .fd-progressbar { flex: 1 1 auto; }\n.fd-progressbar-edit > .fd-input { flex: 0 0 96px; }\n.fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }\n.fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }\n.fd-step { display: grid; gap: 18px; }\n.fd-step-title { font-size: 18px; font-weight: 650; margin: 0; }\n.fd-wizard-nav { display: flex; gap: 8px; justify-content: space-between; }\n.fd-wizard-nav .fd-spacer { flex: 1; }\n\n/* ---- text, status, dialog ------------------------------------------------- */\n.fd-text-heading { font-size: 16px; font-weight: 650; margin: 0; }\n.fd-text-paragraph { margin: 0; }\n.fd-text-note { margin: 0; color: var(--fd-muted); font-size: 13px; }\n.fd-status { min-height: 1.4em; color: var(--fd-muted); font-size: 13px; }\n.fd-status.fd-status-error { color: var(--fd-error); }\n.fd-status.fd-status-saved { color: var(--fd-success); }\n.fd-draft { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 14px; margin-block-end: 16px;\n background: var(--fd-info-soft); border: 1px solid #a9c8ef; border-radius: var(--fd-control-radius); }\n.fd-done { padding: 40px 0; text-align: center; display: grid; gap: 12px; justify-items: center; }\n.fd-done-title { font-size: 20px; font-weight: 650; margin: 0; }\n.fd-dialog-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 25, 0.45); display: grid; place-items: center; z-index: 1000; padding: 16px; }\n.fd-dialog {\n background: var(--fd-surface); color: var(--fd-text); border-radius: max(var(--fd-radius), 6px); max-width: 420px; width: 100%;\n padding: 20px 22px; display: grid; gap: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); font-family: var(--fd-font);\n}\n.fd-dialog p { margin: 0; }\n@media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }\n";
|
|
15
15
|
/** Add Fieldia's stylesheet to a document, once. */
|
|
16
16
|
export declare function installStyles(document: Document): void;
|
package/src/lib/styles.js
CHANGED
|
@@ -153,6 +153,12 @@ exports.FIELDIA_CSS = `
|
|
|
153
153
|
.fd-number { display: flex; align-items: baseline; gap: 6px; }
|
|
154
154
|
.fd-number-input { font-variant-numeric: tabular-nums; }
|
|
155
155
|
.fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }
|
|
156
|
+
/* With the currency after it, the amount ends right beside it. */
|
|
157
|
+
.fd-currency-after > .fd-number-input { text-align: end; }
|
|
158
|
+
/* A picked currency is a small box of its own beside the amount. */
|
|
159
|
+
.fd-currency-picked { align-items: center; }
|
|
160
|
+
.fd-currency-picked > :not(.fd-number-input) { flex: 0 0 104px; min-width: 0; }
|
|
161
|
+
.fd-currency-picked > .fd-number-input { flex: 1 1 auto; min-width: 0; }
|
|
156
162
|
.fd-pending { color: var(--fd-muted); font-style: italic; }
|
|
157
163
|
.fd-pending:empty::before { content: "—"; }
|
|
158
164
|
|
|
@@ -197,6 +203,7 @@ exports.FIELDIA_CSS = `
|
|
|
197
203
|
}
|
|
198
204
|
.fd-option { padding: 6px 12px; cursor: pointer; }
|
|
199
205
|
.fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }
|
|
206
|
+
.fd-option-create { color: var(--fd-accent); border-block-start: 1px solid var(--fd-border); }
|
|
200
207
|
.fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }
|
|
201
208
|
.fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
|
|
202
209
|
.fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }
|
|
@@ -247,6 +254,24 @@ exports.FIELDIA_CSS = `
|
|
|
247
254
|
.fd-avatar .fd-image-pick { width: 88px; height: 88px; }
|
|
248
255
|
.fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }
|
|
249
256
|
.fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
257
|
+
.fd-richtext-box { display: grid; gap: 0; min-width: 0; }
|
|
258
|
+
.fd-richtext-box > .fd-richtext { border-start-start-radius: 0; border-start-end-radius: 0; }
|
|
259
|
+
.fd-richtext-bar {
|
|
260
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; min-width: 0;
|
|
261
|
+
border: 1px solid var(--fd-border); border-block-end: none; border-start-start-radius: var(--fd-control-radius); border-start-end-radius: var(--fd-control-radius);
|
|
262
|
+
background: var(--fd-page);
|
|
263
|
+
}
|
|
264
|
+
.fd-richtext-style { font: inherit; font-size: 12.5px; padding: 3px 6px; margin-inline-end: 4px; border: 1px solid var(--fd-border); border-radius: 4px; background: var(--fd-surface); color: var(--fd-text); }
|
|
265
|
+
.fd-richtext-tool {
|
|
266
|
+
display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 4px;
|
|
267
|
+
background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 14px;
|
|
268
|
+
}
|
|
269
|
+
.fd-richtext-tool:hover { background: var(--fd-surface); }
|
|
270
|
+
.fd-richtext-tool[aria-pressed="true"] { background: var(--fd-accent-soft); color: var(--fd-accent); }
|
|
271
|
+
.fd-richtext-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
|
|
272
|
+
.fd-richtext-tool svg circle { fill: currentColor; stroke: none; }
|
|
273
|
+
.fd-link-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--fd-border); border-block-end: none; background: var(--fd-surface); }
|
|
274
|
+
.fd-link-row > .fd-input { flex: 1 1 200px; min-width: 0; }
|
|
250
275
|
.fd-richtext[contenteditable="false"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }
|
|
251
276
|
.fd-richtext p { margin: 0 0 6px; }
|
|
252
277
|
.fd-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }
|
|
@@ -380,6 +405,53 @@ exports.FIELDIA_CSS = `
|
|
|
380
405
|
.fd-wizard { display: grid; gap: 20px; }
|
|
381
406
|
.fd-progress { display: grid; gap: 8px; }
|
|
382
407
|
.fd-progress-text { color: var(--fd-muted); font-size: 13px; }
|
|
408
|
+
.fd-value-text { display: block; padding-block: 6px; font-variant-numeric: tabular-nums; }
|
|
409
|
+
.fd-date-pick { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
410
|
+
.fd-date-pick > .fd-input { flex: 1 1 auto; min-width: 0; }
|
|
411
|
+
.fd-calendar-button {
|
|
412
|
+
flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
|
|
413
|
+
border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-surface); color: var(--fd-muted);
|
|
414
|
+
}
|
|
415
|
+
.fd-calendar-button:hover, .fd-calendar-button[aria-expanded="true"] { color: var(--fd-text); background: var(--fd-page); }
|
|
416
|
+
.fd-calendar-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
|
|
417
|
+
.fd-calendar {
|
|
418
|
+
position: absolute; inset-block-start: calc(100% + 4px); inset-inline-end: 0; z-index: 30; padding: 8px;
|
|
419
|
+
background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 6px);
|
|
420
|
+
box-shadow: 0 8px 24px rgba(15, 20, 25, 0.14);
|
|
421
|
+
}
|
|
422
|
+
.fd-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 6px; }
|
|
423
|
+
.fd-calendar-head button { border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 4px; color: var(--fd-text); }
|
|
424
|
+
.fd-calendar-head button:hover { background: var(--fd-page); }
|
|
425
|
+
.fd-calendar-title { font-weight: 600; }
|
|
426
|
+
.fd-calendar-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
|
427
|
+
.fd-calendar-grid th { font-size: 11.5px; font-weight: 600; color: var(--fd-muted); padding: 4px 0; width: 34px; text-align: center; }
|
|
428
|
+
.fd-calendar-grid .fd-week { color: var(--fd-accent); font-weight: 600; border-inline-end: 1px solid var(--fd-border); }
|
|
429
|
+
.fd-calendar-grid td { padding: 1px; }
|
|
430
|
+
.fd-calendar-grid td button {
|
|
431
|
+
width: 32px; height: 30px; border: none; border-radius: 4px; background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 13px;
|
|
432
|
+
}
|
|
433
|
+
.fd-calendar-grid td button:hover { background: var(--fd-accent-soft); }
|
|
434
|
+
.fd-calendar-grid td button.fd-outside { color: var(--fd-muted); opacity: 0.6; }
|
|
435
|
+
.fd-calendar-grid td button[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--fd-accent); }
|
|
436
|
+
.fd-calendar-grid td button[aria-selected="true"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
|
|
437
|
+
.fd-calendar-grid td button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
|
|
438
|
+
.fd-properties { display: grid; gap: 8px; min-width: 0; }
|
|
439
|
+
.fd-property { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
|
|
440
|
+
.fd-property > label { color: var(--fd-muted); font-size: 13px; }
|
|
441
|
+
.fd-property[data-type="boolean"] > :last-child { justify-self: start; }
|
|
442
|
+
@container (max-width: 520px) { .fd-property { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
|
|
443
|
+
.fd-progressbar {
|
|
444
|
+
position: relative; height: 22px; min-width: 120px; border-radius: 999px; overflow: hidden;
|
|
445
|
+
background: var(--fd-page); border: 1px solid var(--fd-border); font-variant-numeric: tabular-nums;
|
|
446
|
+
}
|
|
447
|
+
.fd-progressbar-fill { height: 100%; background: var(--fd-success); transition: width 0.2s ease; }
|
|
448
|
+
.fd-progressbar[data-tone="warning"] .fd-progressbar-fill { background: #d97706; }
|
|
449
|
+
.fd-progressbar[data-tone="danger"] .fd-progressbar-fill { background: var(--fd-error); }
|
|
450
|
+
.fd-progressbar[data-tone="info"] .fd-progressbar-fill { background: var(--fd-info); }
|
|
451
|
+
.fd-progressbar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fd-text); }
|
|
452
|
+
.fd-progressbar-edit { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
|
453
|
+
.fd-progressbar-edit > .fd-progressbar { flex: 1 1 auto; }
|
|
454
|
+
.fd-progressbar-edit > .fd-input { flex: 0 0 96px; }
|
|
383
455
|
.fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }
|
|
384
456
|
.fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }
|
|
385
457
|
.fd-step { display: grid; gap: 18px; }
|
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":";;;AAgeA,sCAMC;AAteD;;;;;;;;;;;;GAYG;AACU,QAAA,WAAW,GAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8cpC,CAAC;AAEF,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC,oDAAoD;AACpD,SAAgB,aAAa,CAAC,QAAkB;IAC9C,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;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
|
@@ -149,6 +149,12 @@ export const FIELDIA_CSS = /* css */ `
|
|
|
149
149
|
.fd-number { display: flex; align-items: baseline; gap: 6px; }
|
|
150
150
|
.fd-number-input { font-variant-numeric: tabular-nums; }
|
|
151
151
|
.fd-currency { color: var(--fd-muted); font-size: 12.5px; font-weight: 600; }
|
|
152
|
+
/* With the currency after it, the amount ends right beside it. */
|
|
153
|
+
.fd-currency-after > .fd-number-input { text-align: end; }
|
|
154
|
+
/* A picked currency is a small box of its own beside the amount. */
|
|
155
|
+
.fd-currency-picked { align-items: center; }
|
|
156
|
+
.fd-currency-picked > :not(.fd-number-input) { flex: 0 0 104px; min-width: 0; }
|
|
157
|
+
.fd-currency-picked > .fd-number-input { flex: 1 1 auto; min-width: 0; }
|
|
152
158
|
.fd-pending { color: var(--fd-muted); font-style: italic; }
|
|
153
159
|
.fd-pending:empty::before { content: "—"; }
|
|
154
160
|
|
|
@@ -193,6 +199,7 @@ export const FIELDIA_CSS = /* css */ `
|
|
|
193
199
|
}
|
|
194
200
|
.fd-option { padding: 6px 12px; cursor: pointer; }
|
|
195
201
|
.fd-option:hover, .fd-option.fd-active { background: var(--fd-accent-soft); }
|
|
202
|
+
.fd-option-create { color: var(--fd-accent); border-block-start: 1px solid var(--fd-border); }
|
|
196
203
|
.fd-empty { padding: 6px 12px; color: var(--fd-muted); font-style: italic; }
|
|
197
204
|
.fd-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
|
|
198
205
|
.fd-chips { display: contents; list-style: none; margin: 0; padding: 0; }
|
|
@@ -243,6 +250,24 @@ export const FIELDIA_CSS = /* css */ `
|
|
|
243
250
|
.fd-avatar .fd-image-pick { width: 88px; height: 88px; }
|
|
244
251
|
.fd-image-preview { max-width: 160px; max-height: 160px; border-radius: var(--fd-control-radius); border: 1px solid var(--fd-border); object-fit: cover; background: var(--fd-page); }
|
|
245
252
|
.fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
253
|
+
.fd-richtext-box { display: grid; gap: 0; min-width: 0; }
|
|
254
|
+
.fd-richtext-box > .fd-richtext { border-start-start-radius: 0; border-start-end-radius: 0; }
|
|
255
|
+
.fd-richtext-bar {
|
|
256
|
+
display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px; min-width: 0;
|
|
257
|
+
border: 1px solid var(--fd-border); border-block-end: none; border-start-start-radius: var(--fd-control-radius); border-start-end-radius: var(--fd-control-radius);
|
|
258
|
+
background: var(--fd-page);
|
|
259
|
+
}
|
|
260
|
+
.fd-richtext-style { font: inherit; font-size: 12.5px; padding: 3px 6px; margin-inline-end: 4px; border: 1px solid var(--fd-border); border-radius: 4px; background: var(--fd-surface); color: var(--fd-text); }
|
|
261
|
+
.fd-richtext-tool {
|
|
262
|
+
display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 4px;
|
|
263
|
+
background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 14px;
|
|
264
|
+
}
|
|
265
|
+
.fd-richtext-tool:hover { background: var(--fd-surface); }
|
|
266
|
+
.fd-richtext-tool[aria-pressed="true"] { background: var(--fd-accent-soft); color: var(--fd-accent); }
|
|
267
|
+
.fd-richtext-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
|
|
268
|
+
.fd-richtext-tool svg circle { fill: currentColor; stroke: none; }
|
|
269
|
+
.fd-link-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--fd-border); border-block-end: none; background: var(--fd-surface); }
|
|
270
|
+
.fd-link-row > .fd-input { flex: 1 1 200px; min-width: 0; }
|
|
246
271
|
.fd-richtext[contenteditable="false"] { background: transparent; border-color: transparent; padding-inline: 0; min-height: 0; }
|
|
247
272
|
.fd-richtext p { margin: 0 0 6px; }
|
|
248
273
|
.fd-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }
|
|
@@ -376,6 +401,53 @@ export const FIELDIA_CSS = /* css */ `
|
|
|
376
401
|
.fd-wizard { display: grid; gap: 20px; }
|
|
377
402
|
.fd-progress { display: grid; gap: 8px; }
|
|
378
403
|
.fd-progress-text { color: var(--fd-muted); font-size: 13px; }
|
|
404
|
+
.fd-value-text { display: block; padding-block: 6px; font-variant-numeric: tabular-nums; }
|
|
405
|
+
.fd-date-pick { position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
406
|
+
.fd-date-pick > .fd-input { flex: 1 1 auto; min-width: 0; }
|
|
407
|
+
.fd-calendar-button {
|
|
408
|
+
flex: 0 0 auto; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
|
|
409
|
+
border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius); background: var(--fd-surface); color: var(--fd-muted);
|
|
410
|
+
}
|
|
411
|
+
.fd-calendar-button:hover, .fd-calendar-button[aria-expanded="true"] { color: var(--fd-text); background: var(--fd-page); }
|
|
412
|
+
.fd-calendar-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; }
|
|
413
|
+
.fd-calendar {
|
|
414
|
+
position: absolute; inset-block-start: calc(100% + 4px); inset-inline-end: 0; z-index: 30; padding: 8px;
|
|
415
|
+
background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: max(var(--fd-control-radius), 6px);
|
|
416
|
+
box-shadow: 0 8px 24px rgba(15, 20, 25, 0.14);
|
|
417
|
+
}
|
|
418
|
+
.fd-calendar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 4px 6px; }
|
|
419
|
+
.fd-calendar-head button { border: none; background: none; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; border-radius: 4px; color: var(--fd-text); }
|
|
420
|
+
.fd-calendar-head button:hover { background: var(--fd-page); }
|
|
421
|
+
.fd-calendar-title { font-weight: 600; }
|
|
422
|
+
.fd-calendar-grid { border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
|
423
|
+
.fd-calendar-grid th { font-size: 11.5px; font-weight: 600; color: var(--fd-muted); padding: 4px 0; width: 34px; text-align: center; }
|
|
424
|
+
.fd-calendar-grid .fd-week { color: var(--fd-accent); font-weight: 600; border-inline-end: 1px solid var(--fd-border); }
|
|
425
|
+
.fd-calendar-grid td { padding: 1px; }
|
|
426
|
+
.fd-calendar-grid td button {
|
|
427
|
+
width: 32px; height: 30px; border: none; border-radius: 4px; background: none; cursor: pointer; color: var(--fd-text); font: inherit; font-size: 13px;
|
|
428
|
+
}
|
|
429
|
+
.fd-calendar-grid td button:hover { background: var(--fd-accent-soft); }
|
|
430
|
+
.fd-calendar-grid td button.fd-outside { color: var(--fd-muted); opacity: 0.6; }
|
|
431
|
+
.fd-calendar-grid td button[aria-current="date"] { box-shadow: inset 0 0 0 1px var(--fd-accent); }
|
|
432
|
+
.fd-calendar-grid td button[aria-selected="true"] { background: var(--fd-accent); color: var(--fd-accent-text); font-weight: 600; }
|
|
433
|
+
.fd-calendar-grid td button:focus-visible { outline: 2px solid var(--fd-focus); outline-offset: 1px; }
|
|
434
|
+
.fd-properties { display: grid; gap: 8px; min-width: 0; }
|
|
435
|
+
.fd-property { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
|
|
436
|
+
.fd-property > label { color: var(--fd-muted); font-size: 13px; }
|
|
437
|
+
.fd-property[data-type="boolean"] > :last-child { justify-self: start; }
|
|
438
|
+
@container (max-width: 520px) { .fd-property { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
|
|
439
|
+
.fd-progressbar {
|
|
440
|
+
position: relative; height: 22px; min-width: 120px; border-radius: 999px; overflow: hidden;
|
|
441
|
+
background: var(--fd-page); border: 1px solid var(--fd-border); font-variant-numeric: tabular-nums;
|
|
442
|
+
}
|
|
443
|
+
.fd-progressbar-fill { height: 100%; background: var(--fd-success); transition: width 0.2s ease; }
|
|
444
|
+
.fd-progressbar[data-tone="warning"] .fd-progressbar-fill { background: #d97706; }
|
|
445
|
+
.fd-progressbar[data-tone="danger"] .fd-progressbar-fill { background: var(--fd-error); }
|
|
446
|
+
.fd-progressbar[data-tone="info"] .fd-progressbar-fill { background: var(--fd-info); }
|
|
447
|
+
.fd-progressbar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fd-text); }
|
|
448
|
+
.fd-progressbar-edit { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
|
449
|
+
.fd-progressbar-edit > .fd-progressbar { flex: 1 1 auto; }
|
|
450
|
+
.fd-progressbar-edit > .fd-input { flex: 0 0 96px; }
|
|
379
451
|
.fd-progress-bar { height: 4px; background: var(--fd-border); border-radius: 999px; overflow: hidden; }
|
|
380
452
|
.fd-progress-bar > span { display: block; height: 100%; background: var(--fd-accent); transition: width 0.25s ease; }
|
|
381
453
|
.fd-step { display: grid; gap: 18px; }
|
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;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"styles.mjs","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8cpC,CAAC;AAEF,MAAM,QAAQ,GAAG,gBAAgB,CAAC;AAElC,oDAAoD;AACpD,MAAM,UAAU,aAAa,CAAC,QAAkB;IAC9C,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO;IAC9C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
package/src/lib/widgets.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Field, FieldNode, Form, Value, Values } from '@fieldia/core';
|
|
1
|
+
import type { Field, FieldNode, Form, Locale, Value, Values } from '@fieldia/core';
|
|
2
2
|
import type { PreferenceStore } from './preferences.mjs';
|
|
3
3
|
import type { WidgetLabels } from './labels.mjs';
|
|
4
4
|
/**
|
|
@@ -19,6 +19,8 @@ export interface WidgetContext {
|
|
|
19
19
|
labels?: WidgetLabels;
|
|
20
20
|
/** Where to keep a person's choices about how the widget looks, such as a table's columns. */
|
|
21
21
|
preferences?: PreferenceStore;
|
|
22
|
+
/** The page's language: numbers and dates are written as its readers write them. English when left out. */
|
|
23
|
+
locale?: Locale;
|
|
22
24
|
}
|
|
23
25
|
export interface WidgetState {
|
|
24
26
|
value: Value | undefined;
|
package/src/lib/widgets.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Field, FieldNode, Form, Value, Values } from '@fieldia/core';
|
|
1
|
+
import type { Field, FieldNode, Form, Locale, Value, Values } from '@fieldia/core';
|
|
2
2
|
import type { PreferenceStore } from './preferences';
|
|
3
3
|
import type { WidgetLabels } from './labels';
|
|
4
4
|
/**
|
|
@@ -19,6 +19,8 @@ export interface WidgetContext {
|
|
|
19
19
|
labels?: WidgetLabels;
|
|
20
20
|
/** Where to keep a person's choices about how the widget looks, such as a table's columns. */
|
|
21
21
|
preferences?: PreferenceStore;
|
|
22
|
+
/** The page's language: numbers and dates are written as its readers write them. English when left out. */
|
|
23
|
+
locale?: Locale;
|
|
22
24
|
}
|
|
23
25
|
export interface WidgetState {
|
|
24
26
|
value: Value | undefined;
|
package/src/lib/widgets.js
CHANGED
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.builtInWidgets = void 0;
|
|
4
4
|
exports.createWidget = createWidget;
|
|
5
5
|
exports.summary = summary;
|
|
6
|
+
const numbers_1 = require("./numbers");
|
|
6
7
|
const relations_1 = require("./relations");
|
|
7
8
|
const lines_1 = require("./lines");
|
|
8
9
|
const files_1 = require("./files");
|
|
10
|
+
const progress_1 = require("./progress");
|
|
11
|
+
const label_1 = require("./label");
|
|
12
|
+
const statusbar_1 = require("./statusbar");
|
|
13
|
+
const calendar_1 = require("./calendar");
|
|
14
|
+
const properties_1 = require("./properties");
|
|
9
15
|
const extras_1 = require("./extras");
|
|
10
16
|
/**
|
|
11
17
|
* Pick the widget for a field: the app's or the built-in one for
|
|
@@ -86,16 +92,23 @@ const textareaWidget = ({ form, name, field, node, id, document }) => {
|
|
|
86
92
|
};
|
|
87
93
|
const NUMBER = /^-?(\d+\.?\d*|\.\d+)$/;
|
|
88
94
|
const UNFINISHED = /^-?\.?$/;
|
|
89
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Numbers are written as readers of the page's language write them, grouped,
|
|
97
|
+
* with the field's decimals, and read back the same way. What is typed stays
|
|
98
|
+
* as typed while focused: "1." means 1 now and 1.5 a keystroke later. The box
|
|
99
|
+
* keeps its spelling when entered, so a selection made on the way in holds.
|
|
100
|
+
*/
|
|
90
101
|
const numberWidget = (context) => {
|
|
91
|
-
const { form, name, field, node, id, document } = context;
|
|
102
|
+
const { form, name, field, node, id, document, locale = 'en' } = context;
|
|
92
103
|
const integer = field.type === 'integer';
|
|
104
|
+
const decimals = integer ? 0 : (field.type === 'float' || field.type === 'monetary' ? field.digits?.[1] : undefined) ?? 2;
|
|
105
|
+
const shown = (value) => (typeof value === 'number' ? (0, numbers_1.formatNumber)(value, decimals, locale) : textOf(value));
|
|
93
106
|
const input = make(document, 'input', { id, type: 'text', class: 'fd-input fd-number-input', autocomplete: 'off' });
|
|
94
107
|
input.inputMode = integer ? 'numeric' : 'decimal';
|
|
95
108
|
if (node.placeholder)
|
|
96
109
|
input.placeholder = node.placeholder;
|
|
97
110
|
const parse = (raw) => {
|
|
98
|
-
const text = raw.trim();
|
|
111
|
+
const text = (0, numbers_1.normalizeNumber)(raw.trim(), locale);
|
|
99
112
|
if (text === '')
|
|
100
113
|
return null;
|
|
101
114
|
if (NUMBER.test(text))
|
|
@@ -110,10 +123,26 @@ const numberWidget = (context) => {
|
|
|
110
123
|
form.setValue(name, value);
|
|
111
124
|
});
|
|
112
125
|
input.addEventListener('blur', () => {
|
|
113
|
-
input.value =
|
|
126
|
+
input.value = shown(form.getState().values[name]);
|
|
114
127
|
});
|
|
115
|
-
|
|
116
|
-
|
|
128
|
+
// Money shows its currency beside the amount (options.symbol "after" puts it
|
|
129
|
+
// after), or with options.pickCurrency the currency field's own widget, to change it.
|
|
130
|
+
const options = node.options ?? {};
|
|
131
|
+
const currencyField = field.type === 'monetary' ? field.currencyField : undefined;
|
|
132
|
+
const currencyDef = currencyField ? form.page.fields[currencyField] : undefined;
|
|
133
|
+
const picker = currencyField && currencyDef && options['pickCurrency'] === true
|
|
134
|
+
? createWidget({ ...context, name: currencyField, field: currencyDef, node: { type: 'field', id: `${node.id}.currency`, field: currencyField }, id: `${id}-currency` })
|
|
135
|
+
: null;
|
|
136
|
+
if (picker && currencyDef)
|
|
137
|
+
picker.element.querySelector('input, select')?.setAttribute('aria-label', currencyDef.label);
|
|
138
|
+
if (picker?.element.matches('input, select') && currencyDef)
|
|
139
|
+
picker.element.setAttribute('aria-label', currencyDef.label);
|
|
140
|
+
const currency = field.type === 'monetary' && !picker ? make(document, 'span', { class: 'fd-currency', 'aria-hidden': 'true' }) : null;
|
|
141
|
+
const side = picker?.element ?? currency;
|
|
142
|
+
const after = options['symbol'] === 'after';
|
|
143
|
+
const element = side
|
|
144
|
+
? make(document, 'span', { class: `fd-number${after ? ' fd-currency-after' : ''}${picker ? ' fd-currency-picked' : ''}` }, ...(after ? [input, side] : [side, input]))
|
|
145
|
+
: input;
|
|
117
146
|
return {
|
|
118
147
|
element,
|
|
119
148
|
focus: () => input.focus(),
|
|
@@ -122,12 +151,15 @@ const numberWidget = (context) => {
|
|
|
122
151
|
const parsed = parse(input.value);
|
|
123
152
|
const showsSame = parsed === undefined || parsed === state.value;
|
|
124
153
|
if (!(typing && showsSame)) {
|
|
125
|
-
const text =
|
|
154
|
+
const text = shown(state.value);
|
|
126
155
|
if (input.value !== text)
|
|
127
156
|
input.value = text;
|
|
128
157
|
}
|
|
129
158
|
input.readOnly = state.readonly;
|
|
130
159
|
describe(input, state);
|
|
160
|
+
if (picker && currencyField) {
|
|
161
|
+
picker.update({ value: state.values[currencyField], values: state.values, readonly: state.readonly, required: false, invalid: false });
|
|
162
|
+
}
|
|
131
163
|
if (currency && field.type === 'monetary') {
|
|
132
164
|
const holder = field.currencyField ? state.values[field.currencyField] : null;
|
|
133
165
|
currency.textContent =
|
|
@@ -245,10 +277,11 @@ function pointsWidget(style) {
|
|
|
245
277
|
};
|
|
246
278
|
};
|
|
247
279
|
}
|
|
248
|
-
const dateWidget = (
|
|
280
|
+
const dateWidget = (context) => {
|
|
281
|
+
const { form, name, id, document, node } = context;
|
|
249
282
|
const input = make(document, 'input', { id, type: 'date', class: 'fd-input fd-date' });
|
|
250
283
|
input.addEventListener('input', () => form.setValue(name, input.value || null));
|
|
251
|
-
|
|
284
|
+
const widget = {
|
|
252
285
|
element: input,
|
|
253
286
|
focus: () => input.focus(),
|
|
254
287
|
update(state) {
|
|
@@ -259,10 +292,12 @@ const dateWidget = ({ form, name, id, document }) => {
|
|
|
259
292
|
describe(input, state);
|
|
260
293
|
},
|
|
261
294
|
};
|
|
295
|
+
return node.options?.['weekNumbers'] === true ? (0, calendar_1.withCalendar)(widget, context, 'date') : widget;
|
|
262
296
|
};
|
|
263
297
|
const pad = (n) => String(n).padStart(2, '0');
|
|
264
298
|
/** Shown in local time, stored as an ISO instant in UTC. */
|
|
265
|
-
const dateTimeWidget = (
|
|
299
|
+
const dateTimeWidget = (context) => {
|
|
300
|
+
const { form, name, id, document, node } = context;
|
|
266
301
|
const input = make(document, 'input', { id, type: 'datetime-local', class: 'fd-input fd-datetime' });
|
|
267
302
|
const local = (iso) => {
|
|
268
303
|
if (typeof iso !== 'string' || !iso)
|
|
@@ -277,7 +312,7 @@ const dateTimeWidget = ({ form, name, id, document }) => {
|
|
|
277
312
|
if (!Number.isNaN(d.getTime()))
|
|
278
313
|
form.setValue(name, d.toISOString());
|
|
279
314
|
});
|
|
280
|
-
|
|
315
|
+
const widget = {
|
|
281
316
|
element: input,
|
|
282
317
|
focus: () => input.focus(),
|
|
283
318
|
update(state) {
|
|
@@ -288,6 +323,7 @@ const dateTimeWidget = ({ form, name, id, document }) => {
|
|
|
288
323
|
describe(input, state);
|
|
289
324
|
},
|
|
290
325
|
};
|
|
326
|
+
return node.options?.['weekNumbers'] === true ? (0, calendar_1.withCalendar)(widget, context, 'datetime') : widget;
|
|
291
327
|
};
|
|
292
328
|
/** Until a type has its own editor (Phase 5), show what it holds. */
|
|
293
329
|
function pendingWidget({ field, id, document }) {
|
|
@@ -328,20 +364,29 @@ exports.builtInWidgets = {
|
|
|
328
364
|
'char.phone': textWidget('tel'),
|
|
329
365
|
'char.url': textWidget('url'),
|
|
330
366
|
'char.password': textWidget('password'),
|
|
367
|
+
'char.tags': relations_1.charTagsWidget,
|
|
331
368
|
text: textareaWidget,
|
|
332
369
|
integer: numberWidget,
|
|
333
370
|
float: numberWidget,
|
|
334
371
|
monetary: numberWidget,
|
|
335
372
|
'integer.rating': pointsWidget('rating'),
|
|
336
373
|
'integer.scale': pointsWidget('scale'),
|
|
374
|
+
'integer.progressbar': progress_1.progressbarWidget,
|
|
375
|
+
'integer.label': label_1.labelWidget,
|
|
376
|
+
'float.label': label_1.labelWidget,
|
|
377
|
+
'monetary.label': label_1.labelWidget,
|
|
378
|
+
'float.progressbar': progress_1.progressbarWidget,
|
|
379
|
+
'monetary.progressbar': progress_1.progressbarWidget,
|
|
337
380
|
boolean: checkboxWidget(),
|
|
338
381
|
'boolean.toggle': checkboxWidget('switch'),
|
|
339
382
|
selection: selectWidget,
|
|
340
383
|
'selection.radio': choiceGroup('radio'),
|
|
341
384
|
'selection.checkboxes': choiceGroup('checkbox'),
|
|
385
|
+
'selection.statusbar': statusbar_1.statusbarWidget,
|
|
342
386
|
date: dateWidget,
|
|
343
387
|
datetime: dateTimeWidget,
|
|
344
388
|
many2one: relations_1.many2oneWidget,
|
|
389
|
+
'many2one.statusbar': statusbar_1.statusbarWidget,
|
|
345
390
|
many2many: relations_1.tagsWidget,
|
|
346
391
|
'many2many.tags': relations_1.tagsWidget,
|
|
347
392
|
'many2many.checkboxes': relations_1.linkCheckboxesWidget,
|
|
@@ -351,6 +396,6 @@ exports.builtInWidgets = {
|
|
|
351
396
|
image: files_1.imageWidget,
|
|
352
397
|
html: extras_1.htmlWidget,
|
|
353
398
|
json: extras_1.jsonWidget,
|
|
354
|
-
properties:
|
|
399
|
+
properties: properties_1.propertiesWidget,
|
|
355
400
|
};
|
|
356
401
|
//# sourceMappingURL=widgets.js.map
|