@ndla/ui 56.0.45-alpha.0 → 56.0.46-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.
@@ -18,7 +18,7 @@
18
18
  "overflowWrap]___[value:anywhere]___[cond:& h1",
19
19
  "gap]___[value:medium",
20
20
  "paddingBlockStart]___[value:xxlarge",
21
- "hyphens]___[value:auto",
21
+ "overflowWrap]___[value:anywhere",
22
22
  "gap]___[value:xxlarge",
23
23
  "paddingBlockEnd]___[value:5xlarge]___[cond:& > :is(:last-child)",
24
24
  "minHeight]___[value:xxlarge",
@@ -64,6 +64,9 @@
64
64
  "paddingInline]___[value:medium]___[cond:tablet",
65
65
  "maxWidth]___[value:surface.xlarge",
66
66
  "whiteSpace]___[value:pre-wrap]___[cond:& span > *",
67
+ "marginBlock]___[value:small]___[cond:& p:not(:first-child):not(:last-child)",
68
+ "textAlign]___[value:center]___[cond:& p[data-align=\"center\"]",
69
+ "direction]___[value:rtl]___[cond:& p:has(span[dir=\"rtl\"])",
67
70
  "alignSelf]___[value:flex-start",
68
71
  "marginInlineStart]___[value:3xsmall",
69
72
  "borderBottomRadius]___[value:xsmall",
@@ -250,7 +253,6 @@
250
253
  "borderStyle]___[value:dashed",
251
254
  "borderColor]___[value:stroke.hover",
252
255
  "paddingBlockStart]___[value:5xsmall",
253
- "paddingInline]___[value:4xsmall",
254
256
  "borderColor]___[value:text.link]___[cond:_hover",
255
257
  "background]___[value:surface.actionSubtle.hover]___[cond:_hover",
256
258
  "borderColor]___[value:text.link]___[cond:_active",
package/dist/styles.css CHANGED
@@ -148,9 +148,8 @@
148
148
  padding-block-start: var(--spacing-xxlarge);
149
149
  }
150
150
 
151
- .hy_auto {
152
- hyphens: auto;
153
- -webkit-hyphens: auto;
151
+ .ov-wrap_anywhere {
152
+ overflow-wrap: anywhere;
154
153
  }
155
154
 
156
155
  .gap_xxlarge {
@@ -526,10 +525,6 @@
526
525
  padding-block-start: var(--spacing-5xsmall);
527
526
  }
528
527
 
529
- .px_4xsmall {
530
- padding-inline: var(--spacing-4xsmall);
531
- }
532
-
533
528
  .ps_4xsmall {
534
529
  padding-inline-start: var(--spacing-4xsmall);
535
530
  }
@@ -915,6 +910,18 @@
915
910
  white-space: pre-wrap;
916
911
  }
917
912
 
913
+ .\[\&_p\:not\(\:first-child\)\:not\(\:last-child\)\]\:my_small p:not(:first-child):not(:last-child) {
914
+ margin-block: var(--spacing-small);
915
+ }
916
+
917
+ .\[\&_p\[data-align\=\"center\"\]\]\:ta_center p[data-align="center"] {
918
+ text-align: center;
919
+ }
920
+
921
+ .\[\&_p\:has\(span\[dir\=\"rtl\"\]\)\]\:direction_rtl p:has(span[dir="rtl"]) {
922
+ direction: rtl;
923
+ }
924
+
918
925
  .\[\&_span\]\:flex_1 span {
919
926
  flex: 1 1 0%;
920
927
  }
@@ -76,8 +76,7 @@ export const ArticleHeader = styled(ark.header, {
76
76
  alignItems: "flex-start",
77
77
  width: "100%",
78
78
  paddingBlockStart: "xxlarge",
79
- overflowWrap: "break-word",
80
- hyphens: "auto"
79
+ overflowWrap: "anywhere"
81
80
  }
82
81
  }, {
83
82
  baseComponent: true
@@ -106,6 +106,15 @@ const TextVersionText = styled("div", {
106
106
  maxWidth: "surface.xlarge",
107
107
  "& span > *": {
108
108
  whiteSpace: "pre-wrap"
109
+ },
110
+ "& p:not(:first-child):not(:last-child)": {
111
+ marginBlock: "small"
112
+ },
113
+ '& p[data-align="center"]': {
114
+ textAlign: "center"
115
+ },
116
+ '& p:has(span[dir="rtl"])': {
117
+ direction: "rtl"
109
118
  }
110
119
  }
111
120
  });
@@ -18,7 +18,6 @@ const StyledSpan = styled("span", {
18
18
  borderStyle: "dashed",
19
19
  borderColor: "stroke.hover",
20
20
  paddingBlockStart: "5xsmall",
21
- paddingInline: "4xsmall",
22
21
  width: "fit-content",
23
22
  cursor: "pointer",
24
23
  _hover: {
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { forwardRef, useEffect, useId, useRef } from "react";
10
- import { ComboboxContext, useTagsInputContext } from "@ark-ui/react";
10
+ import { useTagsInputContext, useComboboxContext } from "@ark-ui/react";
11
11
  import { CloseLine } from "@ndla/icons/action";
12
12
  import { ComboboxClearTrigger, ComboboxControl, ComboboxInput, ComboboxLabel, ComboboxRoot, ComboboxTrigger, TagsInputControl, TagsInputInput, TagsInputItem, TagsInputItemDeleteTrigger, TagsInputItemPreview, TagsInputItemText, TagsInputRoot, TagsInputItemInput } from "@ndla/primitives";
13
13
  import { contains } from "@ndla/util";
@@ -51,20 +51,25 @@ export const TagSelectorRoot = _ref => {
51
51
  },
52
52
  value: value,
53
53
  ...rest,
54
- children: /*#__PURE__*/_jsx(ComboboxContext, {
55
- children: api => /*#__PURE__*/_jsx(TagsInputRoot, {
56
- ids: ids,
57
- value: value,
58
- onInputValueChange: details => api.setInputValue(details.inputValue),
59
- editable: editable,
60
- onValueChange: onValueChange,
61
- addOnPaste: addOnPaste,
62
- translations: translations,
63
- children: children
64
- })
54
+ children: /*#__PURE__*/_jsx(TagSelectorTagsInputRoot, {
55
+ ids: ids,
56
+ value: value,
57
+ editable: editable,
58
+ onValueChange: onValueChange,
59
+ addOnPaste: addOnPaste,
60
+ translations: translations,
61
+ children: children
65
62
  })
66
63
  });
67
64
  };
65
+ const TagSelectorTagsInputRoot = /*#__PURE__*/forwardRef((props, ref) => {
66
+ const comboboxApi = useComboboxContext();
67
+ return /*#__PURE__*/_jsx(TagsInputRoot, {
68
+ ref: ref,
69
+ onInputValueChange: details => comboboxApi.setInputValue(details.inputValue),
70
+ ...props
71
+ });
72
+ });
68
73
  export const TagSelectorLabel = ComboboxLabel;
69
74
  export const TagSelectorItemInput = TagsInputItemInput;
70
75
  export const TagSelectorTrigger = ComboboxTrigger;
@@ -94,12 +99,12 @@ export const TagSelectorInputBase = /*#__PURE__*/forwardRef((_ref3, ref) => {
94
99
  ref: ref,
95
100
  asChild: true,
96
101
  children: /*#__PURE__*/_jsx(TagsInputInput, {
97
- ...props,
98
102
  onKeyDown: event => {
99
103
  if (event.key === "Enter") {
100
104
  tagsApi.addValue(tagsApi.inputValue);
101
105
  }
102
106
  },
107
+ ...props,
103
108
  children: children
104
109
  })
105
110
  });
@@ -125,12 +130,12 @@ export const TagSelectorInput = /*#__PURE__*/forwardRef((_ref4, ref) => {
125
130
  ref: ref,
126
131
  asChild: true,
127
132
  children: /*#__PURE__*/_jsx(TagsInputInput, {
128
- ...props,
129
133
  onKeyDown: event => {
130
134
  if (event.key === "Enter") {
131
135
  tagsApi.addValue(tagsApi.inputValue);
132
136
  }
133
137
  },
138
+ ...props,
134
139
  children: children
135
140
  })
136
141
  })]
@@ -82,8 +82,7 @@ const ArticleHeader = exports.ArticleHeader = (0, _jsx2.styled)(_react2.ark.head
82
82
  alignItems: "flex-start",
83
83
  width: "100%",
84
84
  paddingBlockStart: "xxlarge",
85
- overflowWrap: "break-word",
86
- hyphens: "auto"
85
+ overflowWrap: "anywhere"
87
86
  }
88
87
  }, {
89
88
  baseComponent: true
@@ -112,6 +112,15 @@ const TextVersionText = (0, _jsx2.styled)("div", {
112
112
  maxWidth: "surface.xlarge",
113
113
  "& span > *": {
114
114
  whiteSpace: "pre-wrap"
115
+ },
116
+ "& p:not(:first-child):not(:last-child)": {
117
+ marginBlock: "small"
118
+ },
119
+ '& p[data-align="center"]': {
120
+ textAlign: "center"
121
+ },
122
+ '& p:has(span[dir="rtl"])': {
123
+ direction: "rtl"
115
124
  }
116
125
  }
117
126
  });
@@ -24,7 +24,6 @@ const StyledSpan = (0, _jsx2.styled)("span", {
24
24
  borderStyle: "dashed",
25
25
  borderColor: "stroke.hover",
26
26
  paddingBlockStart: "5xsmall",
27
- paddingInline: "4xsmall",
28
27
  width: "fit-content",
29
28
  cursor: "pointer",
30
29
  _hover: {
@@ -57,21 +57,26 @@ const TagSelectorRoot = _ref => {
57
57
  },
58
58
  value: value,
59
59
  ...rest,
60
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.ComboboxContext, {
61
- children: api => /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputRoot, {
62
- ids: ids,
63
- value: value,
64
- onInputValueChange: details => api.setInputValue(details.inputValue),
65
- editable: editable,
66
- onValueChange: onValueChange,
67
- addOnPaste: addOnPaste,
68
- translations: translations,
69
- children: children
70
- })
60
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(TagSelectorTagsInputRoot, {
61
+ ids: ids,
62
+ value: value,
63
+ editable: editable,
64
+ onValueChange: onValueChange,
65
+ addOnPaste: addOnPaste,
66
+ translations: translations,
67
+ children: children
71
68
  })
72
69
  });
73
70
  };
74
71
  exports.TagSelectorRoot = TagSelectorRoot;
72
+ const TagSelectorTagsInputRoot = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
73
+ const comboboxApi = (0, _react2.useComboboxContext)();
74
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputRoot, {
75
+ ref: ref,
76
+ onInputValueChange: details => comboboxApi.setInputValue(details.inputValue),
77
+ ...props
78
+ });
79
+ });
75
80
  const TagSelectorLabel = exports.TagSelectorLabel = _primitives.ComboboxLabel;
76
81
  const TagSelectorItemInput = exports.TagSelectorItemInput = _primitives.TagsInputItemInput;
77
82
  const TagSelectorTrigger = exports.TagSelectorTrigger = _primitives.ComboboxTrigger;
@@ -101,12 +106,12 @@ const TagSelectorInputBase = exports.TagSelectorInputBase = /*#__PURE__*/(0, _re
101
106
  ref: ref,
102
107
  asChild: true,
103
108
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputInput, {
104
- ...props,
105
109
  onKeyDown: event => {
106
110
  if (event.key === "Enter") {
107
111
  tagsApi.addValue(tagsApi.inputValue);
108
112
  }
109
113
  },
114
+ ...props,
110
115
  children: children
111
116
  })
112
117
  });
@@ -132,12 +137,12 @@ const TagSelectorInput = exports.TagSelectorInput = /*#__PURE__*/(0, _react.forw
132
137
  ref: ref,
133
138
  asChild: true,
134
139
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.TagsInputInput, {
135
- ...props,
136
140
  onKeyDown: event => {
137
141
  if (event.key === "Enter") {
138
142
  tagsApi.addValue(tagsApi.inputValue);
139
143
  }
140
144
  },
145
+ ...props,
141
146
  children: children
142
147
  })
143
148
  })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.45-alpha.0",
3
+ "version": "56.0.46-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -33,10 +33,10 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "@ndla/core": "^5.0.2",
36
- "@ndla/icons": "^8.0.28-alpha.0",
36
+ "@ndla/icons": "^8.0.29-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.40-alpha.0",
39
- "@ndla/safelink": "^7.0.40-alpha.0",
38
+ "@ndla/primitives": "^1.0.41-alpha.0",
39
+ "@ndla/safelink": "^7.0.41-alpha.0",
40
40
  "@ndla/styled-system": "^0.0.23",
41
41
  "@ndla/util": "^5.0.0-alpha.0",
42
42
  "html-react-parser": "^5.1.8",
@@ -50,7 +50,7 @@
50
50
  "react-router-dom": "> 6.0.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@ndla/preset-panda": "^0.0.37",
53
+ "@ndla/preset-panda": "^0.0.38",
54
54
  "@ndla/types-backend": "^0.2.86",
55
55
  "@ndla/types-embed": "^5.0.3-alpha.0",
56
56
  "@pandacss/dev": "^0.46.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "e79c68709bfa94d73a608d460f271f41f9f04e09"
61
+ "gitHead": "e29f1689ea7268f8a1eed1c99f179a3524c70758"
62
62
  }
@@ -80,8 +80,7 @@ export const ArticleHeader = styled(
80
80
  alignItems: "flex-start",
81
81
  width: "100%",
82
82
  paddingBlockStart: "xxlarge",
83
- overflowWrap: "break-word",
84
- hyphens: "auto",
83
+ overflowWrap: "anywhere",
85
84
  },
86
85
  },
87
86
  { baseComponent: true },
@@ -113,6 +113,15 @@ const TextVersionText = styled("div", {
113
113
  "& span > *": {
114
114
  whiteSpace: "pre-wrap",
115
115
  },
116
+ "& p:not(:first-child):not(:last-child)": {
117
+ marginBlock: "small",
118
+ },
119
+ '& p[data-align="center"]': {
120
+ textAlign: "center",
121
+ },
122
+ '& p:has(span[dir="rtl"])': {
123
+ direction: "rtl",
124
+ },
116
125
  },
117
126
  });
118
127
 
@@ -18,7 +18,6 @@ const StyledSpan = styled("span", {
18
18
  borderStyle: "dashed",
19
19
  borderColor: "stroke.hover",
20
20
  paddingBlockStart: "5xsmall",
21
- paddingInline: "4xsmall",
22
21
  width: "fit-content",
23
22
  cursor: "pointer",
24
23
  _hover: {
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { forwardRef, useEffect, useId, useRef } from "react";
10
10
  import type { CollectionItem } from "@ark-ui/react";
11
- import { ComboboxContext, useTagsInputContext } from "@ark-ui/react";
11
+ import { useTagsInputContext, useComboboxContext } from "@ark-ui/react";
12
12
  import { CloseLine } from "@ndla/icons/action";
13
13
  import {
14
14
  ComboboxClearTrigger,
@@ -79,25 +79,31 @@ export const TagSelectorRoot = <T extends CollectionItem>({
79
79
  value={value}
80
80
  {...rest}
81
81
  >
82
- <ComboboxContext>
83
- {(api) => (
84
- <TagsInputRoot
85
- ids={ids}
86
- value={value}
87
- onInputValueChange={(details) => api.setInputValue(details.inputValue)}
88
- editable={editable}
89
- onValueChange={onValueChange}
90
- addOnPaste={addOnPaste}
91
- translations={translations}
92
- >
93
- {children}
94
- </TagsInputRoot>
95
- )}
96
- </ComboboxContext>
82
+ <TagSelectorTagsInputRoot
83
+ ids={ids}
84
+ value={value}
85
+ editable={editable}
86
+ onValueChange={onValueChange}
87
+ addOnPaste={addOnPaste}
88
+ translations={translations}
89
+ >
90
+ {children}
91
+ </TagSelectorTagsInputRoot>
97
92
  </ComboboxRoot>
98
93
  );
99
94
  };
100
95
 
96
+ const TagSelectorTagsInputRoot = forwardRef<HTMLDivElement, TagsInputRootProps>((props, ref) => {
97
+ const comboboxApi = useComboboxContext();
98
+ return (
99
+ <TagsInputRoot
100
+ ref={ref}
101
+ onInputValueChange={(details) => comboboxApi.setInputValue(details.inputValue)}
102
+ {...props}
103
+ />
104
+ );
105
+ });
106
+
101
107
  export type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;
102
108
 
103
109
  export const TagSelectorLabel = ComboboxLabel;
@@ -126,12 +132,12 @@ export const TagSelectorInputBase = forwardRef<HTMLInputElement, TagSelectorInpu
126
132
  return (
127
133
  <ComboboxInput ref={ref} asChild>
128
134
  <TagsInputInput
129
- {...props}
130
135
  onKeyDown={(event) => {
131
136
  if (event.key === "Enter") {
132
137
  tagsApi.addValue(tagsApi.inputValue);
133
138
  }
134
139
  }}
140
+ {...props}
135
141
  >
136
142
  {children}
137
143
  </TagsInputInput>
@@ -158,12 +164,12 @@ export const TagSelectorInput = forwardRef<HTMLInputElement, TagSelectorInputPro
158
164
  ))}
159
165
  <ComboboxInput ref={ref} asChild>
160
166
  <TagsInputInput
161
- {...props}
162
167
  onKeyDown={(event) => {
163
168
  if (event.key === "Enter") {
164
169
  tagsApi.addValue(tagsApi.inputValue);
165
170
  }
166
171
  }}
172
+ {...props}
167
173
  >
168
174
  {children}
169
175
  </TagsInputInput>