@fristil/designsystem 0.2.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 (314) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/LICENSE +21 -0
  3. package/README.md +101 -0
  4. package/dist/cli.d.ts +31 -0
  5. package/dist/cli.d.ts.map +1 -0
  6. package/dist/cli.js +261 -0
  7. package/dist/cli.js.map +1 -0
  8. package/dist/components/css/accordion/accordion.d.ts +37 -0
  9. package/dist/components/css/accordion/accordion.d.ts.map +1 -0
  10. package/dist/components/css/accordion/accordion.js +31 -0
  11. package/dist/components/css/accordion/accordion.js.map +1 -0
  12. package/dist/components/css/alert/alert.d.ts +35 -0
  13. package/dist/components/css/alert/alert.d.ts.map +1 -0
  14. package/dist/components/css/alert/alert.js +29 -0
  15. package/dist/components/css/alert/alert.js.map +1 -0
  16. package/dist/components/css/avatar/avatar.d.ts +40 -0
  17. package/dist/components/css/avatar/avatar.d.ts.map +1 -0
  18. package/dist/components/css/avatar/avatar.js +30 -0
  19. package/dist/components/css/avatar/avatar.js.map +1 -0
  20. package/dist/components/css/badge/badge.d.ts +24 -0
  21. package/dist/components/css/badge/badge.d.ts.map +1 -0
  22. package/dist/components/css/badge/badge.js +24 -0
  23. package/dist/components/css/badge/badge.js.map +1 -0
  24. package/dist/components/css/breadcrumbs/breadcrumbs.d.ts +25 -0
  25. package/dist/components/css/breadcrumbs/breadcrumbs.d.ts.map +1 -0
  26. package/dist/components/css/breadcrumbs/breadcrumbs.js +23 -0
  27. package/dist/components/css/breadcrumbs/breadcrumbs.js.map +1 -0
  28. package/dist/components/css/button/button.d.ts +26 -0
  29. package/dist/components/css/button/button.d.ts.map +1 -0
  30. package/dist/components/css/button/button.js +25 -0
  31. package/dist/components/css/button/button.js.map +1 -0
  32. package/dist/components/css/card/card.d.ts +36 -0
  33. package/dist/components/css/card/card.d.ts.map +1 -0
  34. package/dist/components/css/card/card.js +28 -0
  35. package/dist/components/css/card/card.js.map +1 -0
  36. package/dist/components/css/checkbox/checkbox.d.ts +32 -0
  37. package/dist/components/css/checkbox/checkbox.d.ts.map +1 -0
  38. package/dist/components/css/checkbox/checkbox.js +27 -0
  39. package/dist/components/css/checkbox/checkbox.js.map +1 -0
  40. package/dist/components/css/dialog/dialog.d.ts +30 -0
  41. package/dist/components/css/dialog/dialog.d.ts.map +1 -0
  42. package/dist/components/css/dialog/dialog.js +28 -0
  43. package/dist/components/css/dialog/dialog.js.map +1 -0
  44. package/dist/components/css/divider/divider.d.ts +28 -0
  45. package/dist/components/css/divider/divider.d.ts.map +1 -0
  46. package/dist/components/css/divider/divider.js +22 -0
  47. package/dist/components/css/divider/divider.js.map +1 -0
  48. package/dist/components/css/error-text/error-text.d.ts +24 -0
  49. package/dist/components/css/error-text/error-text.d.ts.map +1 -0
  50. package/dist/components/css/error-text/error-text.js +18 -0
  51. package/dist/components/css/error-text/error-text.js.map +1 -0
  52. package/dist/components/css/fieldset/fieldset.d.ts +55 -0
  53. package/dist/components/css/fieldset/fieldset.d.ts.map +1 -0
  54. package/dist/components/css/fieldset/fieldset.js +39 -0
  55. package/dist/components/css/fieldset/fieldset.js.map +1 -0
  56. package/dist/components/css/file-upload/file-upload.d.ts +41 -0
  57. package/dist/components/css/file-upload/file-upload.d.ts.map +1 -0
  58. package/dist/components/css/file-upload/file-upload.js +32 -0
  59. package/dist/components/css/file-upload/file-upload.js.map +1 -0
  60. package/dist/components/css/heading/heading.d.ts +29 -0
  61. package/dist/components/css/heading/heading.d.ts.map +1 -0
  62. package/dist/components/css/heading/heading.js +23 -0
  63. package/dist/components/css/heading/heading.js.map +1 -0
  64. package/dist/components/css/help-text/help-text.d.ts +24 -0
  65. package/dist/components/css/help-text/help-text.d.ts.map +1 -0
  66. package/dist/components/css/help-text/help-text.js +23 -0
  67. package/dist/components/css/help-text/help-text.js.map +1 -0
  68. package/dist/components/css/input/input.d.ts +39 -0
  69. package/dist/components/css/input/input.d.ts.map +1 -0
  70. package/dist/components/css/input/input.js +44 -0
  71. package/dist/components/css/input/input.js.map +1 -0
  72. package/dist/components/css/label/label.d.ts +33 -0
  73. package/dist/components/css/label/label.d.ts.map +1 -0
  74. package/dist/components/css/label/label.js +23 -0
  75. package/dist/components/css/label/label.js.map +1 -0
  76. package/dist/components/css/link/link.d.ts +21 -0
  77. package/dist/components/css/link/link.d.ts.map +1 -0
  78. package/dist/components/css/link/link.js +14 -0
  79. package/dist/components/css/link/link.js.map +1 -0
  80. package/dist/components/css/list/list.d.ts +29 -0
  81. package/dist/components/css/list/list.d.ts.map +1 -0
  82. package/dist/components/css/list/list.js +23 -0
  83. package/dist/components/css/list/list.js.map +1 -0
  84. package/dist/components/css/pagination/pagination.d.ts +27 -0
  85. package/dist/components/css/pagination/pagination.d.ts.map +1 -0
  86. package/dist/components/css/pagination/pagination.js +25 -0
  87. package/dist/components/css/pagination/pagination.js.map +1 -0
  88. package/dist/components/css/paragraph/paragraph.d.ts +36 -0
  89. package/dist/components/css/paragraph/paragraph.d.ts.map +1 -0
  90. package/dist/components/css/paragraph/paragraph.js +26 -0
  91. package/dist/components/css/paragraph/paragraph.js.map +1 -0
  92. package/dist/components/css/radio/radio.d.ts +32 -0
  93. package/dist/components/css/radio/radio.d.ts.map +1 -0
  94. package/dist/components/css/radio/radio.js +27 -0
  95. package/dist/components/css/radio/radio.js.map +1 -0
  96. package/dist/components/css/search/search.d.ts +33 -0
  97. package/dist/components/css/search/search.d.ts.map +1 -0
  98. package/dist/components/css/search/search.js +31 -0
  99. package/dist/components/css/search/search.js.map +1 -0
  100. package/dist/components/css/select/select.d.ts +23 -0
  101. package/dist/components/css/select/select.d.ts.map +1 -0
  102. package/dist/components/css/select/select.js +18 -0
  103. package/dist/components/css/select/select.js.map +1 -0
  104. package/dist/components/css/shared.d.ts +26 -0
  105. package/dist/components/css/shared.d.ts.map +1 -0
  106. package/dist/components/css/shared.js +34 -0
  107. package/dist/components/css/shared.js.map +1 -0
  108. package/dist/components/css/skeleton/skeleton.d.ts +29 -0
  109. package/dist/components/css/skeleton/skeleton.d.ts.map +1 -0
  110. package/dist/components/css/skeleton/skeleton.js +23 -0
  111. package/dist/components/css/skeleton/skeleton.js.map +1 -0
  112. package/dist/components/css/skip-link/skip-link.d.ts +18 -0
  113. package/dist/components/css/skip-link/skip-link.d.ts.map +1 -0
  114. package/dist/components/css/skip-link/skip-link.js +16 -0
  115. package/dist/components/css/skip-link/skip-link.js.map +1 -0
  116. package/dist/components/css/spinner/spinner.d.ts +33 -0
  117. package/dist/components/css/spinner/spinner.d.ts.map +1 -0
  118. package/dist/components/css/spinner/spinner.js +25 -0
  119. package/dist/components/css/spinner/spinner.js.map +1 -0
  120. package/dist/components/css/sr-only/sr-only.d.ts +17 -0
  121. package/dist/components/css/sr-only/sr-only.d.ts.map +1 -0
  122. package/dist/components/css/sr-only/sr-only.js +14 -0
  123. package/dist/components/css/sr-only/sr-only.js.map +1 -0
  124. package/dist/components/css/switch/switch.d.ts +33 -0
  125. package/dist/components/css/switch/switch.d.ts.map +1 -0
  126. package/dist/components/css/switch/switch.js +29 -0
  127. package/dist/components/css/switch/switch.js.map +1 -0
  128. package/dist/components/css/table/table.d.ts +36 -0
  129. package/dist/components/css/table/table.d.ts.map +1 -0
  130. package/dist/components/css/table/table.js +28 -0
  131. package/dist/components/css/table/table.js.map +1 -0
  132. package/dist/components/css/tag/tag.d.ts +35 -0
  133. package/dist/components/css/tag/tag.d.ts.map +1 -0
  134. package/dist/components/css/tag/tag.js +27 -0
  135. package/dist/components/css/tag/tag.js.map +1 -0
  136. package/dist/components/css/textarea/textarea.d.ts +23 -0
  137. package/dist/components/css/textarea/textarea.d.ts.map +1 -0
  138. package/dist/components/css/textarea/textarea.js +18 -0
  139. package/dist/components/css/textarea/textarea.js.map +1 -0
  140. package/dist/components/css/toggle-group/toggle-group.d.ts +31 -0
  141. package/dist/components/css/toggle-group/toggle-group.d.ts.map +1 -0
  142. package/dist/components/css/toggle-group/toggle-group.js +29 -0
  143. package/dist/components/css/toggle-group/toggle-group.js.map +1 -0
  144. package/dist/components/css/tooltip/tooltip.d.ts +30 -0
  145. package/dist/components/css/tooltip/tooltip.d.ts.map +1 -0
  146. package/dist/components/css/tooltip/tooltip.js +28 -0
  147. package/dist/components/css/tooltip/tooltip.js.map +1 -0
  148. package/dist/components/frittstaende/calendar/fs-calendar.d.ts +52 -0
  149. package/dist/components/frittstaende/calendar/fs-calendar.d.ts.map +1 -0
  150. package/dist/components/frittstaende/calendar/fs-calendar.js +462 -0
  151. package/dist/components/frittstaende/calendar/fs-calendar.js.map +1 -0
  152. package/dist/components/frittstaende/date-field/fs-date-field.d.ts +110 -0
  153. package/dist/components/frittstaende/date-field/fs-date-field.d.ts.map +1 -0
  154. package/dist/components/frittstaende/date-field/fs-date-field.js +264 -0
  155. package/dist/components/frittstaende/date-field/fs-date-field.js.map +1 -0
  156. package/dist/components/frittstaende/suggestion/fs-suggestion.d.ts +133 -0
  157. package/dist/components/frittstaende/suggestion/fs-suggestion.d.ts.map +1 -0
  158. package/dist/components/frittstaende/suggestion/fs-suggestion.js +280 -0
  159. package/dist/components/frittstaende/suggestion/fs-suggestion.js.map +1 -0
  160. package/dist/components/frittstaende/toast/fs-toast.d.ts +67 -0
  161. package/dist/components/frittstaende/toast/fs-toast.d.ts.map +1 -0
  162. package/dist/components/frittstaende/toast/fs-toast.js +108 -0
  163. package/dist/components/frittstaende/toast/fs-toast.js.map +1 -0
  164. package/dist/components/ramme/error-summary/fs-error-summary.d.ts +70 -0
  165. package/dist/components/ramme/error-summary/fs-error-summary.d.ts.map +1 -0
  166. package/dist/components/ramme/error-summary/fs-error-summary.js +155 -0
  167. package/dist/components/ramme/error-summary/fs-error-summary.js.map +1 -0
  168. package/dist/components/ramme/field/field-core.d.ts +70 -0
  169. package/dist/components/ramme/field/field-core.d.ts.map +1 -0
  170. package/dist/components/ramme/field/field-core.js +60 -0
  171. package/dist/components/ramme/field/field-core.js.map +1 -0
  172. package/dist/components/ramme/field/fs-field.d.ts +49 -0
  173. package/dist/components/ramme/field/fs-field.d.ts.map +1 -0
  174. package/dist/components/ramme/field/fs-field.js +118 -0
  175. package/dist/components/ramme/field/fs-field.js.map +1 -0
  176. package/dist/components/ramme/popover/fs-popover.d.ts +68 -0
  177. package/dist/components/ramme/popover/fs-popover.d.ts.map +1 -0
  178. package/dist/components/ramme/popover/fs-popover.js +167 -0
  179. package/dist/components/ramme/popover/fs-popover.js.map +1 -0
  180. package/dist/components/ramme/tabs/fs-tabs.d.ts +61 -0
  181. package/dist/components/ramme/tabs/fs-tabs.d.ts.map +1 -0
  182. package/dist/components/ramme/tabs/fs-tabs.js +156 -0
  183. package/dist/components/ramme/tabs/fs-tabs.js.map +1 -0
  184. package/dist/dom.d.ts +33 -0
  185. package/dist/dom.d.ts.map +1 -0
  186. package/dist/dom.js +77 -0
  187. package/dist/dom.js.map +1 -0
  188. package/dist/fs.d.ts +199 -0
  189. package/dist/fs.d.ts.map +1 -0
  190. package/dist/fs.js +128 -0
  191. package/dist/fs.js.map +1 -0
  192. package/dist/index.d.ts +84 -0
  193. package/dist/index.d.ts.map +1 -0
  194. package/dist/index.js +48 -0
  195. package/dist/index.js.map +1 -0
  196. package/dist/jsx/react.d.ts +127 -0
  197. package/dist/jsx/react.d.ts.map +1 -0
  198. package/dist/jsx/react.js +2 -0
  199. package/dist/jsx/react.js.map +1 -0
  200. package/dist/react.d.ts +207 -0
  201. package/dist/react.d.ts.map +1 -0
  202. package/dist/react.js +109 -0
  203. package/dist/react.js.map +1 -0
  204. package/dist/tailwind/preset.d.ts +120 -0
  205. package/dist/tailwind/preset.d.ts.map +1 -0
  206. package/dist/tailwind/preset.js +107 -0
  207. package/dist/tailwind/preset.js.map +1 -0
  208. package/dist/takeover.d.ts +79 -0
  209. package/dist/takeover.d.ts.map +1 -0
  210. package/dist/takeover.js +119 -0
  211. package/dist/takeover.js.map +1 -0
  212. package/dist/tokens/color.d.ts +85 -0
  213. package/dist/tokens/color.d.ts.map +1 -0
  214. package/dist/tokens/color.js +212 -0
  215. package/dist/tokens/color.js.map +1 -0
  216. package/dist/tokens/theme.d.ts +52 -0
  217. package/dist/tokens/theme.d.ts.map +1 -0
  218. package/dist/tokens/theme.js +197 -0
  219. package/dist/tokens/theme.js.map +1 -0
  220. package/dist/tokens/tokens.d.ts +210 -0
  221. package/dist/tokens/tokens.d.ts.map +1 -0
  222. package/dist/tokens/tokens.js +238 -0
  223. package/dist/tokens/tokens.js.map +1 -0
  224. package/package.json +334 -0
  225. package/src/components/css/accordion/accordion.css +74 -0
  226. package/src/components/css/accordion/accordion.ts +50 -0
  227. package/src/components/css/alert/alert.css +50 -0
  228. package/src/components/css/alert/alert.ts +48 -0
  229. package/src/components/css/avatar/avatar.css +64 -0
  230. package/src/components/css/avatar/avatar.ts +57 -0
  231. package/src/components/css/badge/badge.css +42 -0
  232. package/src/components/css/badge/badge.ts +43 -0
  233. package/src/components/css/breadcrumbs/breadcrumbs.css +50 -0
  234. package/src/components/css/breadcrumbs/breadcrumbs.ts +29 -0
  235. package/src/components/css/button/button.css +101 -0
  236. package/src/components/css/button/button.ts +44 -0
  237. package/src/components/css/card/card.css +48 -0
  238. package/src/components/css/card/card.ts +50 -0
  239. package/src/components/css/checkbox/checkbox.css +96 -0
  240. package/src/components/css/checkbox/checkbox.ts +50 -0
  241. package/src/components/css/dialog/dialog.css +50 -0
  242. package/src/components/css/dialog/dialog.ts +36 -0
  243. package/src/components/css/divider/divider.css +18 -0
  244. package/src/components/css/divider/divider.ts +41 -0
  245. package/src/components/css/error-text/error-text.css +21 -0
  246. package/src/components/css/error-text/error-text.ts +37 -0
  247. package/src/components/css/fieldset/fieldset.css +57 -0
  248. package/src/components/css/fieldset/fieldset.ts +87 -0
  249. package/src/components/css/file-upload/file-upload.css +92 -0
  250. package/src/components/css/file-upload/file-upload.ts +65 -0
  251. package/src/components/css/heading/heading.css +33 -0
  252. package/src/components/css/heading/heading.ts +42 -0
  253. package/src/components/css/help-text/help-text.css +24 -0
  254. package/src/components/css/help-text/help-text.ts +42 -0
  255. package/src/components/css/input/input.css +131 -0
  256. package/src/components/css/input/input.ts +76 -0
  257. package/src/components/css/label/label.css +34 -0
  258. package/src/components/css/label/label.ts +51 -0
  259. package/src/components/css/link/link.css +36 -0
  260. package/src/components/css/link/link.ts +29 -0
  261. package/src/components/css/list/list.css +40 -0
  262. package/src/components/css/list/list.ts +42 -0
  263. package/src/components/css/pagination/pagination.css +77 -0
  264. package/src/components/css/pagination/pagination.ts +33 -0
  265. package/src/components/css/paragraph/paragraph.css +31 -0
  266. package/src/components/css/paragraph/paragraph.ts +53 -0
  267. package/src/components/css/radio/radio.css +76 -0
  268. package/src/components/css/radio/radio.ts +50 -0
  269. package/src/components/css/search/search.css +49 -0
  270. package/src/components/css/search/search.ts +52 -0
  271. package/src/components/css/select/select.css +95 -0
  272. package/src/components/css/select/select.ts +40 -0
  273. package/src/components/css/shared.ts +40 -0
  274. package/src/components/css/skeleton/skeleton.css +49 -0
  275. package/src/components/css/skeleton/skeleton.ts +43 -0
  276. package/src/components/css/skip-link/skip-link.css +36 -0
  277. package/src/components/css/skip-link/skip-link.ts +22 -0
  278. package/src/components/css/spinner/spinner.css +48 -0
  279. package/src/components/css/spinner/spinner.ts +48 -0
  280. package/src/components/css/sr-only/sr-only.css +16 -0
  281. package/src/components/css/sr-only/sr-only.ts +18 -0
  282. package/src/components/css/switch/switch.css +101 -0
  283. package/src/components/css/switch/switch.ts +46 -0
  284. package/src/components/css/table/table.css +63 -0
  285. package/src/components/css/table/table.ts +50 -0
  286. package/src/components/css/tag/tag.css +58 -0
  287. package/src/components/css/tag/tag.ts +49 -0
  288. package/src/components/css/textarea/textarea.css +71 -0
  289. package/src/components/css/textarea/textarea.ts +40 -0
  290. package/src/components/css/toggle-group/toggle-group.css +82 -0
  291. package/src/components/css/toggle-group/toggle-group.ts +37 -0
  292. package/src/components/css/tooltip/tooltip.css +47 -0
  293. package/src/components/css/tooltip/tooltip.ts +36 -0
  294. package/src/components/frittstaende/calendar/fs-calendar.ts +525 -0
  295. package/src/components/frittstaende/date-field/date-field.css +54 -0
  296. package/src/components/frittstaende/date-field/fs-date-field.ts +309 -0
  297. package/src/components/frittstaende/suggestion/fs-suggestion.ts +333 -0
  298. package/src/components/frittstaende/suggestion/suggestion.css +63 -0
  299. package/src/components/frittstaende/toast/fs-toast.ts +146 -0
  300. package/src/components/frittstaende/toast/toast.css +71 -0
  301. package/src/components/ramme/error-summary/error-summary.css +45 -0
  302. package/src/components/ramme/error-summary/fs-error-summary.ts +197 -0
  303. package/src/components/ramme/field/field-core.ts +132 -0
  304. package/src/components/ramme/field/field.css +6 -0
  305. package/src/components/ramme/field/fs-field.ts +154 -0
  306. package/src/components/ramme/popover/fs-popover.ts +205 -0
  307. package/src/components/ramme/popover/popover.css +34 -0
  308. package/src/components/ramme/tabs/fs-tabs.ts +182 -0
  309. package/src/components/ramme/tabs/tabs.css +68 -0
  310. package/src/tailwind/tailwind.css +134 -0
  311. package/src/tokens/color.ts +267 -0
  312. package/src/tokens/theme.ts +350 -0
  313. package/src/tokens/tokens.css +214 -0
  314. package/src/tokens/tokens.ts +293 -0
@@ -0,0 +1,207 @@
1
+ import { type FieldOptions } from "./components/ramme/field/field-core.js";
2
+ import { setAttributes } from "./dom.js";
3
+ /**
4
+ * Samme API som `fs`, men med `className` og `htmlFor`.
5
+ *
6
+ * Resten av systemet returnerer `class` og `for`, slik attributtene faktisk
7
+ * heter i HTML. React godtar dem, og de havner riktig i DOM-en, men
8
+ * utviklingsbygget skriver «Invalid DOM property `class`. Did you mean
9
+ * `className`?» i konsollen for hvert element. Med et helt felt blir det to
10
+ * advarsler per felt, og det er ikke en utvikleropplevelse vi kan by på.
11
+ *
12
+ * ```ts
13
+ * import { fs } from "@fristil/designsystem/react"
14
+ *
15
+ * <button {...fs.button({ variant: "secondary" })}>Lagre utkast</button>
16
+ * ```
17
+ *
18
+ * Kallstedene er identiske med resten av systemet; bare importstien er en
19
+ * annen. Dette er ren omdøping av to nøkler, så pakken får ingen
20
+ * avhengighet til React av det.
21
+ *
22
+ * Vue, Svelte, Solid og Preact tar `class` og `for` som de er. Der bruker du
23
+ * `@fristil/designsystem` direkte.
24
+ */
25
+ /** Gir nøklene navnene React forventer. */
26
+ export type ReactAttributes<T> = {
27
+ [K in keyof T as K extends "class" ? "className" : K extends "for" ? "htmlFor" : K]: T[K];
28
+ };
29
+ export declare function toReactAttributes<T extends Record<string, unknown>>(attributes: T): ReactAttributes<T>;
30
+ export declare const fs: {
31
+ readonly accordion: ((options?: import("./index.js").AccordionOptions | undefined) => ReactAttributes<import("./index.js").AccordionAttributes>) & (({ variant }?: import("./index.js").AccordionOptions) => import("./index.js").AccordionAttributes) & {
32
+ content: "fs-accordion__content";
33
+ variants: readonly ["default", "plain"];
34
+ isVariant: (value: string) => value is "default" | "plain";
35
+ };
36
+ readonly alert: ((options?: import("./index.js").AlertOptions | undefined) => ReactAttributes<import("./index.js").AlertAttributes>) & (({ color }?: import("./index.js").AlertOptions) => import("./index.js").AlertAttributes) & {
37
+ title: "fs-alert__title";
38
+ colors: readonly ["info", "success", "warning", "danger"];
39
+ isColor: (value: string) => value is "warning" | "info" | "danger" | "success";
40
+ };
41
+ readonly avatar: ((options?: import("./index.js").AvatarOptions | undefined) => ReactAttributes<import("./index.js").AvatarAttributes>) & (({ size, variant, }?: import("./index.js").AvatarOptions) => import("./index.js").AvatarAttributes) & {
42
+ stack: "fs-avatar-stack";
43
+ sizes: readonly ["small", "medium", "large"];
44
+ isSize: (value: string) => value is "small" | "medium" | "large";
45
+ variants: readonly ["circle", "square"];
46
+ isVariant: (value: string) => value is "circle" | "square";
47
+ };
48
+ readonly badge: ((options?: import("./index.js").BadgeOptions | undefined) => ReactAttributes<import("./index.js").BadgeAttributes>) & (({ color }?: import("./index.js").BadgeOptions) => import("./index.js").BadgeAttributes) & {
49
+ colors: readonly ["info", "success", "warning", "danger", "neutral"];
50
+ isColor: (value: string) => value is "warning" | "info" | "danger" | "success" | "neutral";
51
+ };
52
+ readonly breadcrumbs: ((options?: unknown) => ReactAttributes<import("./index.js").BreadcrumbsAttributes>) & (() => import("./index.js").BreadcrumbsAttributes);
53
+ readonly button: ((options?: import("./index.js").ButtonOptions | undefined) => ReactAttributes<import("./index.js").ButtonAttributes>) & (({ variant }?: import("./index.js").ButtonOptions) => import("./index.js").ButtonAttributes) & {
54
+ variants: readonly ["primary", "secondary", "ghost", "danger"];
55
+ isVariant: (value: string) => value is "danger" | "primary" | "secondary" | "ghost";
56
+ };
57
+ readonly card: ((options?: import("./index.js").CardOptions | undefined) => ReactAttributes<import("./index.js").CardAttributes>) & (({ variant, interactive }?: import("./index.js").CardOptions) => import("./index.js").CardAttributes) & {
58
+ title: "fs-card__title";
59
+ variants: readonly ["outline", "filled"];
60
+ isVariant: (value: string) => value is "outline" | "filled";
61
+ };
62
+ readonly checkbox: ((options?: import("./index.js").CheckboxOptions | undefined) => ReactAttributes<import("./index.js").CheckboxAttributes>) & (({ state }?: import("./index.js").CheckboxOptions) => import("./index.js").CheckboxAttributes) & {
63
+ row: "fs-checkbox-row";
64
+ states: readonly ["default", "invalid", "success"];
65
+ isState: (value: string) => value is "default" | "success" | "invalid";
66
+ };
67
+ readonly dialog: ((options?: unknown) => ReactAttributes<import("./index.js").DialogAttributes>) & (() => import("./index.js").DialogAttributes) & {
68
+ title: "fs-dialog__title";
69
+ body: "fs-dialog__body";
70
+ footer: "fs-dialog__footer";
71
+ };
72
+ readonly divider: ((options?: import("./index.js").DividerOptions | undefined) => ReactAttributes<import("./index.js").DividerAttributes>) & (({ variant }?: import("./index.js").DividerOptions) => import("./index.js").DividerAttributes) & {
73
+ variants: readonly ["default", "subtle", "strong"];
74
+ isVariant: (value: string) => value is "default" | "subtle" | "strong";
75
+ };
76
+ readonly errorText: ((options?: import("./index.js").ErrorTextOptions | undefined) => ReactAttributes<import("./index.js").ErrorTextAttributes>) & (({ variant }?: import("./index.js").ErrorTextOptions) => import("./index.js").ErrorTextAttributes) & {
77
+ variants: readonly ["error", "warning"];
78
+ isVariant: (value: string) => value is "error" | "warning";
79
+ };
80
+ readonly fieldset: ((options?: import("./index.js").FieldsetOptions | undefined) => ReactAttributes<import("./index.js").FieldsetAttributes>) & (({ state, disabled }?: import("./index.js").FieldsetOptions) => import("./index.js").FieldsetAttributes) & {
81
+ states: readonly ["default", "invalid", "success"];
82
+ isState: (value: string) => value is "default" | "success" | "invalid";
83
+ };
84
+ readonly heading: ((options?: import("./index.js").HeadingOptions | undefined) => ReactAttributes<import("./index.js").HeadingAttributes>) & (({ size }?: import("./index.js").HeadingOptions) => import("./index.js").HeadingAttributes) & {
85
+ sizes: readonly ["xs", "s", "m", "l", "xl", "mega"];
86
+ isSize: (value: string) => value is "l" | "xs" | "s" | "m" | "xl" | "mega";
87
+ };
88
+ readonly fileUpload: ((options?: import("./index.js").FileUploadOptions | undefined) => ReactAttributes<import("./index.js").FileUploadAttributes>) & (({ state, multiple, accept, }?: import("./index.js").FileUploadOptions) => import("./index.js").FileUploadAttributes) & {
89
+ list: "fs-file-upload-list";
90
+ states: readonly ["default", "invalid", "success"];
91
+ isState: (value: string) => value is "default" | "success" | "invalid";
92
+ };
93
+ readonly helpText: ((options?: import("./index.js").HelpTextOptions | undefined) => ReactAttributes<import("./index.js").HelpTextAttributes>) & (({ variant }?: import("./index.js").HelpTextOptions) => import("./index.js").HelpTextAttributes) & {
94
+ variants: readonly ["muted", "default", "success", "warning"];
95
+ isVariant: (value: string) => value is "default" | "warning" | "success" | "muted";
96
+ };
97
+ readonly input: ((options?: import("./index.js").InputOptions | undefined) => ReactAttributes<import("./index.js").InputAttributes>) & (({ type, state }?: import("./index.js").InputOptions) => import("./index.js").InputAttributes) & {
98
+ types: readonly ["text", "password", "email", "number", "date", "datetime-local", "week", "month", "tel", "url", "search", "time"];
99
+ isType: (value: string) => value is "number" | "date" | "search" | "url" | "text" | "password" | "email" | "datetime-local" | "week" | "month" | "tel" | "time";
100
+ states: readonly ["default", "invalid", "success"];
101
+ isState: (value: string) => value is "default" | "success" | "invalid";
102
+ };
103
+ readonly label: ((options?: import("./index.js").LabelOptions | undefined) => ReactAttributes<import("./index.js").LabelAttributes>) & (({ required, optional, disabled }?: import("./index.js").LabelOptions) => import("./index.js").LabelAttributes) & {
104
+ markers: readonly ["symbol", "text"];
105
+ isMarker: (value: string) => value is "symbol" | "text";
106
+ };
107
+ readonly legend: ((options?: import("./index.js").LegendOptions | undefined) => ReactAttributes<import("./index.js").LegendAttributes>) & (({ required, optional, disabled }?: import("./index.js").LegendOptions) => import("./index.js").LegendAttributes) & {
108
+ markers: readonly ["symbol", "text"];
109
+ isMarker: (value: string) => value is "symbol" | "text";
110
+ };
111
+ readonly link: ((options?: import("./index.js").LinkOptions | undefined) => ReactAttributes<import("./index.js").LinkAttributes>) & (({ disabled }?: import("./index.js").LinkOptions) => import("./index.js").LinkAttributes);
112
+ readonly list: ((options?: import("./index.js").ListOptions | undefined) => ReactAttributes<import("./index.js").ListAttributes>) & (({ variant }?: import("./index.js").ListOptions) => import("./index.js").ListAttributes) & {
113
+ variants: readonly ["default", "plain", "divided"];
114
+ isVariant: (value: string) => value is "default" | "plain" | "divided";
115
+ };
116
+ readonly pagination: ((options?: unknown) => ReactAttributes<import("./index.js").PaginationAttributes>) & (() => import("./index.js").PaginationAttributes) & {
117
+ gap: "fs-pagination__gap";
118
+ };
119
+ readonly paragraph: ((options?: import("./index.js").ParagraphOptions | undefined) => ReactAttributes<import("./index.js").ParagraphAttributes>) & (({ size, variant, }?: import("./index.js").ParagraphOptions) => import("./index.js").ParagraphAttributes) & {
120
+ sizes: readonly ["small", "medium", "large"];
121
+ isSize: (value: string) => value is "small" | "medium" | "large";
122
+ variants: readonly ["default", "lead"];
123
+ isVariant: (value: string) => value is "default" | "lead";
124
+ };
125
+ readonly radio: ((options?: import("./index.js").RadioOptions | undefined) => ReactAttributes<import("./index.js").RadioAttributes>) & (({ state }?: import("./index.js").RadioOptions) => import("./index.js").RadioAttributes) & {
126
+ row: "fs-radio-row";
127
+ states: readonly ["default", "invalid", "success"];
128
+ isState: (value: string) => value is "default" | "success" | "invalid";
129
+ };
130
+ readonly search: ((options?: import("./index.js").SearchOptions | undefined) => ReactAttributes<import("./index.js").SearchAttributes>) & (({ state }?: import("./index.js").SearchOptions) => import("./index.js").SearchAttributes) & {
131
+ row: "fs-search-row";
132
+ states: readonly ["default", "invalid", "success"];
133
+ isState: (value: string) => value is "default" | "success" | "invalid";
134
+ };
135
+ readonly select: ((options?: import("./index.js").SelectOptions | undefined) => ReactAttributes<import("./index.js").SelectAttributes>) & (({ state }?: import("./index.js").SelectOptions) => import("./index.js").SelectAttributes) & {
136
+ states: readonly ["default", "invalid", "success"];
137
+ isState: (value: string) => value is "default" | "success" | "invalid";
138
+ };
139
+ readonly skeleton: ((options?: import("./index.js").SkeletonOptions | undefined) => ReactAttributes<import("./index.js").SkeletonAttributes>) & (({ variant }?: import("./index.js").SkeletonOptions) => import("./index.js").SkeletonAttributes) & {
140
+ variants: readonly ["block", "text", "circle"];
141
+ isVariant: (value: string) => value is "text" | "circle" | "block";
142
+ };
143
+ readonly skipLink: ((options?: unknown) => ReactAttributes<import("./index.js").SkipLinkAttributes>) & (() => import("./index.js").SkipLinkAttributes);
144
+ readonly spinner: ((options?: import("./index.js").SpinnerOptions | undefined) => ReactAttributes<import("./index.js").SpinnerAttributes>) & (({ size, label }?: import("./index.js").SpinnerOptions) => import("./index.js").SpinnerAttributes) & {
145
+ sizes: readonly ["small", "medium", "large"];
146
+ isSize: (value: string) => value is "small" | "medium" | "large";
147
+ };
148
+ readonly srOnly: ((options?: unknown) => ReactAttributes<import("./index.js").SrOnlyAttributes>) & (() => import("./index.js").SrOnlyAttributes);
149
+ readonly switch: ((options?: import("./index.js").SwitchOptions | undefined) => ReactAttributes<import("./index.js").SwitchAttributes>) & (({ disabled }?: import("./index.js").SwitchOptions) => import("./index.js").SwitchAttributes) & {
150
+ row: "fs-switch-row";
151
+ };
152
+ readonly toggleGroup: ((options?: unknown) => ReactAttributes<import("./index.js").ToggleGroupAttributes>) & (() => import("./index.js").ToggleGroupAttributes) & {
153
+ option: "fs-toggle-group__option";
154
+ };
155
+ readonly tooltip: ((options?: unknown) => ReactAttributes<import("./index.js").TooltipAttributes>) & (() => import("./index.js").TooltipAttributes) & {
156
+ bubble: "fs-tooltip__bubble";
157
+ };
158
+ readonly table: ((options?: import("./index.js").TableOptions | undefined) => ReactAttributes<import("./index.js").TableAttributes>) & (({ variant, hoverable }?: import("./index.js").TableOptions) => import("./index.js").TableAttributes) & {
159
+ scroll: "fs-table-scroll";
160
+ variants: readonly ["default", "striped"];
161
+ isVariant: (value: string) => value is "default" | "striped";
162
+ };
163
+ readonly tag: ((options?: import("./index.js").TagOptions | undefined) => ReactAttributes<import("./index.js").TagAttributes>) & (({ variant, selectable }?: import("./index.js").TagOptions) => import("./index.js").TagAttributes) & {
164
+ variants: readonly ["outline", "filled"];
165
+ isVariant: (value: string) => value is "outline" | "filled";
166
+ };
167
+ readonly textarea: ((options?: import("./index.js").TextareaOptions | undefined) => ReactAttributes<import("./index.js").TextareaAttributes>) & (({ state }?: import("./index.js").TextareaOptions) => import("./index.js").TextareaAttributes) & {
168
+ states: readonly ["default", "invalid", "success"];
169
+ isState: (value: string) => value is "default" | "success" | "invalid";
170
+ };
171
+ /**
172
+ * Kobler et helt felt, med `className` og `htmlFor` på ledeteksten.
173
+ *
174
+ * `control`, `help` og `error` har ingen nøkler som må døpes om, og er
175
+ * derfor like i begge inngangene.
176
+ */
177
+ readonly field: (options?: FieldOptions) => {
178
+ label: ReactAttributes<{
179
+ class: "fs-label";
180
+ for: string;
181
+ "data-required"?: import("./index.js").RequiredMarker;
182
+ "data-optional"?: "";
183
+ "aria-disabled"?: "true";
184
+ }>;
185
+ control: {
186
+ id: string;
187
+ "aria-describedby"?: string;
188
+ "aria-invalid"?: "true";
189
+ "data-state"?: "invalid";
190
+ disabled?: true;
191
+ };
192
+ help: {
193
+ id: string;
194
+ };
195
+ error: {
196
+ id: string;
197
+ hidden?: true;
198
+ };
199
+ state: import("./index.js").FieldState;
200
+ };
201
+ readonly setAttributes: typeof setAttributes;
202
+ readonly states: readonly ["default", "invalid", "success"];
203
+ readonly isState: (value: string) => value is "default" | "success" | "invalid";
204
+ readonly markers: readonly ["symbol", "text"];
205
+ readonly isMarker: (value: string) => value is "symbol" | "text";
206
+ };
207
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAwCA,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,2CAA2C;AAC3C,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI;KAC9B,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,OAAO,GAC9B,WAAW,GACX,CAAC,SAAS,KAAK,GACb,SAAS,GACT,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACf,CAAA;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,UAAU,EAAE,CAAC,GACZ,eAAe,CAAC,CAAC,CAAC,CAOpB;AAgBD,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqCb;;;;;OAKG;+BACc,YAAY;;;;;;;;;;8BArHjB,CAAC;0BACR,CAAA;wBAAyB,CAAC;oBAAwB,CAAC;;;;;;;kBACF,CAAC;;;;;;;;;CA8H/C,CAAA"}
package/dist/react.js ADDED
@@ -0,0 +1,109 @@
1
+ import { accordion } from "./components/css/accordion/accordion.js";
2
+ import { alert } from "./components/css/alert/alert.js";
3
+ import { avatar } from "./components/css/avatar/avatar.js";
4
+ import { badge } from "./components/css/badge/badge.js";
5
+ import { breadcrumbs } from "./components/css/breadcrumbs/breadcrumbs.js";
6
+ import { button } from "./components/css/button/button.js";
7
+ import { card } from "./components/css/card/card.js";
8
+ import { checkbox } from "./components/css/checkbox/checkbox.js";
9
+ import { dialog } from "./components/css/dialog/dialog.js";
10
+ import { divider } from "./components/css/divider/divider.js";
11
+ import { errorText } from "./components/css/error-text/error-text.js";
12
+ import { fieldset, legend } from "./components/css/fieldset/fieldset.js";
13
+ import { fileUpload } from "./components/css/file-upload/file-upload.js";
14
+ import { heading } from "./components/css/heading/heading.js";
15
+ import { helpText } from "./components/css/help-text/help-text.js";
16
+ import { input } from "./components/css/input/input.js";
17
+ import { label } from "./components/css/label/label.js";
18
+ import { link } from "./components/css/link/link.js";
19
+ import { list } from "./components/css/list/list.js";
20
+ import { pagination } from "./components/css/pagination/pagination.js";
21
+ import { paragraph } from "./components/css/paragraph/paragraph.js";
22
+ import { radio } from "./components/css/radio/radio.js";
23
+ import { search } from "./components/css/search/search.js";
24
+ import { select } from "./components/css/select/select.js";
25
+ import { fieldStates, isFieldState, isRequiredMarker, requiredMarkers, } from "./components/css/shared.js";
26
+ import { skeleton } from "./components/css/skeleton/skeleton.js";
27
+ import { skipLink } from "./components/css/skip-link/skip-link.js";
28
+ import { spinner } from "./components/css/spinner/spinner.js";
29
+ import { srOnly } from "./components/css/sr-only/sr-only.js";
30
+ import { switchControl } from "./components/css/switch/switch.js";
31
+ import { table } from "./components/css/table/table.js";
32
+ import { tag } from "./components/css/tag/tag.js";
33
+ import { textarea } from "./components/css/textarea/textarea.js";
34
+ import { toggleGroup } from "./components/css/toggle-group/toggle-group.js";
35
+ import { tooltip } from "./components/css/tooltip/tooltip.js";
36
+ import { computeFieldAttributes, } from "./components/ramme/field/field-core.js";
37
+ import { setAttributes } from "./dom.js";
38
+ export function toReactAttributes(attributes) {
39
+ const result = {};
40
+ for (const [name, value] of Object.entries(attributes)) {
41
+ result[name === "class" ? "className" : name === "for" ? "htmlFor" : name] =
42
+ value;
43
+ }
44
+ return result;
45
+ }
46
+ /**
47
+ * Pakker inn en byggefunksjon så returverdien får React-navnene.
48
+ *
49
+ * Signaturen er skrevet som en snitt-type for at TypeScript skal kunne utlede
50
+ * både valgtypen og de ekstra feltene som henger på funksjonen, altså
51
+ * `variants`, `isVariant` og de andre, i samme slengen.
52
+ */
53
+ function forReact(fn) {
54
+ const wrapped = (options) => toReactAttributes(fn(options));
55
+ return Object.assign(wrapped, fn);
56
+ }
57
+ export const fs = {
58
+ accordion: forReact(accordion),
59
+ alert: forReact(alert),
60
+ avatar: forReact(avatar),
61
+ badge: forReact(badge),
62
+ breadcrumbs: forReact(breadcrumbs),
63
+ button: forReact(button),
64
+ card: forReact(card),
65
+ checkbox: forReact(checkbox),
66
+ dialog: forReact(dialog),
67
+ divider: forReact(divider),
68
+ errorText: forReact(errorText),
69
+ fieldset: forReact(fieldset),
70
+ heading: forReact(heading),
71
+ fileUpload: forReact(fileUpload),
72
+ helpText: forReact(helpText),
73
+ input: forReact(input),
74
+ label: forReact(label),
75
+ legend: forReact(legend),
76
+ link: forReact(link),
77
+ list: forReact(list),
78
+ pagination: forReact(pagination),
79
+ paragraph: forReact(paragraph),
80
+ radio: forReact(radio),
81
+ search: forReact(search),
82
+ select: forReact(select),
83
+ skeleton: forReact(skeleton),
84
+ skipLink: forReact(skipLink),
85
+ spinner: forReact(spinner),
86
+ srOnly: forReact(srOnly),
87
+ switch: forReact(switchControl),
88
+ toggleGroup: forReact(toggleGroup),
89
+ tooltip: forReact(tooltip),
90
+ table: forReact(table),
91
+ tag: forReact(tag),
92
+ textarea: forReact(textarea),
93
+ /**
94
+ * Kobler et helt felt, med `className` og `htmlFor` på ledeteksten.
95
+ *
96
+ * `control`, `help` og `error` har ingen nøkler som må døpes om, og er
97
+ * derfor like i begge inngangene.
98
+ */
99
+ field: (options = {}) => {
100
+ const field = computeFieldAttributes(options);
101
+ return { ...field, label: toReactAttributes(field.label) };
102
+ },
103
+ setAttributes,
104
+ states: fieldStates,
105
+ isState: isFieldState,
106
+ markers: requiredMarkers,
107
+ isMarker: isRequiredMarker,
108
+ };
109
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAA;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAA;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,6CAA6C,CAAA;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,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 };
10
+ colors: {
11
+ transparent: string;
12
+ current: string;
13
+ page: {
14
+ bg: string;
15
+ fg: string;
16
+ };
17
+ interactive: {
18
+ DEFAULT: string;
19
+ bg: string;
20
+ fg: string;
21
+ };
22
+ danger: {
23
+ DEFAULT: string;
24
+ bg: string;
25
+ };
26
+ warning: {
27
+ DEFAULT: string;
28
+ bg: string;
29
+ };
30
+ success: {
31
+ DEFAULT: string;
32
+ bg: string;
33
+ };
34
+ disabled: {
35
+ DEFAULT: string;
36
+ bg: string;
37
+ };
38
+ neutral: {
39
+ DEFAULT: string;
40
+ bg: string;
41
+ };
42
+ divider: {
43
+ DEFAULT: string;
44
+ strong: string;
45
+ };
46
+ palette: {
47
+ burgundy: {
48
+ 5: string;
49
+ 10: string;
50
+ 30: string;
51
+ 50: string;
52
+ 70: string;
53
+ 100: string;
54
+ };
55
+ forest: {
56
+ 5: string;
57
+ 10: string;
58
+ 30: string;
59
+ 50: string;
60
+ 70: string;
61
+ 100: string;
62
+ };
63
+ ochre: {
64
+ 5: string;
65
+ 10: string;
66
+ 30: string;
67
+ 50: string;
68
+ 70: string;
69
+ 100: string;
70
+ };
71
+ denim: {
72
+ 5: string;
73
+ 10: string;
74
+ 30: string;
75
+ 50: string;
76
+ 70: string;
77
+ 100: string;
78
+ };
79
+ azure: {
80
+ 10: string;
81
+ 30: string;
82
+ 70: string;
83
+ 100: string;
84
+ };
85
+ graphite: {
86
+ 0: string;
87
+ 5: string;
88
+ 10: string;
89
+ 30: string;
90
+ 50: string;
91
+ 70: string;
92
+ 100: string;
93
+ };
94
+ };
95
+ };
96
+ fontSize: {
97
+ xxs: string;
98
+ xs: string;
99
+ s: string;
100
+ m: string;
101
+ l: string;
102
+ xl: string;
103
+ xxl: string;
104
+ mega: string;
105
+ };
106
+ extend: {
107
+ maxWidth: {
108
+ readonly xs: "100%";
109
+ readonly sm: "576px";
110
+ readonly md: "960px";
111
+ readonly lg: "1152px";
112
+ readonly xl: "1536px";
113
+ readonly aside: "384px";
114
+ readonly asideNarrow: "288px";
115
+ readonly wideContent: "768px";
116
+ };
117
+ };
118
+ };
119
+ };
120
+ //# sourceMappingURL=preset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset.d.ts","sourceRoot":"","sources":["../../src/tailwind/preset.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4GC,CAAA"}
@@ -0,0 +1,107 @@
1
+ import { Breakpoints, Containers } from "../tokens/tokens.js";
2
+ const v = (token) => `var(${token})`;
3
+ export const fristilPreset = {
4
+ theme: {
5
+ screens: Breakpoints,
6
+ colors: {
7
+ transparent: "transparent",
8
+ current: "currentColor",
9
+ page: {
10
+ bg: v("--semantic-page-background"),
11
+ fg: v("--semantic-page-foreground"),
12
+ },
13
+ interactive: {
14
+ DEFAULT: v("--semantic-interactive-main"),
15
+ bg: v("--semantic-interactive-background"),
16
+ fg: v("--semantic-interactive-foreground"),
17
+ },
18
+ danger: {
19
+ DEFAULT: v("--semantic-danger-foreground"),
20
+ bg: v("--semantic-danger-background"),
21
+ },
22
+ warning: {
23
+ DEFAULT: v("--semantic-warning-foreground"),
24
+ bg: v("--semantic-warning-background"),
25
+ },
26
+ success: {
27
+ DEFAULT: v("--semantic-success-foreground"),
28
+ bg: v("--semantic-success-background"),
29
+ },
30
+ disabled: {
31
+ DEFAULT: v("--semantic-disabled-foreground"),
32
+ bg: v("--semantic-disabled-background"),
33
+ },
34
+ neutral: {
35
+ DEFAULT: v("--semantic-neutral-foreground"),
36
+ bg: v("--semantic-neutral-background"),
37
+ },
38
+ divider: {
39
+ DEFAULT: v("--semantic-divider-30"),
40
+ strong: v("--semantic-divider-100"),
41
+ },
42
+ palette: {
43
+ burgundy: {
44
+ 5: v("--palette-burgundy-5"),
45
+ 10: v("--palette-burgundy-10"),
46
+ 30: v("--palette-burgundy-30"),
47
+ 50: v("--palette-burgundy-50"),
48
+ 70: v("--palette-burgundy-70"),
49
+ 100: v("--palette-burgundy-100"),
50
+ },
51
+ forest: {
52
+ 5: v("--palette-forest-5"),
53
+ 10: v("--palette-forest-10"),
54
+ 30: v("--palette-forest-30"),
55
+ 50: v("--palette-forest-50"),
56
+ 70: v("--palette-forest-70"),
57
+ 100: v("--palette-forest-100"),
58
+ },
59
+ ochre: {
60
+ 5: v("--palette-ochre-5"),
61
+ 10: v("--palette-ochre-10"),
62
+ 30: v("--palette-ochre-30"),
63
+ 50: v("--palette-ochre-50"),
64
+ 70: v("--palette-ochre-70"),
65
+ 100: v("--palette-ochre-100"),
66
+ },
67
+ denim: {
68
+ 5: v("--palette-denim-5"),
69
+ 10: v("--palette-denim-10"),
70
+ 30: v("--palette-denim-30"),
71
+ 50: v("--palette-denim-50"),
72
+ 70: v("--palette-denim-70"),
73
+ 100: v("--palette-denim-100"),
74
+ },
75
+ azure: {
76
+ 10: v("--palette-azure-10"),
77
+ 30: v("--palette-azure-30"),
78
+ 70: v("--palette-azure-70"),
79
+ 100: v("--palette-azure-100"),
80
+ },
81
+ graphite: {
82
+ 0: v("--palette-graphite-0"),
83
+ 5: v("--palette-graphite-5"),
84
+ 10: v("--palette-graphite-10"),
85
+ 30: v("--palette-graphite-30"),
86
+ 50: v("--palette-graphite-50"),
87
+ 70: v("--palette-graphite-70"),
88
+ 100: v("--palette-graphite-100"),
89
+ },
90
+ },
91
+ },
92
+ fontSize: {
93
+ xxs: v("--font-size-xxs"),
94
+ xs: v("--font-size-xs"),
95
+ s: v("--font-size-s"),
96
+ m: v("--font-size-m"),
97
+ l: v("--font-size-l"),
98
+ xl: v("--font-size-xl"),
99
+ xxl: v("--font-size-xxl"),
100
+ mega: v("--font-size-mega"),
101
+ },
102
+ extend: {
103
+ maxWidth: Containers,
104
+ },
105
+ },
106
+ };
107
+ //# sourceMappingURL=preset.js.map
@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et ditt.
5
+ * Tilpasning gjennom `@layer`, `--fs-*`-variabler og `::part()` dekker
6
+ * utseendet, men ikke «jeg vil at denne komponenten skal oppføre seg
7
+ * annerledes». Da er alternativet enten å leve med det eller å skrive
8
+ * komponenten på nytt fra bunnen. Denne kommandoen er veien imellom.
9
+ *
10
+ * Fila her gjør ingenting med filsystemet, bare med tekst, slik at
11
+ * omskrivingen kan måles i en test. `cli.ts` leser og skriver filene.
12
+ *
13
+ * Det som må skrives om er henvisningene ut av mappa. En komponent peker på
14
+ * naboene sine med relative stier, og de stiene finnes ikke lenger når mappa
15
+ * står i et annet prosjekt. `../shared.js` blir til
16
+ * `@fristil/designsystem/shared`, som fortsatt virker, og som gjør det synlig
17
+ * hva kopien fremdeles henter fra pakken.
18
+ */
19
+ /** En fil i pakken, slik `cli.ts` har lest den. */
20
+ export type SourceFile = {
21
+ /** Stien i pakken, som «src/components/css/button/button.ts». */
22
+ path: string;
23
+ content: string;
24
+ };
25
+ export type PackageExports = Record<string, string | {
26
+ import?: string;
27
+ types?: string;
28
+ }>;
29
+ export type PlannedFile = {
30
+ /** Filnavnet alene, som «button.ts». */
31
+ name: string;
32
+ content: string;
33
+ /** Henvisninger som ble skrevet om, til utskrift etterpå. */
34
+ rewrites: {
35
+ from: string;
36
+ to: string;
37
+ }[];
38
+ };
39
+ export type TakeoverPlan = {
40
+ files: PlannedFile[];
41
+ /** Pakker kopien trenger i prosjektet, som «lit». */
42
+ dependencies: string[];
43
+ /** Stilark kopien fortsatt henter fra pakken. */
44
+ keptImports: string[];
45
+ /**
46
+ * Inngangspunktene kopien tar over for.
47
+ *
48
+ * Kopien beholder klassenavnene, så importerer prosjektet fortsatt
49
+ * `@fristil/designsystem/button.css` i tillegg, finnes komponenten to
50
+ * ganger, og den ene vinner tilfeldig.
51
+ */
52
+ replacedEntries: string[];
53
+ };
54
+ /**
55
+ * Bygger oppslaget fra en fil i pakken til inngangspunktet som peker på den.
56
+ *
57
+ * `exports` peker på `dist` for JavaScript og på `src` for CSS. Begge føres
58
+ * tilbake til kilden, siden det er kilden som kopieres.
59
+ */
60
+ export declare function buildEntryPoints(name: string, exports: PackageExports): Map<string, string>;
61
+ /** Slår sammen en relativ sti med mappa den står i. */
62
+ export declare function resolvePath(fromDirectory: string, relative: string): string;
63
+ /**
64
+ * Skriver om henvisningene i én fil.
65
+ *
66
+ * Bare stier som peker ut av mappa røres. En nabo i samme mappe blir med i
67
+ * kopien, og skal fortsatt finnes der.
68
+ */
69
+ export declare function rewriteReferences(file: SourceFile, entryPoints: Map<string, string>,
70
+ /** Stiene til filene som blir med i kopien, som de står i pakken. */
71
+ ownFiles: Set<string>): PlannedFile;
72
+ /**
73
+ * Setter sammen hele planen for én komponent.
74
+ *
75
+ * `files` er alle filene i komponentmappa, uten testene: de hører til
76
+ * pakkens eget oppsett og sier ingenting i et annet prosjekt.
77
+ */
78
+ export declare function planTakeover(files: SourceFile[], entryPoints: Map<string, string>): TakeoverPlan;
79
+ //# sourceMappingURL=takeover.d.ts.map