@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.
- package/cjs/alert/Alert.js +2 -4
- package/cjs/alert/Alert.js.map +1 -1
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js +72 -0
- package/cjs/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.js +70 -0
- package/cjs/alert/base-alert/content/BaseAlertContent.js.map +1 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.js +77 -0
- package/cjs/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
- package/cjs/alert/base-alert/index.d.ts +1 -0
- package/cjs/alert/base-alert/index.js +39 -0
- package/cjs/alert/base-alert/index.js.map +1 -0
- package/cjs/alert/base-alert/namespace.d.ts +10 -0
- package/cjs/alert/base-alert/namespace.js +14 -0
- package/cjs/alert/base-alert/namespace.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js +11 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.js +65 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js +48 -0
- package/cjs/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.js +77 -0
- package/cjs/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js +19 -0
- package/cjs/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.js +20 -0
- package/cjs/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.js +54 -0
- package/cjs/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
- package/cjs/alert/global-alert/index.d.ts +2 -0
- package/cjs/alert/global-alert/index.js +11 -0
- package/cjs/alert/global-alert/index.js.map +1 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js +69 -0
- package/cjs/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.js +19 -0
- package/cjs/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
- package/cjs/alert/info-card/content/InfoCardContent.d.ts +18 -0
- package/cjs/alert/info-card/content/InfoCardContent.js +20 -0
- package/cjs/alert/info-card/content/InfoCardContent.js.map +1 -0
- package/cjs/alert/info-card/header/InfoCardHeader.d.ts +16 -0
- package/cjs/alert/info-card/header/InfoCardHeader.js +18 -0
- package/cjs/alert/info-card/header/InfoCardHeader.js.map +1 -0
- package/cjs/alert/info-card/index.d.ts +2 -0
- package/cjs/alert/info-card/index.js +10 -0
- package/cjs/alert/info-card/index.js.map +1 -0
- package/cjs/alert/info-card/root/InfoCardRoot.d.ts +76 -0
- package/cjs/alert/info-card/root/InfoCardRoot.js +78 -0
- package/cjs/alert/info-card/root/InfoCardRoot.js.map +1 -0
- package/cjs/alert/info-card/title/InfoCardTitle.d.ts +17 -0
- package/cjs/alert/info-card/title/InfoCardTitle.js +19 -0
- package/cjs/alert/info-card/title/InfoCardTitle.js.map +1 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js +19 -0
- package/cjs/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.js +20 -0
- package/cjs/alert/local-alert/content/LocalAlertContent.js.map +1 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.js +54 -0
- package/cjs/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
- package/cjs/alert/local-alert/index.d.ts +2 -0
- package/cjs/alert/local-alert/index.js +11 -0
- package/cjs/alert/local-alert/index.js.map +1 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.js +81 -0
- package/cjs/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.js +19 -0
- package/cjs/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
- package/cjs/date/Date.locale.d.ts +5 -0
- package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
- package/cjs/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +9 -1
- package/cjs/index.js.map +1 -1
- package/cjs/inline-message/icon/InlineMessageIcon.d.ts +5 -0
- package/cjs/inline-message/icon/InlineMessageIcon.js +24 -0
- package/cjs/inline-message/icon/InlineMessageIcon.js.map +1 -0
- package/cjs/inline-message/index.d.ts +2 -0
- package/cjs/inline-message/index.js +7 -0
- package/cjs/inline-message/index.js.map +1 -0
- package/cjs/inline-message/root/InlineMessage.d.ts +36 -0
- package/cjs/inline-message/root/InlineMessage.js +91 -0
- package/cjs/inline-message/root/InlineMessage.js.map +1 -0
- package/cjs/timeline/period/ClickablePeriod.js +3 -15
- package/cjs/timeline/period/ClickablePeriod.js.map +1 -1
- package/cjs/timeline/pin/PinInternal.js +3 -15
- package/cjs/timeline/pin/PinInternal.js.map +1 -1
- package/cjs/util/i18n/locales/en.d.ts +2 -4
- package/cjs/util/i18n/locales/en.js +2 -4
- package/cjs/util/i18n/locales/en.js.map +1 -1
- package/cjs/util/i18n/locales/nb.d.ts +4 -6
- package/cjs/util/i18n/locales/nb.js +4 -6
- package/cjs/util/i18n/locales/nb.js.map +1 -1
- package/cjs/util/i18n/locales/nn.d.ts +2 -4
- package/cjs/util/i18n/locales/nn.js +2 -4
- package/cjs/util/i18n/locales/nn.js.map +1 -1
- package/esm/alert/Alert.js +2 -4
- package/esm/alert/Alert.js.map +1 -1
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.d.ts +17 -0
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js +36 -0
- package/esm/alert/base-alert/close-button/BaseAlertCloseButton.js.map +1 -0
- package/esm/alert/base-alert/content/BaseAlertContent.d.ts +20 -0
- package/esm/alert/base-alert/content/BaseAlertContent.js +34 -0
- package/esm/alert/base-alert/content/BaseAlertContent.js.map +1 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.d.ts +22 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.js +41 -0
- package/esm/alert/base-alert/header/BaseAlertHeader.js.map +1 -0
- package/esm/alert/base-alert/index.d.ts +1 -0
- package/esm/alert/base-alert/index.js +3 -0
- package/esm/alert/base-alert/index.js.map +1 -0
- package/esm/alert/base-alert/namespace.d.ts +10 -0
- package/esm/alert/base-alert/namespace.js +6 -0
- package/esm/alert/base-alert/namespace.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.d.ts +12 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js +7 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.context.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.d.ts +43 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.js +29 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.js.map +1 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.d.ts +9 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.js +42 -0
- package/esm/alert/base-alert/root/BaseAlertRoot.utils.js.map +1 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.d.ts +24 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.js +38 -0
- package/esm/alert/base-alert/title/BaseAlertTitle.js.map +1 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.d.ts +17 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js +16 -0
- package/esm/alert/global-alert/close-button/GlobalAlertCloseButton.js.map +1 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.d.ts +18 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.js +17 -0
- package/esm/alert/global-alert/content/GlobalAlertContent.js.map +1 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.d.ts +17 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.js +18 -0
- package/esm/alert/global-alert/header/GlobalAlertHeader.js.map +1 -0
- package/esm/alert/global-alert/index.d.ts +2 -0
- package/esm/alert/global-alert/index.js +3 -0
- package/esm/alert/global-alert/index.js.map +1 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.d.ts +81 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js +30 -0
- package/esm/alert/global-alert/root/GlobalAlertRoot.js.map +1 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.d.ts +17 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.js +16 -0
- package/esm/alert/global-alert/title/GlobalAlertTitle.js.map +1 -0
- package/esm/alert/info-card/content/InfoCardContent.d.ts +18 -0
- package/esm/alert/info-card/content/InfoCardContent.js +17 -0
- package/esm/alert/info-card/content/InfoCardContent.js.map +1 -0
- package/esm/alert/info-card/header/InfoCardHeader.d.ts +16 -0
- package/esm/alert/info-card/header/InfoCardHeader.js +15 -0
- package/esm/alert/info-card/header/InfoCardHeader.js.map +1 -0
- package/esm/alert/info-card/index.d.ts +2 -0
- package/esm/alert/info-card/index.js +3 -0
- package/esm/alert/info-card/index.js.map +1 -0
- package/esm/alert/info-card/root/InfoCardRoot.d.ts +76 -0
- package/esm/alert/info-card/root/InfoCardRoot.js +40 -0
- package/esm/alert/info-card/root/InfoCardRoot.js.map +1 -0
- package/esm/alert/info-card/title/InfoCardTitle.d.ts +17 -0
- package/esm/alert/info-card/title/InfoCardTitle.js +16 -0
- package/esm/alert/info-card/title/InfoCardTitle.js.map +1 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.d.ts +17 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js +16 -0
- package/esm/alert/local-alert/close-button/LocalAlertCloseButton.js.map +1 -0
- package/esm/alert/local-alert/content/LocalAlertContent.d.ts +18 -0
- package/esm/alert/local-alert/content/LocalAlertContent.js +17 -0
- package/esm/alert/local-alert/content/LocalAlertContent.js.map +1 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.d.ts +17 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.js +18 -0
- package/esm/alert/local-alert/header/LocalAlertHeader.js.map +1 -0
- package/esm/alert/local-alert/index.d.ts +2 -0
- package/esm/alert/local-alert/index.js +3 -0
- package/esm/alert/local-alert/index.js.map +1 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.d.ts +81 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.js +42 -0
- package/esm/alert/local-alert/root/LocalAlertRoot.js.map +1 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.d.ts +17 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.js +16 -0
- package/esm/alert/local-alert/title/LocalAlertTitle.js.map +1 -0
- package/esm/date/Date.locale.d.ts +5 -0
- package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js +3 -1
- package/esm/form/combobox/FilteredOptions/NoSearchHitsMessage.js.map +1 -1
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -0
- package/esm/index.js.map +1 -1
- package/esm/inline-message/icon/InlineMessageIcon.d.ts +5 -0
- package/esm/inline-message/icon/InlineMessageIcon.js +19 -0
- package/esm/inline-message/icon/InlineMessageIcon.js.map +1 -0
- package/esm/inline-message/index.d.ts +2 -0
- package/esm/inline-message/index.js +3 -0
- package/esm/inline-message/index.js.map +1 -0
- package/esm/inline-message/root/InlineMessage.d.ts +36 -0
- package/esm/inline-message/root/InlineMessage.js +52 -0
- package/esm/inline-message/root/InlineMessage.js.map +1 -0
- package/esm/timeline/period/ClickablePeriod.js +6 -18
- package/esm/timeline/period/ClickablePeriod.js.map +1 -1
- package/esm/timeline/pin/PinInternal.js +6 -18
- package/esm/timeline/pin/PinInternal.js.map +1 -1
- package/esm/util/i18n/locales/en.d.ts +2 -4
- package/esm/util/i18n/locales/en.js +2 -4
- package/esm/util/i18n/locales/en.js.map +1 -1
- package/esm/util/i18n/locales/nb.d.ts +4 -6
- package/esm/util/i18n/locales/nb.js +4 -6
- package/esm/util/i18n/locales/nb.js.map +1 -1
- package/esm/util/i18n/locales/nn.d.ts +2 -4
- package/esm/util/i18n/locales/nn.js +2 -4
- package/esm/util/i18n/locales/nn.js.map +1 -1
- package/package.json +45 -4
- package/src/alert/Alert.tsx +2 -10
- package/src/alert/base-alert/close-button/BaseAlertCloseButton.tsx +44 -0
- package/src/alert/base-alert/content/BaseAlertContent.tsx +43 -0
- package/src/alert/base-alert/header/BaseAlertHeader.tsx +61 -0
- package/src/alert/base-alert/index.ts +2 -0
- package/src/alert/base-alert/namespace.ts +11 -0
- package/src/alert/base-alert/root/BaseAlertRoot.context.tsx +17 -0
- package/src/alert/base-alert/root/BaseAlertRoot.tsx +102 -0
- package/src/alert/base-alert/root/BaseAlertRoot.utils.tsx +67 -0
- package/src/alert/base-alert/title/BaseAlertTitle.tsx +63 -0
- package/src/alert/global-alert/close-button/GlobalAlertCloseButton.tsx +20 -0
- package/src/alert/global-alert/content/GlobalAlertContent.tsx +21 -0
- package/src/alert/global-alert/header/GlobalAlertHeader.tsx +24 -0
- package/src/alert/global-alert/index.ts +16 -0
- package/src/alert/global-alert/root/GlobalAlertRoot.tsx +132 -0
- package/src/alert/global-alert/title/GlobalAlertTitle.tsx +20 -0
- package/src/alert/info-card/content/InfoCardContent.tsx +21 -0
- package/src/alert/info-card/header/InfoCardHeader.tsx +19 -0
- package/src/alert/info-card/index.ts +14 -0
- package/src/alert/info-card/root/InfoCardRoot.tsx +123 -0
- package/src/alert/info-card/title/InfoCardTitle.tsx +20 -0
- package/src/alert/local-alert/close-button/LocalAlertCloseButton.tsx +20 -0
- package/src/alert/local-alert/content/LocalAlertContent.tsx +21 -0
- package/src/alert/local-alert/header/LocalAlertHeader.tsx +24 -0
- package/src/alert/local-alert/index.ts +16 -0
- package/src/alert/local-alert/root/LocalAlertRoot.tsx +133 -0
- package/src/alert/local-alert/title/LocalAlertTitle.tsx +20 -0
- package/src/form/combobox/FilteredOptions/NoSearchHitsMessage.tsx +4 -1
- package/src/index.ts +24 -0
- package/src/inline-message/icon/InlineMessageIcon.tsx +33 -0
- package/src/inline-message/index.ts +3 -0
- package/src/inline-message/root/InlineMessage.tsx +92 -0
- package/src/timeline/period/ClickablePeriod.tsx +5 -34
- package/src/timeline/pin/PinInternal.tsx +5 -28
- package/src/util/i18n/locales/en.ts +2 -5
- package/src/util/i18n/locales/nb.ts +2 -5
- package/src/util/i18n/locales/nn.ts +2 -5
- package/cjs/util/renderStoriesForChromatic.d.ts +0 -5
- package/cjs/util/renderStoriesForChromatic.js +0 -21
- package/cjs/util/renderStoriesForChromatic.js.map +0 -1
- package/esm/util/renderStoriesForChromatic.d.ts +0 -5
- package/esm/util/renderStoriesForChromatic.js +0 -15
- package/esm/util/renderStoriesForChromatic.js.map +0 -1
- 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, {
|
|
16
|
-
import { useRenameCSS
|
|
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
|
|
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(
|
|
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,
|
|
17
|
-
import { useRenameCSS
|
|
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
|
|
44
|
-
const showArrow = !themeContext?.isDarkside;
|
|
40
|
+
const translate = useI18n("Timeline");
|
|
45
41
|
|
|
46
42
|
const {
|
|
47
43
|
context,
|
|
48
44
|
placement,
|
|
49
|
-
|
|
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(
|
|
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,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,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
|
-
}
|