@ndla/ui 56.0.40-alpha.0 → 56.0.41-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.
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
+ import { createListCollection } from "@ark-ui/react";
11
12
  import { Replay15Line, Forward15Line } from "@ndla/icons/action";
12
13
  import { PlayFill, PauseLine, VolumeUpFill } from "@ndla/icons/common";
13
14
  import { CheckLine } from "@ndla/icons/editor";
@@ -115,7 +116,9 @@ const formatTime = seconds => {
115
116
  const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;
116
117
  return `${minutes}:${formattedSeconds}`;
117
118
  };
118
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
119
+ const speedValues = createListCollection({
120
+ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"]
121
+ });
119
122
  const Controls = _ref => {
120
123
  let {
121
124
  src,
@@ -253,7 +256,7 @@ const Controls = _ref => {
253
256
  })
254
257
  })]
255
258
  }), /*#__PURE__*/_jsxs(StyledSelectRoot, {
256
- items: speedValues,
259
+ collection: speedValues,
257
260
  value: [speedValue.toString()],
258
261
  onValueChange: details => setSpeedValue(parseFloat(details.value[0])),
259
262
  positioning: {
@@ -276,7 +279,7 @@ const Controls = _ref => {
276
279
  })
277
280
  }), /*#__PURE__*/_jsx(SelectPositioner, {
278
281
  children: /*#__PURE__*/_jsx(SelectContent, {
279
- children: speedValues.map(speed => /*#__PURE__*/_jsxs(SelectItem, {
282
+ children: speedValues.items.map(speed => /*#__PURE__*/_jsxs(SelectItem, {
280
283
  item: speed,
281
284
  children: [/*#__PURE__*/_jsxs(SelectItemText, {
282
285
  children: [speed, "x"]
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _reactI18next = require("react-i18next");
9
+ var _react2 = require("@ark-ui/react");
9
10
  var _action = require("@ndla/icons/action");
10
11
  var _common = require("@ndla/icons/common");
11
12
  var _editor = require("@ndla/icons/editor");
@@ -121,7 +122,9 @@ const formatTime = seconds => {
121
122
  const formattedSeconds = currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds;
122
123
  return `${minutes}:${formattedSeconds}`;
123
124
  };
124
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
125
+ const speedValues = (0, _react2.createListCollection)({
126
+ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"]
127
+ });
125
128
  const Controls = _ref => {
126
129
  let {
127
130
  src,
@@ -259,7 +262,7 @@ const Controls = _ref => {
259
262
  })
260
263
  })]
261
264
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledSelectRoot, {
262
- items: speedValues,
265
+ collection: speedValues,
263
266
  value: [speedValue.toString()],
264
267
  onValueChange: details => setSpeedValue(parseFloat(details.value[0])),
265
268
  positioning: {
@@ -282,7 +285,7 @@ const Controls = _ref => {
282
285
  })
283
286
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SelectPositioner, {
284
287
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SelectContent, {
285
- children: speedValues.map(speed => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItem, {
288
+ children: speedValues.items.map(speed => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItem, {
286
289
  item: speed,
287
290
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_primitives.SelectItemText, {
288
291
  children: [speed, "x"]
@@ -6,10 +6,10 @@
6
6
  *
7
7
  */
8
8
  /// <reference types="react" />
9
- import type { ComboboxCollectionItem } from "@ark-ui/react";
9
+ import type { CollectionItem } from "@ark-ui/react";
10
10
  import { ComboboxControlProps, ComboboxInputProps, ComboboxRootProps, TagsInputControlProps, TagsInputInputProps, TagsInputRootProps } from "@ndla/primitives";
11
- export type TagSelectorRootProps<T extends ComboboxCollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
12
- export declare const TagSelectorRoot: <T extends ComboboxCollectionItem>({ allowCustomValue, multiple, selectionBehavior, editable, addOnPaste, onValueChange, children, value, translations, ...rest }: TagSelectorRootProps<T>) => import("react/jsx-runtime").JSX.Element;
11
+ export type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
12
+ export declare const TagSelectorRoot: <T extends unknown>({ allowCustomValue, multiple, selectionBehavior, editable, addOnPaste, onValueChange, children, value, translations, ...rest }: TagSelectorRootProps<T>) => import("react/jsx-runtime").JSX.Element;
13
13
  export type TagSelectorControlProps = ComboboxControlProps & TagsInputControlProps;
14
14
  export declare const TagSelectorLabel: ({ textStyle, fontWeight, ...props }: import("@ndla/primitives").ComboboxLabelProps) => import("react/jsx-runtime").JSX.Element;
15
15
  export declare const TagSelectorItemInput: import("react").ForwardRefExoticComponent<import("@ark-ui/react").TagsInputItemInputProps & {
@@ -5,15 +5,14 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
- import type { ComboboxCollectionItem } from "@ark-ui/react";
9
8
  import type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps } from "@ndla/primitives";
10
9
  import { TagSelectorRootProps } from "../TagSelector/TagSelector";
11
10
  type DeepPartial<T> = {
12
11
  [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
13
12
  };
14
13
  export declare const useTagsInputTranslations: (translations?: Partial<TagsInputRootProps["translations"]>) => TagsInputRootProps["translations"];
15
- export declare const useComboboxTranslations: <T extends ComboboxCollectionItem>(translations?: Partial<ComboboxRootProps<T>["translations"]>) => ComboboxRootProps<T>["translations"];
16
- export declare const useTagSelectorTranslations: <T extends ComboboxCollectionItem>(translations?: Partial<TagSelectorRootProps<T>["translations"]>) => TagSelectorRootProps<T>["translations"];
14
+ export declare const useComboboxTranslations: <T extends unknown>(translations?: Partial<ComboboxRootProps<T>["translations"]>) => ComboboxRootProps<T>["translations"];
15
+ export declare const useTagSelectorTranslations: <T extends unknown>(translations?: Partial<TagSelectorRootProps<T>["translations"]>) => TagSelectorRootProps<T>["translations"];
17
16
  export declare const usePaginationTranslations: (translations?: Partial<PaginationRootProps["translations"]>) => PaginationRootProps["translations"];
18
17
  interface AudioSearchTranslations {
19
18
  searchPlaceholder: string;
package/lib/index.d.ts CHANGED
@@ -48,7 +48,7 @@ export { Grid, GridParallaxItem } from "./Grid";
48
48
  export type { GridType } from "./Grid";
49
49
  export { Gloss, GlossExample } from "./Gloss";
50
50
  export { LinkBlock, LinkBlockSection } from "./LinkBlock";
51
- export type { Article as ArticleType } from "./types";
51
+ export type { Article as ArticleType, HeadingLevel } from "./types";
52
52
  export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
53
53
  export { ZendeskButton } from "./ZendeskButton/ZendeskButton";
54
54
  export type { ZendeskButtonProps } from "./ZendeskButton/ZendeskButton";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ndla/ui",
3
- "version": "56.0.40-alpha.0",
3
+ "version": "56.0.41-alpha.0",
4
4
  "description": "UI component library for NDLA",
5
5
  "license": "GPL-3.0",
6
6
  "main": "lib/index.js",
@@ -35,8 +35,8 @@
35
35
  "@ndla/core": "^5.0.2",
36
36
  "@ndla/icons": "^8.0.27-alpha.0",
37
37
  "@ndla/licenses": "^8.0.3-alpha.0",
38
- "@ndla/primitives": "^1.0.36-alpha.0",
39
- "@ndla/safelink": "^7.0.36-alpha.0",
38
+ "@ndla/primitives": "^1.0.37-alpha.0",
39
+ "@ndla/safelink": "^7.0.37-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",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "4bdd26c1af4c3ed459924af5888de4040de6d47b"
61
+ "gitHead": "29f766c461881909c892102640cd09944f64d694"
62
62
  }
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef, useState } from "react";
10
10
  import { useTranslation } from "react-i18next";
11
- import type { SliderValueChangeDetails } from "@ark-ui/react";
11
+ import { type SliderValueChangeDetails, createListCollection } from "@ark-ui/react";
12
12
  import { Replay15Line, Forward15Line } from "@ndla/icons/action";
13
13
  import { PlayFill, PauseLine, VolumeUpFill } from "@ndla/icons/common";
14
14
  import { CheckLine } from "@ndla/icons/editor";
@@ -152,7 +152,7 @@ const formatTime = (seconds: number) => {
152
152
  return `${minutes}:${formattedSeconds}`;
153
153
  };
154
154
 
155
- const speedValues = ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"];
155
+ const speedValues = createListCollection({ items: ["0.5", "0.75", "1", "1.25", "1.5", "1.75", "2"] });
156
156
 
157
157
  interface Props {
158
158
  src: string;
@@ -291,7 +291,7 @@ const Controls = ({ src, title }: Props) => {
291
291
  </StyledText>
292
292
  </ProgressWrapper>
293
293
  <StyledSelectRoot
294
- items={speedValues}
294
+ collection={speedValues}
295
295
  value={[speedValue.toString()]}
296
296
  onValueChange={(details) => setSpeedValue(parseFloat(details.value[0]))}
297
297
  positioning={{ placement: "top" }}
@@ -310,7 +310,7 @@ const Controls = ({ src, title }: Props) => {
310
310
  </SelectControl>
311
311
  <SelectPositioner>
312
312
  <SelectContent>
313
- {speedValues.map((speed) => (
313
+ {speedValues.items.map((speed) => (
314
314
  <SelectItem key={speed} item={speed}>
315
315
  <SelectItemText>{speed}x</SelectItemText>
316
316
  <SelectItemIndicator>
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { useState } from "react";
10
- import type { ComboboxInputValueChangeDetails } from "@ark-ui/react";
10
+ import { type ComboboxInputValueChangeDetails, createListCollection } from "@ark-ui/react";
11
11
 
12
12
  import { Meta, StoryFn } from "@storybook/react";
13
13
  import { CloseLine } from "@ndla/icons/action";
@@ -63,11 +63,13 @@ export const Default: StoryFn<typeof TagSelectorRoot> = ({ translations, ...args
63
63
  setOptions(filtered);
64
64
  };
65
65
 
66
+ const collection = createListCollection({ items: options });
67
+
66
68
  return (
67
69
  <TagSelectorRoot
68
70
  {...args}
69
71
  value={value}
70
- items={options}
72
+ collection={collection}
71
73
  onInputValueChange={handleChange}
72
74
  onValueChange={(details) => setValue(details.value)}
73
75
  translations={componentTranslations}
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { forwardRef, useEffect, useId, useRef } from "react";
10
- import type { ComboboxCollectionItem } from "@ark-ui/react";
10
+ import type { CollectionItem } from "@ark-ui/react";
11
11
  import { ComboboxContext, useTagsInputContext } from "@ark-ui/react";
12
12
  import { CloseLine } from "@ndla/icons/action";
13
13
  import {
@@ -34,9 +34,9 @@ import {
34
34
  } from "@ndla/primitives";
35
35
  import { contains } from "@ndla/util";
36
36
 
37
- export type TagSelectorRootProps<T extends ComboboxCollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
37
+ export type TagSelectorRootProps<T extends CollectionItem> = ComboboxRootProps<T> & TagsInputRootProps;
38
38
 
39
- export const TagSelectorRoot = <T extends ComboboxCollectionItem>({
39
+ export const TagSelectorRoot = <T extends CollectionItem>({
40
40
  allowCustomValue = true,
41
41
  multiple = true,
42
42
  selectionBehavior = "clear",
@@ -7,7 +7,7 @@
7
7
  */
8
8
 
9
9
  import { useTranslation } from "react-i18next";
10
- import type { ComboboxCollectionItem } from "@ark-ui/react";
10
+ import type { CollectionItem } from "@ark-ui/react";
11
11
  import type { ComboboxRootProps, PaginationRootProps, TagsInputRootProps } from "@ndla/primitives";
12
12
  import { TagSelectorRootProps } from "../TagSelector/TagSelector";
13
13
 
@@ -33,7 +33,7 @@ export const useTagsInputTranslations = (
33
33
  };
34
34
  };
35
35
 
36
- export const useComboboxTranslations = <T extends ComboboxCollectionItem>(
36
+ export const useComboboxTranslations = <T extends CollectionItem>(
37
37
  translations?: Partial<ComboboxRootProps<T>["translations"]>,
38
38
  ): ComboboxRootProps<T>["translations"] => {
39
39
  const { t } = useTranslation("translation", { keyPrefix: "component.combobox" });
@@ -45,7 +45,7 @@ export const useComboboxTranslations = <T extends ComboboxCollectionItem>(
45
45
  };
46
46
  };
47
47
 
48
- export const useTagSelectorTranslations = <T extends ComboboxCollectionItem>(
48
+ export const useTagSelectorTranslations = <T extends CollectionItem>(
49
49
  translations?: Partial<TagSelectorRootProps<T>["translations"]>,
50
50
  ): TagSelectorRootProps<T>["translations"] => {
51
51
  const tagsInputTranslations = useTagsInputTranslations();
package/src/index.ts CHANGED
@@ -142,7 +142,7 @@ export { Gloss, GlossExample } from "./Gloss";
142
142
 
143
143
  export { LinkBlock, LinkBlockSection } from "./LinkBlock";
144
144
 
145
- export type { Article as ArticleType } from "./types";
145
+ export type { Article as ArticleType, HeadingLevel } from "./types";
146
146
 
147
147
  export { CodeBlock, codeLanguageOptions } from "./CodeBlock";
148
148