@helsenorge/designsystem-react 9.2.0 → 9.4.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 (33) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LazyIcon.js +2 -2
  3. package/LazyIcon.js.map +1 -1
  4. package/components/Icons/AdditionalIconInformation.d.ts +40 -0
  5. package/components/Icons/AdditionalIconInformation.js +11 -1
  6. package/components/Icons/AdditionalIconInformation.js.map +1 -1
  7. package/components/Icons/HomeFill.d.ts +4 -0
  8. package/components/Icons/HomeFill.js +35 -0
  9. package/components/Icons/HomeFill.js.map +1 -0
  10. package/components/Icons/IconNames.d.ts +1 -1
  11. package/components/Icons/IconNames.js +5 -0
  12. package/components/Icons/IconNames.js.map +1 -1
  13. package/components/Icons/LocationFill.d.ts +4 -0
  14. package/components/Icons/LocationFill.js +35 -0
  15. package/components/Icons/LocationFill.js.map +1 -0
  16. package/components/Icons/MaleDoctorCompact.d.ts +4 -0
  17. package/components/Icons/MaleDoctorCompact.js +48 -0
  18. package/components/Icons/MaleDoctorCompact.js.map +1 -0
  19. package/components/Icons/MaleDoctorCompactFill.d.ts +4 -0
  20. package/components/Icons/MaleDoctorCompactFill.js +55 -0
  21. package/components/Icons/MaleDoctorCompactFill.js.map +1 -0
  22. package/components/Icons/Settings.js +15 -11
  23. package/components/Icons/Settings.js.map +1 -1
  24. package/components/Icons/SettingsFill.d.ts +4 -0
  25. package/components/Icons/SettingsFill.js +35 -0
  26. package/components/Icons/SettingsFill.js.map +1 -0
  27. package/components/Tile/Tile.d.ts +3 -0
  28. package/components/Tile/index.js +52 -51
  29. package/components/Tile/index.js.map +1 -1
  30. package/components/Tile/styles.module.scss +40 -30
  31. package/components/Tile/styles.module.scss.d.ts +0 -1
  32. package/hooks/useOutsideEvent.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,73 +1,74 @@
1
- import { jsx as p, jsxs as g } from "react/jsx-runtime";
2
- import s from "react";
3
- import h from "classnames";
4
- import { AnalyticsId as k, IconSize as I } from "../../constants.js";
5
- import { useHover as b } from "../../hooks/useHover.js";
6
- import { mergeRefs as j } from "../../utils/refs.js";
1
+ import { jsx as p, jsxs as N } from "react/jsx-runtime";
2
+ import l from "react";
3
+ import d from "classnames";
4
+ import { AnalyticsId as S, IconSize as u } from "../../constants.js";
5
+ import { useBreakpoint as j, Breakpoint as z } from "../../hooks/useBreakpoint.js";
6
+ import { useHover as B } from "../../hooks/useHover.js";
7
+ import { mergeRefs as E } from "../../utils/refs.js";
7
8
  import e from "./styles.module.scss";
8
- const _ = s.forwardRef((a, r) => {
9
- const { children: i, className: o, htmlMarkup: c = "span", highlighted: m, compact: t } = a, n = h(
9
+ const T = l.forwardRef((r, s) => {
10
+ const { children: t, className: a, htmlMarkup: o = "span", highlighted: c } = r, n = d(
10
11
  e.tile__title,
11
12
  {
12
- [e["tile__title--highlighted"]]: m,
13
- [e["tile__title--compact"]]: t
13
+ [e["tile__title--highlighted"]]: c
14
14
  },
15
- o
15
+ a
16
16
  );
17
- return /* @__PURE__ */ p(c, { className: n, ref: r, children: i });
17
+ return /* @__PURE__ */ p(o, { className: n, ref: s, children: t });
18
18
  });
19
- _.displayName = "Title";
20
- const N = s.forwardRef((a, r) => {
19
+ T.displayName = "Title";
20
+ const _ = l.forwardRef((r, s) => {
21
21
  const {
22
- children: i,
23
- icon: o,
24
- title: c,
25
- className: m = "",
26
- description: t,
27
- fixed: n = !1,
28
- highlighted: l = !1,
29
- testId: T,
30
- target: f,
31
- rel: u,
32
- href: C,
33
- onClick: v
34
- } = a, { hoverRef: w, isHovered: x } = b(), d = !t, y = h(
22
+ children: t,
23
+ icon: a,
24
+ title: o,
25
+ className: c = "",
26
+ description: n,
27
+ fixed: f = !1,
28
+ highlighted: m = !1,
29
+ testId: k,
30
+ target: h,
31
+ rel: v,
32
+ variant: C = "normal",
33
+ href: b,
34
+ onClick: w
35
+ } = r, { hoverRef: x, isHovered: y } = B(), g = j() < z.md, i = C === "compact", R = d(
35
36
  e.tile,
36
37
  {
37
- [e["tile--fixed"]]: n,
38
- [e["tile--compact"]]: d,
39
- [e["tile--highlighted"]]: l
38
+ [e["tile--fixed"]]: f,
39
+ [e["tile--compact"]]: i,
40
+ [e["tile--highlighted"]]: m
40
41
  },
41
- m
42
- ), R = h(e["title-wrapper"], {
43
- [e["title-wrapper--compact"]]: d
42
+ c
43
+ ), I = d(e["title-wrapper"], {
44
+ [e["title-wrapper--compact"]]: i
44
45
  });
45
- return /* @__PURE__ */ g(
46
+ return /* @__PURE__ */ N(
46
47
  "a",
47
48
  {
48
- ref: j([r, w]),
49
- href: C,
50
- target: f,
51
- rel: f === "_blank" ? "noopener noreferrer" : u,
52
- className: y,
53
- "data-testid": T,
54
- "data-analyticsid": k.Tile,
55
- onClick: v,
49
+ ref: E([s, x]),
50
+ href: b,
51
+ target: h,
52
+ rel: h === "_blank" ? "noopener noreferrer" : v,
53
+ className: R,
54
+ "data-testid": k,
55
+ "data-analyticsid": S.Tile,
56
+ onClick: w,
56
57
  children: [
57
- /* @__PURE__ */ g("div", { className: R, children: [
58
- s.cloneElement(o, { size: I.Medium, isHovered: x, color: l ? "white" : "black" }),
59
- s.cloneElement(c, { highlighted: l, compact: d })
58
+ /* @__PURE__ */ N("div", { className: I, children: [
59
+ l.cloneElement(a, { size: g ? u.Small : u.Medium, isHovered: y, color: m ? "white" : "black" }),
60
+ l.cloneElement(o, { highlighted: m, compact: i })
60
61
  ] }),
61
- t && /* @__PURE__ */ p("p", { className: e.tile__description, children: t }),
62
- i && /* @__PURE__ */ p("div", { className: e.tile__children, children: i })
62
+ !i && !g && /* @__PURE__ */ p("p", { className: e.tile__description, children: n }),
63
+ t && /* @__PURE__ */ p("div", { className: e.tile__children, children: t })
63
64
  ]
64
65
  }
65
66
  );
66
67
  });
67
- N.displayName = "Tile";
68
- N.Title = _;
68
+ _.displayName = "Tile";
69
+ _.Title = T;
69
70
  export {
70
- N as Tile,
71
- N as default
71
+ _ as Tile,
72
+ _ as default
72
73
  };
73
74
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Tile/Tile.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { TitleTags } from './../Title/Title';\nimport { AnalyticsId } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { mergeRefs } from '../../utils/refs';\nimport { IconSize } from '../Icon';\n\nimport tileStyles from './styles.module.scss';\n\ninterface TileProps extends Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick' | 'rel'> {\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { children, className, htmlMarkup = 'span', highlighted, compact } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n [tileStyles['tile__title--compact']]: compact,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nTitle.displayName = 'Title';\n\nexport const Tile = React.forwardRef<HTMLAnchorElement, TileProps>((props, ref) => {\n const {\n children,\n icon,\n title,\n className = '',\n description,\n fixed = false,\n highlighted = false,\n testId,\n target,\n rel,\n href,\n onClick,\n } = props;\n const { hoverRef, isHovered } = useHover<HTMLAnchorElement>();\n const compact = !description;\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n return (\n <a\n ref={mergeRefs([ref, hoverRef])}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : rel}\n className={tileClasses}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tile}\n onClick={onClick}\n >\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {description && <p className={tileStyles.tile__description}>{description}</p>}\n {children && <div className={tileStyles.tile__children}>{children}</div>}\n </a>\n );\n}) as TileCompound;\n\nTile.displayName = 'Tile';\nTile.Title = Title;\n\nexport default Tile;\n"],"names":["Title","React","props","ref","children","className","htmlMarkup","highlighted","compact","titleClasses","classNames","tileStyles","jsx","Tile","icon","title","description","fixed","testId","target","rel","href","onClick","hoverRef","isHovered","useHover","tileClasses","tileTitleWrapperClasses","jsxs","mergeRefs","AnalyticsId","IconSize"],"mappings":";;;;;;;AA0CA,MAAMA,IAAQC,EAAM,WAA+C,CAACC,GAAOC,MAAQ;AACjF,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,YAAAC,IAAa,QAAQ,aAAAC,GAAa,SAAAC,EAAY,IAAAN,GACrEO,IAAeC;AAAA,IACnBC,EAAW;AAAA,IACX;AAAA,MACE,CAACA,EAAW,0BAA0B,CAAC,GAAGJ;AAAA,MAC1C,CAACI,EAAW,sBAAsB,CAAC,GAAGH;AAAA,IACxC;AAAA,IACAH;AAAA,EAAA;AAIF,SACG,gBAAAO,EAHeN,GAGf,EAAU,WAAWG,GAAc,KAAAN,GACjC,UAAAC,EACH,CAAA;AAEJ,CAAC;AAEDJ,EAAM,cAAc;AAEb,MAAMa,IAAOZ,EAAM,WAAyC,CAACC,GAAOC,MAAQ;AAC3E,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,MAAAU;AAAA,IACA,OAAAC;AAAA,IACA,WAAAV,IAAY;AAAA,IACZ,aAAAW;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,aAAAV,IAAc;AAAA,IACd,QAAAW;AAAA,IACA,QAAAC;AAAA,IACA,KAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAAAC;AAAA,EACE,IAAApB,GACE,EAAE,UAAAqB,GAAU,WAAAC,EAAU,IAAIC,EAA4B,GACtDjB,IAAU,CAACQ,GACXU,IAAchB;AAAA,IAClBC,EAAW;AAAA,IACX;AAAA,MACE,CAACA,EAAW,aAAa,CAAC,GAAGM;AAAA,MAC7B,CAACN,EAAW,eAAe,CAAC,GAAGH;AAAA,MAC/B,CAACG,EAAW,mBAAmB,CAAC,GAAGJ;AAAA,IACrC;AAAA,IACAF;AAAA,EAAA,GAEIsB,IAA0BjB,EAAWC,EAAW,eAAe,GAAG;AAAA,IACtE,CAACA,EAAW,wBAAwB,CAAC,GAAGH;AAAA,EAAA,CACzC;AAGC,SAAA,gBAAAoB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKC,EAAU,CAAC1B,GAAKoB,CAAQ,CAAC;AAAA,MAC9B,MAAAF;AAAA,MACA,QAAAF;AAAA,MACA,KAAKA,MAAW,WAAW,wBAAwBC;AAAA,MACnD,WAAWM;AAAA,MACX,eAAaR;AAAA,MACb,oBAAkBY,EAAY;AAAA,MAC9B,SAAAR;AAAA,MAEA,UAAA;AAAA,QAAC,gBAAAM,EAAA,OAAA,EAAI,WAAWD,GACb,UAAA;AAAA,UAAM1B,EAAA,aAAaa,GAAM,EAAE,MAAMiB,EAAS,QAAQ,WAAAP,GAAW,OAAOjB,IAAc,UAAU,QAAA,CAAS;AAAA,UACrGN,EAAM,aAAac,GAAO,EAAE,aAAAR,GAA0B,SAAAC,GAAkB;AAAA,QAAA,GAC3E;AAAA,QACCQ,KAAgB,gBAAAJ,EAAA,KAAA,EAAE,WAAWD,EAAW,mBAAoB,UAAYK,GAAA;AAAA,QACxEZ,KAAa,gBAAAQ,EAAA,OAAA,EAAI,WAAWD,EAAW,gBAAiB,UAAAP,GAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxE,CAAC;AAEDS,EAAK,cAAc;AACnBA,EAAK,QAAQb;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Tile/Tile.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { TitleTags } from './../Title/Title';\nimport { useBreakpoint, Breakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { mergeRefs } from '../../utils/refs';\nimport { IconSize } from '../Icon';\n\nimport tileStyles from './styles.module.scss';\n\nexport type TileVariants = 'normal' | 'compact';\n\ninterface TileProps extends Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href' | 'target' | 'onClick' | 'rel'> {\n children?: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /**\tSets the icon to be displayed inside the tile. */\n icon: React.ReactElement;\n /**\tSets the title to be displayed inside the tile. */\n title: React.ReactElement;\n /** Toggles the highlighted style of the tile. */\n highlighted?: boolean;\n /** Sets the description to be displayed inside the tile. */\n description?: string;\n /** Sets a fixed max and min width for the tile. */\n fixed?: boolean;\n /** Sets the visual variant of the component */\n variant?: TileVariants;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\ninterface TileTitleProps {\n children: React.ReactNode;\n className?: string;\n htmlMarkup?: TitleTags;\n highlighted?: boolean;\n compact?: boolean;\n}\n\nexport interface TileCompound extends React.ForwardRefExoticComponent<TileProps & React.RefAttributes<HTMLAnchorElement>> {\n Title: React.ForwardRefExoticComponent<TileTitleProps & React.RefAttributes<HTMLHeadingElement>>;\n}\n\nconst Title = React.forwardRef<HTMLHeadingElement, TileTitleProps>((props, ref) => {\n const { children, className, htmlMarkup = 'span', highlighted } = props;\n const titleClasses = classNames(\n tileStyles['tile__title'],\n {\n [tileStyles['tile__title--highlighted']]: highlighted,\n },\n className\n );\n const CustomTag = htmlMarkup;\n\n return (\n <CustomTag className={titleClasses} ref={ref}>\n {children}\n </CustomTag>\n );\n});\n\nTitle.displayName = 'Title';\n\nexport const Tile = React.forwardRef<HTMLAnchorElement, TileProps>((props, ref) => {\n const {\n children,\n icon,\n title,\n className = '',\n description,\n fixed = false,\n highlighted = false,\n testId,\n target,\n rel,\n variant = 'normal',\n href,\n onClick,\n } = props;\n const { hoverRef, isHovered } = useHover<HTMLAnchorElement>();\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < Breakpoint.md;\n const compact = variant === 'compact';\n const tileClasses = classNames(\n tileStyles.tile,\n {\n [tileStyles['tile--fixed']]: fixed,\n [tileStyles['tile--compact']]: compact,\n [tileStyles['tile--highlighted']]: highlighted,\n },\n className\n );\n const tileTitleWrapperClasses = classNames(tileStyles['title-wrapper'], {\n [tileStyles['title-wrapper--compact']]: compact,\n });\n\n return (\n <a\n ref={mergeRefs([ref, hoverRef])}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : rel}\n className={tileClasses}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Tile}\n onClick={onClick}\n >\n <div className={tileTitleWrapperClasses}>\n {React.cloneElement(icon, { size: mobile ? IconSize.Small : IconSize.Medium, isHovered, color: highlighted ? 'white' : 'black' })}\n {React.cloneElement(title, { highlighted: highlighted, compact: compact })}\n </div>\n {!compact && !mobile && <p className={tileStyles.tile__description}>{description}</p>}\n {children && <div className={tileStyles.tile__children}>{children}</div>}\n </a>\n );\n}) as TileCompound;\n\nTile.displayName = 'Tile';\nTile.Title = Title;\n\nexport default Tile;\n"],"names":["Title","React","props","ref","children","className","htmlMarkup","highlighted","titleClasses","classNames","tileStyles","jsx","Tile","icon","title","description","fixed","testId","target","rel","variant","href","onClick","hoverRef","isHovered","useHover","mobile","useBreakpoint","Breakpoint","compact","tileClasses","tileTitleWrapperClasses","jsxs","mergeRefs","AnalyticsId","IconSize"],"mappings":";;;;;;;;AA+CA,MAAMA,IAAQC,EAAM,WAA+C,CAACC,GAAOC,MAAQ;AACjF,QAAM,EAAE,UAAAC,GAAU,WAAAC,GAAW,YAAAC,IAAa,QAAQ,aAAAC,EAAgB,IAAAL,GAC5DM,IAAeC;AAAA,IACnBC,EAAW;AAAA,IACX;AAAA,MACE,CAACA,EAAW,0BAA0B,CAAC,GAAGH;AAAA,IAC5C;AAAA,IACAF;AAAA,EAAA;AAIF,SACG,gBAAAM,EAHeL,GAGf,EAAU,WAAWE,GAAc,KAAAL,GACjC,UAAAC,EACH,CAAA;AAEJ,CAAC;AAEDJ,EAAM,cAAc;AAEb,MAAMY,IAAOX,EAAM,WAAyC,CAACC,GAAOC,MAAQ;AAC3E,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,MAAAS;AAAA,IACA,OAAAC;AAAA,IACA,WAAAT,IAAY;AAAA,IACZ,aAAAU;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,aAAAT,IAAc;AAAA,IACd,QAAAU;AAAA,IACA,QAAAC;AAAA,IACA,KAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,MAAAC;AAAA,IACA,SAAAC;AAAA,EACE,IAAApB,GACE,EAAE,UAAAqB,GAAU,WAAAC,EAAU,IAAIC,EAA4B,GAEtDC,IADaC,MACSC,EAAW,IACjCC,IAAUT,MAAY,WACtBU,IAAcrB;AAAA,IAClBC,EAAW;AAAA,IACX;AAAA,MACE,CAACA,EAAW,aAAa,CAAC,GAAGM;AAAA,MAC7B,CAACN,EAAW,eAAe,CAAC,GAAGmB;AAAA,MAC/B,CAACnB,EAAW,mBAAmB,CAAC,GAAGH;AAAA,IACrC;AAAA,IACAF;AAAA,EAAA,GAEI0B,IAA0BtB,EAAWC,EAAW,eAAe,GAAG;AAAA,IACtE,CAACA,EAAW,wBAAwB,CAAC,GAAGmB;AAAA,EAAA,CACzC;AAGC,SAAA,gBAAAG;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKC,EAAU,CAAC9B,GAAKoB,CAAQ,CAAC;AAAA,MAC9B,MAAAF;AAAA,MACA,QAAAH;AAAA,MACA,KAAKA,MAAW,WAAW,wBAAwBC;AAAA,MACnD,WAAWW;AAAA,MACX,eAAab;AAAA,MACb,oBAAkBiB,EAAY;AAAA,MAC9B,SAAAZ;AAAA,MAEA,UAAA;AAAA,QAAC,gBAAAU,EAAA,OAAA,EAAI,WAAWD,GACb,UAAA;AAAA,UAAA9B,EAAM,aAAaY,GAAM,EAAE,MAAMa,IAASS,EAAS,QAAQA,EAAS,QAAQ,WAAAX,GAAW,OAAOjB,IAAc,UAAU,SAAS;AAAA,UAC/HN,EAAM,aAAaa,GAAO,EAAE,aAAAP,GAA0B,SAAAsB,GAAkB;AAAA,QAAA,GAC3E;AAAA,QACC,CAACA,KAAW,CAACH,uBAAW,KAAE,EAAA,WAAWhB,EAAW,mBAAoB,UAAYK,EAAA,CAAA;AAAA,QAChFX,KAAa,gBAAAO,EAAA,OAAA,EAAI,WAAWD,EAAW,gBAAiB,UAAAN,GAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGxE,CAAC;AAEDQ,EAAK,cAAc;AACnBA,EAAK,QAAQZ;"}
@@ -1,22 +1,26 @@
1
1
  @use 'sass:map';
2
+ @import '../../scss/font-settings';
2
3
  @import '../../scss/palette';
3
4
  @import '../../scss/spacers';
4
5
  @import '../../scss/breakpoints';
6
+ @import '../../scss/screen-reader';
7
+ @import '../../scss/supernova/styles/colors';
5
8
 
6
9
  @mixin tile-title {
7
10
  overflow-wrap: break-word;
8
11
  word-wrap: break-word;
9
12
  word-break: break-word;
10
- font-size: 1.5rem;
13
+ font-size: $font-size-sm;
11
14
  text-align: left;
12
- line-height: 1.75rem;
13
- font-weight: 600;
14
- margin: 0;
15
- margin-left: 0.5rem;
16
-
17
- @media (min-width: map.get($grid-breakpoints, sm)) {
18
- font-size: 1.25rem;
19
- margin-top: 1rem;
15
+ line-height: 1.74rem;
16
+ font-weight: 400;
17
+ margin: getSpacer(3xs) 0 0 getSpacer(2xs);
18
+
19
+ @media (min-width: map.get($grid-breakpoints, md)) {
20
+ font-weight: 600;
21
+ font-size: $font-size-md;
22
+ line-height: 1.625rem;
23
+ margin-top: getSpacer(s);
20
24
  }
21
25
  }
22
26
 
@@ -26,15 +30,21 @@
26
30
 
27
31
  display: flex;
28
32
  width: inherit;
29
- padding: 1.5rem 2rem 2rem 1rem;
33
+ padding: getSpacer(2xs) getSpacer(2xs) getSpacer(xs);
30
34
  flex-direction: column;
31
- justify-content: flex-start;
32
- background-color: $white;
35
+ justify-content: center;
36
+ background-color: var(--core-color-white);
33
37
  color: $black;
34
38
  text-decoration: none;
35
39
  cursor: pointer;
40
+ border: 1px solid var(--color-base-border-blueberry);
36
41
  outline: none;
37
42
 
43
+ @media (min-width: map.get($grid-breakpoints, md)) {
44
+ padding: getSpacer(l) getSpacer(m) getSpacer(l) getSpacer(s);
45
+ justify-content: flex-start;
46
+ }
47
+
38
48
  @media print {
39
49
  border: 1px solid $black;
40
50
  }
@@ -45,7 +55,11 @@
45
55
  }
46
56
 
47
57
  &--compact {
48
- padding: 1.5rem 1rem;
58
+ padding: getSpacer(2xs) getSpacer(2xs) getSpacer(xs);
59
+
60
+ @media (min-width: map.get($grid-breakpoints, md)) {
61
+ padding: getSpacer(s) getSpacer(m) getSpacer(s) getSpacer(s);
62
+ }
49
63
  }
50
64
 
51
65
  svg {
@@ -53,39 +67,36 @@
53
67
  }
54
68
 
55
69
  &:hover,
56
- &:active,
57
- &:focus {
58
- background-color: $neutral100;
70
+ &:active {
71
+ background-color: var(--color-action-background-ondark-selected);
59
72
  }
60
73
 
61
- &:focus {
62
- box-shadow: 0 0 0 6px $neutral600;
74
+ &:focus-visible {
75
+ box-shadow: 0 0 0 3px var(--color-action-border-onlight-focus);
76
+ border-color: var(--color-action-border-onlight-focus);
63
77
  }
64
78
 
65
79
  &--highlighted {
66
80
  background-color: $blueberry500;
81
+ border-color: $blueberry500;
67
82
  color: $white;
68
83
 
69
84
  &:hover,
70
- &:active,
71
- &:focus {
85
+ &:active {
72
86
  background-color: $blueberry700;
87
+ border-color: $blueberry700;
73
88
  }
74
89
 
75
- &:focus {
76
- box-shadow: 0 0 0 6px $blueberry700;
90
+ &:focus-visible {
91
+ border-color: var(--color-action-border-onlight-focus);
77
92
  }
78
93
  }
79
94
 
80
95
  &__title {
81
96
  @include tile-title;
82
-
83
- &--compact {
84
- margin: 0 0 0 1.5rem;
85
- }
86
97
  }
87
98
 
88
- #{$tile}:focus & {
99
+ #{$tile}:focus-visible & {
89
100
  &__title {
90
101
  &--highlighted {
91
102
  text-decoration: underline;
@@ -106,12 +117,11 @@
106
117
 
107
118
  .title-wrapper {
108
119
  display: flex;
109
- flex-direction: row;
120
+ flex-direction: column;
110
121
  align-items: center;
111
122
  padding-bottom: 0.5rem;
112
123
 
113
- @media (min-width: map.get($grid-breakpoints, sm)) {
114
- flex-direction: column;
124
+ @media (min-width: map.get($grid-breakpoints, md)) {
115
125
  align-items: start;
116
126
 
117
127
  @media print {
@@ -3,7 +3,6 @@ export type Styles = {
3
3
  tile__children: string;
4
4
  tile__description: string;
5
5
  tile__title: string;
6
- 'tile__title--compact': string;
7
6
  'tile__title--highlighted': string;
8
7
  'tile--compact': string;
9
8
  'tile--fixed': string;
@@ -1 +1 @@
1
- {"version":3,"file":"useOutsideEvent.js","sources":["../../src/hooks/useOutsideEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype OutsideEvents = keyof PickByValue<HTMLElementEventMap, MouseEvent | FocusEvent>;\n\n/**\n * Custom hook for klikk eller fokus utenfor et gitt element\n * @param ref Sjekker om det klikkes utenfor dette elementet\n * @param handleClick Callback-funksjon ved klikk utenfor elementet\n * @param events Type eventer å lytte på. Default: mousedown\n */\nexport const useOutsideEvent = (\n ref: React.RefObject<HTMLElement>,\n handleClick: (event: HTMLElementEventMap[OutsideEvents]) => void,\n events: OutsideEvents[] = ['mousedown']\n): void => {\n const handleOutsideEvent = (event: HTMLElementEventMap[OutsideEvents]): void => {\n if (ref.current && !event.composedPath().includes(ref.current)) {\n handleClick(event);\n }\n };\n\n useEffect(() => {\n events.forEach(eventName => document.addEventListener(eventName, handleOutsideEvent));\n\n return () => {\n events.forEach(eventName => document.removeEventListener(eventName, handleOutsideEvent));\n };\n }, [ref, handleClick, events]);\n};\n"],"names":["useOutsideEvent","ref","handleClick","events","handleOutsideEvent","event","useEffect","eventName"],"mappings":";AAUO,MAAMA,IAAkB,CAC7BC,GACAC,GACAC,IAA0B,CAAC,WAAW,MAC7B;AACH,QAAAC,IAAqB,CAACC,MAAoD;AAC1E,IAAAJ,EAAI,WAAW,CAACI,EAAM,eAAe,SAASJ,EAAI,OAAO,KAC3DC,EAAYG,CAAK;AAAA,EACnB;AAGF,EAAAC,EAAU,OACRH,EAAO,QAAQ,CAAaI,MAAA,SAAS,iBAAiBA,GAAWH,CAAkB,CAAC,GAE7E,MAAM;AACX,IAAAD,EAAO,QAAQ,CAAaI,MAAA,SAAS,oBAAoBA,GAAWH,CAAkB,CAAC;AAAA,EAAA,IAExF,CAACH,GAAKC,GAAaC,CAAM,CAAC;AAC/B;"}
1
+ {"version":3,"file":"useOutsideEvent.js","sources":["../../src/hooks/useOutsideEvent.ts"],"sourcesContent":["import { useEffect } from 'react';\n\ntype OutsideEvents = keyof PickByValue<HTMLElementEventMap, MouseEvent | FocusEvent>;\n\n/**\n * Custom hook for klikk eller fokus utenfor et gitt element\n * @param ref Sjekker om det klikkes utenfor dette elementet\n * @param handleClick Callback-funksjon ved klikk utenfor elementet\n * @param events Type eventer å lytte på. Default: mousedown\n */\nexport const useOutsideEvent = (\n ref: React.RefObject<HTMLElement>,\n handleClick: (event: HTMLElementEventMap[OutsideEvents]) => void,\n events: OutsideEvents[] = ['mousedown']\n): void => {\n const handleOutsideEvent = (event: HTMLElementEventMap[OutsideEvents]): void => {\n if (ref.current && !event.composedPath().includes(ref.current)) {\n handleClick(event);\n }\n };\n\n useEffect(() => {\n events.forEach(eventName => document.addEventListener(eventName, handleOutsideEvent));\n\n return (): void => {\n events.forEach(eventName => document.removeEventListener(eventName, handleOutsideEvent));\n };\n }, [ref, handleClick, events]);\n};\n"],"names":["useOutsideEvent","ref","handleClick","events","handleOutsideEvent","event","useEffect","eventName"],"mappings":";AAUO,MAAMA,IAAkB,CAC7BC,GACAC,GACAC,IAA0B,CAAC,WAAW,MAC7B;AACH,QAAAC,IAAqB,CAACC,MAAoD;AAC1E,IAAAJ,EAAI,WAAW,CAACI,EAAM,eAAe,SAASJ,EAAI,OAAO,KAC3DC,EAAYG,CAAK;AAAA,EACnB;AAGF,EAAAC,EAAU,OACRH,EAAO,QAAQ,CAAaI,MAAA,SAAS,iBAAiBA,GAAWH,CAAkB,CAAC,GAE7E,MAAY;AACjB,IAAAD,EAAO,QAAQ,CAAaI,MAAA,SAAS,oBAAoBA,GAAWH,CAAkB,CAAC;AAAA,EAAA,IAExF,CAACH,GAAKC,GAAaC,CAAM,CAAC;AAC/B;"}
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/helsenorge/designsystem.git"
8
8
  },
9
9
  "homepage": "https://helsenorge.design",
10
- "version": "9.2.0",
10
+ "version": "9.4.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "dependencies": {