@ndla/ui 56.0.31-alpha.0 → 56.0.33-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 +4 -4
- package/dist/styles.css +41 -14
- package/es/Embed/ConceptEmbed.js +5 -2
- package/es/Embed/GlossEmbed.js +4 -0
- package/es/FactBox/FactBox.js +6 -7
- package/lib/Embed/ConceptEmbed.js +4 -1
- package/lib/Embed/GlossEmbed.js +6 -2
- package/lib/FactBox/FactBox.js +6 -7
- package/package.json +10 -16
- package/src/Embed/ConceptEmbed.tsx +26 -23
- package/src/Embed/GlossEmbed.tsx +4 -2
- package/src/FactBox/FactBox.tsx +4 -5
- package/src/FactBox/Factbox.stories.tsx +2 -2
- package/dist/all-aout.js +0 -0
- package/dist/all.css +0 -1
- package/es/all.css +0 -1
- package/es/styles.css +0 -1826
- package/lib/all.css +0 -1
- package/lib/styles.css +0 -1826
|
@@ -322,17 +322,17 @@
|
|
|
322
322
|
"inset]___[value:0]___[cond:_after",
|
|
323
323
|
"transitionProperty]___[value:opacity]___[cond:_after",
|
|
324
324
|
"transitionDuration]___[value:slow]___[cond:_after",
|
|
325
|
-
"transitionTimingFunction]___[value:ease-out]___[cond:_after",
|
|
326
|
-
"gradientFrom]___[value:surface.default/
|
|
327
|
-
"gradientTo]___[value:surface.default]___[cond:_after",
|
|
325
|
+
"transitionTimingFunction]___[value:ease-in-out]___[cond:_after",
|
|
326
|
+
"gradientFrom]___[value:surface.default/20]___[cond:_after",
|
|
327
|
+
"gradientTo]___[value:surface.default/95]___[cond:_after",
|
|
328
328
|
"backgroundGradient]___[value:to-b]___[cond:_after",
|
|
329
329
|
"opacity]___[value:1]___[cond:_after",
|
|
330
330
|
"zIndex]___[value:base]___[cond:_after",
|
|
331
|
+
"pointerEvents]___[value:none]___[cond:_after",
|
|
331
332
|
"overflow]___[value:visible]___[cond:_print",
|
|
332
333
|
"display]___[value:none]___[cond:_print<___>_after",
|
|
333
334
|
"paddingBlockEnd]___[value:xsmall]___[cond:_open",
|
|
334
335
|
"opacity]___[value:0]___[cond:_open<___>_after",
|
|
335
|
-
"zIndex]___[value:hide]___[cond:_open<___>_after",
|
|
336
336
|
"bottom]___[value:-medium",
|
|
337
337
|
"transitionTimingFunction]___[value:ease-in-out]___[cond:& svg",
|
|
338
338
|
"transitionDuration]___[value:fast]___[cond:& svg",
|
package/dist/styles.css
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@layer utilities {
|
|
2
2
|
@layer compositions {
|
|
3
3
|
.textStyle_body\.medium {
|
|
4
|
+
letter-spacing: normal;
|
|
4
5
|
font-family: var(--fonts-sans);
|
|
5
6
|
font-weight: var(--font-weights-normal);
|
|
6
7
|
font-size: var(--font-sizes-small);
|
|
@@ -13,6 +14,7 @@
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.textStyle_body\.large {
|
|
17
|
+
letter-spacing: normal;
|
|
16
18
|
font-family: var(--fonts-sans);
|
|
17
19
|
font-weight: var(--font-weights-normal);
|
|
18
20
|
font-size: var(--font-sizes-medium);
|
|
@@ -25,6 +27,7 @@
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
.textStyle_label\.medium {
|
|
30
|
+
letter-spacing: normal;
|
|
28
31
|
font-family: var(--fonts-sans);
|
|
29
32
|
font-weight: var(--font-weights-normal);
|
|
30
33
|
font-size: var(--font-sizes-small);
|
|
@@ -37,6 +40,7 @@
|
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
.textStyle_label\.large {
|
|
43
|
+
letter-spacing: normal;
|
|
40
44
|
font-family: var(--fonts-sans);
|
|
41
45
|
font-weight: var(--font-weights-normal);
|
|
42
46
|
font-size: var(--font-sizes-medium);
|
|
@@ -49,6 +53,7 @@
|
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
.textStyle_heading\.large {
|
|
56
|
+
letter-spacing: -0.01em;
|
|
52
57
|
font-family: var(--fonts-sans);
|
|
53
58
|
font-weight: var(--font-weights-bold);
|
|
54
59
|
font-size: var(--font-sizes-4xlarge);
|
|
@@ -61,6 +66,7 @@
|
|
|
61
66
|
}
|
|
62
67
|
|
|
63
68
|
.textStyle_title\.medium {
|
|
69
|
+
letter-spacing: -0.01em;
|
|
64
70
|
font-family: var(--fonts-sans);
|
|
65
71
|
font-weight: var(--font-weights-bold);
|
|
66
72
|
font-size: var(--font-sizes-large);
|
|
@@ -73,6 +79,7 @@
|
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
.\[\&_a\]\:textStyle_label\.xsmall a {
|
|
82
|
+
letter-spacing: normal;
|
|
76
83
|
font-family: var(--fonts-sans);
|
|
77
84
|
font-weight: var(--font-weights-normal);
|
|
78
85
|
font-size: var(--font-sizes-xxsmall);
|
|
@@ -82,6 +89,30 @@
|
|
|
82
89
|
.\[\&_a\]\:textStyle_label\.xsmall a:where([lang='zh'], [lang='zh-Hans'], [lang='zh-Hant']):not([data-pinyin]) {
|
|
83
90
|
font-size: calc(var(--font-sizes-xxsmall) * 1.11);
|
|
84
91
|
line-height: calc(var(--line-heights-xxsmall) * 1.11);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@media screen and (max-width: 29.7475rem) {
|
|
95
|
+
.textStyle_heading\.large {
|
|
96
|
+
font-size: var(--font-sizes-3xlarge);
|
|
97
|
+
line-height: var(--line-heights-3xlarge);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.textStyle_heading\.large:where([lang='zh'], [lang='zh-Hans'], [lang='zh-Hant']):not([data-pinyin]) {
|
|
101
|
+
font-size: calc(var(--font-sizes-3xlarge) * 1.11);
|
|
102
|
+
line-height: calc(var(--line-heights-3xlarge) * 1.11);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@media screen and (max-width: 29.7475rem) {
|
|
107
|
+
.textStyle_title\.medium {
|
|
108
|
+
font-size: var(--font-sizes-medium);
|
|
109
|
+
line-height: var(--line-heights-small);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.textStyle_title\.medium:where([lang='zh'], [lang='zh-Hans'], [lang='zh-Hant']):not([data-pinyin]) {
|
|
113
|
+
font-size: calc(var(--font-sizes-medium) * 1.11);
|
|
114
|
+
line-height: calc(var(--line-heights-small) * 1.11);
|
|
115
|
+
}
|
|
85
116
|
}
|
|
86
117
|
}
|
|
87
118
|
|
|
@@ -1120,13 +1151,14 @@
|
|
|
1120
1151
|
inset: 0;
|
|
1121
1152
|
}
|
|
1122
1153
|
|
|
1123
|
-
.after\:grad-from_surface\.default\/
|
|
1124
|
-
--mix---gradient-from: color-mix(in srgb, var(--colors-surface-default)
|
|
1154
|
+
.after\:grad-from_surface\.default\/20::after {
|
|
1155
|
+
--mix---gradient-from: color-mix(in srgb, var(--colors-surface-default) 20%, transparent);
|
|
1125
1156
|
--gradient-from: var(--mix---gradient-from, var(--colors-surface-default));
|
|
1126
1157
|
}
|
|
1127
1158
|
|
|
1128
|
-
.after\:grad-to_surface\.default::after {
|
|
1129
|
-
--gradient-to: var(--colors-surface-default);
|
|
1159
|
+
.after\:grad-to_surface\.default\/95::after {
|
|
1160
|
+
--mix---gradient-to: color-mix(in srgb, var(--colors-surface-default) 95%, transparent);
|
|
1161
|
+
--gradient-to: var(--mix---gradient-to, var(--colors-surface-default));
|
|
1130
1162
|
}
|
|
1131
1163
|
|
|
1132
1164
|
.after\:bg-grad_to-b::after {
|
|
@@ -1143,6 +1175,10 @@
|
|
|
1143
1175
|
z-index: var(--z-index-base);
|
|
1144
1176
|
}
|
|
1145
1177
|
|
|
1178
|
+
.after\:pointer-events_none::after {
|
|
1179
|
+
pointer-events: none;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1146
1182
|
.open\:pbe_xsmall:is([open], [data-open], [data-state="open"]) {
|
|
1147
1183
|
padding-block-end: var(--spacing-xsmall);
|
|
1148
1184
|
}
|
|
@@ -1272,12 +1308,7 @@
|
|
|
1272
1308
|
transition-duration: var(--durations-slow);
|
|
1273
1309
|
}
|
|
1274
1310
|
|
|
1275
|
-
.after\:trs-tmf_ease-out::after {
|
|
1276
|
-
--transition-easing: ease-out;
|
|
1277
|
-
transition-timing-function: ease-out;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
.\[\&_svg\]\:trs-tmf_ease-in-out svg {
|
|
1311
|
+
.after\:trs-tmf_ease-in-out::after,.\[\&_svg\]\:trs-tmf_ease-in-out svg {
|
|
1281
1312
|
--transition-easing: ease-in-out;
|
|
1282
1313
|
transition-timing-function: ease-in-out;
|
|
1283
1314
|
}
|
|
@@ -1375,10 +1406,6 @@
|
|
|
1375
1406
|
opacity: 0;
|
|
1376
1407
|
}
|
|
1377
1408
|
|
|
1378
|
-
.open\:after\:z_hide:is([open], [data-open], [data-state="open"])::after {
|
|
1379
|
-
z-index: var(--z-index-hide);
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
1409
|
.open\:\[\&_svg\]\:trf_rotate\(180deg\):is([open], [data-open], [data-state="open"]) svg {
|
|
1383
1410
|
transform: rotate(180deg);
|
|
1384
1411
|
}
|
package/es/Embed/ConceptEmbed.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import parse from "html-react-parser";
|
|
10
|
-
import { forwardRef, useMemo } from "react";
|
|
10
|
+
import { forwardRef, useMemo, useRef } from "react";
|
|
11
11
|
import { Portal } from "@ark-ui/react";
|
|
12
12
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
13
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -89,7 +89,9 @@ export const InlineConcept = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
89
89
|
source,
|
|
90
90
|
...rest
|
|
91
91
|
} = _ref2;
|
|
92
|
+
const contentRef = useRef(null);
|
|
92
93
|
return /*#__PURE__*/_jsxs(PopoverRoot, {
|
|
94
|
+
initialFocusEl: () => contentRef.current,
|
|
93
95
|
children: [/*#__PURE__*/_jsx(PopoverTrigger, {
|
|
94
96
|
asChild: true,
|
|
95
97
|
ref: ref,
|
|
@@ -99,11 +101,12 @@ export const InlineConcept = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
99
101
|
})
|
|
100
102
|
}), /*#__PURE__*/_jsx(Portal, {
|
|
101
103
|
children: /*#__PURE__*/_jsx(StyledPopoverContent, {
|
|
104
|
+
ref: contentRef,
|
|
102
105
|
children: /*#__PURE__*/_jsx(Concept, {
|
|
103
106
|
copyright: copyright,
|
|
104
107
|
visualElement: visualElement,
|
|
105
|
-
lang: lang,
|
|
106
108
|
title: title,
|
|
109
|
+
lang: lang,
|
|
107
110
|
source: source,
|
|
108
111
|
previewAlt: previewAlt,
|
|
109
112
|
children: children
|
package/es/Embed/GlossEmbed.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { useRef } from "react";
|
|
9
10
|
import { Portal } from "@ark-ui/react";
|
|
10
11
|
import { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -22,6 +23,7 @@ export const GlossEmbed = _ref => {
|
|
|
22
23
|
let {
|
|
23
24
|
embed
|
|
24
25
|
} = _ref;
|
|
26
|
+
const contentRef = useRef(null);
|
|
25
27
|
if (embed.status === "error" && embed.embedData.type === "inline") {
|
|
26
28
|
return /*#__PURE__*/_jsx("span", {
|
|
27
29
|
children: embed.embedData.linkText
|
|
@@ -42,6 +44,7 @@ export const GlossEmbed = _ref => {
|
|
|
42
44
|
} : undefined;
|
|
43
45
|
if (embed.embedData.type === "inline") {
|
|
44
46
|
return /*#__PURE__*/_jsxs(PopoverRoot, {
|
|
47
|
+
initialFocusEl: () => contentRef.current,
|
|
45
48
|
children: [/*#__PURE__*/_jsx(PopoverTrigger, {
|
|
46
49
|
asChild: true,
|
|
47
50
|
children: /*#__PURE__*/_jsx(InlineTriggerButton, {
|
|
@@ -49,6 +52,7 @@ export const GlossEmbed = _ref => {
|
|
|
49
52
|
})
|
|
50
53
|
}), /*#__PURE__*/_jsx(Portal, {
|
|
51
54
|
children: /*#__PURE__*/_jsx(StyledPopoverContent, {
|
|
55
|
+
ref: contentRef,
|
|
52
56
|
children: /*#__PURE__*/_jsx(Figure, {
|
|
53
57
|
children: /*#__PURE__*/_jsx(Gloss, {
|
|
54
58
|
glossData: concept.glossData,
|
package/es/FactBox/FactBox.js
CHANGED
|
@@ -57,13 +57,13 @@ const StyledContent = styled("div", {
|
|
|
57
57
|
inset: "0",
|
|
58
58
|
transitionProperty: "opacity",
|
|
59
59
|
transitionDuration: "slow",
|
|
60
|
-
transitionTimingFunction: "ease-out",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
gradientTo: "surface.default",
|
|
60
|
+
transitionTimingFunction: "ease-in-out",
|
|
61
|
+
gradientFrom: "surface.default/20",
|
|
62
|
+
gradientTo: "surface.default/95",
|
|
64
63
|
backgroundGradient: "to-b",
|
|
65
64
|
opacity: "1",
|
|
66
|
-
zIndex: "base"
|
|
65
|
+
zIndex: "base",
|
|
66
|
+
pointerEvents: "none"
|
|
67
67
|
},
|
|
68
68
|
_print: {
|
|
69
69
|
overflow: "visible",
|
|
@@ -74,8 +74,7 @@ const StyledContent = styled("div", {
|
|
|
74
74
|
_open: {
|
|
75
75
|
paddingBlockEnd: "xsmall",
|
|
76
76
|
_after: {
|
|
77
|
-
opacity: "0"
|
|
78
|
-
zIndex: "hide"
|
|
77
|
+
opacity: "0"
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -97,7 +97,9 @@ const InlineConcept = exports.InlineConcept = /*#__PURE__*/(0, _react.forwardRef
|
|
|
97
97
|
source,
|
|
98
98
|
...rest
|
|
99
99
|
} = _ref2;
|
|
100
|
+
const contentRef = (0, _react.useRef)(null);
|
|
100
101
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
102
|
+
initialFocusEl: () => contentRef.current,
|
|
101
103
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
102
104
|
asChild: true,
|
|
103
105
|
ref: ref,
|
|
@@ -107,11 +109,12 @@ const InlineConcept = exports.InlineConcept = /*#__PURE__*/(0, _react.forwardRef
|
|
|
107
109
|
})
|
|
108
110
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Portal, {
|
|
109
111
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
|
|
112
|
+
ref: contentRef,
|
|
110
113
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Concept.Concept, {
|
|
111
114
|
copyright: copyright,
|
|
112
115
|
visualElement: visualElement,
|
|
113
|
-
lang: lang,
|
|
114
116
|
title: title,
|
|
117
|
+
lang: lang,
|
|
115
118
|
source: source,
|
|
116
119
|
previewAlt: previewAlt,
|
|
117
120
|
children: children
|
package/lib/Embed/GlossEmbed.js
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.GlossEmbed = void 0;
|
|
7
|
-
var _react = require("
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@ark-ui/react");
|
|
8
9
|
var _primitives = require("@ndla/primitives");
|
|
9
10
|
var _jsx2 = require("@ndla/styled-system/jsx");
|
|
10
11
|
var _EmbedErrorPlaceholder = _interopRequireDefault(require("./EmbedErrorPlaceholder"));
|
|
@@ -29,6 +30,7 @@ const GlossEmbed = _ref => {
|
|
|
29
30
|
let {
|
|
30
31
|
embed
|
|
31
32
|
} = _ref;
|
|
33
|
+
const contentRef = (0, _react.useRef)(null);
|
|
32
34
|
if (embed.status === "error" && embed.embedData.type === "inline") {
|
|
33
35
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
34
36
|
children: embed.embedData.linkText
|
|
@@ -49,13 +51,15 @@ const GlossEmbed = _ref => {
|
|
|
49
51
|
} : undefined;
|
|
50
52
|
if (embed.embedData.type === "inline") {
|
|
51
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.PopoverRoot, {
|
|
54
|
+
initialFocusEl: () => contentRef.current,
|
|
52
55
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.PopoverTrigger, {
|
|
53
56
|
asChild: true,
|
|
54
57
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_InlineTriggerButton.InlineTriggerButton, {
|
|
55
58
|
children: embed.embedData.linkText
|
|
56
59
|
})
|
|
57
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Portal, {
|
|
58
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPopoverContent, {
|
|
62
|
+
ref: contentRef,
|
|
59
63
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.Figure, {
|
|
60
64
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Gloss.Gloss, {
|
|
61
65
|
glossData: concept.glossData,
|
package/lib/FactBox/FactBox.js
CHANGED
|
@@ -63,13 +63,13 @@ const StyledContent = (0, _jsx2.styled)("div", {
|
|
|
63
63
|
inset: "0",
|
|
64
64
|
transitionProperty: "opacity",
|
|
65
65
|
transitionDuration: "slow",
|
|
66
|
-
transitionTimingFunction: "ease-out",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
gradientTo: "surface.default",
|
|
66
|
+
transitionTimingFunction: "ease-in-out",
|
|
67
|
+
gradientFrom: "surface.default/20",
|
|
68
|
+
gradientTo: "surface.default/95",
|
|
70
69
|
backgroundGradient: "to-b",
|
|
71
70
|
opacity: "1",
|
|
72
|
-
zIndex: "base"
|
|
71
|
+
zIndex: "base",
|
|
72
|
+
pointerEvents: "none"
|
|
73
73
|
},
|
|
74
74
|
_print: {
|
|
75
75
|
overflow: "visible",
|
|
@@ -80,8 +80,7 @@ const StyledContent = (0, _jsx2.styled)("div", {
|
|
|
80
80
|
_open: {
|
|
81
81
|
paddingBlockEnd: "xsmall",
|
|
82
82
|
_after: {
|
|
83
|
-
opacity: "0"
|
|
84
|
-
zIndex: "hide"
|
|
83
|
+
opacity: "0"
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndla/ui",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.33-alpha.0",
|
|
4
4
|
"description": "UI component library for NDLA",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "node ../../scripts/build.js package",
|
|
12
12
|
"build:types": "tsc -p tsconfig.build.json",
|
|
13
|
-
"prepublish": "concurrently 'yarn build:types' 'yarn build:
|
|
14
|
-
"build:panda": "mkdir -p dist && concurrently 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
|
|
15
|
-
"build:css": "webpack && cp ./dist/*.css ./es && cp ./dist/*.css ./lib"
|
|
13
|
+
"prepublish": "concurrently 'yarn build:types' 'yarn build:panda'",
|
|
14
|
+
"build:panda": "mkdir -p dist && concurrently 'panda cssgen --minimal --outfile dist/styles.css' 'panda ship --outfile dist/panda.buildinfo.json'"
|
|
16
15
|
},
|
|
17
16
|
"repository": {
|
|
18
17
|
"type": "git",
|
|
@@ -34,10 +33,10 @@
|
|
|
34
33
|
],
|
|
35
34
|
"dependencies": {
|
|
36
35
|
"@ndla/core": "^5.0.2",
|
|
37
|
-
"@ndla/icons": "^8.0.
|
|
36
|
+
"@ndla/icons": "^8.0.23-alpha.0",
|
|
38
37
|
"@ndla/licenses": "^8.0.3-alpha.0",
|
|
39
|
-
"@ndla/primitives": "^1.0.
|
|
40
|
-
"@ndla/safelink": "^7.0.
|
|
38
|
+
"@ndla/primitives": "^1.0.30-alpha.0",
|
|
39
|
+
"@ndla/safelink": "^7.0.30-alpha.0",
|
|
41
40
|
"@ndla/styled-system": "^0.0.22",
|
|
42
41
|
"@ndla/util": "^5.0.0-alpha.0",
|
|
43
42
|
"html-react-parser": "^5.1.8",
|
|
@@ -51,18 +50,13 @@
|
|
|
51
50
|
"react-router-dom": "> 6.0.0"
|
|
52
51
|
},
|
|
53
52
|
"devDependencies": {
|
|
54
|
-
"@ndla/preset-panda": "^0.0.
|
|
53
|
+
"@ndla/preset-panda": "^0.0.33",
|
|
55
54
|
"@ndla/types-backend": "^0.2.86",
|
|
56
|
-
"@ndla/types-embed": "^5.0.
|
|
57
|
-
"@pandacss/dev": "^0.46.0"
|
|
58
|
-
"css-loader": "^6.7.3",
|
|
59
|
-
"mini-css-extract-plugin": "^2.7.5",
|
|
60
|
-
"sass-loader": "^13.2.2",
|
|
61
|
-
"webpack": "^5.79.0",
|
|
62
|
-
"webpack-cli": "^5.0.1"
|
|
55
|
+
"@ndla/types-embed": "^5.0.3-alpha.0",
|
|
56
|
+
"@pandacss/dev": "^0.46.0"
|
|
63
57
|
},
|
|
64
58
|
"publishConfig": {
|
|
65
59
|
"access": "public"
|
|
66
60
|
},
|
|
67
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "ce553947c81fac1140a0f197084cea944eae44ec"
|
|
68
62
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import parse from "html-react-parser";
|
|
10
|
-
import { forwardRef, useMemo } from "react";
|
|
10
|
+
import { forwardRef, useMemo, useRef } from "react";
|
|
11
11
|
import { Portal } from "@ark-ui/react";
|
|
12
12
|
import { PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
13
13
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -92,28 +92,31 @@ export interface InlineConceptProps extends ConceptProps, BaseProps {
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
export const InlineConcept = forwardRef<HTMLSpanElement, InlineConceptProps>(
|
|
95
|
-
({ linkText, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) =>
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
95
|
+
({ linkText, copyright, visualElement, previewAlt, lang, children, title, source, ...rest }, ref) => {
|
|
96
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
97
|
+
return (
|
|
98
|
+
<PopoverRoot initialFocusEl={() => contentRef.current}>
|
|
99
|
+
{/* @ts-expect-error placing ref and rest on popover trigger somehow removes a bug where the popover target becomes a bit bigger */}
|
|
100
|
+
<PopoverTrigger asChild ref={ref} {...rest}>
|
|
101
|
+
<InlineTriggerButton>{linkText}</InlineTriggerButton>
|
|
102
|
+
</PopoverTrigger>
|
|
103
|
+
<Portal>
|
|
104
|
+
<StyledPopoverContent ref={contentRef}>
|
|
105
|
+
<Concept
|
|
106
|
+
copyright={copyright}
|
|
107
|
+
visualElement={visualElement}
|
|
108
|
+
title={title}
|
|
109
|
+
lang={lang}
|
|
110
|
+
source={source}
|
|
111
|
+
previewAlt={previewAlt}
|
|
112
|
+
>
|
|
113
|
+
{children}
|
|
114
|
+
</Concept>
|
|
115
|
+
</StyledPopoverContent>
|
|
116
|
+
</Portal>
|
|
117
|
+
</PopoverRoot>
|
|
118
|
+
);
|
|
119
|
+
},
|
|
117
120
|
);
|
|
118
121
|
|
|
119
122
|
export interface BlockConceptProps extends ConceptProps {}
|
package/src/Embed/GlossEmbed.tsx
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
import { useRef } from "react";
|
|
9
10
|
import { Portal } from "@ark-ui/react";
|
|
10
11
|
import { Figure, PopoverContent, PopoverRoot, PopoverTrigger } from "@ndla/primitives";
|
|
11
12
|
import { styled } from "@ndla/styled-system/jsx";
|
|
@@ -25,6 +26,7 @@ const StyledPopoverContent = styled(PopoverContent, {
|
|
|
25
26
|
});
|
|
26
27
|
|
|
27
28
|
export const GlossEmbed = ({ embed }: Props) => {
|
|
29
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
28
30
|
if (embed.status === "error" && embed.embedData.type === "inline") {
|
|
29
31
|
return <span>{embed.embedData.linkText}</span>;
|
|
30
32
|
}
|
|
@@ -44,12 +46,12 @@ export const GlossEmbed = ({ embed }: Props) => {
|
|
|
44
46
|
|
|
45
47
|
if (embed.embedData.type === "inline") {
|
|
46
48
|
return (
|
|
47
|
-
<PopoverRoot>
|
|
49
|
+
<PopoverRoot initialFocusEl={() => contentRef.current}>
|
|
48
50
|
<PopoverTrigger asChild>
|
|
49
51
|
<InlineTriggerButton>{embed.embedData.linkText}</InlineTriggerButton>
|
|
50
52
|
</PopoverTrigger>
|
|
51
53
|
<Portal>
|
|
52
|
-
<StyledPopoverContent>
|
|
54
|
+
<StyledPopoverContent ref={contentRef}>
|
|
53
55
|
<Figure>
|
|
54
56
|
<Gloss glossData={concept.glossData} title={concept.title} audio={audio} />
|
|
55
57
|
</Figure>
|
package/src/FactBox/FactBox.tsx
CHANGED
|
@@ -65,13 +65,13 @@ const StyledContent = styled("div", {
|
|
|
65
65
|
inset: "0",
|
|
66
66
|
transitionProperty: "opacity",
|
|
67
67
|
transitionDuration: "slow",
|
|
68
|
-
transitionTimingFunction: "ease-out",
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
gradientTo: "surface.default",
|
|
68
|
+
transitionTimingFunction: "ease-in-out",
|
|
69
|
+
gradientFrom: "surface.default/20",
|
|
70
|
+
gradientTo: "surface.default/95",
|
|
72
71
|
backgroundGradient: "to-b",
|
|
73
72
|
opacity: "1",
|
|
74
73
|
zIndex: "base",
|
|
74
|
+
pointerEvents: "none",
|
|
75
75
|
},
|
|
76
76
|
_print: {
|
|
77
77
|
overflow: "visible",
|
|
@@ -83,7 +83,6 @@ const StyledContent = styled("div", {
|
|
|
83
83
|
paddingBlockEnd: "xsmall",
|
|
84
84
|
_after: {
|
|
85
85
|
opacity: "0",
|
|
86
|
-
zIndex: "hide",
|
|
87
86
|
},
|
|
88
87
|
},
|
|
89
88
|
},
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { Meta, StoryObj } from "@storybook/react";
|
|
10
|
-
import { Button, UnOrderedList, OrderedList } from "@ndla/primitives";
|
|
10
|
+
import { Button, Heading, UnOrderedList, OrderedList } from "@ndla/primitives";
|
|
11
11
|
import FactBox from "./FactBox";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -24,7 +24,7 @@ export default {
|
|
|
24
24
|
args: {
|
|
25
25
|
children: (
|
|
26
26
|
<>
|
|
27
|
-
<
|
|
27
|
+
<Heading>Faktaboks</Heading>
|
|
28
28
|
<p>Innhold kan først nås etter at boksen er åpnet.</p>
|
|
29
29
|
<Button>Klikk meg</Button>
|
|
30
30
|
<p>En faktaboks kan inneholde punktlister eller korte fakta som er relevant for artikkelens innhold.</p>
|
package/dist/all-aout.js
DELETED
|
File without changes
|