@ndla/ui 56.0.192-alpha.0 → 56.0.194-alpha.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/dist/panda.buildinfo.json +10 -0
- package/dist/styles.css +53 -1
- package/es/Article/Article.mjs +1 -1
- package/es/Article/Article.mjs.map +1 -1
- package/es/Article/ArticleByline.mjs +1 -1
- package/es/Article/ArticleByline.mjs.map +1 -1
- package/es/AudioPlayer/AudioProgress.mjs.map +1 -1
- package/es/AudioPlayer/Controls.mjs +1 -1
- package/es/AudioPlayer/Controls.mjs.map +1 -1
- package/es/AudioPlayer/VolumeSlider.mjs.map +1 -1
- package/es/AudioPlayer/useAudioControls.mjs.map +1 -1
- package/es/Embed/ConceptEmbed.mjs +1 -1
- package/es/Embed/ConceptEmbed.mjs.map +1 -1
- package/es/Embed/EmbedWrapper.mjs +1 -1
- package/es/Embed/EmbedWrapper.mjs.map +1 -1
- package/es/Embed/GlossEmbed.mjs +1 -1
- package/es/Embed/GlossEmbed.mjs.map +1 -1
- package/es/Embed/UuDisclaimerEmbed.mjs +50 -15
- package/es/Embed/UuDisclaimerEmbed.mjs.map +1 -1
- package/es/FileList/FileList.mjs +1 -1
- package/es/FileList/FileList.mjs.map +1 -1
- package/es/Gloss/Gloss.mjs +1 -1
- package/es/Gloss/Gloss.mjs.map +1 -1
- package/es/TagSelector/TagSelector.mjs +3 -8
- package/es/TagSelector/TagSelector.mjs.map +1 -1
- package/es/i18n/useComponentTranslations.mjs +3 -3
- package/es/i18n/useComponentTranslations.mjs.map +1 -1
- package/lib/Article/Article.d.ts +4 -4
- package/lib/Article/Article.js +6 -6
- package/lib/Article/Article.js.map +1 -1
- package/lib/Article/ArticleByline.js +2 -2
- package/lib/Article/ArticleByline.js.map +1 -1
- package/lib/AudioPlayer/AudioProgress.d.ts +1 -1
- package/lib/AudioPlayer/AudioProgress.js.map +1 -1
- package/lib/AudioPlayer/Controls.js +2 -2
- package/lib/AudioPlayer/Controls.js.map +1 -1
- package/lib/AudioPlayer/VolumeSlider.d.ts +1 -1
- package/lib/AudioPlayer/VolumeSlider.js.map +1 -1
- package/lib/AudioPlayer/useAudioControls.d.ts +1 -1
- package/lib/AudioPlayer/useAudioControls.js.map +1 -1
- package/lib/Embed/ConceptEmbed.js +2 -2
- package/lib/Embed/ConceptEmbed.js.map +1 -1
- package/lib/Embed/EmbedWrapper.d.ts +1 -1
- package/lib/Embed/EmbedWrapper.js +2 -2
- package/lib/Embed/EmbedWrapper.js.map +1 -1
- package/lib/Embed/GlossEmbed.js +2 -2
- package/lib/Embed/GlossEmbed.js.map +1 -1
- package/lib/Embed/UuDisclaimerEmbed.js +49 -14
- package/lib/Embed/UuDisclaimerEmbed.js.map +1 -1
- package/lib/FileList/FileList.d.ts +2 -2
- package/lib/FileList/FileList.js +3 -3
- package/lib/FileList/FileList.js.map +1 -1
- package/lib/Gloss/Gloss.d.ts +2 -2
- package/lib/Gloss/Gloss.js +2 -2
- package/lib/Gloss/Gloss.js.map +1 -1
- package/lib/TagSelector/TagSelector.d.ts +4 -4
- package/lib/TagSelector/TagSelector.js +6 -4
- package/lib/TagSelector/TagSelector.js.map +1 -1
- package/lib/i18n/useComponentTranslations.d.ts +1 -1
- package/lib/i18n/useComponentTranslations.js +3 -3
- package/lib/i18n/useComponentTranslations.js.map +1 -1
- package/package.json +9 -9
- package/src/Article/Article.tsx +1 -1
- package/src/Article/ArticleByline.tsx +1 -1
- package/src/AudioPlayer/AudioProgress.tsx +1 -1
- package/src/AudioPlayer/Controls.tsx +1 -1
- package/src/AudioPlayer/VolumeSlider.tsx +1 -1
- package/src/AudioPlayer/useAudioControls.ts +1 -1
- package/src/Embed/ConceptEmbed.tsx +1 -1
- package/src/Embed/EmbedWrapper.tsx +1 -1
- package/src/Embed/GlossEmbed.tsx +1 -1
- package/src/Embed/UuDisclaimerEmbed.stories.tsx +28 -1
- package/src/Embed/UuDisclaimerEmbed.tsx +31 -5
- package/src/FileList/FileList.tsx +1 -1
- package/src/Gloss/Gloss.tsx +1 -1
- package/src/TagSelector/TagSelector.stories.tsx +2 -1
- package/src/TagSelector/TagSelector.tsx +3 -1
- package/src/i18n/useComponentTranslations.ts +4 -4
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { SliderValueChangeDetails } from "@ark-ui/react";
|
|
9
|
+
import type { SliderValueChangeDetails } from "@ark-ui/react/slider";
|
|
10
10
|
import { useCallback, useRef, useState, type ReactEventHandler } from "react";
|
|
11
11
|
|
|
12
12
|
export const useAudioControls = () => {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Portal } from "@ark-ui/react";
|
|
9
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
10
10
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import type { ConceptMetaData } from "@ndla/types-embed";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ark, type HTMLArkProps } from "@ark-ui/react";
|
|
9
|
+
import { ark, type HTMLArkProps } from "@ark-ui/react/factory";
|
|
10
10
|
import { css, cva } from "@ndla/styled-system/css";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import type { StyledProps, RecipeVariantProps } from "@ndla/styled-system/types";
|
package/src/Embed/GlossEmbed.tsx
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Portal } from "@ark-ui/react";
|
|
9
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
10
10
|
import { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
11
11
|
import { styled } from "@ndla/styled-system/jsx";
|
|
12
12
|
import type { ConceptMetaData } from "@ndla/types-embed";
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { ExpandableBox, ExpandableBoxSummary, FramedContent, PageContent } from "@ndla/primitives";
|
|
9
|
+
import { ExpandableBox, ExpandableBoxSummary, FramedContent, PageContent, Button } from "@ndla/primitives";
|
|
10
10
|
import type { UUDisclaimerData, UuDisclaimerEmbedData } from "@ndla/types-embed";
|
|
11
11
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
12
12
|
import { AnchorHeading } from "../AnchorHeading/AnchorHeading";
|
|
@@ -199,3 +199,30 @@ export const Error: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
|
199
199
|
),
|
|
200
200
|
},
|
|
201
201
|
};
|
|
202
|
+
export const SkipContent: StoryObj<typeof UuDisclaimerEmbed> = {
|
|
203
|
+
args: {
|
|
204
|
+
embed: {
|
|
205
|
+
resource: "uu-disclaimer",
|
|
206
|
+
status: "success",
|
|
207
|
+
embedData,
|
|
208
|
+
data,
|
|
209
|
+
},
|
|
210
|
+
children: (
|
|
211
|
+
<div>
|
|
212
|
+
<h2>Dette er noe ugyldig innhold</h2>
|
|
213
|
+
<Button>Denne kan hoppes over!</Button>
|
|
214
|
+
<p>
|
|
215
|
+
Innholdet kan enkelt hoppes over ved å bruke knappen skip-knappen som dukker opp når du bruker
|
|
216
|
+
tastaturnavigering inne i popoveren.
|
|
217
|
+
</p>
|
|
218
|
+
</div>
|
|
219
|
+
),
|
|
220
|
+
},
|
|
221
|
+
render: (args) => (
|
|
222
|
+
<>
|
|
223
|
+
<UuDisclaimerEmbed {...args} />
|
|
224
|
+
<h2>Dette er noe gyldig innhold</h2>
|
|
225
|
+
<Button>Denne vil ikke hoppes over</Button>
|
|
226
|
+
</>
|
|
227
|
+
),
|
|
228
|
+
};
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { Portal } from "@ark-ui/react";
|
|
9
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
10
10
|
import { AccessibilityFill, ErrorWarningFill } from "@ndla/icons";
|
|
11
|
-
import { IconButton, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
11
|
+
import { Button, IconButton, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
12
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
13
|
+
import { visuallyHidden } from "@ndla/styled-system/patterns";
|
|
13
14
|
import type { UuDisclaimerMetaData } from "@ndla/types-embed";
|
|
14
|
-
import { type ReactNode } from "react";
|
|
15
|
+
import { useRef, type ReactNode } from "react";
|
|
15
16
|
import { useTranslation } from "react-i18next";
|
|
16
17
|
|
|
17
18
|
interface Props {
|
|
@@ -44,14 +45,35 @@ const StyledErrorWarningFill = styled(ErrorWarningFill, {
|
|
|
44
45
|
|
|
45
46
|
const StyledPopoverContent = styled(PopoverContent, {
|
|
46
47
|
base: {
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexDirection: "column",
|
|
50
|
+
gap: "xsmall",
|
|
47
51
|
width: "surface.xlarge",
|
|
48
52
|
maxHeight: "50vh",
|
|
49
53
|
overflowY: "auto",
|
|
50
54
|
},
|
|
51
55
|
});
|
|
52
56
|
|
|
57
|
+
const HiddenButton = styled(Button, {
|
|
58
|
+
base: {
|
|
59
|
+
"&:not(:focus)": {
|
|
60
|
+
position: "absolute",
|
|
61
|
+
width: "1px",
|
|
62
|
+
height: "1px",
|
|
63
|
+
padding: "0",
|
|
64
|
+
margin: "-1px",
|
|
65
|
+
overflow: "hidden",
|
|
66
|
+
clip: "rect(0,0,0,0)",
|
|
67
|
+
whiteSpace: "nowrap",
|
|
68
|
+
borderWidth: "0",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
53
73
|
export const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Props) => {
|
|
54
74
|
const { t } = useTranslation();
|
|
75
|
+
const skipRef = useRef<HTMLDivElement>(null);
|
|
76
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
55
77
|
if (embed.status === "error") {
|
|
56
78
|
return (
|
|
57
79
|
<DisclaimerWrapper>
|
|
@@ -67,7 +89,7 @@ export const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Pr
|
|
|
67
89
|
return (
|
|
68
90
|
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role
|
|
69
91
|
<DisclaimerWrapper role="region" data-embed-type="uu-disclaimer">
|
|
70
|
-
<PopoverRoot>
|
|
92
|
+
<PopoverRoot initialFocusEl={() => contentRef.current}>
|
|
71
93
|
<PopoverTrigger asChild>
|
|
72
94
|
<StyledIconButton
|
|
73
95
|
size="small"
|
|
@@ -79,12 +101,16 @@ export const UuDisclaimerEmbed = ({ embed, transformedDisclaimer, children }: Pr
|
|
|
79
101
|
</StyledIconButton>
|
|
80
102
|
</PopoverTrigger>
|
|
81
103
|
<Portal>
|
|
82
|
-
<StyledPopoverContent>
|
|
104
|
+
<StyledPopoverContent ref={contentRef}>
|
|
83
105
|
<div>{transformedDisclaimer}</div>
|
|
106
|
+
<HiddenButton onClick={() => skipRef.current?.focus()}>{t("uuDisclaimer.skipContent")}</HiddenButton>
|
|
84
107
|
</StyledPopoverContent>
|
|
85
108
|
</Portal>
|
|
86
109
|
</PopoverRoot>
|
|
87
110
|
<div data-uu-content="">{children}</div>
|
|
111
|
+
<div className={visuallyHidden()} tabIndex={-1} ref={skipRef}>
|
|
112
|
+
{t("uuDisclaimer.contentCompleted")}
|
|
113
|
+
</div>
|
|
88
114
|
</DisclaimerWrapper>
|
|
89
115
|
);
|
|
90
116
|
};
|
package/src/Gloss/Gloss.tsx
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { createListCollection } from "@ark-ui/react/collection";
|
|
10
|
+
import { type ComboboxInputValueChangeDetails } from "@ark-ui/react/combobox";
|
|
10
11
|
import { CloseLine, ArrowDownShortLine, CheckLine } from "@ndla/icons";
|
|
11
12
|
import {
|
|
12
13
|
ComboboxContent,
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { type CollectionItem
|
|
9
|
+
import { type CollectionItem } from "@ark-ui/react/collection";
|
|
10
|
+
import { useComboboxContext } from "@ark-ui/react/combobox";
|
|
11
|
+
import { useTagsInputContext } from "@ark-ui/react/tags-input";
|
|
10
12
|
import { CloseLine } from "@ndla/icons";
|
|
11
13
|
import {
|
|
12
14
|
ComboboxClearTrigger,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { CollectionItem } from "@ark-ui/react";
|
|
9
|
+
import type { CollectionItem } from "@ark-ui/react/collection";
|
|
10
10
|
import type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps, DatePickerRootProps } from "@ndla/primitives";
|
|
11
11
|
import { useMemo } from "react";
|
|
12
12
|
import { useTranslation } from "react-i18next";
|
|
@@ -208,10 +208,10 @@ export const useDatePickerTranslations = (
|
|
|
208
208
|
() => ({
|
|
209
209
|
dayCell: (state) => {
|
|
210
210
|
if (state.unavailable) {
|
|
211
|
-
return t("dayCell.unavailable", { date: state.
|
|
211
|
+
return t("dayCell.unavailable", { date: state.valueText });
|
|
212
212
|
} else if (state.selected) {
|
|
213
|
-
return t("dayCell.selected", { date: state.
|
|
214
|
-
} else return t("dayCell.select", { date: state.
|
|
213
|
+
return t("dayCell.selected", { date: state.valueText });
|
|
214
|
+
} else return t("dayCell.select", { date: state.valueText });
|
|
215
215
|
},
|
|
216
216
|
nextTrigger: (view) => t(`nextTrigger.${view}`),
|
|
217
217
|
prevTrigger: (view) => t(`prevTrigger.${view}`),
|