@navikt/ds-react 7.33.5 → 7.35.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 (261) hide show
  1. package/cjs/alert/Alert.js +2 -4
  2. package/cjs/alert/Alert.js.map +1 -1
  3. package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
  4. package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js +72 -0
  5. package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
  6. package/cjs/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
  7. package/cjs/alert/base-alert/content/BaseAlertContent.js +70 -0
  8. package/cjs/alert/base-alert/content/BaseAlertContent.js.map +1 -0
  9. package/cjs/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
  10. package/cjs/alert/base-alert/header/BaseAlertHeader.js +77 -0
  11. package/cjs/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
  12. package/cjs/alert/base-alert/index.d.ts +1 -0
  13. package/cjs/alert/base-alert/index.js +39 -0
  14. package/cjs/alert/base-alert/index.js.map +1 -0
  15. package/cjs/alert/base-alert/namespace.d.ts +10 -0
  16. package/cjs/alert/base-alert/namespace.js +14 -0
  17. package/cjs/alert/base-alert/namespace.js.map +1 -0
  18. package/cjs/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
  19. package/cjs/alert/base-alert/root/BaseAlertRoot.context.js +11 -0
  20. package/cjs/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
  21. package/cjs/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
  22. package/cjs/alert/base-alert/root/BaseAlertRoot.js +65 -0
  23. package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
  24. package/cjs/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
  25. package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js +48 -0
  26. package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
  27. package/cjs/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
  28. package/cjs/alert/base-alert/title/BaseAlertTitle.js +77 -0
  29. package/cjs/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
  30. package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
  31. package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js +19 -0
  32. package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
  33. package/cjs/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
  34. package/cjs/alert/global-alert/content/GlobalAlertContent.js +20 -0
  35. package/cjs/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
  36. package/cjs/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
  37. package/cjs/alert/global-alert/header/GlobalAlertHeader.js +54 -0
  38. package/cjs/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
  39. package/cjs/alert/global-alert/index.d.ts +2 -0
  40. package/cjs/alert/global-alert/index.js +11 -0
  41. package/cjs/alert/global-alert/index.js.map +1 -0
  42. package/cjs/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
  43. package/cjs/alert/global-alert/root/GlobalAlertRoot.js +69 -0
  44. package/cjs/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
  45. package/cjs/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
  46. package/cjs/alert/global-alert/title/GlobalAlertTitle.js +19 -0
  47. package/cjs/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
  48. package/cjs/alert/info-card/content/InfoCardContent.d.ts +18 -0
  49. package/cjs/alert/info-card/content/InfoCardContent.js +20 -0
  50. package/cjs/alert/info-card/content/InfoCardContent.js.map +1 -0
  51. package/cjs/alert/info-card/header/InfoCardHeader.d.ts +16 -0
  52. package/cjs/alert/info-card/header/InfoCardHeader.js +18 -0
  53. package/cjs/alert/info-card/header/InfoCardHeader.js.map +1 -0
  54. package/cjs/alert/info-card/index.d.ts +2 -0
  55. package/cjs/alert/info-card/index.js +10 -0
  56. package/cjs/alert/info-card/index.js.map +1 -0
  57. package/cjs/alert/info-card/root/InfoCardRoot.d.ts +76 -0
  58. package/cjs/alert/info-card/root/InfoCardRoot.js +78 -0
  59. package/cjs/alert/info-card/root/InfoCardRoot.js.map +1 -0
  60. package/cjs/alert/info-card/title/InfoCardTitle.d.ts +17 -0
  61. package/cjs/alert/info-card/title/InfoCardTitle.js +19 -0
  62. package/cjs/alert/info-card/title/InfoCardTitle.js.map +1 -0
  63. package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
  64. package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js +19 -0
  65. package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
  66. package/cjs/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
  67. package/cjs/alert/local-alert/content/LocalAlertContent.js +20 -0
  68. package/cjs/alert/local-alert/content/LocalAlertContent.js.map +1 -0
  69. package/cjs/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
  70. package/cjs/alert/local-alert/header/LocalAlertHeader.js +54 -0
  71. package/cjs/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
  72. package/cjs/alert/local-alert/index.d.ts +2 -0
  73. package/cjs/alert/local-alert/index.js +11 -0
  74. package/cjs/alert/local-alert/index.js.map +1 -0
  75. package/cjs/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
  76. package/cjs/alert/local-alert/root/LocalAlertRoot.js +81 -0
  77. package/cjs/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
  78. package/cjs/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
  79. package/cjs/alert/local-alert/title/LocalAlertTitle.js +19 -0
  80. package/cjs/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
  81. package/cjs/date/Date.locale.d.ts +5 -0
  82. package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
  83. package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
  84. package/cjs/index.d.ts +4 -0
  85. package/cjs/index.js +9 -1
  86. package/cjs/index.js.map +1 -1
  87. package/cjs/inline-message/icon/InlineMessageIcon.d.ts +5 -0
  88. package/cjs/inline-message/icon/InlineMessageIcon.js +24 -0
  89. package/cjs/inline-message/icon/InlineMessageIcon.js.map +1 -0
  90. package/cjs/inline-message/index.d.ts +2 -0
  91. package/cjs/inline-message/index.js +7 -0
  92. package/cjs/inline-message/index.js.map +1 -0
  93. package/cjs/inline-message/root/InlineMessage.d.ts +36 -0
  94. package/cjs/inline-message/root/InlineMessage.js +91 -0
  95. package/cjs/inline-message/root/InlineMessage.js.map +1 -0
  96. package/cjs/timeline/period/ClickablePeriod.js +3 -15
  97. package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
  98. package/cjs/timeline/pin/PinInternal.js +3 -15
  99. package/cjs/timeline/pin/PinInternal.js.map +1 -1
  100. package/cjs/util/i18n/locales/en.d.ts +2 -4
  101. package/cjs/util/i18n/locales/en.js +2 -4
  102. package/cjs/util/i18n/locales/en.js.map +1 -1
  103. package/cjs/util/i18n/locales/nb.d.ts +4 -6
  104. package/cjs/util/i18n/locales/nb.js +4 -6
  105. package/cjs/util/i18n/locales/nb.js.map +1 -1
  106. package/cjs/util/i18n/locales/nn.d.ts +2 -4
  107. package/cjs/util/i18n/locales/nn.js +2 -4
  108. package/cjs/util/i18n/locales/nn.js.map +1 -1
  109. package/esm/alert/Alert.js +2 -4
  110. package/esm/alert/Alert.js.map +1 -1
  111. package/esm/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
  112. package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js +36 -0
  113. package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
  114. package/esm/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
  115. package/esm/alert/base-alert/content/BaseAlertContent.js +34 -0
  116. package/esm/alert/base-alert/content/BaseAlertContent.js.map +1 -0
  117. package/esm/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
  118. package/esm/alert/base-alert/header/BaseAlertHeader.js +41 -0
  119. package/esm/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
  120. package/esm/alert/base-alert/index.d.ts +1 -0
  121. package/esm/alert/base-alert/index.js +3 -0
  122. package/esm/alert/base-alert/index.js.map +1 -0
  123. package/esm/alert/base-alert/namespace.d.ts +10 -0
  124. package/esm/alert/base-alert/namespace.js +6 -0
  125. package/esm/alert/base-alert/namespace.js.map +1 -0
  126. package/esm/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
  127. package/esm/alert/base-alert/root/BaseAlertRoot.context.js +7 -0
  128. package/esm/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
  129. package/esm/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
  130. package/esm/alert/base-alert/root/BaseAlertRoot.js +29 -0
  131. package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
  132. package/esm/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
  133. package/esm/alert/base-alert/root/BaseAlertRoot.utils.js +42 -0
  134. package/esm/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
  135. package/esm/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
  136. package/esm/alert/base-alert/title/BaseAlertTitle.js +38 -0
  137. package/esm/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
  138. package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
  139. package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js +16 -0
  140. package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
  141. package/esm/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
  142. package/esm/alert/global-alert/content/GlobalAlertContent.js +17 -0
  143. package/esm/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
  144. package/esm/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
  145. package/esm/alert/global-alert/header/GlobalAlertHeader.js +18 -0
  146. package/esm/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
  147. package/esm/alert/global-alert/index.d.ts +2 -0
  148. package/esm/alert/global-alert/index.js +3 -0
  149. package/esm/alert/global-alert/index.js.map +1 -0
  150. package/esm/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
  151. package/esm/alert/global-alert/root/GlobalAlertRoot.js +30 -0
  152. package/esm/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
  153. package/esm/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
  154. package/esm/alert/global-alert/title/GlobalAlertTitle.js +16 -0
  155. package/esm/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
  156. package/esm/alert/info-card/content/InfoCardContent.d.ts +18 -0
  157. package/esm/alert/info-card/content/InfoCardContent.js +17 -0
  158. package/esm/alert/info-card/content/InfoCardContent.js.map +1 -0
  159. package/esm/alert/info-card/header/InfoCardHeader.d.ts +16 -0
  160. package/esm/alert/info-card/header/InfoCardHeader.js +15 -0
  161. package/esm/alert/info-card/header/InfoCardHeader.js.map +1 -0
  162. package/esm/alert/info-card/index.d.ts +2 -0
  163. package/esm/alert/info-card/index.js +3 -0
  164. package/esm/alert/info-card/index.js.map +1 -0
  165. package/esm/alert/info-card/root/InfoCardRoot.d.ts +76 -0
  166. package/esm/alert/info-card/root/InfoCardRoot.js +40 -0
  167. package/esm/alert/info-card/root/InfoCardRoot.js.map +1 -0
  168. package/esm/alert/info-card/title/InfoCardTitle.d.ts +17 -0
  169. package/esm/alert/info-card/title/InfoCardTitle.js +16 -0
  170. package/esm/alert/info-card/title/InfoCardTitle.js.map +1 -0
  171. package/esm/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
  172. package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js +16 -0
  173. package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
  174. package/esm/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
  175. package/esm/alert/local-alert/content/LocalAlertContent.js +17 -0
  176. package/esm/alert/local-alert/content/LocalAlertContent.js.map +1 -0
  177. package/esm/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
  178. package/esm/alert/local-alert/header/LocalAlertHeader.js +18 -0
  179. package/esm/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
  180. package/esm/alert/local-alert/index.d.ts +2 -0
  181. package/esm/alert/local-alert/index.js +3 -0
  182. package/esm/alert/local-alert/index.js.map +1 -0
  183. package/esm/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
  184. package/esm/alert/local-alert/root/LocalAlertRoot.js +42 -0
  185. package/esm/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
  186. package/esm/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
  187. package/esm/alert/local-alert/title/LocalAlertTitle.js +16 -0
  188. package/esm/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
  189. package/esm/date/Date.locale.d.ts +5 -0
  190. package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
  191. package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
  192. package/esm/index.d.ts +4 -0
  193. package/esm/index.js +4 -0
  194. package/esm/index.js.map +1 -1
  195. package/esm/inline-message/icon/InlineMessageIcon.d.ts +5 -0
  196. package/esm/inline-message/icon/InlineMessageIcon.js +19 -0
  197. package/esm/inline-message/icon/InlineMessageIcon.js.map +1 -0
  198. package/esm/inline-message/index.d.ts +2 -0
  199. package/esm/inline-message/index.js +3 -0
  200. package/esm/inline-message/index.js.map +1 -0
  201. package/esm/inline-message/root/InlineMessage.d.ts +36 -0
  202. package/esm/inline-message/root/InlineMessage.js +52 -0
  203. package/esm/inline-message/root/InlineMessage.js.map +1 -0
  204. package/esm/timeline/period/ClickablePeriod.js +6 -18
  205. package/esm/timeline/period/ClickablePeriod.js.map +1 -1
  206. package/esm/timeline/pin/PinInternal.js +6 -18
  207. package/esm/timeline/pin/PinInternal.js.map +1 -1
  208. package/esm/util/i18n/locales/en.d.ts +2 -4
  209. package/esm/util/i18n/locales/en.js +2 -4
  210. package/esm/util/i18n/locales/en.js.map +1 -1
  211. package/esm/util/i18n/locales/nb.d.ts +4 -6
  212. package/esm/util/i18n/locales/nb.js +4 -6
  213. package/esm/util/i18n/locales/nb.js.map +1 -1
  214. package/esm/util/i18n/locales/nn.d.ts +2 -4
  215. package/esm/util/i18n/locales/nn.js +2 -4
  216. package/esm/util/i18n/locales/nn.js.map +1 -1
  217. package/package.json +45 -4
  218. package/src/alert/Alert.tsx +2 -10
  219. package/src/alert/base-alert/close-button/BaseAlertCloseButton.tsx +44 -0
  220. package/src/alert/base-alert/content/BaseAlertContent.tsx +43 -0
  221. package/src/alert/base-alert/header/BaseAlertHeader.tsx +61 -0
  222. package/src/alert/base-alert/index.ts +2 -0
  223. package/src/alert/base-alert/namespace.ts +11 -0
  224. package/src/alert/base-alert/root/BaseAlertRoot.context.tsx +17 -0
  225. package/src/alert/base-alert/root/BaseAlertRoot.tsx +102 -0
  226. package/src/alert/base-alert/root/BaseAlertRoot.utils.tsx +67 -0
  227. package/src/alert/base-alert/title/BaseAlertTitle.tsx +63 -0
  228. package/src/alert/global-alert/close-button/GlobalAlertCloseButton.tsx +20 -0
  229. package/src/alert/global-alert/content/GlobalAlertContent.tsx +21 -0
  230. package/src/alert/global-alert/header/GlobalAlertHeader.tsx +24 -0
  231. package/src/alert/global-alert/index.ts +16 -0
  232. package/src/alert/global-alert/root/GlobalAlertRoot.tsx +132 -0
  233. package/src/alert/global-alert/title/GlobalAlertTitle.tsx +20 -0
  234. package/src/alert/info-card/content/InfoCardContent.tsx +21 -0
  235. package/src/alert/info-card/header/InfoCardHeader.tsx +19 -0
  236. package/src/alert/info-card/index.ts +14 -0
  237. package/src/alert/info-card/root/InfoCardRoot.tsx +123 -0
  238. package/src/alert/info-card/title/InfoCardTitle.tsx +20 -0
  239. package/src/alert/local-alert/close-button/LocalAlertCloseButton.tsx +20 -0
  240. package/src/alert/local-alert/content/LocalAlertContent.tsx +21 -0
  241. package/src/alert/local-alert/header/LocalAlertHeader.tsx +24 -0
  242. package/src/alert/local-alert/index.ts +16 -0
  243. package/src/alert/local-alert/root/LocalAlertRoot.tsx +133 -0
  244. package/src/alert/local-alert/title/LocalAlertTitle.tsx +20 -0
  245. package/src/form/combobox/FilteredOptions/NoSearchHitsMessage.tsx +4 -1
  246. package/src/index.ts +24 -0
  247. package/src/inline-message/icon/InlineMessageIcon.tsx +33 -0
  248. package/src/inline-message/index.ts +3 -0
  249. package/src/inline-message/root/InlineMessage.tsx +92 -0
  250. package/src/timeline/period/ClickablePeriod.tsx +5 -34
  251. package/src/timeline/pin/PinInternal.tsx +5 -28
  252. package/src/util/i18n/locales/en.ts +2 -5
  253. package/src/util/i18n/locales/nb.ts +2 -5
  254. package/src/util/i18n/locales/nn.ts +2 -5
  255. package/cjs/util/renderStoriesForChromatic.d.ts +0 -5
  256. package/cjs/util/renderStoriesForChromatic.js +0 -21
  257. package/cjs/util/renderStoriesForChromatic.js.map +0 -1
  258. package/esm/util/renderStoriesForChromatic.d.ts +0 -5
  259. package/esm/util/renderStoriesForChromatic.js +0 -15
  260. package/esm/util/renderStoriesForChromatic.js.map +0 -1
  261. package/src/util/renderStoriesForChromatic.tsx +0 -26
@@ -0,0 +1,132 @@
1
+ import React, { forwardRef } from "react";
2
+ import { BaseAlert } from "../../base-alert";
3
+ import {
4
+ GlobalAlertCloseButton,
5
+ type GlobalAlertCloseButtonProps,
6
+ } from "../close-button/GlobalAlertCloseButton";
7
+ import {
8
+ GlobalAlertContent,
9
+ type GlobalAlertContentProps,
10
+ } from "../content/GlobalAlertContent";
11
+ import {
12
+ GlobalAlertHeader,
13
+ type GlobalAlertHeaderProps,
14
+ } from "../header/GlobalAlertHeader";
15
+ import {
16
+ GlobalAlertTitle,
17
+ type GlobalAlertTitleProps,
18
+ } from "../title/GlobalAlertTitle";
19
+
20
+ interface GlobalAlertProps
21
+ extends Omit<BaseAlert.RootProps, "type" | "global" | "data-color"> {
22
+ status: Exclude<BaseAlert.RootProps["status"], undefined>;
23
+ }
24
+
25
+ interface GlobalAlertComponent
26
+ extends React.ForwardRefExoticComponent<
27
+ GlobalAlertProps & React.RefAttributes<HTMLDivElement>
28
+ > {
29
+ /**
30
+ * @see 🏷️ {@link GlobalAlertHeaderProps}
31
+ * @example
32
+ * ```jsx
33
+ * <GlobalAlert>
34
+ * <GlobalAlert.Header>
35
+ * <GlobalAlert.Title>Info title</GlobalAlert.Title>
36
+ * </GlobalAlert.Header>
37
+ * </GlobalAlert>
38
+ * ```
39
+ */
40
+ Header: typeof GlobalAlertHeader;
41
+
42
+ /**
43
+ * Title component for GlobalAlert. Remember to use correct heading-level with the `as` prop.
44
+ * @see 🏷️ {@link GlobalAlertTitleProps}
45
+ * @example
46
+ * ```jsx
47
+ * <GlobalAlert>
48
+ * <GlobalAlert.Header>
49
+ * <GlobalAlert.Title as="h2">Info title</GlobalAlert.Title>
50
+ * </GlobalAlert.Header>
51
+ * </GlobalAlert>
52
+ * ```
53
+ */
54
+ Title: typeof GlobalAlertTitle;
55
+
56
+ /**
57
+ * @see 🏷️ {@link GlobalAlertContentProps}
58
+ * @example
59
+ * ```jsx
60
+ * <GlobalAlert>
61
+ * <GlobalAlert.Header>
62
+ * <GlobalAlert.Title>Info title</GlobalAlert.Title>
63
+ * </GlobalAlert.Header>
64
+ *
65
+ * <GlobalAlert.Content>Content</GlobalAlert.Content>
66
+ * </GlobalAlert>
67
+ * ```
68
+ */
69
+ Content: typeof GlobalAlertContent;
70
+
71
+ /**
72
+ * @see 🏷️ {@link GlobalAlertCloseProps}
73
+ * @example
74
+ * ```jsx
75
+ * <GlobalAlert>
76
+ * <GlobalAlert.Header>
77
+ * <GlobalAlert.Title>Info title</GlobalAlert.Title>
78
+ * <GlobalAlert.CloseButton onClick={() => alert("Closed!")} />
79
+ * </GlobalAlert.Header>
80
+ * </GlobalAlert>
81
+ * ```
82
+ */
83
+ CloseButton: typeof GlobalAlertCloseButton;
84
+ }
85
+
86
+ /**
87
+ * A component for displaying alerts about your app.
88
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/globalalert)
89
+ * @see 🏷️ {@link GlobalAlertProps}
90
+ * @example
91
+ * ```jsx
92
+ * <GlobalAlert status="error">
93
+ * <GlobalAlert.Header>
94
+ * <GlobalAlert.Title>Alert title</GlobalAlert.Title>
95
+ * </GlobalAlert.Header>
96
+ * <GlobalAlert.Content>Content</GlobalAlert.Content>
97
+ * </GlobalAlert>
98
+ * ```
99
+ */
100
+ export const GlobalAlert = forwardRef<HTMLDivElement, GlobalAlertProps>(
101
+ (props: GlobalAlertProps, forwardedRef) => {
102
+ return (
103
+ <BaseAlert.Root
104
+ ref={forwardedRef}
105
+ role="alert"
106
+ {...props}
107
+ type="strong"
108
+ global
109
+ />
110
+ );
111
+ },
112
+ ) as GlobalAlertComponent;
113
+
114
+ GlobalAlert.Header = GlobalAlertHeader;
115
+ GlobalAlert.Title = GlobalAlertTitle;
116
+ GlobalAlert.Content = GlobalAlertContent;
117
+ GlobalAlert.CloseButton = GlobalAlertCloseButton;
118
+
119
+ export default GlobalAlert;
120
+ export {
121
+ GlobalAlertCloseButton,
122
+ GlobalAlertContent,
123
+ GlobalAlertHeader,
124
+ GlobalAlertTitle,
125
+ };
126
+ export type {
127
+ GlobalAlertCloseButtonProps,
128
+ GlobalAlertContentProps,
129
+ GlobalAlertHeaderProps,
130
+ GlobalAlertProps,
131
+ GlobalAlertTitleProps,
132
+ };
@@ -0,0 +1,20 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type GlobalAlertTitleProps = BaseAlert.TitleProps;
4
+
5
+ /**
6
+ * Title component for GlobalAlert. Remember to use correct heading-level with the `as` prop.
7
+ * @see 🏷️ {@link GlobalAlertTitleProps}
8
+ * @example
9
+ * ```jsx
10
+ * <GlobalAlert>
11
+ * <GlobalAlert.Header>
12
+ * <GlobalAlert.Title as="h2">Info title</GlobalAlert.Title>
13
+ * </GlobalAlert.Header>
14
+ * </GlobalAlert>
15
+ * ```
16
+ */
17
+ const GlobalAlertTitle = BaseAlert.Title;
18
+
19
+ export { GlobalAlertTitle };
20
+ export type { GlobalAlertTitleProps };
@@ -0,0 +1,21 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type InfoCardContentProps = BaseAlert.ContentProps;
4
+
5
+ /**
6
+ * @see 🏷️ {@link InfoCardContentProps}
7
+ * @example
8
+ * ```jsx
9
+ * <InfoCard>
10
+ * <InfoCard.Header>
11
+ * <InfoCard.Title>Info title</InfoCard.Title>
12
+ * </InfoCard.Header>
13
+ *
14
+ * <InfoCard.Content>Content</InfoCard.Content>
15
+ * </InfoCard>
16
+ * ```
17
+ */
18
+ const InfoCardContent = BaseAlert.Content;
19
+
20
+ export { InfoCardContent };
21
+ export type { InfoCardContentProps };
@@ -0,0 +1,19 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type InfoCardHeaderProps = BaseAlert.HeaderProps;
4
+
5
+ /**
6
+ * @see 🏷️ {@link InfoCardHeaderProps}
7
+ * @example
8
+ * ```jsx
9
+ * <InfoCard>
10
+ * <InfoCard.Header icon={<InformationSquareIcon aria-hidden />}>
11
+ * <InfoCard.Title>Info title</InfoCard.Title>
12
+ * </InfoCard.Header>
13
+ * </InfoCard>
14
+ * ```
15
+ */
16
+ const InfoCardHeader = BaseAlert.Header;
17
+
18
+ export { InfoCardHeader };
19
+ export type { InfoCardHeaderProps };
@@ -0,0 +1,14 @@
1
+ "use client";
2
+ export {
3
+ InfoCard,
4
+ InfoCardHeader,
5
+ InfoCardTitle,
6
+ InfoCardContent,
7
+ } from "./root/InfoCardRoot";
8
+
9
+ export type {
10
+ InfoCardProps,
11
+ InfoCardHeaderProps,
12
+ InfoCardTitleProps,
13
+ InfoCardContentProps,
14
+ } from "./root/InfoCardRoot";
@@ -0,0 +1,123 @@
1
+ import React, { forwardRef } from "react";
2
+ import { BaseAlert } from "../../base-alert";
3
+ import {
4
+ InfoCardContent,
5
+ type InfoCardContentProps,
6
+ } from "../content/InfoCardContent";
7
+ import {
8
+ InfoCardHeader,
9
+ type InfoCardHeaderProps,
10
+ } from "../header/InfoCardHeader";
11
+ import { InfoCardTitle, type InfoCardTitleProps } from "../title/InfoCardTitle";
12
+
13
+ type InfoCardProps = Omit<
14
+ BaseAlert.RootProps,
15
+ "type" | "global" | "status" | "as"
16
+ > & {
17
+ /**
18
+ * Changes the HTML element used for the root element.
19
+ *
20
+ * **When using `section`, provide either `aria-label` or `aria-labelledby` for better accessibility.**
21
+ * `axe-core` might warn about unique landmarks if you have multiple InfoCards on page with the same label.
22
+ * In those cases consider updating to unique `aria-label` or `aria-labelledby` props.
23
+ * @see [📝 Landmarks unique](https://dequeuniversity.com/rules/axe/4.6/landmark-unique)
24
+ * @default "div"
25
+ */
26
+ as?: "div" | "section";
27
+ };
28
+
29
+ interface InfoCardComponent
30
+ extends React.ForwardRefExoticComponent<
31
+ InfoCardProps & React.RefAttributes<HTMLDivElement>
32
+ > {
33
+ /**
34
+ * @see 🏷️ {@link InfoCardHeaderProps}
35
+ * @example
36
+ * ```jsx
37
+ * <InfoCard>
38
+ * <InfoCard.Header icon={<InformationSquareIcon aria-hidden />}>
39
+ * <InfoCard.Title>Info title</InfoCard.Title>
40
+ * </InfoCard.Header>
41
+ * </InfoCard>
42
+ * ```
43
+ */
44
+ Header: typeof InfoCardHeader;
45
+
46
+ /**
47
+ * Title component for InfoCard. Remember to use correct heading-level with the `as` prop.
48
+ * @see 🏷️ {@link InfoCardTitleProps}
49
+ * @example
50
+ * ```jsx
51
+ * <InfoCard>
52
+ * <InfoCard.Header>
53
+ * <InfoCard.Title as="h2">Info title</InfoCard.Title>
54
+ * </InfoCard.Header>
55
+ * </InfoCard>
56
+ * ```
57
+ */
58
+ Title: typeof InfoCardTitle;
59
+
60
+ /**
61
+ * @see 🏷️ {@link InfoCardContentProps}
62
+ * @example
63
+ * ```jsx
64
+ * <InfoCard>
65
+ * <InfoCard.Header>
66
+ * <InfoCard.Title>Info title</InfoCard.Title>
67
+ * </InfoCard.Header>
68
+ *
69
+ * <InfoCard.Content>Content</InfoCard.Content>
70
+ * </InfoCard>
71
+ * ```
72
+ */
73
+ Content: typeof InfoCardContent;
74
+ }
75
+
76
+ /**
77
+ * A component for displaying informational content in a card format.
78
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/infocard)
79
+ * @see 🏷️ {@link InfoCardProps}
80
+ * @example
81
+ * ```jsx
82
+ * <InfoCard data-color="info">
83
+ * <InfoCard.Header icon={<InformationSquareIcon aria-hidden />}>
84
+ * <InfoCard.Title>Info title</InfoCard.Title>
85
+ * </InfoCard.Header>
86
+ * <InfoCard.Content>Content</InfoCard.Content>
87
+ * </InfoCard>
88
+ * ```
89
+ */
90
+ export const InfoCard = forwardRef<HTMLDivElement, InfoCardProps>(
91
+ (
92
+ {
93
+ "data-color": dataColor = "info",
94
+ as = "div",
95
+ ...restProps
96
+ }: InfoCardProps,
97
+ forwardedRef,
98
+ ) => {
99
+ return (
100
+ <BaseAlert.Root
101
+ ref={forwardedRef}
102
+ data-color={dataColor}
103
+ {...restProps}
104
+ type="moderate"
105
+ global={false}
106
+ as={as}
107
+ />
108
+ );
109
+ },
110
+ ) as InfoCardComponent;
111
+
112
+ InfoCard.Header = InfoCardHeader;
113
+ InfoCard.Title = InfoCardTitle;
114
+ InfoCard.Content = InfoCardContent;
115
+
116
+ export default InfoCard;
117
+ export { InfoCardContent, InfoCardHeader, InfoCardTitle };
118
+ export type {
119
+ InfoCardProps,
120
+ InfoCardHeaderProps,
121
+ InfoCardTitleProps,
122
+ InfoCardContentProps,
123
+ };
@@ -0,0 +1,20 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type InfoCardTitleProps = BaseAlert.TitleProps;
4
+
5
+ /**
6
+ * Title component for InfoCard. Remember to use correct heading-level with the `as` prop.
7
+ * @see 🏷️ {@link InfoCardTitleProps}
8
+ * @example
9
+ * ```jsx
10
+ * <InfoCard>
11
+ * <InfoCard.Header>
12
+ * <InfoCard.Title as="h2">Info title</InfoCard.Title>
13
+ * </InfoCard.Header>
14
+ * </InfoCard>
15
+ * ```
16
+ */
17
+ const InfoCardTitle = BaseAlert.Title;
18
+
19
+ export { InfoCardTitle };
20
+ export type { InfoCardTitleProps };
@@ -0,0 +1,20 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type LocalAlertCloseButtonProps = BaseAlert.CloseButtonProps;
4
+
5
+ /**
6
+ * @see 🏷️ {@link LocalAlertCloseButtonProps}
7
+ * @example
8
+ * ```jsx
9
+ * <LocalAlert>
10
+ * <LocalAlert.Header>
11
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
12
+ * <LocalAlert.CloseButton onClick={() => alert("Closed!")} />
13
+ * </LocalAlert.Header>
14
+ * </LocalAlert>
15
+ * ```
16
+ */
17
+ const LocalAlertCloseButton = BaseAlert.CloseButton;
18
+
19
+ export { LocalAlertCloseButton };
20
+ export type { LocalAlertCloseButtonProps };
@@ -0,0 +1,21 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type LocalAlertContentProps = BaseAlert.ContentProps;
4
+
5
+ /**
6
+ * @see 🏷️ {@link LocalAlertContentProps}
7
+ * @example
8
+ * ```jsx
9
+ * <LocalAlert>
10
+ * <LocalAlert.Header>
11
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
12
+ * </LocalAlert.Header>
13
+ *
14
+ * <LocalAlert.Content>Content</LocalAlert.Content>
15
+ * </LocalAlert>
16
+ * ```
17
+ */
18
+ const LocalAlertContent = BaseAlert.Content;
19
+
20
+ export { LocalAlertContent };
21
+ export type { LocalAlertContentProps };
@@ -0,0 +1,24 @@
1
+ import React, { forwardRef } from "react";
2
+ import { BaseAlert } from "../../base-alert";
3
+
4
+ type LocalAlertHeaderProps = Omit<BaseAlert.HeaderProps, "icon">;
5
+
6
+ /**
7
+ * @see 🏷️ {@link LocalAlertHeaderProps}
8
+ * @example
9
+ * ```jsx
10
+ * <LocalAlert>
11
+ * <LocalAlert.Header>
12
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
13
+ * </LocalAlert.Header>
14
+ * </LocalAlert>
15
+ * ```
16
+ */
17
+ const LocalAlertHeader = forwardRef<HTMLDivElement, LocalAlertHeaderProps>(
18
+ (props, forwardedRef) => {
19
+ return <BaseAlert.Header ref={forwardedRef} {...props} />;
20
+ },
21
+ );
22
+
23
+ export { LocalAlertHeader };
24
+ export type { LocalAlertHeaderProps };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ export {
3
+ LocalAlert,
4
+ LocalAlertHeader,
5
+ LocalAlertTitle,
6
+ LocalAlertContent,
7
+ LocalAlertCloseButton,
8
+ } from "./root/LocalAlertRoot";
9
+
10
+ export type {
11
+ LocalAlertProps,
12
+ LocalAlertHeaderProps,
13
+ LocalAlertTitleProps,
14
+ LocalAlertContentProps,
15
+ LocalAlertCloseButtonProps,
16
+ } from "./root/LocalAlertRoot";
@@ -0,0 +1,133 @@
1
+ import React, { forwardRef } from "react";
2
+ import { BaseAlert } from "../../base-alert";
3
+ import {
4
+ LocalAlertCloseButton,
5
+ type LocalAlertCloseButtonProps,
6
+ } from "../close-button/LocalAlertCloseButton";
7
+ import {
8
+ LocalAlertContent,
9
+ type LocalAlertContentProps,
10
+ } from "../content/LocalAlertContent";
11
+ import {
12
+ LocalAlertHeader,
13
+ type LocalAlertHeaderProps,
14
+ } from "../header/LocalAlertHeader";
15
+ import {
16
+ LocalAlertTitle,
17
+ type LocalAlertTitleProps,
18
+ } from "../title/LocalAlertTitle";
19
+
20
+ interface LocalAlertProps
21
+ extends Omit<BaseAlert.RootProps, "type" | "global" | "data-color"> {
22
+ status: Exclude<BaseAlert.RootProps["status"], undefined>;
23
+ }
24
+
25
+ interface LocalAlertComponent
26
+ extends React.ForwardRefExoticComponent<
27
+ LocalAlertProps & React.RefAttributes<HTMLDivElement>
28
+ > {
29
+ /**
30
+ * @see 🏷️ {@link LocalAlertHeaderProps}
31
+ * @example
32
+ * ```jsx
33
+ * <LocalAlert>
34
+ * <LocalAlert.Header>
35
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
36
+ * </LocalAlert.Header>
37
+ * </LocalAlert>
38
+ * ```
39
+ */
40
+ Header: typeof LocalAlertHeader;
41
+
42
+ /**
43
+ * Title component for LocalAlert. Remember to use correct heading-level with the `as` prop.
44
+ * @see 🏷️ {@link LocalAlertTitleProps}
45
+ * @example
46
+ * ```jsx
47
+ * <LocalAlert>
48
+ * <LocalAlert.Header>
49
+ * <LocalAlert.Title as="h2">Info title</LocalAlert.Title>
50
+ * </LocalAlert.Header>
51
+ * </LocalAlert>
52
+ * ```
53
+ */
54
+ Title: typeof LocalAlertTitle;
55
+
56
+ /**
57
+ * @see 🏷️ {@link LocalAlertContentProps}
58
+ * @example
59
+ * ```jsx
60
+ * <LocalAlert>
61
+ * <LocalAlert.Header>
62
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
63
+ * </LocalAlert.Header>
64
+ *
65
+ * <LocalAlert.Content>Content</LocalAlert.Content>
66
+ * </LocalAlert>
67
+ * ```
68
+ */
69
+ Content: typeof LocalAlertContent;
70
+
71
+ /**
72
+ * @see 🏷️ {@link LocalAlertCloseProps}
73
+ * @example
74
+ * ```jsx
75
+ * <LocalAlert>
76
+ * <LocalAlert.Header>
77
+ * <LocalAlert.Title>Info title</LocalAlert.Title>
78
+ * <LocalAlert.CloseButton onClick={() => alert("Closed!")} />
79
+ * </LocalAlert.Header>
80
+ * </LocalAlert>
81
+ * ```
82
+ */
83
+ CloseButton: typeof LocalAlertCloseButton;
84
+ }
85
+
86
+ /**
87
+ * A component for displaying important messages about a certain part of the page.
88
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/localalert)
89
+ * @see 🏷️ {@link LocalAlertProps}
90
+ * @example
91
+ * ```jsx
92
+ * <LocalAlert status="error">
93
+ * <LocalAlert.Header>
94
+ * <LocalAlert.Title>Alert title</LocalAlert.Title>
95
+ * </LocalAlert.Header>
96
+ * <LocalAlert.Content>Content</LocalAlert.Content>
97
+ * </LocalAlert>
98
+ * ```
99
+ */
100
+ export const LocalAlert = forwardRef<HTMLDivElement, LocalAlertProps>(
101
+ ({ status, ...restProps }: LocalAlertProps, forwardedRef) => {
102
+ return (
103
+ <BaseAlert.Root
104
+ ref={forwardedRef}
105
+ role="alert"
106
+ {...restProps}
107
+ type="strong"
108
+ global={false}
109
+ status={status}
110
+ />
111
+ );
112
+ },
113
+ ) as LocalAlertComponent;
114
+
115
+ LocalAlert.Header = LocalAlertHeader;
116
+ LocalAlert.Title = LocalAlertTitle;
117
+ LocalAlert.Content = LocalAlertContent;
118
+ LocalAlert.CloseButton = LocalAlertCloseButton;
119
+
120
+ export default LocalAlert;
121
+ export {
122
+ LocalAlertContent,
123
+ LocalAlertHeader,
124
+ LocalAlertTitle,
125
+ LocalAlertCloseButton,
126
+ };
127
+ export type {
128
+ LocalAlertProps,
129
+ LocalAlertContentProps,
130
+ LocalAlertHeaderProps,
131
+ LocalAlertTitleProps,
132
+ LocalAlertCloseButtonProps,
133
+ };
@@ -0,0 +1,20 @@
1
+ import { BaseAlert } from "../../base-alert";
2
+
3
+ type LocalAlertTitleProps = BaseAlert.TitleProps;
4
+
5
+ /**
6
+ * Title component for LocalAlert. Remember to use correct heading-level with the `as` prop.
7
+ * @see 🏷️ {@link LocalAlertTitleProps}
8
+ * @example
9
+ * ```jsx
10
+ * <LocalAlert>
11
+ * <LocalAlert.Header>
12
+ * <LocalAlert.Title as="h2">Info title</LocalAlert.Title>
13
+ * </LocalAlert.Header>
14
+ * </LocalAlert>
15
+ * ```
16
+ */
17
+ const LocalAlertTitle = BaseAlert.Title;
18
+
19
+ export { LocalAlertTitle };
20
+ export type { LocalAlertTitleProps };
@@ -1,11 +1,14 @@
1
1
  import React from "react";
2
2
  import { useRenameCSS } from "../../../theme/Theme";
3
+ import { useI18n } from "../../../util/i18n/i18n.hooks";
3
4
  import { useInputContext } from "../Input/Input.context";
4
5
  import filteredOptionsUtil from "./filtered-options-util";
5
6
 
6
7
  const NoSearchHitsMessage = () => {
7
8
  const { cn } = useRenameCSS();
8
9
 
10
+ const translate = useI18n("Combobox");
11
+
9
12
  const {
10
13
  inputProps: { id },
11
14
  } = useInputContext();
@@ -15,7 +18,7 @@ const NoSearchHitsMessage = () => {
15
18
  className={cn("navds-combobox__list-item--no-options")}
16
19
  id={filteredOptionsUtil.getNoHitsId(id)}
17
20
  >
18
- Ingen søketreff
21
+ {translate("noMatches")}
19
22
  </div>
20
23
  );
21
24
  };
package/src/index.ts CHANGED
@@ -163,6 +163,30 @@ export {
163
163
  type LinkCardIconProps,
164
164
  type LinkCardImageProps,
165
165
  } from "./link-card";
166
+ export { InlineMessage, type InlineMessageProps } from "./inline-message";
167
+ export {
168
+ GlobalAlert,
169
+ type GlobalAlertProps,
170
+ type GlobalAlertHeaderProps,
171
+ type GlobalAlertTitleProps,
172
+ type GlobalAlertContentProps,
173
+ type GlobalAlertCloseButtonProps,
174
+ } from "./alert/global-alert";
175
+ export {
176
+ InfoCard,
177
+ type InfoCardProps,
178
+ type InfoCardHeaderProps,
179
+ type InfoCardTitleProps,
180
+ type InfoCardContentProps,
181
+ } from "./alert/info-card";
182
+ export {
183
+ LocalAlert,
184
+ type LocalAlertProps,
185
+ type LocalAlertHeaderProps,
186
+ type LocalAlertTitleProps,
187
+ type LocalAlertContentProps,
188
+ type LocalAlertCloseButtonProps,
189
+ } from "./alert/local-alert";
166
190
 
167
191
  /**
168
192
  * Theming
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import {
3
+ CheckmarkCircleFillIcon,
4
+ ExclamationmarkTriangleFillIcon,
5
+ InformationSquareFillIcon,
6
+ XMarkOctagonFillIcon,
7
+ } from "@navikt/aksel-icons";
8
+ import { useRenameCSS } from "../../theme/Theme";
9
+
10
+ const STATUS_ICONS = {
11
+ info: InformationSquareFillIcon,
12
+ success: CheckmarkCircleFillIcon,
13
+ warning: ExclamationmarkTriangleFillIcon,
14
+ error: XMarkOctagonFillIcon,
15
+ } as const;
16
+
17
+ function InlineMessageIcon({
18
+ status,
19
+ }: {
20
+ status: "info" | "success" | "warning" | "error";
21
+ }) {
22
+ const { cn } = useRenameCSS();
23
+
24
+ if (!(status in STATUS_ICONS)) {
25
+ return null;
26
+ }
27
+
28
+ const Icon = STATUS_ICONS[status];
29
+
30
+ return <Icon className={cn("navds-inline-message__icon")} aria-hidden />;
31
+ }
32
+
33
+ export { InlineMessageIcon };
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ export { InlineMessage } from "./root/InlineMessage";
3
+ export type { InlineMessageProps } from "./root/InlineMessage";