@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,92 @@
1
+ import cl from "clsx";
2
+ import React, { forwardRef } from "react";
3
+ import { useRenameCSS, useThemeInternal } from "../../theme/Theme";
4
+ import { BodyShort } from "../../typography";
5
+ import { type OverridableComponent, useId } from "../../util";
6
+ import { useI18n } from "../../util/i18n/i18n.hooks";
7
+ import { InlineMessageIcon } from "../icon/InlineMessageIcon";
8
+
9
+ interface InlineMessageProps extends React.HTMLAttributes<HTMLDivElement> {
10
+ /**
11
+ * InlineMessage status.
12
+ */
13
+ status: "info" | "success" | "warning" | "error";
14
+ /**
15
+ * InlineMessage size.
16
+ * @default "medium"
17
+ */
18
+ size?: "medium" | "small";
19
+ }
20
+
21
+ /**
22
+ * InlineMessage is used to highlight short messages next to other content.
23
+ * @see [📝 Documentation](https://aksel.nav.no/komponenter/core/inline-message)
24
+ * @see 🏷️ {@link InlineMessageProps}
25
+ * @see [🤖 OverridableComponent](https://aksel.nav.no/grunnleggende/kode/overridablecomponent) support
26
+ * @example
27
+ * ```jsx
28
+ * <InlineMessage status="error">
29
+ * Inline Errormessage
30
+ * </InlineMessage>
31
+ * ```
32
+ *
33
+ * @example
34
+ * As a link
35
+ * ```jsx
36
+ * <InlineMessage status="error" as={Link} href="#">
37
+ * Inline Errormessage
38
+ * </InlineMessage>
39
+ * ```
40
+ */
41
+ export const InlineMessage: OverridableComponent<
42
+ InlineMessageProps,
43
+ HTMLDivElement
44
+ > = forwardRef(
45
+ (
46
+ {
47
+ as: Component = "div",
48
+ children,
49
+ className,
50
+ status,
51
+ size = "medium",
52
+ ...restProps
53
+ }: InlineMessageProps & { as?: React.ElementType },
54
+ forwardedRef,
55
+ ) => {
56
+ const { cn } = useRenameCSS();
57
+ const themeContext = useThemeInternal(false);
58
+
59
+ const translate = useI18n("global");
60
+ const statusId = useId();
61
+ const contentId = useId();
62
+
63
+ return (
64
+ <BodyShort
65
+ ref={forwardedRef}
66
+ className={cn("navds-inline-message", className)}
67
+ data-color={status === "error" ? "danger" : status}
68
+ {...restProps}
69
+ size={size}
70
+ as={Component}
71
+ data-size={size}
72
+ >
73
+ <InlineMessageIcon status={status} />
74
+ {status && (
75
+ <BodyShort id={statusId} aria-hidden visuallyHidden>
76
+ {`${translate(status)}: `}
77
+ </BodyShort>
78
+ )}
79
+ <span
80
+ data-color={themeContext?.color}
81
+ id={contentId}
82
+ aria-labelledby={cl(statusId, contentId)}
83
+ >
84
+ {children}
85
+ </span>
86
+ </BodyShort>
87
+ );
88
+ },
89
+ );
90
+
91
+ export default InlineMessage;
92
+ export type { InlineMessageProps };
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  FloatingFocusManager,
3
3
  autoUpdate,
4
- arrow as flArrow,
5
4
  flip,
6
5
  offset,
7
6
  safePolygon,
@@ -12,8 +11,8 @@ import {
12
11
  useHover,
13
12
  useInteractions,
14
13
  } from "@floating-ui/react";
15
- import React, { useRef, useState } from "react";
16
- import { useRenameCSS, useThemeInternal } from "../../theme/Theme";
14
+ import React, { useState } from "react";
15
+ import { useRenameCSS } from "../../theme/Theme";
17
16
  import { useMergeRefs } from "../../util/hooks/useMergeRefs";
18
17
  import { useI18n } from "../../util/i18n/i18n.hooks";
19
18
  import { usePeriodContext } from "../hooks/usePeriodContext";
@@ -57,28 +56,18 @@ const ClickablePeriod = React.memo(
57
56
  const { index } = useRowContext();
58
57
  const { firstFocus } = usePeriodContext();
59
58
  const { initiate, addFocusable } = useTimelineContext();
60
- const arrowRef = useRef<HTMLDivElement | null>(null);
61
- const translate = useI18n("Timeline");
62
59
 
63
- const themeContext = useThemeInternal(false);
64
- const showArrow = !themeContext?.isDarkside;
60
+ const translate = useI18n("Timeline");
65
61
 
66
- const {
67
- context,
68
- placement,
69
- middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
70
- refs,
71
- floatingStyles,
72
- } = useFloating({
62
+ const { context, placement, refs, floatingStyles } = useFloating({
73
63
  placement: restProps?.placement ?? "top",
74
64
  open,
75
65
  onOpenChange: (_open) => setOpen(_open),
76
66
  whileElementsMounted: autoUpdate,
77
67
  middleware: [
78
- offset(showArrow ? 16 : 8),
68
+ offset(8),
79
69
  shift(),
80
70
  flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
81
- flArrow({ element: arrowRef, padding: 5 }),
82
71
  ],
83
72
  });
84
73
 
@@ -99,13 +88,6 @@ const ClickablePeriod = React.memo(
99
88
 
100
89
  const mergedRef = useMergeRefs(refs.setReference, periodRef);
101
90
 
102
- const staticSide = {
103
- top: "bottom",
104
- right: "left",
105
- bottom: "top",
106
- left: "right",
107
- }[placement.split("-")[0]];
108
-
109
91
  const label = ariaLabel(start, end, status, statusLabel, translate);
110
92
 
111
93
  return (
@@ -175,17 +157,6 @@ const ClickablePeriod = React.memo(
175
157
  style={floatingStyles}
176
158
  >
177
159
  {children}
178
- {showArrow && (
179
- <div
180
- ref={arrowRef}
181
- style={{
182
- ...(arrowX != null ? { left: arrowX } : {}),
183
- ...(arrowY != null ? { top: arrowY } : {}),
184
- ...(staticSide ? { [staticSide]: "-0.5rem" } : {}),
185
- }}
186
- className={cn("navds-timeline__popover-arrow")}
187
- />
188
- )}
189
160
  </div>
190
161
  </FloatingFocusManager>
191
162
  )}
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  FloatingFocusManager,
3
3
  autoUpdate,
4
- arrow as flArrow,
5
4
  flip,
6
5
  offset,
7
6
  safePolygon,
@@ -13,8 +12,8 @@ import {
13
12
  useInteractions,
14
13
  } from "@floating-ui/react";
15
14
  import { format } from "date-fns";
16
- import React, { forwardRef, useRef, useState } from "react";
17
- import { useRenameCSS, useThemeInternal } from "../../theme/Theme";
15
+ import React, { forwardRef, useState } from "react";
16
+ import { useRenameCSS } from "../../theme/Theme";
18
17
  import { useMergeRefs } from "../../util/hooks/useMergeRefs";
19
18
  import { useI18n } from "../../util/i18n/i18n.hooks";
20
19
  import { useTimelineContext } from "../hooks/useTimelineContext";
@@ -37,16 +36,13 @@ export const PinInternal = forwardRef<HTMLButtonElement, TimelinePinProps>(
37
36
  const { cn } = useRenameCSS();
38
37
  const { startDate, endDate, direction } = useTimelineContext();
39
38
  const [open, setOpen] = useState(false);
40
- const arrowRef = useRef<HTMLDivElement | null>(null);
41
- const translate = useI18n("Timeline");
42
39
 
43
- const themeContext = useThemeInternal(false);
44
- const showArrow = !themeContext?.isDarkside;
40
+ const translate = useI18n("Timeline");
45
41
 
46
42
  const {
47
43
  context,
48
44
  placement,
49
- middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
45
+
50
46
  refs,
51
47
  floatingStyles,
52
48
  } = useFloating({
@@ -55,10 +51,9 @@ export const PinInternal = forwardRef<HTMLButtonElement, TimelinePinProps>(
55
51
  onOpenChange: (_open) => setOpen(_open),
56
52
  whileElementsMounted: autoUpdate,
57
53
  middleware: [
58
- offset(showArrow ? 16 : 8),
54
+ offset(8),
59
55
  shift(),
60
56
  flip({ padding: 5, fallbackPlacements: ["bottom", "top"] }),
61
- flArrow({ element: arrowRef, padding: 5 }),
62
57
  ],
63
58
  });
64
59
 
@@ -79,13 +74,6 @@ export const PinInternal = forwardRef<HTMLButtonElement, TimelinePinProps>(
79
74
 
80
75
  const mergedRef = useMergeRefs(refs.setReference, ref);
81
76
 
82
- const staticSide = {
83
- top: "bottom",
84
- right: "left",
85
- bottom: "top",
86
- left: "right",
87
- }[placement.split("-")[0]];
88
-
89
77
  const label = translate("Pin.pin", {
90
78
  date: format(date, translate("dateFormat")),
91
79
  });
@@ -132,17 +120,6 @@ export const PinInternal = forwardRef<HTMLButtonElement, TimelinePinProps>(
132
120
  style={floatingStyles}
133
121
  >
134
122
  {children}
135
- {showArrow && (
136
- <div
137
- ref={arrowRef}
138
- style={{
139
- ...(arrowX != null ? { left: arrowX } : {}),
140
- ...(arrowY != null ? { top: arrowY } : {}),
141
- ...(staticSide ? { [staticSide]: "-0.5rem" } : {}),
142
- }}
143
- className={cn("navds-timeline__popover-arrow")}
144
- />
145
- )}
146
123
  </div>
147
124
  </FloatingFocusManager>
148
125
  )}
@@ -8,15 +8,11 @@ export default {
8
8
  showLess: "Show less",
9
9
  readOnly: "Read-only",
10
10
  close: "Close",
11
- },
12
-
13
- Alert: {
14
- closeAlert: "Close alert",
15
- closeMessage: "Close message",
16
11
  error: "Error",
17
12
  info: "Information",
18
13
  success: "Success",
19
14
  warning: "Warning",
15
+ announcement: "Announcement",
20
16
  },
21
17
  Chips: {
22
18
  Removable: {
@@ -25,6 +21,7 @@ export default {
25
21
  },
26
22
  Combobox: {
27
23
  addOption: "Add",
24
+ noMatches: "No search hits",
28
25
  loading: "Searching…",
29
26
  maxSelected: "{selected} of max {limit} are selected.",
30
27
  },
@@ -11,15 +11,11 @@ export default {
11
11
  showLess: "Vis mindre",
12
12
  readOnly: "Skrivebeskyttet",
13
13
  close: "Lukk",
14
- },
15
-
16
- Alert: {
17
- closeAlert: "Lukk varsel",
18
- closeMessage: "Lukk melding",
19
14
  error: "Feil",
20
15
  info: "Informasjon",
21
16
  success: "Suksess",
22
17
  warning: "Advarsel",
18
+ announcement: "Kunngjøring",
23
19
  },
24
20
  Chips: {
25
21
  Removable: {
@@ -30,6 +26,7 @@ export default {
30
26
  Combobox: {
31
27
  /** The input value will be appended to the end of this text, e.g. `Legg til "input value"`. */
32
28
  addOption: "Legg til",
29
+ noMatches: "Ingen søketreff",
33
30
  /** Loader title */
34
31
  loading: "Søker…",
35
32
  maxSelected: "{selected} av maks {limit} er valgt.",
@@ -8,15 +8,11 @@ export default {
8
8
  showLess: "Vis mindre",
9
9
  readOnly: "Skrivebeskytta",
10
10
  close: "Lukk",
11
- },
12
-
13
- Alert: {
14
- closeAlert: "Lukk varsel",
15
- closeMessage: "Lukk melding",
16
11
  error: "Feil",
17
12
  info: "Informasjon",
18
13
  success: "Suksess",
19
14
  warning: "Åtvaring",
15
+ announcement: "Kunngjering",
20
16
  },
21
17
  Chips: {
22
18
  Removable: {
@@ -25,6 +21,7 @@ export default {
25
21
  },
26
22
  Combobox: {
27
23
  addOption: "Legg til",
24
+ noMatches: "Ingen søketreff",
28
25
  loading: "Søker…",
29
26
  maxSelected: "{selected} av maks {limit} er valt.",
30
27
  },
@@ -1,5 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import React from "react";
3
- export declare function renderStoriesForChromatic(stories: Record<string, {
4
- render?: (...args: any[]) => React.ReactNode;
5
- } | React.FunctionComponent>): StoryObj;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.renderStoriesForChromatic = renderStoriesForChromatic;
7
- const react_1 = __importDefault(require("react"));
8
- function renderStoriesForChromatic(stories) {
9
- return {
10
- render: (...args) => (react_1.default.createElement(react_1.default.Fragment, null, Object.entries(stories).map(([storyName, Story]) => {
11
- var _a;
12
- return (react_1.default.createElement("div", { key: storyName },
13
- react_1.default.createElement("h2", { className: "storyheading" }, storyName),
14
- typeof Story === "function" ? react_1.default.createElement(Story, null) : (_a = Story.render) === null || _a === void 0 ? void 0 : _a.call(Story, ...args)));
15
- }))),
16
- parameters: {
17
- chromatic: { disable: false },
18
- },
19
- };
20
- }
21
- //# sourceMappingURL=renderStoriesForChromatic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderStoriesForChromatic.js","sourceRoot":"","sources":["../../src/util/renderStoriesForChromatic.tsx"],"names":[],"mappings":";;;;;AAIA,8DAqBC;AAxBD,kDAA0B;AAG1B,SAAgB,yBAAyB,CACvC,OAGC;IAED,OAAO;QACL,MAAM,EAAE,CAAC,GAAG,IAA0C,EAAE,EAAE,CAAC,CACzD,8DACG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;;YAAC,OAAA,CACnD,uCAAK,GAAG,EAAE,SAAS;gBACjB,sCAAI,SAAS,EAAC,cAAc,IAAE,SAAS,CAAM;gBAC5C,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,8BAAC,KAAK,OAAG,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,MAAM,sDAAG,GAAG,IAAI,CAAC,CAC9D,CACP,CAAA;SAAA,CAAC,CACD,CACJ;QACD,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC9B;KACF,CAAC;AACJ,CAAC"}
@@ -1,5 +0,0 @@
1
- import { StoryObj } from "@storybook/react-vite";
2
- import React from "react";
3
- export declare function renderStoriesForChromatic(stories: Record<string, {
4
- render?: (...args: any[]) => React.ReactNode;
5
- } | React.FunctionComponent>): StoryObj;
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- export function renderStoriesForChromatic(stories) {
3
- return {
4
- render: (...args) => (React.createElement(React.Fragment, null, Object.entries(stories).map(([storyName, Story]) => {
5
- var _a;
6
- return (React.createElement("div", { key: storyName },
7
- React.createElement("h2", { className: "storyheading" }, storyName),
8
- typeof Story === "function" ? React.createElement(Story, null) : (_a = Story.render) === null || _a === void 0 ? void 0 : _a.call(Story, ...args)));
9
- }))),
10
- parameters: {
11
- chromatic: { disable: false },
12
- },
13
- };
14
- }
15
- //# sourceMappingURL=renderStoriesForChromatic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderStoriesForChromatic.js","sourceRoot":"","sources":["../../src/util/renderStoriesForChromatic.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,UAAU,yBAAyB,CACvC,OAGC;IAED,OAAO;QACL,MAAM,EAAE,CAAC,GAAG,IAA0C,EAAE,EAAE,CAAC,CACzD,0CACG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,EAAE;;YAAC,OAAA,CACnD,6BAAK,GAAG,EAAE,SAAS;gBACjB,4BAAI,SAAS,EAAC,cAAc,IAAE,SAAS,CAAM;gBAC5C,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,oBAAC,KAAK,OAAG,CAAC,CAAC,CAAC,MAAA,KAAK,CAAC,MAAM,sDAAG,GAAG,IAAI,CAAC,CAC9D,CACP,CAAA;SAAA,CAAC,CACD,CACJ;QACD,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE;SAC9B;KACF,CAAC;AACJ,CAAC"}
@@ -1,26 +0,0 @@
1
- import { Args, StoryObj } from "@storybook/react-vite";
2
- import React from "react";
3
- import { Renderer, StoryContext } from "storybook/internal/types";
4
-
5
- export function renderStoriesForChromatic(
6
- stories: Record<
7
- string,
8
- { render?: (...args: any[]) => React.ReactNode } | React.FunctionComponent
9
- >,
10
- ): StoryObj {
11
- return {
12
- render: (...args: [Args, StoryContext<Renderer, Args>]) => (
13
- <>
14
- {Object.entries(stories).map(([storyName, Story]) => (
15
- <div key={storyName}>
16
- <h2 className="storyheading">{storyName}</h2>
17
- {typeof Story === "function" ? <Story /> : Story.render?.(...args)}
18
- </div>
19
- ))}
20
- </>
21
- ),
22
- parameters: {
23
- chromatic: { disable: false },
24
- },
25
- };
26
- }