@fieldia/widgets 0.9.2 → 0.10.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.
Files changed (211) hide show
  1. package/package.json +2 -2
  2. package/src/index.d.mts +2 -0
  3. package/src/index.d.ts +2 -0
  4. package/src/index.js +4 -0
  5. package/src/index.js.map +1 -1
  6. package/src/index.mjs +2 -0
  7. package/src/index.mjs.map +1 -1
  8. package/src/lib/address.d.mts +4 -0
  9. package/src/lib/address.d.ts +4 -0
  10. package/src/lib/address.js +105 -0
  11. package/src/lib/address.js.map +1 -0
  12. package/src/lib/address.mjs +100 -0
  13. package/src/lib/address.mjs.map +1 -0
  14. package/src/lib/cards.d.mts +2 -0
  15. package/src/lib/cards.d.ts +2 -0
  16. package/src/lib/cards.js +152 -0
  17. package/src/lib/cards.js.map +1 -0
  18. package/src/lib/cards.mjs +148 -0
  19. package/src/lib/cards.mjs.map +1 -0
  20. package/src/lib/choice-images.d.mts +2 -0
  21. package/src/lib/choice-images.d.ts +2 -0
  22. package/src/lib/choice-images.js +99 -0
  23. package/src/lib/choice-images.js.map +1 -0
  24. package/src/lib/choice-images.mjs +95 -0
  25. package/src/lib/choice-images.mjs.map +1 -0
  26. package/src/lib/choice-rules.d.mts +22 -0
  27. package/src/lib/choice-rules.d.ts +22 -0
  28. package/src/lib/choice-rules.js +46 -0
  29. package/src/lib/choice-rules.js.map +1 -0
  30. package/src/lib/choice-rules.mjs +41 -0
  31. package/src/lib/choice-rules.mjs.map +1 -0
  32. package/src/lib/choice-tags.d.mts +17 -0
  33. package/src/lib/choice-tags.d.ts +17 -0
  34. package/src/lib/choice-tags.js +187 -0
  35. package/src/lib/choice-tags.js.map +1 -0
  36. package/src/lib/choice-tags.mjs +182 -0
  37. package/src/lib/choice-tags.mjs.map +1 -0
  38. package/src/lib/choices-from.d.mts +8 -0
  39. package/src/lib/choices-from.d.ts +8 -0
  40. package/src/lib/choices-from.js +63 -0
  41. package/src/lib/choices-from.js.map +1 -0
  42. package/src/lib/choices-from.mjs +60 -0
  43. package/src/lib/choices-from.mjs.map +1 -0
  44. package/src/lib/display.js +4 -3
  45. package/src/lib/display.js.map +1 -1
  46. package/src/lib/display.mjs +5 -4
  47. package/src/lib/display.mjs.map +1 -1
  48. package/src/lib/extras.js +8 -4
  49. package/src/lib/extras.js.map +1 -1
  50. package/src/lib/extras.mjs +8 -4
  51. package/src/lib/extras.mjs.map +1 -1
  52. package/src/lib/files.d.mts +2 -0
  53. package/src/lib/files.d.ts +2 -0
  54. package/src/lib/files.js +180 -80
  55. package/src/lib/files.js.map +1 -1
  56. package/src/lib/files.mjs +179 -80
  57. package/src/lib/files.mjs.map +1 -1
  58. package/src/lib/focus-trap.d.mts +7 -0
  59. package/src/lib/focus-trap.d.ts +7 -0
  60. package/src/lib/focus-trap.js +26 -0
  61. package/src/lib/focus-trap.js.map +1 -0
  62. package/src/lib/focus-trap.mjs +23 -0
  63. package/src/lib/focus-trap.mjs.map +1 -0
  64. package/src/lib/icons.js +1 -0
  65. package/src/lib/icons.js.map +1 -1
  66. package/src/lib/icons.mjs +1 -0
  67. package/src/lib/icons.mjs.map +1 -1
  68. package/src/lib/kind-parts.d.mts +56 -0
  69. package/src/lib/kind-parts.d.ts +56 -0
  70. package/src/lib/kind-parts.js +121 -0
  71. package/src/lib/kind-parts.js.map +1 -0
  72. package/src/lib/kind-parts.mjs +107 -0
  73. package/src/lib/kind-parts.mjs.map +1 -0
  74. package/src/lib/labels.d.mts +80 -0
  75. package/src/lib/labels.d.ts +80 -0
  76. package/src/lib/labels.js +107 -189
  77. package/src/lib/labels.js.map +1 -1
  78. package/src/lib/labels.mjs +107 -189
  79. package/src/lib/labels.mjs.map +1 -1
  80. package/src/lib/layout-styles.d.mts +11 -0
  81. package/src/lib/layout-styles.d.ts +11 -0
  82. package/src/lib/layout-styles.js +176 -0
  83. package/src/lib/layout-styles.js.map +1 -0
  84. package/src/lib/layout-styles.mjs +173 -0
  85. package/src/lib/layout-styles.mjs.map +1 -0
  86. package/src/lib/limits.d.mts +20 -0
  87. package/src/lib/limits.d.ts +20 -0
  88. package/src/lib/limits.js +71 -0
  89. package/src/lib/limits.js.map +1 -0
  90. package/src/lib/limits.mjs +66 -0
  91. package/src/lib/limits.mjs.map +1 -0
  92. package/src/lib/line-moves.d.mts +8 -0
  93. package/src/lib/line-moves.d.ts +8 -0
  94. package/src/lib/line-moves.js +20 -0
  95. package/src/lib/line-moves.js.map +1 -0
  96. package/src/lib/line-moves.mjs +17 -0
  97. package/src/lib/line-moves.mjs.map +1 -0
  98. package/src/lib/lines.js +85 -7
  99. package/src/lib/lines.js.map +1 -1
  100. package/src/lib/lines.mjs +86 -8
  101. package/src/lib/lines.mjs.map +1 -1
  102. package/src/lib/locales/all.d.mts +8 -0
  103. package/src/lib/locales/all.d.ts +8 -0
  104. package/src/lib/locales/all.js +13 -0
  105. package/src/lib/locales/all.js.map +1 -0
  106. package/src/lib/locales/all.mjs +10 -0
  107. package/src/lib/locales/all.mjs.map +1 -0
  108. package/src/lib/locales/ar.d.mts +3 -0
  109. package/src/lib/locales/ar.d.ts +3 -0
  110. package/src/lib/locales/ar.js +104 -0
  111. package/src/lib/locales/ar.js.map +1 -0
  112. package/src/lib/locales/ar.mjs +101 -0
  113. package/src/lib/locales/ar.mjs.map +1 -0
  114. package/src/lib/locales/de.d.mts +3 -0
  115. package/src/lib/locales/de.d.ts +3 -0
  116. package/src/lib/locales/de.js +104 -0
  117. package/src/lib/locales/de.js.map +1 -0
  118. package/src/lib/locales/de.mjs +101 -0
  119. package/src/lib/locales/de.mjs.map +1 -0
  120. package/src/lib/locales/fr.d.mts +3 -0
  121. package/src/lib/locales/fr.d.ts +3 -0
  122. package/src/lib/locales/fr.js +104 -0
  123. package/src/lib/locales/fr.js.map +1 -0
  124. package/src/lib/locales/fr.mjs +101 -0
  125. package/src/lib/locales/fr.mjs.map +1 -0
  126. package/src/lib/matrix.d.mts +10 -0
  127. package/src/lib/matrix.d.ts +10 -0
  128. package/src/lib/matrix.js +86 -0
  129. package/src/lib/matrix.js.map +1 -0
  130. package/src/lib/matrix.mjs +82 -0
  131. package/src/lib/matrix.mjs.map +1 -0
  132. package/src/lib/numbers.d.mts +7 -0
  133. package/src/lib/numbers.d.ts +7 -0
  134. package/src/lib/numbers.js +15 -0
  135. package/src/lib/numbers.js.map +1 -1
  136. package/src/lib/numbers.mjs +14 -0
  137. package/src/lib/numbers.mjs.map +1 -1
  138. package/src/lib/progress.js +8 -4
  139. package/src/lib/progress.js.map +1 -1
  140. package/src/lib/progress.mjs +8 -4
  141. package/src/lib/progress.mjs.map +1 -1
  142. package/src/lib/ranking.d.mts +2 -0
  143. package/src/lib/ranking.d.ts +2 -0
  144. package/src/lib/ranking.js +172 -0
  145. package/src/lib/ranking.js.map +1 -0
  146. package/src/lib/ranking.mjs +168 -0
  147. package/src/lib/ranking.mjs.map +1 -0
  148. package/src/lib/relations.d.mts +1 -1
  149. package/src/lib/relations.d.ts +1 -1
  150. package/src/lib/relations.js +43 -18
  151. package/src/lib/relations.js.map +1 -1
  152. package/src/lib/relations.mjs +43 -18
  153. package/src/lib/relations.mjs.map +1 -1
  154. package/src/lib/shuffle.d.mts +7 -0
  155. package/src/lib/shuffle.d.ts +7 -0
  156. package/src/lib/shuffle.js +60 -0
  157. package/src/lib/shuffle.js.map +1 -0
  158. package/src/lib/shuffle.mjs +57 -0
  159. package/src/lib/shuffle.mjs.map +1 -0
  160. package/src/lib/signature.d.mts +2 -0
  161. package/src/lib/signature.d.ts +2 -0
  162. package/src/lib/signature.js +223 -0
  163. package/src/lib/signature.js.map +1 -0
  164. package/src/lib/signature.mjs +219 -0
  165. package/src/lib/signature.mjs.map +1 -0
  166. package/src/lib/slider.d.mts +10 -0
  167. package/src/lib/slider.d.ts +10 -0
  168. package/src/lib/slider.js +57 -0
  169. package/src/lib/slider.js.map +1 -0
  170. package/src/lib/slider.mjs +53 -0
  171. package/src/lib/slider.mjs.map +1 -0
  172. package/src/lib/styles-choices.d.mts +7 -0
  173. package/src/lib/styles-choices.d.ts +7 -0
  174. package/src/lib/styles-choices.js +47 -0
  175. package/src/lib/styles-choices.js.map +1 -0
  176. package/src/lib/styles-choices.mjs +44 -0
  177. package/src/lib/styles-choices.mjs.map +1 -0
  178. package/src/lib/styles-inputs.d.mts +9 -0
  179. package/src/lib/styles-inputs.d.ts +9 -0
  180. package/src/lib/styles-inputs.js +41 -0
  181. package/src/lib/styles-inputs.js.map +1 -0
  182. package/src/lib/styles-inputs.mjs +38 -0
  183. package/src/lib/styles-inputs.mjs.map +1 -0
  184. package/src/lib/styles-kinds.d.mts +7 -0
  185. package/src/lib/styles-kinds.d.ts +7 -0
  186. package/src/lib/styles-kinds.js +119 -0
  187. package/src/lib/styles-kinds.js.map +1 -0
  188. package/src/lib/styles-kinds.mjs +116 -0
  189. package/src/lib/styles-kinds.mjs.map +1 -0
  190. package/src/lib/styles.d.mts +2 -14
  191. package/src/lib/styles.d.ts +2 -14
  192. package/src/lib/styles.js +172 -60
  193. package/src/lib/styles.js.map +1 -1
  194. package/src/lib/styles.mjs +172 -60
  195. package/src/lib/styles.mjs.map +1 -1
  196. package/src/lib/units.d.mts +10 -0
  197. package/src/lib/units.d.ts +10 -0
  198. package/src/lib/units.js +19 -0
  199. package/src/lib/units.js.map +1 -0
  200. package/src/lib/units.mjs +16 -0
  201. package/src/lib/units.mjs.map +1 -0
  202. package/src/lib/widgets.js +215 -57
  203. package/src/lib/widgets.js.map +1 -1
  204. package/src/lib/widgets.mjs +215 -57
  205. package/src/lib/widgets.mjs.map +1 -1
  206. package/src/lib/yes-no.d.mts +9 -0
  207. package/src/lib/yes-no.d.ts +9 -0
  208. package/src/lib/yes-no.js +58 -0
  209. package/src/lib/yes-no.js.map +1 -0
  210. package/src/lib/yes-no.mjs +54 -0
  211. package/src/lib/yes-no.mjs.map +1 -0
@@ -1,3 +1,6 @@
1
+ import { KINDS_CSS } from './styles-kinds.mjs';
2
+ import { CHOICES_CSS } from './styles-choices.mjs';
3
+ import { INPUTS_CSS } from './styles-inputs.mjs';
1
4
  /**
2
5
  * Fieldia's stylesheet: two skins and the layout chrome, all scoped to the
3
6
  * form's own root (`.fd-form[data-fd-skin=…]`), so two forms on one page can
@@ -11,12 +14,15 @@
11
14
  * Written with logical properties (inline/block, start/end), so a right-to-left
12
15
  * form mirrors without a second stylesheet.
13
16
  */
14
- export const FIELDIA_CSS = /* css */ `
15
- /* .fd-theme carries the same tokens for things outside a form, such as a dialog over the page. */
16
- .fd-form, .fd-theme {
17
+ import { LAYOUT_CSS } from './layout-styles.mjs';
18
+ /** The skins and the parts' chrome. One literal, so the script bundle can minify it as CSS. */
19
+ const SKINS_CSS = /* css */ `
20
+ /* .fd-theme carries the same tokens for things outside a form, such as a dialog over the page. One inside a form
21
+ with no skin of its own (the conversation beside a record) wears the form's skin and scheme instead. */
22
+ .fd-form, .fd-theme:is([data-fd-skin], :not(.fd-form *)) {
17
23
  --fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;
18
24
  --fd-text: #212529;
19
- --fd-muted: #6b7280;
25
+ --fd-muted: #636976;
20
26
  --fd-page: #f2f3f5;
21
27
  --fd-surface: #ffffff;
22
28
  --fd-border: #cfd4da;
@@ -49,17 +55,18 @@ export const FIELDIA_CSS = /* css */ `
49
55
  color: var(--fd-text);
50
56
  -webkit-text-size-adjust: 100%;
51
57
  }
58
+ /* Ant Design's blue and red, a shade darker: words in them read at 4.5:1 (WCAG AA) on white, the page and their soft shades. */
52
59
  .fd-form[data-fd-skin="outlined"], .fd-theme[data-fd-skin="outlined"] {
53
60
  --fd-text: rgba(0, 0, 0, 0.88);
54
61
  --fd-muted: rgba(0, 0, 0, 0.55);
55
62
  --fd-page: #f5f5f5;
56
63
  --fd-border: #d9d9d9;
57
64
  --fd-border-strong: #bfbfbf;
58
- --fd-accent: #1677ff;
65
+ --fd-accent: #1365d9;
59
66
  --fd-accent-soft: #e6f4ff;
60
- --fd-focus: #1677ff;
67
+ --fd-focus: #1365d9;
61
68
  --fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, 0.12);
62
- --fd-error: #ff4d4f;
69
+ --fd-error: #c63c3d;
63
70
  --fd-error-soft: #fff2f0;
64
71
  --fd-radius: 8px;
65
72
  --fd-control-radius: 6px;
@@ -92,13 +99,19 @@ export const FIELDIA_CSS = /* css */ `
92
99
  .fd-section-title .fd-icon { color: var(--fd-muted); }
93
100
 
94
101
  /* ---- fields ---------------------------------------------------------------- */
102
+ /* A grid of parts. --fd-cols is how many columns it has at the width it has now: the
103
+ rules for narrower widths change only that, and each part spans its --fd-span of them, never more. */
95
104
  .fd-grid {
105
+ --fd-cols: var(--fd-columns, 1);
106
+ /* A group that spans columns does not hand its width down to the parts inside it. */
107
+ --fd-span: 1;
96
108
  display: grid;
97
- grid-template-columns: repeat(var(--fd-columns, 1), minmax(0, 1fr));
109
+ grid-template-columns: repeat(var(--fd-cols), minmax(0, 1fr));
98
110
  gap: var(--fd-gap-y) var(--fd-gap-x);
99
111
  align-items: start;
100
112
  }
101
- .fd-field { display: grid; gap: 4px; min-width: 0; grid-column: span min(var(--fd-span, 1), var(--fd-columns, 1)); }
113
+ .fd-grid > * { grid-column: span min(var(--fd-span, 1), var(--fd-cols)); }
114
+ .fd-field { display: grid; gap: 4px; min-width: 0; }
102
115
  .fd-label { font-weight: var(--fd-label-weight); color: var(--fd-text); }
103
116
  /* The ✓ of a field filled in right, by its label. */
104
117
  .fd-valid-mark { color: var(--fd-success); width: 1em; height: 1em; margin-inline-start: 6px; vertical-align: -0.15em; stroke-width: 2.4; }
@@ -106,43 +119,51 @@ export const FIELDIA_CSS = /* css */ `
106
119
  .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::after { content: ""; }
107
120
  .fd-form[data-fd-skin="outlined"] .fd-field.fd-required > .fd-label::before { content: "* "; color: var(--fd-error); }
108
121
  .fd-help { color: var(--fd-muted); font-size: 12.5px; }
122
+ /*
123
+ * A page's words run the way they are written — a sentence left in English on
124
+ * an Arabic page keeps its full stop at its end — and line up with the form.
125
+ * Titles with an icon keep their words apart instead, in a <bdi>.
126
+ */
127
+ .fd-page-title, .fd-page-description, .fd-section-description, .fd-label, .fd-help, .fd-text-heading, .fd-text-paragraph, .fd-text-note, .fd-choice > span {
128
+ unicode-bidi: plaintext; text-align: match-parent; text-align: -webkit-match-parent;
129
+ }
109
130
  .fd-error { color: var(--fd-error); font-size: 12.5px; }
110
131
  .fd-warning {
111
132
  color: var(--fd-warning); background: var(--fd-warning-soft); font-size: 12.5px;
112
133
  padding: 3px 8px; border-radius: var(--fd-control-radius); justify-self: start;
113
134
  }
114
135
 
115
- /* underline: label beside the value, the way a Flectra sheet reads */
116
- .fd-form[data-fd-skin="underline"] .fd-field {
136
+ /* underline: label beside the value, the way a Flectra sheet reads. A field whose page or group
137
+ says where its label goes (data-labels) is laid out by those rules instead, in either skin. */
138
+ .fd-form[data-fd-skin="underline"] .fd-field:where(:not([data-labels])) {
117
139
  /* One label width for every field, so a field spanning two columns lines up with its neighbours. */
118
140
  grid-template-columns: var(--fd-label-width, 11em) minmax(0, 1fr);
119
141
  column-gap: 12px;
120
142
  align-items: baseline;
121
143
  }
122
- .fd-form[data-fd-skin="underline"] .fd-field > .fd-label { grid-column: 1; }
144
+ .fd-form[data-fd-skin="underline"] .fd-field:where(:not([data-labels])) > .fd-label { grid-column: 1; }
123
145
  /* A table of lines needs the full width: its label sits above it. */
124
146
  .fd-form[data-fd-skin="underline"] .fd-field[data-type="one2many"] { grid-template-columns: minmax(0, 1fr); }
125
147
  .fd-form[data-fd-skin="underline"] .fd-field[data-type="one2many"] > * { grid-column: 1 !important; }
126
- .fd-form[data-fd-skin="underline"] .fd-field > :not(.fd-label) { grid-column: 2; }
148
+ .fd-form[data-fd-skin="underline"] .fd-field:where(:not([data-labels])) > :not(.fd-label) { grid-column: 2; }
127
149
  /* A label beside every value needs room twice over: the underline skin stacks its columns sooner. */
128
150
  @container (max-width: 760px) {
129
- .fd-form[data-fd-skin="underline"] .fd-grid { grid-template-columns: minmax(0, 1fr); }
130
- .fd-form[data-fd-skin="underline"] .fd-field { grid-column: auto; }
151
+ .fd-form[data-fd-skin="underline"] .fd-grid { --fd-cols: 1; }
131
152
  /* A section that says how many columns it keeps here keeps them, in either skin. */
132
- .fd-form .fd-grid[data-columns-medium] { grid-template-columns: repeat(var(--fd-columns-medium), minmax(0, 1fr)); }
133
- .fd-form .fd-grid[data-columns-medium] > .fd-field { grid-column: span min(var(--fd-span, 1), var(--fd-columns-medium)); }
153
+ .fd-form .fd-grid[data-columns-medium] { --fd-cols: var(--fd-columns-medium); }
134
154
  /* Kept side by side here, the underline skin's fields have no room for a label beside: it goes above. */
135
- .fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field { grid-template-columns: minmax(0, 1fr); }
136
- .fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field > * { grid-column: 1 !important; }
155
+ .fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])) { grid-template-columns: minmax(0, 1fr); }
156
+ .fd-form[data-fd-skin="underline"] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])) > * { grid-column: 1 !important; }
137
157
  }
138
158
  @container (max-width: 520px) {
139
- .fd-grid { grid-template-columns: minmax(0, 1fr); }
140
- .fd-field { grid-column: auto; }
141
- .fd-form[data-fd-skin="underline"] .fd-field { grid-template-columns: minmax(0, 1fr); }
142
- .fd-form[data-fd-skin="underline"] .fd-field > * { grid-column: 1 !important; }
159
+ .fd-grid { --fd-cols: 1; }
160
+ .fd-form[data-fd-skin="underline"] .fd-field:where(:not([data-labels])) { grid-template-columns: minmax(0, 1fr); }
161
+ .fd-form[data-fd-skin="underline"] .fd-field:where(:not([data-labels])) > * { grid-column: 1 !important; }
143
162
  /* The narrow count, or one column when only the medium one was given. */
144
- .fd-form .fd-grid[data-columns-medium], .fd-form .fd-grid[data-columns-narrow] { grid-template-columns: repeat(var(--fd-columns-narrow, 1), minmax(0, 1fr)); }
145
- .fd-form .fd-grid[data-columns-medium] > .fd-field, .fd-form .fd-grid[data-columns-narrow] > .fd-field { grid-column: span min(var(--fd-span, 1), var(--fd-columns-narrow, 1)); }
163
+ .fd-form .fd-grid[data-columns-medium], .fd-form .fd-grid[data-columns-narrow] { --fd-cols: var(--fd-columns-narrow, 1); }
164
+ /* A file open on a phone: its name and Close on a row, the tools on the next. */
165
+ .fd-form .fd-file-viewer > :first-child { padding-inline-end: 16px; }
166
+ .fd-form .fd-file-viewer h2 { flex-basis: 100%; margin-inline-end: 36px; }
146
167
  }
147
168
 
148
169
  /* ---- inputs ---------------------------------------------------------------- */
@@ -156,7 +177,7 @@ export const FIELDIA_CSS = /* css */ `
156
177
  border-width: var(--fd-input-border);
157
178
  border-radius: var(--fd-control-radius);
158
179
  padding: var(--fd-pad-y) var(--fd-pad-x);
159
- min-height: 30px;
180
+ min-height: var(--fd-control-height, 30px);
160
181
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
161
182
  }
162
183
  .fd-input::placeholder { color: var(--fd-muted); opacity: 0.8; }
@@ -201,6 +222,21 @@ export const FIELDIA_CSS = /* css */ `
201
222
  [dir="rtl"] .fd-switch:checked::after { transform: translateX(-14px); }
202
223
  .fd-choices { display: flex; flex-wrap: wrap; gap: 6px 18px; }
203
224
  .fd-choice { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
225
+ /* "Other:", with a box for an answer of one's own, a choice like the others. */
226
+ .fd-choice-other { cursor: default; flex: 1 1 260px; max-width: 420px; min-width: 0; }
227
+ .fd-choice-other-pick { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex: none; }
228
+ .fd-choice-other .fd-other-input { flex: 1; min-width: 6em; width: auto; min-height: 30px; padding-block: 2px; }
229
+ /* A scale's ends in words, under its first and last points. */
230
+ .fd-scale-box { display: inline-grid; gap: 4px; max-width: 100%; }
231
+ .fd-scale-ends { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; color: var(--fd-muted); }
232
+ /* "Clear selection", at the question's end, once a single choice that need not be answered has one; never in a table's cell. */
233
+ .fd-choices-box { display: grid; gap: 6px; min-width: 0; }
234
+ .fd-choice-clear {
235
+ justify-self: end; font: inherit; font-size: 13px; color: var(--fd-muted); background: none; border: 0;
236
+ padding: 2px 4px; border-radius: 4px; cursor: pointer;
237
+ }
238
+ .fd-choice-clear:hover { color: var(--fd-text); text-decoration: underline; text-underline-offset: 3px; }
239
+ .fd-lines-table .fd-choice-clear, .fd-grid-editor .fd-choice-clear { display: none; }
204
240
  .fd-points { display: flex; flex-wrap: wrap; gap: 6px; }
205
241
  .fd-points button {
206
242
  font: inherit; cursor: pointer; border: 1px solid var(--fd-border); background: var(--fd-surface);
@@ -215,17 +251,18 @@ export const FIELDIA_CSS = /* css */ `
215
251
 
216
252
  /* ---- pickers: many2one, many2many, reference ------------------------------ */
217
253
  .fd-combo { position: relative; display: flex; align-items: center; min-width: 0; }
218
- .fd-combo-input { padding-inline-end: 28px; }
254
+ .fd-combo-input { padding-inline-end: 30px; }
255
+ /* Its buttons are 24px each way at least: a target a finger or a shaking hand can hit (WCAG 2.5.8). */
219
256
  .fd-combo-clear {
220
- position: absolute; inset-inline-end: 4px; border: none; background: none; cursor: pointer; color: var(--fd-muted);
221
- font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 4px;
257
+ position: absolute; inset-inline-end: 3px; border: none; background: none; cursor: pointer; color: var(--fd-muted);
258
+ font-size: 16px; line-height: 1; padding: 0 4px; border-radius: 4px; min-width: 24px; min-height: 24px; display: inline-grid; place-items: center;
222
259
  }
223
260
  .fd-combo-clear:hover { color: var(--fd-text); background: var(--fd-page); }
224
261
  /* A link that can be opened has its open button beside the clear button. */
225
- .fd-combo:has(> .fd-combo-open:not([hidden])) .fd-combo-input { padding-inline-end: 52px; }
262
+ .fd-combo:has(> .fd-combo-open:not([hidden])) .fd-combo-input { padding-inline-end: 56px; }
226
263
  .fd-combo-open {
227
- position: absolute; inset-inline-end: 28px; border: none; background: none; cursor: pointer; color: var(--fd-accent);
228
- font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 4px;
264
+ position: absolute; inset-inline-end: 29px; border: none; background: none; cursor: pointer; color: var(--fd-accent);
265
+ font-size: 14px; line-height: 1; padding: 0 4px; border-radius: 4px; min-width: 24px; min-height: 24px; display: inline-grid; place-items: center;
229
266
  }
230
267
  .fd-combo-open:hover { background: var(--fd-page); }
231
268
  .fd-listbox {
@@ -243,6 +280,8 @@ export const FIELDIA_CSS = /* css */ `
243
280
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 10px; border-radius: 999px;
244
281
  background: var(--fd-accent-soft); color: var(--fd-text); font-size: 13px; line-height: 22px;
245
282
  }
283
+ button.fd-chip-label { border: none; padding: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
284
+ button.fd-chip-label:hover { text-decoration: underline; }
246
285
  .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; }
247
286
  .fd-chip-remove:hover { color: var(--fd-error); }
248
287
  .fd-tags .fd-combo { flex: 1 1 140px; }
@@ -260,6 +299,8 @@ export const FIELDIA_CSS = /* css */ `
260
299
  .fd-lines-table .fd-input { min-height: 28px; }
261
300
  /* A yes/no cell sits level with the inputs beside it. */
262
301
  .fd-lines-table td > .fd-checkbox, .fd-lines-table td > .fd-switch { margin-block-start: 6px; }
302
+ .fd-lines-table .fd-lines-grip { width: 1px; min-width: 0; padding-inline: 6px 2px; }
303
+ .fd-line-grip { display: block; margin-block-start: 7px; cursor: grab; }
263
304
  .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; }
264
305
  .fd-line-delete:hover { color: var(--fd-error); background: var(--fd-error-soft); }
265
306
  .fd-lines-totals td { padding: 8px; font-weight: 600; border-block-start: 1px solid var(--fd-border); font-variant-numeric: tabular-nums; }
@@ -272,19 +313,74 @@ export const FIELDIA_CSS = /* css */ `
272
313
  .fd-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
273
314
 
274
315
  /* ---- files, images, rich text, json ------------------------------------ */
275
- .fd-file { display: grid; gap: 8px; justify-items: start; padding: 6px 0; border-radius: var(--fd-control-radius); }
316
+ .fd-file { display: grid; gap: 8px; justify-items: start; padding: 6px 0; border-radius: var(--fd-control-radius); min-width: 0; }
276
317
  .fd-file.fd-dragging { outline: 2px dashed var(--fd-accent); outline-offset: 4px; }
277
- .fd-file-pick { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }
278
- .fd-file-chosen { display: inline-flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
279
- .fd-file-name { font-variant-numeric: tabular-nums; }
318
+ .fd-file-pick { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; cursor: pointer; }
319
+ .fd-file input:focus-visible + .fd-file-pick { outline: 2px solid var(--fd-focus); outline-offset: 2px; }
320
+ .fd-files-list .fd-file-pick { justify-self: stretch; padding: 10px 14px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius); background: var(--fd-page); }
321
+ .fd-file-pick:hover, .fd-dragging .fd-file-pick { border-color: var(--fd-accent); }
322
+ .fd-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; justify-self: stretch; min-width: 0; }
323
+ .fd-files:empty { display: none; }
324
+ .fd-file-item { position: relative; display: flex; align-items: center; gap: 2px; min-width: 0; }
325
+ .fd-file-open {
326
+ flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 5px 8px; font: inherit; color: inherit; text-align: start; cursor: pointer;
327
+ background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-control-radius);
328
+ }
329
+ .fd-file-open:hover { border-color: var(--fd-accent); }
330
+ .fd-file-thumb, .fd-file-icon { flex: none; width: 36px; height: 36px; border-radius: 3px; object-fit: cover; }
331
+ /* A page with its corner folded, its colour by kind, its extension on it. */
332
+ .fd-file-icon {
333
+ display: grid; place-items: end center; padding-block-end: 4px; font-size: 9px; font-weight: 700; color: #fff;
334
+ background: var(--fd-kind, #5b6573); clip-path: polygon(0 0, 68% 0, 100% 28%, 100% 100%, 0 100%);
335
+ }
336
+ .fd-file-icon[data-kind="pdf"] { --fd-kind: #c62828; }
337
+ .fd-file-icon[data-kind="doc"] { --fd-kind: #1f5fbf; }
338
+ .fd-file-icon[data-kind="sheet"] { --fd-kind: #1d7a3e; }
339
+ .fd-file-icon[data-kind="zip"] { --fd-kind: #8a5300; }
340
+ .fd-file-name { flex: 1; display: flex; min-width: 0; white-space: pre; }
341
+ .fd-file-name > span { overflow: hidden; text-overflow: ellipsis; }
342
+ /* A size reads in its own direction, right to left too. */
343
+ .fd-file-size { color: var(--fd-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; unicode-bidi: plaintext; }
344
+ .fd-file-remove { flex: none; width: 32px; height: 32px; border: none; border-radius: 999px; background: none; color: var(--fd-muted); font-size: 20px; line-height: 1; cursor: pointer; }
345
+ .fd-file-remove:hover { color: var(--fd-error); background: var(--fd-error-soft); }
346
+ .fd-file-confirm:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
347
+ .fd-file-note:empty { display: none; }
348
+ .fd-file-note { color: var(--fd-warning); }
349
+ /* Thumbnails: tiles in a row that wraps, the picker the last of them. */
350
+ .fd-files-thumbs { display: flex; flex-wrap: wrap; align-items: flex-start; }
351
+ .fd-files-thumbs > * { flex-basis: 100%; order: 2; }
352
+ .fd-files-thumbs > .fd-files { display: contents; }
353
+ .fd-files-thumbs .fd-file-item, .fd-image-pick { flex: none; width: 96px; height: 96px; order: 0; }
354
+ .fd-files-thumbs > .fd-file-count { order: -1; }
355
+ .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; }
357
+ .fd-files-thumbs .fd-file-name { flex: none; max-width: 100%; }
358
+ .fd-files-thumbs .fd-file-size, .fd-files-thumbs .fd-file-thumb ~ * { display: none; }
359
+ .fd-files-thumbs .fd-file-remove {
360
+ position: absolute; inset-block-start: 4px; inset-inline-end: 4px; width: 26px; height: 26px; font-size: 17px;
361
+ background: rgba(15, 20, 25, 0.62); color: #fff; opacity: 0;
362
+ }
363
+ .fd-file-item:is(:hover, :focus-within) .fd-file-remove { opacity: 1; }
280
364
  .fd-image-pick {
281
- width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);
282
- display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);
283
- }
284
- .fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }
285
- .fd-image-pick:hover { border-color: var(--fd-accent); }
286
- .fd-avatar .fd-image-pick { width: 88px; height: 88px; }
287
- .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); }
365
+ order: 1; display: grid; place-content: center; justify-items: center; gap: 2px; padding: 6px; text-align: center; font-size: 12px;
366
+ border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius); background: var(--fd-page);
367
+ }
368
+ .fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; font-size: 13px; }
369
+ /* A file open to look at: its name and tools over it, the image whole, a PDF or text filling the box. */
370
+ .fd-file-viewer { max-width: 1000px; height: min(88vh, 100%); background: var(--fd-surface); }
371
+ /* Close in the corner, beside the name however the tools wrap. */
372
+ .fd-file-viewer > :first-child { position: relative; flex-wrap: wrap; justify-content: start; gap: 6px 10px; padding-block: 8px; padding-inline-end: 52px; }
373
+ .fd-file-viewer .fd-dialog-close { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; }
374
+ .fd-file-viewer h2 { flex: 1 1 10em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
375
+ .fd-file-step { font-size: 18px; line-height: 1; min-width: 34px; }
376
+ .fd-file-viewer a { text-decoration: none; }
377
+ .fd-file-viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; background: var(--fd-page); }
378
+ .fd-file-viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
379
+ .fd-file-viewer-body :is(iframe, pre) { flex: 1; align-self: stretch; margin: 0; border: 0; background: var(--fd-surface); }
380
+ .fd-file-viewer-body pre { padding: 14px 16px; overflow: auto; font: 13px/1.5 monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
381
+ .fd-file-none { display: grid; justify-items: center; gap: 4px; padding: 24px; text-align: center; color: var(--fd-muted); }
382
+ .fd-file-none strong { color: var(--fd-text); overflow-wrap: anywhere; }
383
+ .fd-file-none .fd-file-icon { width: 64px; height: 64px; font-size: 14px; padding-block-end: 8px; }
288
384
  .fd-richtext { min-height: 96px; line-height: 1.5; overflow-wrap: anywhere; }
289
385
  .fd-richtext-box { display: grid; gap: 0; min-width: 0; }
290
386
  .fd-richtext-box > .fd-richtext { border-start-start-radius: 0; border-start-end-radius: 0; }
@@ -309,7 +405,7 @@ export const FIELDIA_CSS = /* css */ `
309
405
  .fd-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; min-height: 96px; }
310
406
 
311
407
  /* ---- sections, tabs ---------------------------------------------------- */
312
- .fd-sections { display: grid; gap: 24px; }
408
+ .fd-sections { display: grid; gap: var(--fd-gap-block, 24px); }
313
409
  .fd-section { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 14px; }
314
410
  .fd-section-title { font-size: 15px; font-weight: 650; padding: 0; margin: 0; float: inline-start; width: 100%; }
315
411
  .fd-section-title + * { clear: both; }
@@ -329,8 +425,9 @@ export const FIELDIA_CSS = /* css */ `
329
425
  }
330
426
  .fd-section-folded .fd-section-chevron { transform: rotate(-45deg); margin-block-start: 0; }
331
427
  [dir="rtl"] .fd-section-folded .fd-section-chevron { transform: rotate(135deg); }
332
- .fd-form[data-fd-skin="outlined"] .fd-sections > .fd-section {
333
- background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 20px 24px;
428
+ /* A card on the page's own ground is a box of its own: on the page, or in an arrangement, a line or tabs there (data-on-page). */
429
+ .fd-form[data-fd-skin="outlined"] :is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page]) {
430
+ background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: var(--fd-group-pad, 20px 24px);
334
431
  }
335
432
  .fd-tablist { display: flex; gap: 2px; border-block-end: 1px solid var(--fd-border); overflow-x: auto; }
336
433
  .fd-tab {
@@ -343,7 +440,7 @@ export const FIELDIA_CSS = /* css */ `
343
440
  /* ---- buttons ---------------------------------------------------------- */
344
441
  .fd-button {
345
442
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
346
- min-height: 32px; padding: 4px 14px; border-radius: var(--fd-control-radius);
443
+ min-height: var(--fd-control-height, 32px); padding: 4px 14px; border-radius: var(--fd-control-radius);
347
444
  border: 1px solid var(--fd-border); background: var(--fd-surface); color: var(--fd-text);
348
445
  }
349
446
  .fd-button:hover { border-color: var(--fd-accent); color: var(--fd-accent); }
@@ -431,18 +528,10 @@ export const FIELDIA_CSS = /* css */ `
431
528
  .fd-avatar > .fd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
432
529
  .fd-form[data-fd-skin="underline"] .fd-avatar { grid-template-columns: minmax(0, 1fr); }
433
530
  .fd-form[data-fd-skin="underline"] .fd-avatar > * { grid-column: 1 !important; }
434
- .fd-avatar .fd-image-pick {
435
- width: 120px; height: 120px; border: 1px dashed var(--fd-border-strong); border-radius: var(--fd-control-radius);
436
- display: grid; place-content: center; justify-items: center; text-align: center; padding: 8px; background: var(--fd-page);
437
- }
438
- .fd-image-pick .fd-button { border: none; background: none; color: var(--fd-accent); padding: 0; min-height: 0; }
439
- .fd-image-pick:hover { border-color: var(--fd-accent); }
440
- .fd-avatar .fd-image-pick { width: 88px; height: 88px; }
441
- .fd-image-preview { width: 88px; height: 88px; }
442
- .fd-avatar .fd-file-pick .fd-help { display: none; }
443
- .fd-avatar .fd-file-name { display: none; }
444
- .fd-avatar .fd-file { justify-items: center; gap: 2px; padding: 0; }
445
- .fd-avatar .fd-file-chosen { gap: 2px 8px; justify-content: center; font-size: 12.5px; }
531
+ .fd-avatar .fd-file { justify-items: center; gap: 4px 8px; padding: 0; justify-content: center; }
532
+ .fd-avatar :is(.fd-file-item, .fd-image-pick) { width: 88px; height: 88px; }
533
+ .fd-avatar :is(.fd-image-pick .fd-help, .fd-file-limits) { display: none; }
534
+ .fd-avatar .fd-button-link { flex-basis: auto; font-size: 12.5px; }
446
535
  /* The title and subtitle themselves: big, their labels only for screen readers. */
447
536
  .fd-title > .fd-field .fd-input { font-size: 24px; font-weight: 600; min-height: 40px; }
448
537
  .fd-form[data-fd-skin="underline"] .fd-title > .fd-field { grid-template-columns: minmax(0, 1fr); }
@@ -518,7 +607,9 @@ export const FIELDIA_CSS = /* css */ `
518
607
  .fd-progressbar[data-tone="warning"] .fd-progressbar-fill { background: #d97706; }
519
608
  .fd-progressbar[data-tone="danger"] .fd-progressbar-fill { background: var(--fd-error); }
520
609
  .fd-progressbar[data-tone="info"] .fd-progressbar-fill { background: var(--fd-info); }
521
- .fd-progressbar-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--fd-text); }
610
+ /* The share in words, on a chip of the surface: it reads the same over the fill and the track, in either scheme. Centred by its left edge, so it is centred right to left too. */
611
+ .fd-progressbar-text { position: absolute; inset-block: 2px; left: 50%; translate: -50% 0; display: grid; place-items: center; padding-inline: 7px; border-radius: 999px; background: var(--fd-surface); font-size: 12px; line-height: 1; font-weight: 600; color: var(--fd-text); }
612
+ .fd-progressbar-text:empty { display: none; }
522
613
  .fd-progressbar-edit { display: flex; align-items: center; gap: 12px; min-width: 0; }
523
614
  .fd-progressbar-edit > .fd-progressbar { flex: 1 1 auto; }
524
615
  .fd-progressbar-edit > .fd-input { flex: 0 0 96px; }
@@ -551,6 +642,25 @@ export const FIELDIA_CSS = /* css */ `
551
642
 
552
643
  /* ---- text, status, dialog ------------------------------------------------- */
553
644
  .fd-text-heading { font-size: 16px; font-weight: 650; margin: 0; }
645
+ /* Blocks between fields: a line across the row; empty room or a picture that spans like a field. */
646
+ /* A matrix: rows against columns; it scrolls sideways in its own box on a narrow screen. */
647
+ .fd-matrix { overflow-x: auto; max-width: 100%; }
648
+ .fd-matrix-table { border-collapse: collapse; min-width: 100%; }
649
+ .fd-matrix-table th, .fd-matrix-table td { padding: 6px 10px; text-align: center; border-bottom: 1px solid var(--fd-border); }
650
+ .fd-matrix-table thead th { font-weight: 500; font-size: 13px; color: var(--fd-muted); }
651
+ .fd-matrix-table tbody th { text-align: start; font-weight: 500; }
652
+ .fd-matrix-table input { accent-color: var(--fd-accent); width: 16px; height: 16px; margin: 0; }
653
+ .fd-divider { grid-column: 1 / -1; width: 100%; border: 0; border-top: 1px solid var(--fd-border); margin: 4px 0; }
654
+ .fd-block { min-width: 0; }
655
+ .fd-spacer { min-height: 24px; }
656
+ .fd-image { display: block; max-width: 100%; height: auto; border-radius: var(--fd-radius); }
657
+ /* A picture's width, by name or in pixels, its place in its row, its link and its caption. */
658
+ .fd-figure { display: grid; justify-items: start; gap: 6px; margin: 0; }
659
+ .fd-figure[data-align="center"] { justify-items: center; }
660
+ .fd-figure[data-align="end"] { justify-items: end; }
661
+ .fd-figure > a, .fd-figure .fd-image { width: var(--fd-image-width, auto); max-width: 100%; }
662
+ .fd-figure > a { display: block; border-radius: var(--fd-radius); }
663
+ .fd-caption { font-size: 13px; color: var(--fd-muted); }
554
664
  .fd-text-paragraph { margin: 0; }
555
665
  .fd-text-note { margin: 0; color: var(--fd-muted); font-size: 13px; }
556
666
  .fd-status { min-height: 1.4em; color: var(--fd-muted); font-size: 13px; }
@@ -622,6 +732,8 @@ export const FIELDIA_CSS = /* css */ `
622
732
  .fd-form-dialog-foot { padding: 12px 16px; border-block-start: 1px solid var(--fd-border); background: var(--fd-surface); margin: 0; }
623
733
  @media (prefers-reduced-motion: reduce) { .fd-form *, .fd-form *::before, .fd-form *::after { transition: none !important; } }
624
734
  `;
735
+ /** 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;
625
737
  const STYLE_ID = 'fieldia-styles';
626
738
  /** Add Fieldia's stylesheet to a document, once. */
627
739
  export function installStyles(document) {
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkmBpC,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"}
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;AAE7C;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,+FAA+F;AAC/F,MAAM,SAAS,GAAG,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2sB3B,CAAC;AAEF,0IAA0I;AAC1I,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,CAAC;AAEzF,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"}
@@ -0,0 +1,10 @@
1
+ import type { Locale } from '@fieldia/core';
2
+ /**
3
+ * A currency as the page's language writes it beside an amount: its symbol —
4
+ * "$", "€", "E£" — and whether it comes after the number, as in "12,50 €".
5
+ * A name that is no currency code stays as it is, before the number.
6
+ */
7
+ export declare function currencySymbol(code: string, locale: Locale): {
8
+ text: string;
9
+ after: boolean;
10
+ };
@@ -0,0 +1,10 @@
1
+ import type { Locale } from '@fieldia/core';
2
+ /**
3
+ * A currency as the page's language writes it beside an amount: its symbol —
4
+ * "$", "€", "E£" — and whether it comes after the number, as in "12,50 €".
5
+ * A name that is no currency code stays as it is, before the number.
6
+ */
7
+ export declare function currencySymbol(code: string, locale: Locale): {
8
+ text: string;
9
+ after: boolean;
10
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.currencySymbol = currencySymbol;
4
+ /**
5
+ * A currency as the page's language writes it beside an amount: its symbol —
6
+ * "$", "€", "E£" — and whether it comes after the number, as in "12,50 €".
7
+ * A name that is no currency code stays as it is, before the number.
8
+ */
9
+ function currencySymbol(code, locale) {
10
+ try {
11
+ const parts = new Intl.NumberFormat(locale, { style: 'currency', currency: code, currencyDisplay: 'narrowSymbol' }).formatToParts(1);
12
+ const at = parts.findIndex((part) => part.type === 'currency');
13
+ return { text: parts[at].value, after: at > parts.findIndex((part) => part.type === 'integer') };
14
+ }
15
+ catch {
16
+ return { text: code, after: false };
17
+ }
18
+ }
19
+ //# sourceMappingURL=units.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units.js","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/units.ts"],"names":[],"mappings":";;AAOA,wCAQC;AAbD;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,MAAc;IACzD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACrI,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,CAAC;IACnG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * A currency as the page's language writes it beside an amount: its symbol —
3
+ * "$", "€", "E£" — and whether it comes after the number, as in "12,50 €".
4
+ * A name that is no currency code stays as it is, before the number.
5
+ */
6
+ export function currencySymbol(code, locale) {
7
+ try {
8
+ const parts = new Intl.NumberFormat(locale, { style: 'currency', currency: code, currencyDisplay: 'narrowSymbol' }).formatToParts(1);
9
+ const at = parts.findIndex((part) => part.type === 'currency');
10
+ return { text: parts[at].value, after: at > parts.findIndex((part) => part.type === 'integer') };
11
+ }
12
+ catch {
13
+ return { text: code, after: false };
14
+ }
15
+ }
16
+ //# sourceMappingURL=units.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"units.mjs","sourceRoot":"","sources":["../../../../../libs/widgets/src/lib/units.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,MAAc;IACzD,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QACrI,MAAM,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAC/D,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,CAAC;IACnG,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;AACH,CAAC"}