@navikt/ds-react 3.3.1 → 3.4.1

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/tag/Tag.js CHANGED
@@ -43,7 +43,6 @@ const clsx_1 = __importDefault(require("clsx"));
43
43
  const __1 = require("..");
44
44
  exports.Tag = (0, react_1.forwardRef)((_a, ref) => {
45
45
  var { className, variant, size = "medium" } = _a, rest = __rest(_a, ["className", "variant", "size"]);
46
- const Component = size === "medium" ? __1.BodyShort : __1.Detail;
47
- return (react_1.default.createElement(Component, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: (0, clsx_1.default)("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) })));
46
+ return (react_1.default.createElement(__1.BodyShort, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: (0, clsx_1.default)("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) })));
48
47
  });
49
48
  exports.default = exports.Tag;
@@ -18,4 +18,4 @@ export declare const SharedMonthProvider: ({ children, dropdownCaption, disabled
18
18
  onSelect: any;
19
19
  year: any;
20
20
  onYearChange: any;
21
- }) => JSX.Element;
21
+ }) => React.JSX.Element;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { DayProps } from "react-day-picker";
3
- export declare const DayButton: (props: DayProps) => JSX.Element;
3
+ export declare const DayButton: (props: DayProps) => React.JSX.Element;
@@ -1,3 +1,2 @@
1
- /// <reference types="react" />
2
1
  /** Render the table head. */
3
2
  export declare function TableHead(): JSX.Element;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { CaptionProps } from "react-day-picker";
3
- export declare const DatePickerCaption: ({ displayMonth, id }: CaptionProps) => JSX.Element;
3
+ export declare const DatePickerCaption: ({ displayMonth, id }: CaptionProps) => React.JSX.Element;
4
4
  export default DatePickerCaption;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  import { CaptionProps } from "react-day-picker";
3
- export declare const DropdownCaption: ({ displayMonth, id }: CaptionProps) => JSX.Element | null;
3
+ export declare const DropdownCaption: ({ displayMonth, id }: CaptionProps) => React.JSX.Element | null;
4
4
  export default DropdownCaption;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  interface MonthType {
3
3
  month: Date;
4
4
  months: Date[];
@@ -7,5 +7,5 @@ interface MonthType {
7
7
  tabRoot?: Date;
8
8
  setTabRoot: Function;
9
9
  }
10
- export declare const MonthButton: ({ month, months, focus, setFocus, tabRoot, setTabRoot, }: MonthType) => JSX.Element;
10
+ export declare const MonthButton: ({ month, months, focus, setFocus, tabRoot, setTabRoot, }: MonthType) => React.JSX.Element;
11
11
  export default MonthButton;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const MonthCaption: () => JSX.Element;
1
+ import React from "react";
2
+ export declare const MonthCaption: () => React.JSX.Element;
3
3
  export default MonthCaption;
@@ -1,3 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const MonthSelector: () => JSX.Element;
1
+ import React from "react";
2
+ export declare const MonthSelector: () => React.JSX.Element;
3
3
  export default MonthSelector;
@@ -54,5 +54,5 @@ export declare const Counter: ({ maxLength, currentLength, size, i18n }: {
54
54
  currentLength: any;
55
55
  size: any;
56
56
  i18n: any;
57
- }) => JSX.Element;
57
+ }) => React.JSX.Element;
58
58
  export default Textarea;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
1
+ import React from "react";
2
2
  export declare const HelpTextIcon: ({ title, filled, }: {
3
3
  title: string;
4
4
  filled?: boolean | undefined;
5
- }) => JSX.Element;
5
+ }) => React.JSX.Element;
@@ -16,5 +16,5 @@ export interface ProviderProps {
16
16
  appElement?: HTMLElement;
17
17
  }
18
18
  export declare const useProvider: () => ProviderContextType | undefined;
19
- export declare const Provider: ({ children, ...rest }: ProviderProps) => JSX.Element;
19
+ export declare const Provider: ({ children, ...rest }: ProviderProps) => React.JSX.Element;
20
20
  export default Provider;
package/esm/tag/Tag.d.ts CHANGED
@@ -4,7 +4,7 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
4
4
  /**
5
5
  * Changes visual profile of tag
6
6
  */
7
- variant: "warning" | "warning-filled" | "error" | "error-filled" | "info" | "info-filled" | "success" | "success-filled" | "neutral" | "neutral-filled" | "alt1" | "alt1-filled" | "alt2" | "alt2-filled" | "alt3" | "alt3-filled";
7
+ variant: "warning" | "warning-filled" | "warning-moderate" | "error" | "error-filled" | "error-moderate" | "info" | "info-filled" | "info-moderate" | "success" | "success-filled" | "success-moderate" | "neutral" | "neutral-filled" | "neutral-moderate" | "alt1" | "alt1-filled" | "alt1-moderate" | "alt2" | "alt2-filled" | "alt2-moderate" | "alt3" | "alt3-filled" | "alt3-moderate";
8
8
  /**
9
9
  * @default "medium"
10
10
  */
package/esm/tag/Tag.js CHANGED
@@ -11,11 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import React, { forwardRef } from "react";
13
13
  import cl from "clsx";
14
- import { BodyShort, Detail } from "..";
14
+ import { BodyShort } from "..";
15
15
  export const Tag = forwardRef((_a, ref) => {
16
16
  var { className, variant, size = "medium" } = _a, rest = __rest(_a, ["className", "variant", "size"]);
17
- const Component = size === "medium" ? BodyShort : Detail;
18
- return (React.createElement(Component, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: cl("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) })));
17
+ return (React.createElement(BodyShort, Object.assign({}, rest, { ref: ref, as: "span", size: size === "medium" ? "medium" : "small", className: cl("navds-tag", className, `navds-tag--${variant}`, `navds-tag--${size}`) })));
19
18
  });
20
19
  export default Tag;
21
20
  //# sourceMappingURL=Tag.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/tag/Tag.tsx"],"names":[],"mappings":";;;;;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SAAS,oBACJ,IAAI,IACR,GAAG,EAAE,GAAG,EACR,EAAE,EAAC,MAAM,EACT,IAAI,EAAE,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAC5C,SAAS,EAAE,EAAE,CACX,WAAW,EACX,SAAS,EACT,cAAc,OAAO,EAAE,EACvB,cAAc,IAAI,EAAE,CACrB,IACD,CACH,CAAA;CAAA,CACF,CAAC;AAEF,eAAe,GAAG,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/ds-react",
3
- "version": "3.3.1",
3
+ "version": "3.4.1",
4
4
  "description": "Aksel react-components for NAV designsystem",
5
5
  "author": "Aksel | NAV designsystem team",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "0.24.1",
41
- "@navikt/aksel-icons": "^3.3.1",
41
+ "@navikt/aksel-icons": "^3.4.1",
42
42
  "@radix-ui/react-tabs": "1.0.0",
43
43
  "@radix-ui/react-toggle-group": "1.0.0",
44
44
  "clsx": "^1.2.1",
package/src/tag/Tag.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { forwardRef, HTMLAttributes } from "react";
2
2
  import cl from "clsx";
3
- import { BodyShort, Detail } from "..";
3
+ import { BodyShort } from "..";
4
4
 
5
5
  export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
6
6
  children: React.ReactNode;
@@ -10,20 +10,28 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
10
10
  variant:
11
11
  | "warning"
12
12
  | "warning-filled"
13
+ | "warning-moderate"
13
14
  | "error"
14
15
  | "error-filled"
16
+ | "error-moderate"
15
17
  | "info"
16
18
  | "info-filled"
19
+ | "info-moderate"
17
20
  | "success"
18
21
  | "success-filled"
22
+ | "success-moderate"
19
23
  | "neutral"
20
24
  | "neutral-filled"
25
+ | "neutral-moderate"
21
26
  | "alt1"
22
27
  | "alt1-filled"
28
+ | "alt1-moderate"
23
29
  | "alt2"
24
30
  | "alt2-filled"
31
+ | "alt2-moderate"
25
32
  | "alt3"
26
- | "alt3-filled";
33
+ | "alt3-filled"
34
+ | "alt3-moderate";
27
35
  /**
28
36
  * @default "medium"
29
37
  */
@@ -31,24 +39,20 @@ export interface TagProps extends HTMLAttributes<HTMLSpanElement> {
31
39
  }
32
40
 
33
41
  export const Tag = forwardRef<HTMLSpanElement, TagProps>(
34
- ({ className, variant, size = "medium", ...rest }, ref) => {
35
- const Component = size === "medium" ? BodyShort : Detail;
36
-
37
- return (
38
- <Component
39
- {...rest}
40
- ref={ref}
41
- as="span"
42
- size={size === "medium" ? "medium" : "small"}
43
- className={cl(
44
- "navds-tag",
45
- className,
46
- `navds-tag--${variant}`,
47
- `navds-tag--${size}`
48
- )}
49
- />
50
- );
51
- }
42
+ ({ className, variant, size = "medium", ...rest }, ref) => (
43
+ <BodyShort
44
+ {...rest}
45
+ ref={ref}
46
+ as="span"
47
+ size={size === "medium" ? "medium" : "small"}
48
+ className={cl(
49
+ "navds-tag",
50
+ className,
51
+ `navds-tag--${variant}`,
52
+ `navds-tag--${size}`
53
+ )}
54
+ />
55
+ )
52
56
  );
53
57
 
54
58
  export default Tag;
@@ -1,62 +1,8 @@
1
1
  import React from "react";
2
- import { Tag } from ".";
2
+ import type { Meta } from "@storybook/react";
3
+ import { Tag, TagProps } from ".";
3
4
 
4
- export default {
5
- title: "ds-react/Tag",
6
- component: Tag,
7
- argTypes: {
8
- variant: {
9
- defaultValue: "info",
10
- control: {
11
- type: "radio",
12
- options: [
13
- "warning",
14
- "error",
15
- "info",
16
- "success",
17
- "neutral",
18
- "alt1",
19
- "alt2",
20
- "alt3",
21
- "warning-filled",
22
- "error-filled",
23
- "info-filled",
24
- "success-filled",
25
- "neutral-filled",
26
- "alt1-filled",
27
- "alt2-filled",
28
- "alt3-filled",
29
- ],
30
- },
31
- },
32
- size: {
33
- defaultValue: "medium",
34
- control: {
35
- type: "radio",
36
- options: ["xsmall", "small", "medium"],
37
- },
38
- },
39
- },
40
- };
41
-
42
- const variants: Array<
43
- | "warning"
44
- | "warning-filled"
45
- | "error"
46
- | "error-filled"
47
- | "info"
48
- | "info-filled"
49
- | "success"
50
- | "success-filled"
51
- | "neutral"
52
- | "neutral-filled"
53
- | "alt1"
54
- | "alt1-filled"
55
- | "alt2"
56
- | "alt2-filled"
57
- | "alt3"
58
- | "alt3-filled"
59
- > = [
5
+ const variants: TagProps["variant"][] = [
60
6
  "warning",
61
7
  "error",
62
8
  "info",
@@ -73,8 +19,37 @@ const variants: Array<
73
19
  "alt1-filled",
74
20
  "alt2-filled",
75
21
  "alt3-filled",
22
+ "warning-moderate",
23
+ "error-moderate",
24
+ "info-moderate",
25
+ "success-moderate",
26
+ "neutral-moderate",
27
+ "alt1-moderate",
28
+ "alt2-moderate",
29
+ "alt3-moderate",
76
30
  ];
77
31
 
32
+ export default {
33
+ title: "ds-react/Tag",
34
+ component: Tag,
35
+ argTypes: {
36
+ variant: {
37
+ defaultValue: "info",
38
+ control: {
39
+ type: "radio",
40
+ },
41
+ options: variants,
42
+ },
43
+ size: {
44
+ defaultValue: "medium",
45
+ control: {
46
+ type: "radio",
47
+ },
48
+ options: ["xsmall", "small", "medium"],
49
+ },
50
+ },
51
+ } satisfies Meta<typeof Tag>;
52
+
78
53
  export const Default = {
79
54
  render: (props) => (
80
55
  <Tag variant={props.variant} size={props.size}>