@helsenorge/designsystem-react 7.6.0 → 7.8.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.
Files changed (77) hide show
  1. package/CHANGELOG.md +40 -3
  2. package/components/AnchorLink/styles.module.scss +6 -5
  3. package/components/Badge/Badge.d.ts +7 -1
  4. package/components/Badge/Badge.js +19 -9
  5. package/components/Badge/Badge.js.map +1 -1
  6. package/components/Badge/Badge.stories.d.ts +11 -0
  7. package/components/Badge/NotificationBadge.d.ts +17 -0
  8. package/components/Badge/NotificationBadge.js +68 -0
  9. package/components/Badge/NotificationBadge.js.map +1 -0
  10. package/components/Button/Button.d.ts +3 -0
  11. package/components/Button/Button.js +68 -66
  12. package/components/Button/Button.js.map +1 -1
  13. package/components/Button/styles.module.scss +6 -0
  14. package/components/Button/styles.module.scss.d.ts +1 -0
  15. package/components/Expander/styles.module.scss +4 -2
  16. package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +13 -12
  17. package/components/LinkList/LinkList.stories.d.ts +1 -0
  18. package/components/List/List.stories.d.ts +19 -2
  19. package/components/ListHeader/ListHeader.d.ts +1 -1
  20. package/components/ListHeader/ListHeader.js +32 -28
  21. package/components/ListHeader/ListHeader.js.map +1 -1
  22. package/components/NotificationPanel/NotificationPanel.d.ts +1 -1
  23. package/components/NotificationPanel/NotificationPanel.js +69 -103
  24. package/components/NotificationPanel/NotificationPanel.js.map +1 -1
  25. package/components/NotificationPanel/NotificationPanel.stories.d.ts +1 -1
  26. package/components/NotificationPanel/styles.module.scss +14 -0
  27. package/components/NotificationPanel/styles.module.scss.d.ts +1 -0
  28. package/components/ServiceMessage/ServiceMessage.js +66 -75
  29. package/components/ServiceMessage/ServiceMessage.js.map +1 -1
  30. package/components/ServiceMessage/ServiceMessage.stories.d.ts +1 -1
  31. package/components/ServiceMessage/styles.module.scss +13 -0
  32. package/components/ServiceMessage/styles.module.scss.d.ts +1 -0
  33. package/components/Tabs/Tab.d.ts +17 -0
  34. package/components/Tabs/Tab.js +6 -0
  35. package/components/Tabs/Tab.js.map +1 -0
  36. package/components/Tabs/TabList/TabList.d.ts +11 -0
  37. package/components/Tabs/TabList/TabList.js +51 -0
  38. package/components/Tabs/TabList/TabList.js.map +1 -0
  39. package/components/Tabs/TabList/index.d.ts +3 -0
  40. package/components/Tabs/TabList/index.js +5 -0
  41. package/components/Tabs/TabList/index.js.map +1 -0
  42. package/components/Tabs/TabList/styles.module.scss +109 -0
  43. package/components/Tabs/TabList/styles.module.scss.d.ts +18 -0
  44. package/components/Tabs/TabPanel/TabPanel.d.ts +9 -0
  45. package/components/Tabs/TabPanel/TabPanel.js +13 -0
  46. package/components/Tabs/TabPanel/TabPanel.js.map +1 -0
  47. package/components/Tabs/TabPanel/index.d.ts +3 -0
  48. package/components/Tabs/TabPanel/index.js +5 -0
  49. package/components/Tabs/TabPanel/index.js.map +1 -0
  50. package/components/Tabs/TabPanel/styles.module.scss +37 -0
  51. package/components/Tabs/TabPanel/styles.module.scss.d.ts +15 -0
  52. package/components/Tabs/Tabs.d.ts +22 -0
  53. package/components/Tabs/Tabs.js +19 -0
  54. package/components/Tabs/Tabs.js.map +1 -0
  55. package/components/Tabs/Tabs.stories.d.ts +50 -0
  56. package/components/Tabs/index.d.ts +3 -0
  57. package/components/Tabs/index.js +5 -0
  58. package/components/Tabs/index.js.map +1 -0
  59. package/components/Tabs/styles.module.scss +3 -0
  60. package/components/Tabs/styles.module.scss.d.ts +9 -0
  61. package/components/Tile/Tile.stories.d.ts +26 -2
  62. package/constants.d.ts +5 -1
  63. package/constants.js +1 -1
  64. package/constants.js.map +1 -1
  65. package/docs/index.js +7 -7
  66. package/docs/index.js.map +1 -1
  67. package/hooks/useRovingFocus.d.ts +1 -0
  68. package/hooks/useRovingFocus.js +27 -0
  69. package/hooks/useRovingFocus.js.map +1 -0
  70. package/hooks/useRovingFocus.stories.d.ts +17 -0
  71. package/package.json +1 -1
  72. package/scss/typography.module.scss +7 -5
  73. package/components/NotificationPanel/DetailButton/DetailButton.d.ts +0 -9
  74. package/components/NotificationPanel/DetailButton/DetailButton.js +0 -28
  75. package/components/NotificationPanel/DetailButton/DetailButton.js.map +0 -1
  76. package/components/NotificationPanel/DetailButton/styles.module.scss +0 -38
  77. package/components/NotificationPanel/DetailButton/styles.module.scss.d.ts +0 -13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,40 @@
1
+ ## [7.7.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.6.0&targetVersion=GTv7.7.0) (2024-05-28)
2
+
3
+ ### Features
4
+
5
+ - ny type notification Badge og tillates flere badges i ListHeader
6
+ ([0768e0a](https://github.com/helsenorge/designsystem/commit/0768e0ae1d137f17ecfa92aa2b708ca52862e6b2)), closes
7
+ [#325119](https://github.com/helsenorge/designsystem/issues/325119)
8
+ - **expander:** bruk token på bakgrunn for liten expander
9
+ ([73d8531](https://github.com/helsenorge/designsystem/commit/73d8531a52ed5a6387af8fa84045a0afd620eb38)), closes
10
+ [#324989](https://github.com/helsenorge/designsystem/issues/324989)
11
+ - **notificationpanel:** bruk Expander-komponent i NotificationPanel
12
+ ([e8d4e8d](https://github.com/helsenorge/designsystem/commit/e8d4e8d776333f243cddba8f15742dd6f271bb3d)), closes
13
+ [#324989](https://github.com/helsenorge/designsystem/issues/324989)
14
+
15
+ ### Bug Fixes
16
+
17
+ - **expander:** manglende import av supernova stylesheet
18
+ ([077ec2d](https://github.com/helsenorge/designsystem/commit/077ec2d1f59ce80076deeae5bc7911f7a9a2e431)), closes
19
+ [#324989](https://github.com/helsenorge/designsystem/issues/324989)
20
+
21
+ ## [7.6.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.5.0&targetVersion=GTv7.6.0) (2024-05-15)
22
+
23
+ ### Features
24
+
25
+ - **notificationpanel:** legg til prop for å sette html tag for label
26
+ ([ebd331a](https://github.com/helsenorge/designsystem/commit/ebd331a75f04099c4ad7e552ff70df8751675734)), closes
27
+ [#324952](https://github.com/helsenorge/designsystem/issues/324952)
28
+
29
+ ### Bug Fixes
30
+
31
+ - skjemaelementer med error styling overlapper utifra dom rekkefølge
32
+ ([b07b7d6](https://github.com/helsenorge/designsystem/commit/b07b7d69391b3e4296e8a8cde8b8d312f835cb03)), closes
33
+ [#324846](https://github.com/helsenorge/designsystem/issues/324846)
34
+ - **expanderlist:** fiks så variant fill ikke mister margin top ved åpning av expander
35
+ ([d277c97](https://github.com/helsenorge/designsystem/commit/d277c97660aa8334a44b1183445f55f2037b2263)), closes
36
+ [#324823](https://github.com/helsenorge/designsystem/issues/324823)
37
+
1
38
  ## [7.5.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.4.0&targetVersion=GTv7.5.0) (2024-05-08)
2
39
 
3
40
  ### Features
@@ -1431,12 +1468,12 @@ Dette er fordi vi skal kunne dynamisk importere alt som ligger i Icons, så da b
1431
1468
 
1432
1469
  ### Bug Fixes
1433
1470
 
1434
- - panel har avstand fra tittel til badge
1435
- ([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
1436
- [#282359](https://github.com/helsenorge/designsystem/issues/282359)
1437
1471
  - økt kontrast på understreking av lenker
1438
1472
  ([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
1439
1473
  [#229049](https://github.com/helsenorge/designsystem/issues/229049)
1474
+ - panel har avstand fra tittel til badge
1475
+ ([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
1476
+ [#282359](https://github.com/helsenorge/designsystem/issues/282359)
1440
1477
 
1441
1478
  ## [1.2.2](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv1.2.1&targetVersion=GTv1.2.2) (2022-08-31)
1442
1479
 
@@ -10,7 +10,7 @@ $focus-width: 0.15rem;
10
10
  cursor: pointer;
11
11
  color: $blueberry700;
12
12
  background-color: $blueberry60010;
13
- border-bottom-color: $blueberry600;
13
+ text-decoration-color: $blueberry600;
14
14
  }
15
15
 
16
16
  @mixin anchorlink-focus {
@@ -24,12 +24,13 @@ $focus-width: 0.15rem;
24
24
  overflow-wrap: break-word;
25
25
  word-break: break-word;
26
26
  text-align: left;
27
- text-decoration: none;
28
27
  color: $blueberry600;
29
28
  border: $focus-width solid transparent;
30
- border-bottom-color: $neutral700;
31
- border-bottom-width: $underline-width;
32
- padding-bottom: calc($focus-width - $underline-width);
29
+ text-decoration: underline;
30
+ text-underline-offset: 0.16rem;
31
+ text-decoration-color: $blueberry400;
32
+ text-decoration-thickness: $underline-width;
33
+ padding: 0.1rem;
33
34
 
34
35
  &:hover {
35
36
  @include anchorlink-hover;
@@ -1,16 +1,22 @@
1
1
  import React from 'react';
2
+ import { BadgeNotificationVariant } from './NotificationBadge';
2
3
  import { PaletteNames } from '../../theme/palette';
3
4
  export type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;
4
5
  export type BadgeChildren = string | number;
6
+ export type BadgeVariant = 'string' | 'notification';
5
7
  export interface BadgeProps {
6
8
  /** Sets the content of the badge. */
7
- children: BadgeChildren;
9
+ children?: BadgeChildren;
8
10
  /** Adds custom classes to the element. */
9
11
  className?: string;
10
12
  /** Changes the badge background color. */
11
13
  color?: BadgeColors;
12
14
  /** Sets the data-testid attribute. */
13
15
  testId?: string;
16
+ /** Changes the type of the badge. Default: string */
17
+ type?: BadgeVariant;
18
+ /** Type of notification badge. Only works if type is 'notification'. */
19
+ notificationVariant?: BadgeNotificationVariant;
14
20
  }
15
21
  export type BadgeType = React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
16
22
  declare const Badge: BadgeType;
@@ -1,20 +1,30 @@
1
- import r from "react";
2
- import n from "classnames";
3
- import { AnalyticsId as b } from "../../constants.js";
1
+ import t from "react";
2
+ import m from "classnames";
3
+ import g from "./NotificationBadge.js";
4
+ import { IconSize as b, AnalyticsId as d } from "../../constants.js";
4
5
  import e from "../Badge/styles.module.scss";
5
- const m = r.forwardRef(function(t, d) {
6
- const { children: s, className: o = "", color: a = "blueberry", testId: l } = t, c = n(
6
+ const u = t.forwardRef(function(n, s) {
7
+ const { children: c, className: r = "", color: a = "blueberry", testId: i, type: l = "string", notificationVariant: o = "info" } = n, f = m(
7
8
  e.badge,
8
9
  {
9
10
  [e["badge--blueberry"]]: a === "blueberry",
10
11
  [e["badge--cherry"]]: a === "cherry",
11
12
  [e["badge--neutral"]]: a === "neutral"
12
13
  },
13
- o
14
+ r
14
15
  );
15
- return /* @__PURE__ */ r.createElement("span", { className: c, ref: d, "data-testid": l, "data-analyticsid": b.Badge }, s);
16
- }), p = m;
16
+ return l === "notification" && o !== void 0 ? /* @__PURE__ */ t.createElement(
17
+ g,
18
+ {
19
+ variant: o,
20
+ size: b.XSmall,
21
+ className: r,
22
+ testId: i,
23
+ "data-analyticsid": d.Badge
24
+ }
25
+ ) : /* @__PURE__ */ t.createElement("span", { className: f, ref: s, "data-testid": i, "data-analyticsid": d.Badge }, c);
26
+ }), R = u;
17
27
  export {
18
- p as default
28
+ R as default
19
29
  };
20
30
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\n\nimport badgeStyles from './styles.module.scss';\n\nexport type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;\nexport type BadgeChildren = string | number;\n\nexport interface BadgeProps {\n /** Sets the content of the badge. */\n children: BadgeChildren;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the badge background color. */\n color?: BadgeColors;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\nexport type BadgeType = React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;\nconst Badge: BadgeType = React.forwardRef(function BadgeForwardedRef(props: BadgeProps, ref: React.ForwardedRef<HTMLElement>) {\n const { children, className = '', color = 'blueberry', testId } = props;\n const badgeClasses = classNames(\n badgeStyles.badge,\n {\n [badgeStyles['badge--blueberry']]: color === 'blueberry',\n [badgeStyles['badge--cherry']]: color === 'cherry',\n [badgeStyles['badge--neutral']]: color === 'neutral',\n },\n className\n );\n\n return (\n <span className={badgeClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Badge}>\n {children}\n </span>\n );\n});\n\nexport default Badge;\n"],"names":["Badge","React","props","ref","children","className","color","testId","badgeClasses","classNames","badgeStyles","AnalyticsId","Badge$1"],"mappings":";;;;AAuBA,MAAMA,IAAmBC,EAAM,WAAW,SAA2BC,GAAmBC,GAAsC;AAC5H,QAAM,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,OAAAC,IAAQ,aAAa,QAAAC,EAAW,IAAAL,GAC5DM,IAAeC;AAAA,IACnBC,EAAY;AAAA,IACZ;AAAA,MACE,CAACA,EAAY,kBAAkB,CAAC,GAAGJ,MAAU;AAAA,MAC7C,CAACI,EAAY,eAAe,CAAC,GAAGJ,MAAU;AAAA,MAC1C,CAACI,EAAY,gBAAgB,CAAC,GAAGJ,MAAU;AAAA,IAC7C;AAAA,IACAD;AAAA,EAAA;AAIA,SAAAJ,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAWO,GAAc,KAAAL,GAAU,eAAaI,GAAQ,oBAAkBI,EAAY,MAAA,GACzFP,CACH;AAEJ,CAAC,GAEDQ,IAAeZ;"}
1
+ {"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport NotificationBadge, { BadgeNotificationVariant } from './NotificationBadge';\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\n\nimport badgeStyles from './styles.module.scss';\n\nexport type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;\nexport type BadgeChildren = string | number;\nexport type BadgeVariant = 'string' | 'notification';\n\nexport interface BadgeProps {\n /** Sets the content of the badge. */\n children?: BadgeChildren;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the badge background color. */\n color?: BadgeColors;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Changes the type of the badge. Default: string */\n type?: BadgeVariant;\n /** Type of notification badge. Only works if type is 'notification'. */\n notificationVariant?: BadgeNotificationVariant;\n}\n\nexport type BadgeType = React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;\nconst Badge: BadgeType = React.forwardRef(function BadgeForwardedRef(props: BadgeProps, ref: React.ForwardedRef<HTMLElement>) {\n const { children, className = '', color = 'blueberry', testId, type = 'string', notificationVariant = 'info' } = props;\n const badgeClasses = classNames(\n badgeStyles.badge,\n {\n [badgeStyles['badge--blueberry']]: color === 'blueberry',\n [badgeStyles['badge--cherry']]: color === 'cherry',\n [badgeStyles['badge--neutral']]: color === 'neutral',\n },\n className\n );\n\n if (type === 'notification' && notificationVariant !== undefined) {\n return (\n <NotificationBadge\n variant={notificationVariant}\n size={IconSize.XSmall}\n className={className}\n testId={testId}\n data-analyticsid={AnalyticsId.Badge}\n />\n );\n }\n\n return (\n <span className={badgeClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Badge}>\n {children}\n </span>\n );\n});\n\nexport default Badge;\n"],"names":["Badge","React","props","ref","children","className","color","testId","type","notificationVariant","badgeClasses","classNames","badgeStyles","NotificationBadge","IconSize","AnalyticsId","Badge$1"],"mappings":";;;;;AA8BA,MAAMA,IAAmBC,EAAM,WAAW,SAA2BC,GAAmBC,GAAsC;AACtH,QAAA,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,OAAAC,IAAQ,aAAa,QAAAC,GAAQ,MAAAC,IAAO,UAAU,qBAAAC,IAAsB,OAAA,IAAWP,GAC3GQ,IAAeC;AAAA,IACnBC,EAAY;AAAA,IACZ;AAAA,MACE,CAACA,EAAY,kBAAkB,CAAC,GAAGN,MAAU;AAAA,MAC7C,CAACM,EAAY,eAAe,CAAC,GAAGN,MAAU;AAAA,MAC1C,CAACM,EAAY,gBAAgB,CAAC,GAAGN,MAAU;AAAA,IAC7C;AAAA,IACAD;AAAA,EAAA;AAGE,SAAAG,MAAS,kBAAkBC,MAAwB,SAEnDR,gBAAAA,EAAA;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,SAASJ;AAAA,MACT,MAAMK,EAAS;AAAA,MACf,WAAAT;AAAA,MACA,QAAAE;AAAA,MACA,oBAAkBQ,EAAY;AAAA,IAAA;AAAA,EAAA,IAMlCd,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAWS,GAAc,KAAAP,GAAU,eAAaI,GAAQ,oBAAkBQ,EAAY,MAAA,GACzFX,CACH;AAEJ,CAAC,GAEDY,IAAehB;"}
@@ -14,6 +14,8 @@ declare const meta: {
14
14
  args: {
15
15
  children: string;
16
16
  color: "blueberry";
17
+ type: "string";
18
+ notificationVariant: "info";
17
19
  };
18
20
  argTypes: {
19
21
  children: {
@@ -23,9 +25,18 @@ declare const meta: {
23
25
  control: string;
24
26
  options: string[];
25
27
  };
28
+ type: {
29
+ control: string;
30
+ options: string[];
31
+ };
32
+ notificationVariant: {
33
+ control: string;
34
+ options: string[];
35
+ };
26
36
  };
27
37
  };
28
38
  export default meta;
29
39
  type Story = StoryObj<typeof meta>;
30
40
  export declare const Default: Story;
31
41
  export declare const Variants: Story;
42
+ export declare const Notification: Story;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { IconSize } from '../../constants';
3
+ export type BadgeNotificationVariant = 'info' | 'warn' | 'error' | 'success';
4
+ export interface NotificationBadgeProps {
5
+ /** Changes the type of the badge */
6
+ variant: BadgeNotificationVariant;
7
+ /** Sets the size of the badge */
8
+ size: IconSize;
9
+ /** Adds custom classes to the element */
10
+ className?: string;
11
+ /** Sets the data-testid attribute. */
12
+ testId?: string;
13
+ /** Sets hover state */
14
+ isHovered?: boolean;
15
+ }
16
+ declare const NotificationBadge: (props: NotificationBadgeProps) => React.JSX.Element;
17
+ export default NotificationBadge;
@@ -0,0 +1,68 @@
1
+ import c from "react";
2
+ import { palette as r } from "../../theme/palette.js";
3
+ import { Icon as n } from "../Icon/Icon.js";
4
+ import s from "../Icons/CheckFill.js";
5
+ import m from "../Icons/ErrorSignFill.js";
6
+ import f from "../Icons/InfoSignFill.js";
7
+ import v from "../Icons/TriangleX.js";
8
+ const g = (i) => {
9
+ const { variant: l, size: e, className: o = "", testId: t, isHovered: a = !1 } = i;
10
+ switch (l) {
11
+ case "info":
12
+ return /* @__PURE__ */ c.createElement(
13
+ n,
14
+ {
15
+ svgIcon: f,
16
+ color: r.blueberry700,
17
+ hoverColor: r.blueberry700,
18
+ size: e,
19
+ className: o,
20
+ testId: t,
21
+ isHovered: a
22
+ }
23
+ );
24
+ case "warn":
25
+ return /* @__PURE__ */ c.createElement(
26
+ n,
27
+ {
28
+ svgIcon: m,
29
+ color: r.banana700,
30
+ hoverColor: r.banana700,
31
+ size: e,
32
+ className: o,
33
+ testId: t,
34
+ isHovered: a
35
+ }
36
+ );
37
+ case "error":
38
+ return /* @__PURE__ */ c.createElement(
39
+ n,
40
+ {
41
+ svgIcon: v,
42
+ color: r.cherry700,
43
+ hoverColor: r.cherry700,
44
+ size: e,
45
+ className: o,
46
+ testId: t,
47
+ isHovered: a
48
+ }
49
+ );
50
+ case "success":
51
+ return /* @__PURE__ */ c.createElement(
52
+ n,
53
+ {
54
+ svgIcon: s,
55
+ color: r.kiwi900,
56
+ hoverColor: r.kiwi900,
57
+ size: e,
58
+ className: o,
59
+ testId: t,
60
+ isHovered: a
61
+ }
62
+ );
63
+ }
64
+ }, E = g;
65
+ export {
66
+ E as default
67
+ };
68
+ //# sourceMappingURL=NotificationBadge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationBadge.js","sources":["../../../src/components/Badge/NotificationBadge.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconSize } from '../../constants';\nimport { palette } from '../../theme/palette';\nimport Icon from '../Icon';\nimport CheckFill from '../Icons/CheckFill';\nimport ErrorSignFill from '../Icons/ErrorSignFill';\nimport InfoSignFill from '../Icons/InfoSignFill';\nimport TriangleX from '../Icons/TriangleX';\n\nexport type BadgeNotificationVariant = 'info' | 'warn' | 'error' | 'success';\n\nexport interface NotificationBadgeProps {\n /** Changes the type of the badge */\n variant: BadgeNotificationVariant;\n /** Sets the size of the badge */\n size: IconSize;\n /** Adds custom classes to the element */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets hover state */\n isHovered?: boolean;\n}\n\nconst NotificationBadge = (props: NotificationBadgeProps): React.JSX.Element => {\n const { variant, size, className = '', testId, isHovered = false } = props;\n switch (variant) {\n case 'info':\n return (\n <Icon\n svgIcon={InfoSignFill}\n color={palette.blueberry700}\n hoverColor={palette.blueberry700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'warn':\n return (\n <Icon\n svgIcon={ErrorSignFill}\n color={palette.banana700}\n hoverColor={palette.banana700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'error':\n return (\n <Icon\n svgIcon={TriangleX}\n color={palette.cherry700}\n hoverColor={palette.cherry700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'success':\n return (\n <Icon\n svgIcon={CheckFill}\n color={palette.kiwi900}\n hoverColor={palette.kiwi900}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n }\n};\n\nexport default NotificationBadge;\n"],"names":["NotificationBadge","props","variant","size","className","testId","isHovered","React","Icon","InfoSignFill","palette","ErrorSignFill","TriangleX","CheckFill","NotificationBadge$1"],"mappings":";;;;;;;AAyBA,MAAMA,IAAoB,CAACC,MAAqD;AACxE,QAAA,EAAE,SAAAC,GAAS,MAAAC,GAAM,WAAAC,IAAY,IAAI,QAAAC,GAAQ,WAAAC,IAAY,GAAU,IAAAL;AACrE,UAAQC,GAAS;AAAA,IACf,KAAK;AAED,aAAAK,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASC;AAAA,UACT,OAAOC,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASG;AAAA,UACT,OAAOD,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASI;AAAA,UACT,OAAOF,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASK;AAAA,UACT,OAAOH,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,EAGR;AACF,GAEAQ,IAAed;"}
@@ -6,6 +6,7 @@ export type ButtonSize = 'medium' | 'large';
6
6
  export type ButtonMode = 'onlight' | 'ondark';
7
7
  export type ButtonTags = 'button' | 'a';
8
8
  export type ButtonArrows = 'icon' | 'accessibility-character';
9
+ export type ButtonTextPosition = 'left' | 'centered-mobile';
9
10
  export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {
10
11
  /** Sets the aria-label of the button, use when the button only includes an icon */
11
12
  ariaLabel?: string;
@@ -41,6 +42,8 @@ export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttri
41
42
  tabIndex?: number;
42
43
  /** Sets the data-testid attribute. */
43
44
  testId?: string;
45
+ /** Sets the position of the text in the button - only applies when button is fluid */
46
+ textPosition?: ButtonTextPosition;
44
47
  /** Button type. Default: button */
45
48
  type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
46
49
  }
@@ -1,116 +1,118 @@
1
- import o, { useRef as lt, useEffect as ct } from "react";
2
- import d from "classnames";
3
- import { Icon as it } from "../Icon/Icon.js";
4
- import { AnalyticsId as $, IconSize as v } from "../../constants.js";
5
- import { useBreakpoint as ut } from "../../hooks/useBreakpoint.js";
1
+ import e, { useRef as it, useEffect as ct } from "react";
2
+ import p from "classnames";
3
+ import { Icon as ut } from "../Icon/Icon.js";
4
+ import { AnalyticsId as $, IconSize as N } from "../../constants.js";
5
+ import { useBreakpoint as mt } from "../../hooks/useBreakpoint.js";
6
6
  import { useHover as D } from "../../hooks/useHover.js";
7
- import { useIcons as mt } from "../../hooks/useIcons.js";
8
- import { getColor as i } from "../../theme/currys/color.js";
9
- import { breakpoints as bt } from "../../theme/grid.js";
10
- import { isTest as dt, isProd as pt } from "../../utils/environment.js";
11
- import ft from "../Icons/ArrowRight.js";
7
+ import { useIcons as bt } from "../../hooks/useIcons.js";
8
+ import { getColor as c } from "../../theme/currys/color.js";
9
+ import { breakpoints as dt } from "../../theme/grid.js";
10
+ import { isTest as pt, isProd as ft } from "../../utils/environment.js";
11
+ import ht from "../Icons/ArrowRight.js";
12
12
  import t from "../Button/styles.module.scss";
13
- const ht = (e, r, n, p, a, g) => g && n ? !a || e ? i("neutral", r ? 500 : 700) : i("white") : n ? !a || e ? i("neutral", 500) : `${i("white")}b3` : e && !a || !e && a ? "white" : p === "normal" ? i("blueberry", 600) : i("cherry", 500), N = (e, r) => r && e ? v.Small : e ? v.Medium : v.XSmall, gt = (e, r, n) => {
14
- if (n && e && (r === void 0 || r === ""))
13
+ const _t = (o, r, n, f, s, _) => _ && n ? !s || o ? c("neutral", r ? 500 : 700) : c("white") : n ? !s || o ? c("neutral", 500) : `${c("white")}b3` : o && !s || !o && s ? "white" : f === "normal" ? c("blueberry", 600) : c("cherry", 500), B = (o, r) => r && o ? N.Small : o ? N.Medium : N.XSmall, gt = (o, r, n) => {
14
+ if (n && o && (r === void 0 || r === ""))
15
15
  throw new Error("Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav");
16
- }, _t = o.forwardRef(function(r, n) {
16
+ }, wt = e.forwardRef(function(r, n) {
17
17
  const {
18
- ariaLabel: p,
19
- id: a,
20
- children: g,
18
+ ariaLabel: f,
19
+ id: s,
20
+ children: _,
21
21
  wrapperClassName: O,
22
22
  className: X,
23
- arrow: _,
24
- concept: B = "normal",
25
- disabled: f = !1,
26
- ellipsis: R = !1,
27
- fluid: A = !1,
28
- htmlMarkup: w = "button",
23
+ arrow: g,
24
+ concept: R = "normal",
25
+ disabled: u = !1,
26
+ ellipsis: x = !1,
27
+ fluid: w = !1,
28
+ htmlMarkup: I = "button",
29
29
  mode: j = "onlight",
30
- onBlur: E,
31
- onClick: x,
30
+ onBlur: A,
31
+ onClick: E,
32
32
  size: q = "medium",
33
- variant: I = "fill",
33
+ variant: y = "fill",
34
34
  href: G,
35
35
  tabIndex: S,
36
36
  testId: z,
37
37
  target: U,
38
38
  type: J = "button",
39
+ textPosition: K = "left",
39
40
  ...F
40
- } = r, [u, m, H] = mt(o.Children.toArray(g)), { hoverRef: L, isHovered: K } = w === "button" ? D(n) : D(n), Q = lt(null), s = !!(u || m) && !H, M = u && (m || _) && !s, y = j === "ondark", h = ut() < bt.md, P = B === "destructive" && !f, Y = I === "outline", l = I === "borderless", T = ht(I === "fill", l, f, B, y, h), C = _ === "icon" && !l, b = q === "large" && !P && !l, Z = _ === "accessibility-character" && !A && !u && !m && !C && l, tt = { ...F }, V = d(
41
+ } = r, [m, b, H] = bt(e.Children.toArray(_)), { hoverRef: P, isHovered: Q } = I === "button" ? D(n) : D(n), Y = it(null), a = !!(m || b) && !H, L = m && (b || g) && !a, C = j === "ondark", h = mt() < dt.md, M = R === "destructive" && !u, Z = y === "outline", l = y === "borderless", T = _t(y === "fill", l, u, R, C, h), v = g === "icon" && !l, d = q === "large" && !M && !l, tt = g === "accessibility-character" && !w && !m && !b && !v && l, et = { ...F }, V = p(
41
42
  t["button-wrapper"],
42
- { [t["button-wrapper--fluid"]]: A || R },
43
+ { [t["button-wrapper--fluid"]]: w || x },
43
44
  O
44
- ), ot = d(
45
+ ), ot = p(
45
46
  t.button,
46
47
  {
47
- [t["button--destructive"]]: P,
48
- [t["button--normal"]]: !b,
49
- [t["button--large"]]: b,
50
- [t["button--outline"]]: Y,
48
+ [t["button--destructive"]]: M,
49
+ [t["button--normal"]]: !d,
50
+ [t["button--large"]]: d,
51
+ [t["button--outline"]]: Z,
51
52
  [t["button--borderless"]]: l,
52
- [t["button--left-icon"]]: u && !s,
53
- [t["button--right-icon"]]: m && !s,
54
- [t["button--both-icons"]]: M,
55
- [t["button--only-icon"]]: s,
56
- [t["button--arrow"]]: C,
57
- [t["button--on-dark"]]: y
53
+ [t["button--left-icon"]]: m && !a,
54
+ [t["button--right-icon"]]: b && !a,
55
+ [t["button--both-icons"]]: L,
56
+ [t["button--only-icon"]]: a,
57
+ [t["button--arrow"]]: v,
58
+ [t["button--on-dark"]]: C
58
59
  },
59
60
  X
60
- ), et = d(t.button__text, {
61
- [t["button__text--ellipsis"]]: R
62
- }), rt = d(t.diagonal, {
63
- [t["diagonal--on-dark"]]: y
61
+ ), rt = p(t.button__text, {
62
+ [t["button__text--ellipsis"]]: x,
63
+ [t["button__text--centered-mobile"]]: w && K === "centered-mobile"
64
+ }), nt = p(t.diagonal, {
65
+ [t["diagonal--on-dark"]]: C
64
66
  });
65
67
  ct(() => {
66
- gt(s, p, !dt() && !pt());
68
+ gt(a, f, !pt() && !ft());
67
69
  }, []);
68
- const k = (c, at, st) => c ? o.cloneElement(c, {
70
+ const k = (i, at, lt) => i ? e.cloneElement(i, {
69
71
  size: at,
70
- color: c != null && c.props.color ? c.props.color : T,
71
- isHovered: K,
72
- className: st
73
- }) : null, nt = () => /* @__PURE__ */ o.createElement("span", { className: et, ref: Q }, f && l && /* @__PURE__ */ o.createElement("span", { className: rt }, /* @__PURE__ */ o.createElement("span", { className: t.diagonal__line })), /* @__PURE__ */ o.createElement("span", null, s ? p : H)), W = () => /* @__PURE__ */ o.createElement("span", { className: ot }, k(u, N(b, h), s ? void 0 : t["button__left-icon"]), nt(), C ? k(
74
- /* @__PURE__ */ o.createElement(it, { svgIcon: ft }),
75
- N(b, h),
76
- d(t.button__arrow, { [t["button__arrow--both-icons"]]: M })
77
- ) : k(m, N(b, h), t["button__right-icon"]), Z && /* @__PURE__ */ o.createElement("span", { style: { color: T }, className: t["button__right-unicode-arrow"], "aria-hidden": !0 }, " →"));
78
- return /* @__PURE__ */ o.createElement(o.Fragment, null, w === "button" && /* @__PURE__ */ o.createElement(
72
+ color: i != null && i.props.color ? i.props.color : T,
73
+ isHovered: !u && Q,
74
+ className: lt
75
+ }) : null, st = () => /* @__PURE__ */ e.createElement("span", { className: rt, ref: Y }, u && l && /* @__PURE__ */ e.createElement("span", { className: nt }, /* @__PURE__ */ e.createElement("span", { className: t.diagonal__line })), /* @__PURE__ */ e.createElement("span", null, a ? f : H)), W = () => /* @__PURE__ */ e.createElement("span", { className: ot }, k(m, B(d, h), a ? void 0 : t["button__left-icon"]), st(), v ? k(
76
+ /* @__PURE__ */ e.createElement(ut, { svgIcon: ht }),
77
+ B(d, h),
78
+ p(t.button__arrow, { [t["button__arrow--both-icons"]]: L })
79
+ ) : k(b, B(d, h), t["button__right-icon"]), tt && /* @__PURE__ */ e.createElement("span", { style: { color: T }, className: t["button__right-unicode-arrow"], "aria-hidden": !0 }, " →"));
80
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, I === "button" && /* @__PURE__ */ e.createElement(
79
81
  "button",
80
82
  {
81
- id: a,
82
- onBlur: E,
83
- onClick: x,
84
- disabled: f,
83
+ id: s,
84
+ onBlur: A,
85
+ onClick: E,
86
+ disabled: u,
85
87
  "data-testid": z,
86
88
  "data-analyticsid": $.Button,
87
89
  className: V,
88
- ref: L,
90
+ ref: P,
89
91
  tabIndex: S,
90
92
  type: J,
91
- ...tt
93
+ ...et
92
94
  },
93
95
  W()
94
- ), w === "a" && /* @__PURE__ */ o.createElement(
96
+ ), I === "a" && /* @__PURE__ */ e.createElement(
95
97
  "a",
96
98
  {
97
- id: a,
98
- onBlur: E,
99
- onClick: x,
99
+ id: s,
100
+ onBlur: A,
101
+ onClick: E,
100
102
  "data-testid": z,
101
103
  "data-analyticsid": $.Button,
102
104
  className: V,
103
105
  href: G,
104
106
  target: U,
105
107
  rel: U === "_blank" ? "noopener noreferrer" : r.rel,
106
- ref: L,
108
+ ref: P,
107
109
  tabIndex: S,
108
110
  ...F
109
111
  },
110
112
  W()
111
113
  ));
112
- }), zt = _t;
114
+ }), Ut = wt;
113
115
  export {
114
- zt as default
116
+ Ut as default
115
117
  };
116
118
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { AriaAttributes, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from './../Icon';\nimport { HTMLButtonProps, HTMLAnchorProps, AnalyticsId } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { BaseIconElement, useIcons } from '../../hooks/useIcons';\nimport { getColor } from '../../theme/currys/color';\nimport { breakpoints } from '../../theme/grid';\nimport { isTest, isProd } from '../../utils/environment';\nimport ArrowRight from '../Icons/ArrowRight';\n\nimport buttonStyles from './styles.module.scss';\n\nexport type ButtonConcept = 'normal' | 'destructive';\nexport type ButtonVariant = 'fill' | 'outline' | 'borderless';\nexport type ButtonSize = 'medium' | 'large';\nexport type ButtonMode = 'onlight' | 'ondark';\nexport type ButtonTags = 'button' | 'a';\nexport type ButtonArrows = 'icon' | 'accessibility-character';\n\nexport interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {\n /** Sets the aria-label of the button, use when the button only includes an icon */\n ariaLabel?: string;\n /** Gives a unique id to the button */\n id?: string;\n /** Sets the content of the button. */\n children: React.ReactNode;\n /** Adds custom classes to the wrapper element. */\n wrapperClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Enables an arrow icon to the right inside the button (Not available in borderless variant) */\n arrow?: ButtonArrows;\n /** Changes the intent of the button. Mostly changes the color profile. */\n concept?: ButtonConcept;\n /** Disables text wrapping and enables ellipsis. */\n ellipsis?: boolean;\n /** Makes the button scale to full width of its parent element. */\n fluid?: boolean;\n /** Changes the underlying element of the button. */\n htmlMarkup?: ButtonTags;\n /** Changes the button colors for different backgrounds. */\n mode?: ButtonMode;\n /** Function that is called when the Button loses focus */\n onBlur?: () => void;\n /** Function that is called when clicked */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<{}> | React.KeyboardEvent<HTMLUListElement> | null) => void;\n /** Changes the button colors for different backgrounds. (Large not available in borderless variant) */\n size?: ButtonSize;\n /** Changes the visual representation of the button. */\n variant?: ButtonVariant;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Button type. Default: button */\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n}\n\nconst getIconColor = (\n fill: boolean,\n borderless: boolean,\n disabled: boolean,\n concept: ButtonConcept,\n ondark: boolean,\n mobile: boolean\n): string => {\n if (mobile && disabled) {\n return !ondark || fill ? getColor('neutral', !borderless ? 700 : 500) : getColor('white');\n }\n if (disabled) {\n return !ondark || fill ? getColor('neutral', 500) : `${getColor('white')}b3`;\n }\n if ((fill && !ondark) || (!fill && ondark)) {\n return 'white';\n }\n\n return concept === 'normal' ? getColor('blueberry', 600) : getColor('cherry', 500);\n};\nconst getLargeIconSize = (large: boolean, mobile: boolean): IconSize => {\n if (mobile && large) return IconSize.Small;\n if (large) return IconSize.Medium;\n return IconSize.XSmall;\n};\n\nconst checkOnlyIconAria = (onlyIcon: boolean, ariaLabel: string | undefined, devEnv: boolean): void => {\n if (devEnv && onlyIcon && (ariaLabel === undefined || ariaLabel === '')) {\n throw new Error('Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav');\n }\n};\n\nconst Button = React.forwardRef(function ButtonForwardedRef(\n props: ButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>\n) {\n const {\n ariaLabel,\n id,\n children,\n wrapperClassName,\n className,\n arrow,\n concept = 'normal',\n disabled = false,\n ellipsis = false,\n fluid = false,\n htmlMarkup = 'button',\n mode = 'onlight',\n onBlur,\n onClick,\n size = 'medium',\n variant = 'fill',\n href,\n tabIndex,\n testId,\n target,\n type = 'button',\n ...restProps\n } = props;\n\n const [leftIcon, rightIcon, restChildren] = useIcons(React.Children.toArray(children));\n const { hoverRef, isHovered } =\n htmlMarkup === 'button'\n ? useHover<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>)\n : useHover<HTMLAnchorElement>(ref as React.RefObject<HTMLAnchorElement>);\n const buttonContentRef = useRef<HTMLDivElement>(null);\n const onlyIcon = !!(leftIcon || rightIcon) && !restChildren;\n const bothIcons = leftIcon && (rightIcon || arrow) && !onlyIcon;\n const onDark = mode === 'ondark';\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n const destructive = concept === 'destructive' && !disabled;\n const outlineVariant = variant === 'outline';\n const borderlessVariant = variant === 'borderless';\n const iconColor = getIconColor(variant === 'fill', borderlessVariant, disabled, concept, onDark, mobile);\n const hasArrow = arrow === 'icon' && !borderlessVariant;\n const large = size === 'large' && !destructive && !borderlessVariant;\n const hasUURightArrow = arrow === 'accessibility-character' && !fluid && !leftIcon && !rightIcon && !hasArrow && borderlessVariant;\n const rest = { ...restProps };\n\n const buttonWrapperClasses = classNames(\n buttonStyles['button-wrapper'],\n { [buttonStyles['button-wrapper--fluid']]: fluid || ellipsis },\n wrapperClassName\n );\n const buttonClasses = classNames(\n buttonStyles.button,\n {\n [buttonStyles['button--destructive']]: destructive,\n [buttonStyles['button--normal']]: !large,\n [buttonStyles['button--large']]: large,\n [buttonStyles['button--outline']]: outlineVariant,\n [buttonStyles['button--borderless']]: borderlessVariant,\n [buttonStyles['button--left-icon']]: leftIcon && !onlyIcon,\n [buttonStyles['button--right-icon']]: rightIcon && !onlyIcon,\n [buttonStyles['button--both-icons']]: bothIcons,\n [buttonStyles['button--only-icon']]: onlyIcon,\n [buttonStyles['button--arrow']]: hasArrow,\n [buttonStyles['button--on-dark']]: onDark,\n },\n className\n );\n const buttonTextClasses = classNames(buttonStyles['button__text'], {\n [buttonStyles['button__text--ellipsis']]: ellipsis,\n });\n const diagonalClasses = classNames(buttonStyles['diagonal'], {\n [buttonStyles['diagonal--on-dark']]: onDark,\n });\n\n useEffect(() => {\n checkOnlyIconAria(onlyIcon, ariaLabel, !isTest() && !isProd());\n }, []);\n\n const renderIcon = (iconElement: BaseIconElement | null, iconSize: number, iconClassName?: string): BaseIconElement | null => {\n return iconElement\n ? React.cloneElement(iconElement, {\n size: iconSize,\n color: iconElement?.props.color ? iconElement.props.color : iconColor,\n isHovered,\n className: iconClassName,\n })\n : null;\n };\n\n const renderButtonContent = (): JSX.Element => {\n return (\n <span className={buttonTextClasses} ref={buttonContentRef}>\n {disabled && borderlessVariant && (\n <span className={diagonalClasses}>\n <span className={buttonStyles['diagonal__line']} />\n </span>\n )}\n <span>{onlyIcon ? ariaLabel : restChildren}</span>\n </span>\n );\n };\n\n const renderbuttonContentWrapper = (): JSX.Element => (\n <span className={buttonClasses}>\n {renderIcon(leftIcon, getLargeIconSize(large, mobile), !onlyIcon ? buttonStyles['button__left-icon'] : undefined)}\n {renderButtonContent()}\n {hasArrow\n ? renderIcon(\n <Icon svgIcon={ArrowRight} />,\n getLargeIconSize(large, mobile),\n classNames(buttonStyles['button__arrow'], { [buttonStyles['button__arrow--both-icons']]: bothIcons })\n )\n : renderIcon(rightIcon, getLargeIconSize(large, mobile), buttonStyles['button__right-icon'])}\n {hasUURightArrow && (\n <span style={{ color: iconColor }} className={buttonStyles['button__right-unicode-arrow']} aria-hidden>\n {' →'}\n </span>\n )}\n </span>\n );\n\n return (\n <>\n {htmlMarkup === 'button' && (\n <button\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n disabled={disabled}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n ref={hoverRef as React.ForwardedRef<HTMLButtonElement>}\n tabIndex={tabIndex}\n type={type}\n {...rest}\n >\n {renderbuttonContentWrapper()}\n </button>\n )}\n {htmlMarkup === 'a' && (\n <a\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : props.rel}\n ref={hoverRef as React.ForwardedRef<HTMLAnchorElement>}\n tabIndex={tabIndex}\n {...restProps}\n >\n {renderbuttonContentWrapper()}\n </a>\n )}\n </>\n );\n});\n\nexport default Button;\n"],"names":["getIconColor","fill","borderless","disabled","concept","ondark","mobile","getColor","getLargeIconSize","large","IconSize","checkOnlyIconAria","onlyIcon","ariaLabel","devEnv","Button","React","props","ref","id","children","wrapperClassName","className","arrow","ellipsis","fluid","htmlMarkup","mode","onBlur","onClick","size","variant","href","tabIndex","testId","target","type","restProps","leftIcon","rightIcon","restChildren","useIcons","hoverRef","isHovered","useHover","buttonContentRef","useRef","bothIcons","onDark","useBreakpoint","breakpoints","destructive","outlineVariant","borderlessVariant","iconColor","hasArrow","hasUURightArrow","rest","buttonWrapperClasses","classNames","buttonStyles","buttonClasses","buttonTextClasses","diagonalClasses","useEffect","isTest","isProd","renderIcon","iconElement","iconSize","iconClassName","renderButtonContent","renderbuttonContentWrapper","Icon","ArrowRight","AnalyticsId","Button$1"],"mappings":";;;;;;;;;;;;AA8DA,MAAMA,KAAe,CACnBC,GACAC,GACAC,GACAC,GACAC,GACAC,MAEIA,KAAUH,IACL,CAACE,KAAUJ,IAAOM,EAAS,WAAYL,IAAmB,MAAN,GAAS,IAAIK,EAAS,OAAO,IAEtFJ,IACK,CAACE,KAAUJ,IAAOM,EAAS,WAAW,GAAG,IAAI,GAAGA,EAAS,OAAO,CAAC,OAErEN,KAAQ,CAACI,KAAY,CAACJ,KAAQI,IAC1B,UAGFD,MAAY,WAAWG,EAAS,aAAa,GAAG,IAAIA,EAAS,UAAU,GAAG,GAE7EC,IAAmB,CAACC,GAAgBH,MACpCA,KAAUG,IAAcC,EAAS,QACjCD,IAAcC,EAAS,SACpBA,EAAS,QAGZC,KAAoB,CAACC,GAAmBC,GAA+BC,MAA0B;AACrG,MAAIA,KAAUF,MAAaC,MAAc,UAAaA,MAAc;AAC5D,UAAA,IAAI,MAAM,yEAAyE;AAE7F,GAEME,KAASC,EAAM,WAAW,SAC9BC,GACAC,GACA;AACM,QAAA;AAAA,IACJ,WAAAL;AAAA,IACA,IAAAM;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAnB,IAAU;AAAA,IACV,UAAAD,IAAW;AAAA,IACX,UAAAqB,IAAW;AAAA,IACX,OAAAC,IAAQ;AAAA,IACR,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO;AAAA,IACP,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,SAAAC,IAAU;AAAA,IACV,MAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,GAAGC;AAAA,EACD,IAAApB,GAEE,CAACqB,GAAUC,GAA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AAAA,IACEnD,gBAAAA,EAAA,cAACyD,IAAK,EAAA,SAASC,GAAY,CAAA;AAAA,IAC3BlE,EAAiBC,GAAOH,CAAM;AAAA,IAC9BqD,EAAWC,EAAa,eAAkB,EAAE,CAACA,EAAa,2BAA2B,CAAC,GAAGb,GAAW;AAAA,EACtG,IACAoB,EAAW5B,GAAW/B,EAAiBC,GAAOH,CAAM,GAAGsD,EAAa,oBAAoB,CAAC,GAC5FJ,KACCxC,gBAAAA,EAAA,cAAC,UAAK,OAAO,EAAE,OAAOsC,EAAA,GAAa,WAAWM,EAAa,6BAA6B,GAAG,eAAW,MACnG,KACH,CAEJ;AAIA,SAAA5C,gBAAAA,EAAA,cAAAA,EAAA,UAAA,MACGU,MAAe,YACdV,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAG;AAAA,MACA,QAAAS;AAAA,MACA,SAAAC;AAAA,MACA,UAAA1B;AAAA,MACA,eAAa+B;AAAA,MACb,oBAAkByC,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,KAAKhB;AAAA,MACL,UAAAT;AAAA,MACA,MAAAG;AAAA,MACC,GAAGqB;AAAA,IAAA;AAAA,IAEHe,EAA2B;AAAA,EAAA,GAG/B9C,MAAe,OACdV,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAG;AAAA,MACA,QAAAS;AAAA,MACA,SAAAC;AAAA,MACA,eAAaK;AAAA,MACb,oBAAkByC,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,MAAA1B;AAAA,MACA,QAAAG;AAAA,MACA,KAAKA,MAAW,WAAW,wBAAwBlB,EAAM;AAAA,MACzD,KAAKyB;AAAA,MACL,UAAAT;AAAA,MACC,GAAGI;AAAA,IAAA;AAAA,IAEHmC,EAA2B;AAAA,EAAA,CAGlC;AAEJ,CAAC,GAEDI,KAAe7D;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { AriaAttributes, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from './../Icon';\nimport { HTMLButtonProps, HTMLAnchorProps, AnalyticsId } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { BaseIconElement, useIcons } from '../../hooks/useIcons';\nimport { getColor } from '../../theme/currys/color';\nimport { breakpoints } from '../../theme/grid';\nimport { isTest, isProd } from '../../utils/environment';\nimport ArrowRight from '../Icons/ArrowRight';\n\nimport buttonStyles from './styles.module.scss';\n\nexport type ButtonConcept = 'normal' | 'destructive';\nexport type ButtonVariant = 'fill' | 'outline' | 'borderless';\nexport type ButtonSize = 'medium' | 'large';\nexport type ButtonMode = 'onlight' | 'ondark';\nexport type ButtonTags = 'button' | 'a';\nexport type ButtonArrows = 'icon' | 'accessibility-character';\nexport type ButtonTextPosition = 'left' | 'centered-mobile';\n\nexport interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {\n /** Sets the aria-label of the button, use when the button only includes an icon */\n ariaLabel?: string;\n /** Gives a unique id to the button */\n id?: string;\n /** Sets the content of the button. */\n children: React.ReactNode;\n /** Adds custom classes to the wrapper element. */\n wrapperClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Enables an arrow icon to the right inside the button (Not available in borderless variant) */\n arrow?: ButtonArrows;\n /** Changes the intent of the button. Mostly changes the color profile. */\n concept?: ButtonConcept;\n /** Disables text wrapping and enables ellipsis. */\n ellipsis?: boolean;\n /** Makes the button scale to full width of its parent element. */\n fluid?: boolean;\n /** Changes the underlying element of the button. */\n htmlMarkup?: ButtonTags;\n /** Changes the button colors for different backgrounds. */\n mode?: ButtonMode;\n /** Function that is called when the Button loses focus */\n onBlur?: () => void;\n /** Function that is called when clicked */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<{}> | React.KeyboardEvent<HTMLUListElement> | null) => void;\n /** Changes the button colors for different backgrounds. (Large not available in borderless variant) */\n size?: ButtonSize;\n /** Changes the visual representation of the button. */\n variant?: ButtonVariant;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the position of the text in the button - only applies when button is fluid */\n textPosition?: ButtonTextPosition;\n /** Button type. Default: button */\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n}\n\nconst getIconColor = (\n fill: boolean,\n borderless: boolean,\n disabled: boolean,\n concept: ButtonConcept,\n ondark: boolean,\n mobile: boolean\n): string => {\n if (mobile && disabled) {\n return !ondark || fill ? getColor('neutral', !borderless ? 700 : 500) : getColor('white');\n }\n if (disabled) {\n return !ondark || fill ? getColor('neutral', 500) : `${getColor('white')}b3`;\n }\n if ((fill && !ondark) || (!fill && ondark)) {\n return 'white';\n }\n\n return concept === 'normal' ? getColor('blueberry', 600) : getColor('cherry', 500);\n};\nconst getLargeIconSize = (large: boolean, mobile: boolean): IconSize => {\n if (mobile && large) return IconSize.Small;\n if (large) return IconSize.Medium;\n return IconSize.XSmall;\n};\n\nconst checkOnlyIconAria = (onlyIcon: boolean, ariaLabel: string | undefined, devEnv: boolean): void => {\n if (devEnv && onlyIcon && (ariaLabel === undefined || ariaLabel === '')) {\n throw new Error('Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav');\n }\n};\n\nconst Button = React.forwardRef(function ButtonForwardedRef(\n props: ButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>\n) {\n const {\n ariaLabel,\n id,\n children,\n wrapperClassName,\n className,\n arrow,\n concept = 'normal',\n disabled = false,\n ellipsis = false,\n fluid = false,\n htmlMarkup = 'button',\n mode = 'onlight',\n onBlur,\n onClick,\n size = 'medium',\n variant = 'fill',\n href,\n tabIndex,\n testId,\n target,\n type = 'button',\n textPosition = 'left',\n ...restProps\n } = props;\n\n const [leftIcon, rightIcon, restChildren] = useIcons(React.Children.toArray(children));\n const { hoverRef, isHovered } =\n htmlMarkup === 'button'\n ? useHover<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>)\n : useHover<HTMLAnchorElement>(ref as React.RefObject<HTMLAnchorElement>);\n const buttonContentRef = useRef<HTMLDivElement>(null);\n const onlyIcon = !!(leftIcon || rightIcon) && !restChildren;\n const bothIcons = leftIcon && (rightIcon || arrow) && !onlyIcon;\n const onDark = mode === 'ondark';\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n const destructive = concept === 'destructive' && !disabled;\n const outlineVariant = variant === 'outline';\n const borderlessVariant = variant === 'borderless';\n const iconColor = getIconColor(variant === 'fill', borderlessVariant, disabled, concept, onDark, mobile);\n const hasArrow = arrow === 'icon' && !borderlessVariant;\n const large = size === 'large' && !destructive && !borderlessVariant;\n const hasUURightArrow = arrow === 'accessibility-character' && !fluid && !leftIcon && !rightIcon && !hasArrow && borderlessVariant;\n const rest = { ...restProps };\n\n const buttonWrapperClasses = classNames(\n buttonStyles['button-wrapper'],\n { [buttonStyles['button-wrapper--fluid']]: fluid || ellipsis },\n wrapperClassName\n );\n const buttonClasses = classNames(\n buttonStyles.button,\n {\n [buttonStyles['button--destructive']]: destructive,\n [buttonStyles['button--normal']]: !large,\n [buttonStyles['button--large']]: large,\n [buttonStyles['button--outline']]: outlineVariant,\n [buttonStyles['button--borderless']]: borderlessVariant,\n [buttonStyles['button--left-icon']]: leftIcon && !onlyIcon,\n [buttonStyles['button--right-icon']]: rightIcon && !onlyIcon,\n [buttonStyles['button--both-icons']]: bothIcons,\n [buttonStyles['button--only-icon']]: onlyIcon,\n [buttonStyles['button--arrow']]: hasArrow,\n [buttonStyles['button--on-dark']]: onDark,\n },\n className\n );\n const buttonTextClasses = classNames(buttonStyles['button__text'], {\n [buttonStyles['button__text--ellipsis']]: ellipsis,\n [buttonStyles['button__text--centered-mobile']]: fluid && textPosition === 'centered-mobile',\n });\n const diagonalClasses = classNames(buttonStyles['diagonal'], {\n [buttonStyles['diagonal--on-dark']]: onDark,\n });\n\n useEffect(() => {\n checkOnlyIconAria(onlyIcon, ariaLabel, !isTest() && !isProd());\n }, []);\n\n const renderIcon = (iconElement: BaseIconElement | null, iconSize: number, iconClassName?: string): BaseIconElement | null => {\n return iconElement\n ? React.cloneElement(iconElement, {\n size: iconSize,\n color: iconElement?.props.color ? iconElement.props.color : iconColor,\n isHovered: !disabled && isHovered,\n className: iconClassName,\n })\n : null;\n };\n\n const renderButtonContent = (): JSX.Element => {\n return (\n <span className={buttonTextClasses} ref={buttonContentRef}>\n {disabled && borderlessVariant && (\n <span className={diagonalClasses}>\n <span className={buttonStyles['diagonal__line']} />\n </span>\n )}\n <span>{onlyIcon ? ariaLabel : restChildren}</span>\n </span>\n );\n };\n\n const renderbuttonContentWrapper = (): JSX.Element => (\n <span className={buttonClasses}>\n {renderIcon(leftIcon, getLargeIconSize(large, mobile), !onlyIcon ? buttonStyles['button__left-icon'] : undefined)}\n {renderButtonContent()}\n {hasArrow\n ? renderIcon(\n <Icon svgIcon={ArrowRight} />,\n getLargeIconSize(large, mobile),\n classNames(buttonStyles['button__arrow'], { [buttonStyles['button__arrow--both-icons']]: bothIcons })\n )\n : renderIcon(rightIcon, getLargeIconSize(large, mobile), buttonStyles['button__right-icon'])}\n {hasUURightArrow && (\n <span style={{ color: iconColor }} className={buttonStyles['button__right-unicode-arrow']} aria-hidden>\n {' →'}\n </span>\n )}\n </span>\n );\n\n return (\n <>\n {htmlMarkup === 'button' && (\n <button\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n disabled={disabled}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n ref={hoverRef as React.ForwardedRef<HTMLButtonElement>}\n tabIndex={tabIndex}\n type={type}\n {...rest}\n >\n {renderbuttonContentWrapper()}\n </button>\n )}\n {htmlMarkup === 'a' && (\n <a\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : props.rel}\n ref={hoverRef as React.ForwardedRef<HTMLAnchorElement>}\n tabIndex={tabIndex}\n {...restProps}\n >\n {renderbuttonContentWrapper()}\n </a>\n )}\n </>\n );\n});\n\nexport default Button;\n"],"names":["getIconColor","fill","borderless","disabled","concept","ondark","mobile","getColor","getLargeIconSize","large","IconSize","checkOnlyIconAria","onlyIcon","ariaLabel","devEnv","Button","React","props","ref","id","children","wrapperClassName","className","arrow","ellipsis","fluid","htmlMarkup","mode","onBlur","onClick","size","variant","href","tabIndex","testId","target","type","textPosition","restProps","leftIcon","rightIcon","restChildren","useIcons","hoverRef","isHovered","useHover","buttonContentRef","useRef","bothIcons","onDark","useBreakpoint","breakpoints","destructive","outlineVariant","borderlessVariant","iconColor","hasArrow","hasUURightArrow","rest","buttonWrapperClasses","classNames","buttonStyles","buttonClasses","buttonTextClasses","diagonalClasses","useEffect","isTest","isProd","renderIcon","iconElement","iconSize","iconClassName","renderButtonContent","renderbuttonContentWrapper","Icon","ArrowRight","AnalyticsId","Button$1"],"mappings":";;;;;;;;;;;;AAiEA,MAAMA,KAAe,CACnBC,GACAC,GACAC,GACAC,GACAC,GACAC,MAEIA,KAAUH,IACL,CAACE,KAAUJ,IAAOM,EAAS,WAAYL,IAAmB,MAAN,GAAS,IAAIK,EAAS,OAAO,IAEtFJ,IACK,CAACE,KAAUJ,IAAOM,EAAS,WAAW,GAAG,IAAI,GAAGA,EAAS,OAAO,CAAC,OAErEN,KAAQ,CAACI,KAAY,CAACJ,KAAQI,IAC1B,UAGFD,MAAY,WAAWG,EAAS,aAAa,GAAG,IAAIA,EAAS,UAAU,GAAG,GAE7EC,IAAmB,CAACC,GAAgBH,MACpCA,KAAUG,IAAcC,EAAS,QACjCD,IAAcC,EAAS,SACpBA,EAAS,QAGZC,KAAoB,CAACC,GAAmBC,GAA+BC,MAA0B;AACrG,MAAIA,KAAUF,MAAaC,MAAc,UAAaA,MAAc;AAC5D,UAA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,MACA,SAAAC;AAAA,MACA,UAAA1B;AAAA,MACA,eAAa+B;AAAA,MACb,oBAAkB0C,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,KAAKhB;AAAA,MACL,UAAAV;AAAA,MACA,MAAAG;AAAA,MACC,GAAGsB;AAAA,IAAA;AAAA,IAEHe,EAA2B;AAAA,EAAA,GAG/B/C,MAAe,OACdV,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAG;AAAA,MACA,QAAAS;AAAA,MACA,SAAAC;AAAA,MACA,eAAaK;AAAA,MACb,oBAAkB0C,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,MAAA3B;AAAA,MACA,QAAAG;AAAA,MACA,KAAKA,MAAW,WAAW,wBAAwBlB,EAAM;AAAA,MACzD,KAAK0B;AAAA,MACL,UAAAV;AAAA,MACC,GAAGK;AAAA,IAAA;AAAA,IAEHmC,EAA2B;AAAA,EAAA,CAGlC;AAEJ,CAAC,GAEDI,KAAe9D;"}
@@ -330,6 +330,12 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
330
330
  overflow: hidden;
331
331
  text-overflow: ellipsis;
332
332
  }
333
+
334
+ &--centered-mobile {
335
+ @media (max-width: map.get($grid-max-breakpoints, xs)) {
336
+ width: 100%;
337
+ }
338
+ }
333
339
  }
334
340
 
335
341
  &__right-unicode-arrow {
@@ -8,6 +8,7 @@ export type Styles = {
8
8
  'button__right-icon': string;
9
9
  'button__right-unicode-arrow': string;
10
10
  button__text: string;
11
+ 'button__text--centered-mobile': string;
11
12
  'button__text--ellipsis': string;
12
13
  'button--arrow': string;
13
14
  'button--arrow--both-icons': string;