@helsenorge/designsystem-react 7.2.0 → 7.3.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 (68) hide show
  1. package/CHANGELOG.md +30 -3
  2. package/components/AnchorLink/AnchorLink.stories.d.ts +1 -0
  3. package/components/Avatar/Avatar.stories.d.ts +2 -0
  4. package/components/Badge/Badge.stories.d.ts +2 -0
  5. package/components/Button/Button.js +21 -21
  6. package/components/Button/Button.js.map +1 -1
  7. package/components/Checkbox/Checkbox.stories.d.ts +1 -0
  8. package/components/Close/Close.stories.d.ts +1 -0
  9. package/components/DictionaryTrigger/DictionaryTrigger.stories.d.ts +1 -0
  10. package/components/Dropdown/Dropdown.stories.d.ts +1 -0
  11. package/components/Duolist/Duolist.stories.d.ts +1 -0
  12. package/components/Duolist/styles.module.scss +19 -19
  13. package/components/EmptyState/EmptyState.stories.d.ts +1 -0
  14. package/components/Expander/Expander.stories.d.ts +1 -0
  15. package/components/Expander/styles.module.scss +13 -13
  16. package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +1 -0
  17. package/components/ExpanderList/ExpanderList.stories.d.ts +2 -0
  18. package/components/FormGroup/FormGroup.stories.d.ts +1 -0
  19. package/components/FormLayout/FormLayout.stories.d.ts +1 -0
  20. package/components/HelpBubble/HelpBubble.stories.d.ts +1 -0
  21. package/components/HelpPanel/HelpPanel.stories.d.ts +1 -0
  22. package/components/HelpQuestion/HelpQuestion.stories.d.ts +1 -0
  23. package/components/HighlightBox/HighlightBox.stories.d.ts +1 -0
  24. package/components/HorizontalScroll/styles.module.scss +2 -0
  25. package/components/Icon/Icon.stories.d.ts +1 -0
  26. package/components/Illustration/Illustration.stories.d.ts +1 -0
  27. package/components/Illustration/Illustrations.stories.d.ts +1 -0
  28. package/components/Input/Input.stories.d.ts +1 -0
  29. package/components/Label/Label.stories.d.ts +1 -0
  30. package/components/LazyIcon/LazyIcon.stories.d.ts +1 -0
  31. package/components/LazyIllustration/LazyIllustration.stories.d.ts +1 -0
  32. package/components/LinkList/LinkList.stories.d.ts +2 -0
  33. package/components/List/styles.module.scss +6 -0
  34. package/components/Loader/Loader.stories.d.ts +1 -0
  35. package/components/Logo/Logo.stories.d.ts +1 -0
  36. package/components/NotificationPanel/NotificationPanel.stories.d.ts +1 -0
  37. package/components/Panel/Panel.stories.d.ts +1 -0
  38. package/components/PanelList/PanelList.stories.d.ts +1 -0
  39. package/components/PopMenu/PopMenu.stories.d.ts +1 -0
  40. package/components/PopMenu/styles.module.scss +7 -8
  41. package/components/PopOver/styles.module.scss +4 -4
  42. package/components/PromoPanel/PromoPanel.stories.d.ts +1 -0
  43. package/components/RadioButton/RadioButton.stories.d.ts +1 -0
  44. package/components/Select/Select.d.ts +2 -0
  45. package/components/Select/Select.js +41 -40
  46. package/components/Select/Select.js.map +1 -1
  47. package/components/Select/Select.stories.d.ts +1 -0
  48. package/components/ServiceMessage/ServiceMessage.stories.d.ts +1 -0
  49. package/components/SharingStatus/SharingStatus.stories.d.ts +1 -0
  50. package/components/Slider/Slider.stories.d.ts +1 -0
  51. package/components/Spacer/Spacer.stories.d.ts +1 -0
  52. package/components/StatusDot/StatusDot.stories.d.ts +1 -0
  53. package/components/Step/Step.stories.d.ts +1 -0
  54. package/components/StepButtons/StepButtons.stories.d.ts +1 -0
  55. package/components/Stepper/Stepper.stories.d.ts +1 -0
  56. package/components/Table/Table.stories.d.ts +1 -0
  57. package/components/Tag/Tag.stories.d.ts +1 -0
  58. package/components/TagList/TagList.stories.d.ts +1 -0
  59. package/components/Textarea/Textarea.stories.d.ts +1 -0
  60. package/components/Tile/Tile.stories.d.ts +2 -0
  61. package/components/Title/Title.stories.d.ts +1 -0
  62. package/components/Tooltip/Tooltip.stories.d.ts +1 -0
  63. package/components/Trigger/Trigger.stories.d.ts +1 -0
  64. package/components/Validation/Validation.stories.d.ts +2 -1
  65. package/docs/index.d.ts +1 -0
  66. package/docs/index.js +9 -4
  67. package/docs/index.js.map +1 -1
  68. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## [7.2.1](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.2.0&targetVersion=GTv7.2.1) (2024-04-19)
2
+
3
+ ### Bug Fixes
4
+
5
+ - i button med accessibility-character-arrow er pilen skjult for skjermleser
6
+ ([0a8fd28](https://github.com/helsenorge/designsystem/commit/0a8fd28f16234ff8ca620c5b086d22b080a2cb17)), closes
7
+ [#273312](https://github.com/helsenorge/designsystem/issues/273312)
8
+ - width satt feil på popmenu ([fb4dc2d](https://github.com/helsenorge/designsystem/commit/fb4dc2d7af645e640a44f7800318f2ffcc64f195)), closes
9
+ [#323102](https://github.com/helsenorge/designsystem/issues/323102)
10
+
11
+ ## [7.2.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.1.0&targetVersion=GTv7.2.0) (2024-04-19)
12
+
13
+ ### Features
14
+
15
+ - knappen i dropdown skal ikke være fluid
16
+ ([a3abe2b](https://github.com/helsenorge/designsystem/commit/a3abe2bf5a57e62302b5e4f1a1f1b609452effd0)), closes
17
+ [#323389](https://github.com/helsenorge/designsystem/issues/323389)
18
+
19
+ ### Bug Fixes
20
+
21
+ - bruk supernova-sjekk som funker i ff
22
+ ([afae2a9](https://github.com/helsenorge/designsystem/commit/afae2a90d9e453be054016b5922aa378500f91cc))
23
+ - oppdater sjekk for om vi er i superNova
24
+ ([b20a776](https://github.com/helsenorge/designsystem/commit/b20a776f293953d78ccab6e40d687bab67676a28))
25
+ - oppdater sjekk for om vi er i superNova
26
+ ([167d572](https://github.com/helsenorge/designsystem/commit/167d572261a91fd60a8c432d4d990356a610115f))
27
+
1
28
  ## [7.1.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.0.0&targetVersion=GTv7.1.0) (2024-04-17)
2
29
 
3
30
  ### Features
@@ -1360,12 +1387,12 @@ Dette er fordi vi skal kunne dynamisk importere alt som ligger i Icons, så da b
1360
1387
 
1361
1388
  ### Bug Fixes
1362
1389
 
1363
- - økt kontrast på understreking av lenker
1364
- ([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
1365
- [#229049](https://github.com/helsenorge/designsystem/issues/229049)
1366
1390
  - panel har avstand fra tittel til badge
1367
1391
  ([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
1368
1392
  [#282359](https://github.com/helsenorge/designsystem/issues/282359)
1393
+ - økt kontrast på understreking av lenker
1394
+ ([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
1395
+ [#229049](https://github.com/helsenorge/designsystem/issues/229049)
1369
1396
 
1370
1397
  ## [1.2.2](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv1.2.1&targetVersion=GTv1.2.2) (2022-08-31)
1371
1398
 
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./AnchorLink").AnchorLinkProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { StoryObj } from '@storybook/react';
2
3
  import { AvatarSize } from './Avatar';
3
4
  declare const meta: {
@@ -5,6 +6,7 @@ declare const meta: {
5
6
  component: import("./Avatar").AvatarType;
6
7
  parameters: {
7
8
  docs: {
9
+ page: () => React.JSX.Element;
8
10
  description: {
9
11
  component: string;
10
12
  };
@@ -1,9 +1,11 @@
1
+ import React from 'react';
1
2
  import { StoryObj } from '@storybook/react';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import("./Badge").BadgeType;
5
6
  parameters: {
6
7
  docs: {
8
+ page: () => React.JSX.Element;
7
9
  description: {
8
10
  component: string;
9
11
  };
@@ -1,5 +1,5 @@
1
1
  import o, { useRef as lt, useEffect as ct } from "react";
2
- import p from "classnames";
2
+ import d from "classnames";
3
3
  import { Icon as it } from "../Icon/Icon.js";
4
4
  import { AnalyticsId as $, IconSize as v } from "../../constants.js";
5
5
  import { useBreakpoint as ut } from "../../hooks/useBreakpoint.js";
@@ -7,16 +7,16 @@ import { useHover as D } from "../../hooks/useHover.js";
7
7
  import { useIcons as mt } from "../../hooks/useIcons.js";
8
8
  import { getColor as i } from "../../theme/currys/color.js";
9
9
  import { breakpoints as bt } from "../../theme/grid.js";
10
- import { isTest as pt, isProd as dt } from "../../utils/environment.js";
10
+ import { isTest as dt, isProd as pt } from "../../utils/environment.js";
11
11
  import ft from "../Icons/ArrowRight.js";
12
12
  import t from "../Button/styles.module.scss";
13
- const ht = (e, r, n, d, s, g) => g && n ? !s || e ? i("neutral", r ? 500 : 700) : i("white") : n ? !s || e ? i("neutral", 500) : `${i("white")}b3` : e && !s || !e && s ? "white" : d === "normal" ? i("blueberry", 600) : i("cherry", 500), N = (e, r) => r && e ? v.Small : e ? v.Medium : v.XSmall, gt = (e, r, n) => {
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
14
  if (n && e && (r === void 0 || r === ""))
15
15
  throw new Error("Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav");
16
16
  }, _t = o.forwardRef(function(r, n) {
17
17
  const {
18
- ariaLabel: d,
19
- id: s,
18
+ ariaLabel: p,
19
+ id: a,
20
20
  children: g,
21
21
  wrapperClassName: O,
22
22
  className: X,
@@ -37,11 +37,11 @@ const ht = (e, r, n, d, s, g) => g && n ? !s || e ? i("neutral", r ? 500 : 700)
37
37
  target: U,
38
38
  type: J = "button",
39
39
  ...F
40
- } = r, [u, m, H] = mt(o.Children.toArray(g)), { hoverRef: L, isHovered: K } = w === "button" ? D(n) : D(n), Q = lt(null), a = !!(u || m) && !H, M = u && (m || _) && !a, 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 = p(
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
41
  t["button-wrapper"],
42
42
  { [t["button-wrapper--fluid"]]: A || R },
43
43
  O
44
- ), ot = p(
44
+ ), ot = d(
45
45
  t.button,
46
46
  {
47
47
  [t["button--destructive"]]: P,
@@ -49,36 +49,36 @@ const ht = (e, r, n, d, s, g) => g && n ? !s || e ? i("neutral", r ? 500 : 700)
49
49
  [t["button--large"]]: b,
50
50
  [t["button--outline"]]: Y,
51
51
  [t["button--borderless"]]: l,
52
- [t["button--left-icon"]]: u && !a,
53
- [t["button--right-icon"]]: m && !a,
52
+ [t["button--left-icon"]]: u && !s,
53
+ [t["button--right-icon"]]: m && !s,
54
54
  [t["button--both-icons"]]: M,
55
- [t["button--only-icon"]]: a,
55
+ [t["button--only-icon"]]: s,
56
56
  [t["button--arrow"]]: C,
57
57
  [t["button--on-dark"]]: y
58
58
  },
59
59
  X
60
- ), et = p(t.button__text, {
60
+ ), et = d(t.button__text, {
61
61
  [t["button__text--ellipsis"]]: R
62
- }), rt = p(t.diagonal, {
62
+ }), rt = d(t.diagonal, {
63
63
  [t["diagonal--on-dark"]]: y
64
64
  });
65
65
  ct(() => {
66
- gt(a, d, !pt() && !dt());
66
+ gt(s, p, !dt() && !pt());
67
67
  }, []);
68
- const k = (c, st, at) => c ? o.cloneElement(c, {
69
- size: st,
68
+ const k = (c, at, st) => c ? o.cloneElement(c, {
69
+ size: at,
70
70
  color: c != null && c.props.color ? c.props.color : T,
71
71
  isHovered: K,
72
- className: at
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, a ? d : H)), W = () => /* @__PURE__ */ o.createElement("span", { className: ot }, k(u, N(b, h), a ? void 0 : t["button__left-icon"]), nt(), C ? 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
74
  /* @__PURE__ */ o.createElement(it, { svgIcon: ft }),
75
75
  N(b, h),
76
- p(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"] }, " →"));
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
78
  return /* @__PURE__ */ o.createElement(o.Fragment, null, w === "button" && /* @__PURE__ */ o.createElement(
79
79
  "button",
80
80
  {
81
- id: s,
81
+ id: a,
82
82
  onBlur: E,
83
83
  onClick: x,
84
84
  disabled: f,
@@ -94,7 +94,7 @@ const ht = (e, r, n, d, s, g) => g && n ? !s || e ? i("neutral", r ? 500 : 700)
94
94
  ), w === "a" && /* @__PURE__ */ o.createElement(
95
95
  "a",
96
96
  {
97
- id: s,
97
+ id: a,
98
98
  onBlur: E,
99
99
  onClick: x,
100
100
  "data-testid": z,
@@ -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']}>\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,SACp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A,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';\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,GACA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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;"}
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.ForwardRefExoticComponent<import("./Checkbox").CheckboxProps & React.RefAttributes<HTMLInputElement>>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Close").CloseProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./DictionaryTrigger").DictionaryTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./Dropdown").DropdownProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Duolist").DuolistProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -25,25 +25,6 @@
25
25
  font-size: $font-size-md;
26
26
  }
27
27
 
28
- &__dt,
29
- &__dd {
30
- line-height: $lineheight-size-md;
31
- padding-bottom: getSpacer(2xs);
32
-
33
- &:last-of-type {
34
- padding-bottom: 0;
35
- }
36
-
37
- &--bold {
38
- font-weight: 600;
39
- line-height: $lineheight-size-sm;
40
- }
41
-
42
- &--non-formatted {
43
- display: inline;
44
- }
45
- }
46
-
47
28
  &__dt {
48
29
  padding-right: getSpacer(l);
49
30
 
@@ -64,6 +45,25 @@
64
45
  margin-inline-start: 0;
65
46
  }
66
47
 
48
+ &__dt,
49
+ &__dd {
50
+ line-height: $lineheight-size-md;
51
+ padding-bottom: getSpacer(2xs);
52
+
53
+ &:last-of-type {
54
+ padding-bottom: 0;
55
+ }
56
+
57
+ &--bold {
58
+ font-weight: 600;
59
+ line-height: $lineheight-size-sm;
60
+ }
61
+
62
+ &--non-formatted {
63
+ display: inline;
64
+ }
65
+ }
66
+
67
67
  &--line &__dt,
68
68
  &--line &__dd {
69
69
  padding-top: getSpacer(2xs);
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./EmptyState").EmptyStateProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./Expander").ExpanderProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -34,6 +34,19 @@
34
34
  }
35
35
  }
36
36
 
37
+ &__button,
38
+ &__trigger {
39
+ &--sticky {
40
+ position: fixed;
41
+ top: 0;
42
+ }
43
+
44
+ &--absolute {
45
+ position: absolute;
46
+ bottom: 0;
47
+ }
48
+ }
49
+
37
50
  &__button {
38
51
  position: relative;
39
52
  padding-right: getSpacer(s);
@@ -134,19 +147,6 @@
134
147
  }
135
148
  }
136
149
 
137
- &__button,
138
- &__trigger {
139
- &--sticky {
140
- position: fixed;
141
- top: 0;
142
- }
143
-
144
- &--absolute {
145
- position: absolute;
146
- bottom: 0;
147
- }
148
- }
149
-
150
150
  &__content {
151
151
  $content: &;
152
152
 
@@ -10,6 +10,7 @@ declare const meta: {
10
10
  component: import("./ExpanderHierarchy").ExpanderHierarchyCompound;
11
11
  parameters: {
12
12
  docs: {
13
+ page: () => React.JSX.Element;
13
14
  description: {
14
15
  component: string;
15
16
  };
@@ -1,9 +1,11 @@
1
+ import React from 'react';
1
2
  import { StoryObj } from '@storybook/react';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import("./ExpanderList").ExpanderListCompound;
5
6
  parameters: {
6
7
  docs: {
8
+ page: () => React.JSX.Element;
7
9
  description: {
8
10
  component: string;
9
11
  };
@@ -7,6 +7,7 @@ declare const meta: {
7
7
  component: React.ForwardRefExoticComponent<import("./FormGroup").FormGroupProps & React.RefAttributes<HTMLDivElement>>;
8
8
  parameters: {
9
9
  docs: {
10
+ page: () => React.JSX.Element;
10
11
  description: {
11
12
  component: string;
12
13
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.ForwardRefExoticComponent<import("./FormLayout").FormLayoutProps & React.RefAttributes<HTMLDivElement>>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./HelpBubble").HelpBubbleProps & React.RefAttributes<HTMLDivElement | SVGSVGElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./HelpPanel").HelpPanelProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./HelpQuestion").HelpQuestionProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./HighlightBox").HighlightBoxProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -1,6 +1,8 @@
1
1
  @import '../../scss/breakpoints';
2
2
  @import '../../scss/palette';
3
3
 
4
+ // Disables fordi stylelint og prettier er uenige
5
+ /* stylelint-disable-next-line scss/dollar-variable-colon-space-after */
4
6
  $gradient:
5
7
  rgb(0 0 0 / 27%),
6
8
  rgb(0 0 0 / 27%) 18%,
@@ -7,6 +7,7 @@ declare const meta: {
7
7
  component: React.ForwardRefExoticComponent<import("./Icon").IconProps & React.RefAttributes<SVGSVGElement>>;
8
8
  parameters: {
9
9
  docs: {
10
+ page: () => React.JSX.Element;
10
11
  description: {
11
12
  component: string;
12
13
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Illustration").IllustrationProps & React.RefAttributes<SVGSVGElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -9,6 +9,7 @@ declare const meta: {
9
9
  component: React.FC<import("../LazyIllustration").LazyIllustrationProps>;
10
10
  parameters: {
11
11
  docs: {
12
+ page: () => React.JSX.Element;
12
13
  description: {
13
14
  component: string;
14
15
  };
@@ -10,6 +10,7 @@ declare const meta: {
10
10
  component: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
11
11
  parameters: {
12
12
  docs: {
13
+ page: () => React.JSX.Element;
13
14
  description: {
14
15
  component: string;
15
16
  };
@@ -9,6 +9,7 @@ declare const meta: {
9
9
  component: React.FunctionComponent<import("./Label").LabelProps>;
10
10
  parameters: {
11
11
  docs: {
12
+ page: () => React.JSX.Element;
12
13
  description: {
13
14
  component: string;
14
15
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./LazyIcon").LazyIconProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./LazyIllustration").LazyIllustrationProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -1,9 +1,11 @@
1
+ import React from 'react';
1
2
  import { StoryObj } from '@storybook/react';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import("./LinkList").CompoundComponent;
5
6
  parameters: {
6
7
  docs: {
8
+ page: () => React.JSX.Element;
7
9
  description: {
8
10
  component: string;
9
11
  };
@@ -20,6 +20,8 @@
20
20
 
21
21
  > #{$list}__item {
22
22
  > #{$list}--bullet {
23
+ // for å beholde utseende disables warning på whitespace her
24
+ /* stylelint-disable-next-line no-irregular-whitespace */
23
25
  list-style-type: '⬥ ';
24
26
 
25
27
  > #{$list}__item {
@@ -28,6 +30,8 @@
28
30
  }
29
31
 
30
32
  > #{$list}--bullet {
33
+ // for å beholde utseende disables warning på whitespace her
34
+ /* stylelint-disable-next-line no-irregular-whitespace */
31
35
  list-style-type: '– ';
32
36
  }
33
37
  }
@@ -38,6 +42,8 @@
38
42
  }
39
43
 
40
44
  &--dashed {
45
+ // for å beholde utseende disables warning på whitespace her
46
+ /* stylelint-disable-next-line no-irregular-whitespace */
41
47
  list-style-type: '– ';
42
48
  }
43
49
 
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Loader").LoaderProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Logo").LogoProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./NotificationPanel").NotificationPanelProps & React.RefAttributes<HTMLDivElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -9,6 +9,7 @@ declare const meta: {
9
9
  component: React.ForwardRefExoticComponent<import("./Panel").PanelProps & React.RefAttributes<HTMLHeadingElement>>;
10
10
  parameters: {
11
11
  docs: {
12
+ page: () => React.JSX.Element;
12
13
  description: {
13
14
  component: string;
14
15
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.ForwardRefExoticComponent<import("./PanelList").PanelListProps & React.RefAttributes<HTMLDivElement>>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./PopMenu").PopMenuProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -18,20 +18,20 @@
18
18
  box-shadow: none;
19
19
  outline: none;
20
20
  }
21
+ }
21
22
 
22
- :focus > .pop-menu-button {
23
- box-shadow: none;
24
- }
23
+ html :focus > .pop-menu-button {
24
+ box-shadow: none;
25
+ border: solid;
25
26
  }
26
27
 
27
- // overrides
28
- :focus > .pop-menu-button:hover {
28
+ .pop-menu-button :focus > .pop-menu-button {
29
29
  box-shadow: none;
30
30
  }
31
31
 
32
- html :focus > .pop-menu-button {
32
+ // overrides
33
+ :focus > .pop-menu-button:hover {
33
34
  box-shadow: none;
34
- border: solid;
35
35
  }
36
36
 
37
37
  .pop-menu-button--on-white {
@@ -108,7 +108,6 @@ html :focus > .pop-menu-button {
108
108
 
109
109
  .pop-menu__pop-over {
110
110
  width: 20.875rem;
111
- width: 26.125rem;
112
111
  border: 0.125rem solid rgb(24 128 151);
113
112
  box-shadow: 0 0 0.3125rem 0 rgb(0 0 0 / 50%);
114
113
 
@@ -20,10 +20,6 @@
20
20
  z-index: 3;
21
21
  visibility: hidden;
22
22
 
23
- & + &__arrow {
24
- visibility: hidden;
25
- }
26
-
27
23
  &--visible {
28
24
  visibility: visible;
29
25
 
@@ -65,4 +61,8 @@
65
61
  filter: drop-shadow(0 0.2rem 0 var(--drop-shadow-color));
66
62
  }
67
63
  }
64
+
65
+ & + &__arrow {
66
+ visibility: hidden;
67
+ }
68
68
  }
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./PromoPanel").PromoPanelProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.ForwardRefExoticComponent<import("./RadioButton").RadioButtonProps & React.RefAttributes<HTMLInputElement>>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -26,6 +26,8 @@ export interface SelectProps extends Pick<React.SelectHTMLAttributes<HTMLSelectE
26
26
  width?: number;
27
27
  /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */
28
28
  defaultValue?: string | number;
29
+ /** Adds custom classes to the wrapper tag */
30
+ wrapperClassName?: boolean;
29
31
  }
30
32
  export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
31
33
  export default Select;
@@ -1,68 +1,69 @@
1
1
  import r from "react";
2
- import v from "classnames";
3
- import { FormMode as z, AnalyticsId as D, IconSize as F, AVERAGE_CHARACTER_WIDTH_PX as H } from "../../constants.js";
2
+ import s from "classnames";
3
+ import { FormMode as F, AnalyticsId as H, IconSize as M, AVERAGE_CHARACTER_WIDTH_PX as U } from "../../constants.js";
4
4
  import { useUuid as w } from "../../hooks/useUuid.js";
5
- import { getColor as y } from "../../theme/currys/color.js";
6
- import M from "../ErrorWrapper/ErrorWrapper.js";
7
- import { Icon as U } from "../Icon/Icon.js";
8
- import V from "../Icons/ChevronDown.js";
9
- import { renderLabel as X } from "../Label/Label.js";
5
+ import { getColor as v } from "../../theme/currys/color.js";
6
+ import V from "../ErrorWrapper/ErrorWrapper.js";
7
+ import { Icon as X } from "../Icon/Icon.js";
8
+ import j from "../Icons/ChevronDown.js";
9
+ import { renderLabel as B } from "../Label/Label.js";
10
10
  import e from "../Select/styles.module.scss";
11
- const j = (o) => `calc(${o * H}px + 2rem)`, B = (o, t) => t ? y("neutral", 500) : y(o ? "cherry" : "blueberry", 600), G = r.forwardRef(function(t, c) {
11
+ const G = (o) => `calc(${o * U}px + 2rem)`, L = (o, t) => t ? v("neutral", 500) : v(o ? "cherry" : "blueberry", 600), P = r.forwardRef(function(t, c) {
12
12
  const {
13
- className: C,
13
+ className: y,
14
14
  children: I,
15
15
  concept: h = "normal",
16
- disabled: n,
16
+ disabled: l,
17
17
  error: E,
18
- errorText: s,
18
+ errorText: i,
19
19
  errorTextId: x,
20
20
  label: S,
21
- selectId: i,
22
- name: W = i,
23
- mode: l = z.onwhite,
24
- testId: g,
25
- width: d,
26
- required: m,
27
- value: N,
21
+ selectId: d,
22
+ name: W = d,
23
+ mode: n = F.onwhite,
24
+ testId: N,
25
+ width: m,
26
+ required: p,
27
+ value: g,
28
28
  defaultValue: R,
29
- autoComplete: p = "off",
30
- ...T
31
- } = t, u = w(i), f = w(x), b = l === "onblueberry", a = l === "oninvalid" || !!s || !!E, A = B(a, !!n), _ = d ? j(d) : void 0, $ = v(
29
+ autoComplete: u = "off",
30
+ wrapperClassName: T,
31
+ ...A
32
+ } = t, f = w(d), b = w(x), C = n === "onblueberry", a = n === "oninvalid" || !!i || !!E, _ = L(a, !!l), $ = m ? G(m) : void 0, q = s(
32
33
  e["select-inner-wrapper"],
33
34
  {
34
35
  [e["select-inner-wrapper--transparent"]]: h === "transparent",
35
- [e["select-inner-wrapper--on-blueberry"]]: b,
36
+ [e["select-inner-wrapper--on-blueberry"]]: C,
36
37
  [e["select-inner-wrapper--invalid"]]: a,
37
- [e["select-inner-wrapper--disabled"]]: n
38
+ [e["select-inner-wrapper--disabled"]]: l
38
39
  },
39
- C
40
- ), q = v(e.select, {
41
- [e["select--on-blueberry"]]: b,
40
+ y
41
+ ), z = s(e.select, {
42
+ [e["select--on-blueberry"]]: C,
42
43
  [e["select--invalid"]]: a
43
- });
44
- return /* @__PURE__ */ r.createElement(M, { errorText: s, errorTextId: f }, /* @__PURE__ */ r.createElement("div", { "data-testid": g, "data-analyticsid": D.Select, className: e["select-wrapper"], style: { maxWidth: _ } }, X(S, u, l), /* @__PURE__ */ r.createElement("div", { className: $ }, /* @__PURE__ */ r.createElement(U, { className: e["select-arrow"], svgIcon: V, color: A, size: F.XSmall }), /* @__PURE__ */ r.createElement(
44
+ }), D = s(e["select-wrapper"], T);
45
+ return /* @__PURE__ */ r.createElement(V, { errorText: i, errorTextId: b }, /* @__PURE__ */ r.createElement("div", { "data-testid": N, "data-analyticsid": H.Select, className: D, style: { maxWidth: $ } }, B(S, f, n), /* @__PURE__ */ r.createElement("div", { className: q }, /* @__PURE__ */ r.createElement(X, { className: e["select-arrow"], svgIcon: j, color: _, size: M.XSmall }), /* @__PURE__ */ r.createElement(
45
46
  "select",
46
47
  {
47
48
  "aria-invalid": !!a,
48
- id: u,
49
+ id: f,
49
50
  name: W,
50
- className: q,
51
- disabled: n,
51
+ className: z,
52
+ disabled: l,
52
53
  ref: c,
53
- required: m,
54
- "aria-describedby": [t["aria-describedby"] || "", f].join(" "),
55
- "aria-required": !!m,
56
- value: N,
54
+ required: p,
55
+ "aria-describedby": [t["aria-describedby"] || "", b].join(" "),
56
+ "aria-required": !!p,
57
+ value: g,
57
58
  defaultValue: R,
58
- autoComplete: p || void 0,
59
- ...T
59
+ autoComplete: u || void 0,
60
+ ...A
60
61
  },
61
62
  I
62
63
  ))));
63
- }), re = G;
64
+ }), oe = P;
64
65
  export {
65
- G as Select,
66
- re as default
66
+ P as Select,
67
+ oe as default
67
68
  };
68
69
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectStyles['select-wrapper']} style={{ maxWidth }}>\n {renderLabel(label, uuid, mode as FormMode)}\n <div className={selectInnerWrapperClasses}>\n <Icon className={selectStyles['select-arrow']} svgIcon={ChevronDown} color={iconColor} size={IconSize.XSmall} />\n <select\n aria-invalid={!!invalid}\n id={uuid}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={[props['aria-describedby'] || '', errorTextUuid].join(' ')}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n {...rest}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n});\n\nexport default Select;\n"],"names":["getSelectMaxWidth","characters","AVERAGE_CHARACTER_WIDTH_PX","getIconColor","invalid","disabled","getColor","Select","React","props","ref","className","children","concept","error","errorText","errorTextId","label","selectId","name","mode","FormMode","testId","width","required","value","defaultValue","autoComplete","rest","uuid","useUuid","errorTextUuid","onBlueberry","iconColor","maxWidth","selectInnerWrapperClasses","classNames","selectStyles","selectClasses","ErrorWrapper","AnalyticsId","renderLabel","Icon","ChevronDown","IconSize","Select$1"],"mappings":";;;;;;;;;;AA+CA,MAAMA,IAAoB,CAACC,MAGlB,QAAQA,IAAaC,CAA0B,cAGlDC,IAAe,CAACC,GAAkBC,MAE/BA,IAAWC,EAAS,WAAW,GAAG,IAAIA,EAD3BF,IAAU,WAAW,aAC0B,GAAG,GAGzDG,IAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAmC;AAClH,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAA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W2B,qCACbO,GAAK,EAAA,WAAWL,EAAa,cAAc,GAAG,SAASM,GAAa,OAAOV,GAAW,MAAMW,EAAS,QAAQ,GAC9GpC,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,gBAAc,CAAC,CAACJ;AAAA,MAChB,IAAIyB;AAAA,MACJ,MAAAV;AAAA,MACA,WAAWmB;AAAA,MACX,UAAAjC;AAAA,MACA,KAAAK;AAAA,MACA,UAAAc;AAAA,MACA,oBAAkB,CAACf,EAAM,kBAAkB,KAAK,IAAIsB,CAAa,EAAE,KAAK,GAAG;AAAA,MAC3E,iBAAe,CAAC,CAACP;AAAA,MACjB,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAcC,KAA8B;AAAA,MAC3C,GAAGC;AAAA,IAAA;AAAA,IAEHhB;AAAA,EAEL,CAAA,CACF,CACF;AAEJ,CAAC,GAEDiC,KAAetC;"}
1
+ {"version":3,"file":"Select.js","sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId, AVERAGE_CHARACTER_WIDTH_PX, FormMode, IconSize } from '../../constants';\nimport { useUuid } from '../../hooks/useUuid';\nimport { getColor } from '../../theme/currys';\nimport ErrorWrapper from '../ErrorWrapper';\nimport Icon from '../Icon';\nimport ChevronDown from '../Icons/ChevronDown';\nimport { renderLabel } from '../Label';\n\nimport selectStyles from './styles.module.scss';\n\ntype SelectConcept = 'normal' | 'transparent';\n\nexport interface SelectProps\n extends Pick<\n React.SelectHTMLAttributes<HTMLSelectElement>,\n 'aria-describedby' | 'name' | 'disabled' | 'required' | 'value' | 'onChange' | 'autoComplete'\n > {\n /** Sets the content of the select element. */\n children: React.ReactNode;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the visuals of the component */\n concept?: SelectConcept;\n /** The label text above the select */\n label?: React.ReactNode;\n /** Changes the visuals of the component */\n mode?: keyof typeof FormMode;\n /** Activates Error style for the select component - This is can be true while errorText is empty, when in a FormGroup */\n error?: boolean;\n /** Error text to show above the component */\n errorText?: string;\n /** Error text id */\n errorTextId?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** select id of the select element */\n selectId?: string;\n /** Width of select in characters (approximate) */\n width?: number;\n /** Gives defaultvalue to the comp. Preferred over selected prop on option by react */\n defaultValue?: string | number;\n /** Adds custom classes to the wrapper tag */\n wrapperClassName?: boolean;\n}\n\nconst getSelectMaxWidth = (characters: number): string => {\n const paddingWidth = '2rem';\n\n return `calc(${characters * AVERAGE_CHARACTER_WIDTH_PX}px + ${paddingWidth})`;\n};\n\nconst getIconColor = (invalid: boolean, disabled: boolean) => {\n const iconColor = invalid ? 'cherry' : 'blueberry';\n return disabled ? getColor('neutral', 500) : getColor(iconColor, 600);\n};\n\nexport const Select = React.forwardRef(function SelectForwardedRef(props: SelectProps, ref: React.Ref<HTMLSelectElement>) {\n const {\n className,\n children,\n concept = 'normal',\n disabled,\n error,\n errorText,\n errorTextId,\n label,\n selectId,\n name = selectId,\n mode = FormMode.onwhite,\n testId,\n width,\n required,\n value,\n defaultValue,\n autoComplete = 'off',\n wrapperClassName,\n ...rest\n } = props;\n\n const uuid = useUuid(selectId);\n const errorTextUuid = useUuid(errorTextId);\n const onBlueberry = mode === 'onblueberry';\n const invalid = mode === 'oninvalid' || !!errorText || !!error;\n const iconColor = getIconColor(invalid, !!disabled);\n const maxWidth = width ? getSelectMaxWidth(width) : undefined;\n\n const selectInnerWrapperClasses = classNames(\n selectStyles['select-inner-wrapper'],\n {\n [selectStyles['select-inner-wrapper--transparent']]: concept === 'transparent',\n [selectStyles['select-inner-wrapper--on-blueberry']]: onBlueberry,\n [selectStyles['select-inner-wrapper--invalid']]: invalid,\n [selectStyles['select-inner-wrapper--disabled']]: disabled,\n },\n className\n );\n\n const selectClasses = classNames(selectStyles.select, {\n [selectStyles['select--on-blueberry']]: onBlueberry,\n [selectStyles['select--invalid']]: invalid,\n });\n\n const selectWrapperClasses = classNames(selectStyles['select-wrapper'], wrapperClassName);\n\n return (\n <ErrorWrapper errorText={errorText} errorTextId={errorTextUuid}>\n <div data-testid={testId} data-analyticsid={AnalyticsId.Select} className={selectWrapperClasses} style={{ maxWidth }}>\n {renderLabel(label, uuid, mode as FormMode)}\n <div className={selectInnerWrapperClasses}>\n <Icon className={selectStyles['select-arrow']} svgIcon={ChevronDown} color={iconColor} size={IconSize.XSmall} />\n <select\n aria-invalid={!!invalid}\n id={uuid}\n name={name}\n className={selectClasses}\n disabled={disabled}\n ref={ref}\n required={required}\n aria-describedby={[props['aria-describedby'] || '', errorTextUuid].join(' ')}\n aria-required={!!required}\n value={value}\n defaultValue={defaultValue}\n autoComplete={autoComplete ? autoComplete : undefined}\n {...rest}\n >\n {children}\n </select>\n </div>\n </div>\n </ErrorWrapper>\n );\n});\n\nexport default Select;\n"],"names":["getSelectMaxWidth","characters","AVERAGE_CHARACTER_WIDTH_PX","getIconColor","invalid","disabled","getColor","Select","React","props","ref","className","children","concept","error","errorText","errorTextId","label","selectId","name","mode","FormMode","testId","width","required","value","defaultValue","autoComplete","wrapperClassName","rest","uuid","useUuid","errorTextUuid","onBlueberry","iconColor","maxWidth","selectInnerWrapperClasses","classNames","selectStyles","selectClasses","selectWrapperClasses","ErrorWrapper","AnalyticsId","renderLabel","Icon","ChevronDown","IconSize","Select$1"],"mappings":";;;;;;;;;;AAiDA,MAAMA,IAAoB,CAACC,MAGlB,QAAQA,IAAaC,CAA0B,cAGlDC,IAAe,CAACC,GAAkBC,MAE/BA,IAAWC,EAAS,WAAW,GAAG,IAAIA,EAD3BF,IAAU,WAAW,aAC0B,GAAG,GAGzDG,IAASC,EAAM,WAAW,SAA4BC,GAAoBC,GAAmC;AAClH,QAAA;AAAA,IACJ,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,UAAAR;AAAA,IACA,OAAAS;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UA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AA,cAACoC,KAAK,WAAWN,EAAa,cAAc,GAAG,SAASO,GAAa,OAAOX,GAAW,MAAMY,EAAS,QAAQ,GAC9GtC,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,gBAAc,CAAC,CAACJ;AAAA,MAChB,IAAI0B;AAAA,MACJ,MAAAX;AAAA,MACA,WAAWoB;AAAA,MACX,UAAAlC;AAAA,MACA,KAAAK;AAAA,MACA,UAAAc;AAAA,MACA,oBAAkB,CAACf,EAAM,kBAAkB,KAAK,IAAIuB,CAAa,EAAE,KAAK,GAAG;AAAA,MAC3E,iBAAe,CAAC,CAACR;AAAA,MACjB,OAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAcC,KAA8B;AAAA,MAC3C,GAAGE;AAAA,IAAA;AAAA,IAEHjB;AAAA,EAEL,CAAA,CACF,CACF;AAEJ,CAAC,GAEDmC,KAAexC;"}
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Select").SelectProps & React.RefAttributes<HTMLSelectElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./ServiceMessage").ServiceMessageProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./SharingStatus").SharingStatusProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Slider").SliderProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Spacer").SpacerProps & React.RefAttributes<HTMLElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./StatusDot").StatusDotProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Step").StepProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./StepButtons").StepButtonsProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Stepper").StepperProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -12,6 +12,7 @@ declare const meta: {
12
12
  component: React.FC<import("./Table").Props>;
13
13
  parameters: {
14
14
  docs: {
15
+ page: () => React.JSX.Element;
15
16
  description: {
16
17
  component: string;
17
18
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.FC<import("./Tag").TagProps>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./TagList").TagListPropsProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: React.ForwardRefExoticComponent<import("./Textarea").TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  };
@@ -1,9 +1,11 @@
1
+ import React from 'react';
1
2
  import { StoryObj } from '@storybook/react';
2
3
  declare const meta: {
3
4
  title: string;
4
5
  component: import("./Tile").TileCompound;
5
6
  parameters: {
6
7
  docs: {
8
+ page: () => React.JSX.Element;
7
9
  description: {
8
10
  component: string;
9
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Title").TitleProps & React.RefAttributes<HTMLHeadingElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.FC<import("./Tooltip").TooltipProps>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -5,6 +5,7 @@ declare const meta: {
5
5
  component: React.ForwardRefExoticComponent<import("./Trigger").TriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  parameters: {
7
7
  docs: {
8
+ page: () => React.JSX.Element;
8
9
  description: {
9
10
  component: string;
10
11
  };
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { StoryObj } from '@storybook/react';
3
3
  import { FormSize } from '../../constants';
4
4
  declare const meta: {
@@ -6,6 +6,7 @@ declare const meta: {
6
6
  component: (props: import("../FormExample/FormExample").FormExampleProps) => JSX.Element;
7
7
  parameters: {
8
8
  docs: {
9
+ page: () => React.JSX.Element;
9
10
  description: {
10
11
  component: string;
11
12
  markdown: string;
package/docs/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  interface DocsProps<T> {
3
3
  component: T;
4
+ hideStories?: boolean;
4
5
  }
5
6
  export declare const isSupernova: () => boolean;
6
7
  declare const Docs: <T>(props: DocsProps<T>) => React.JSX.Element;
package/docs/index.js CHANGED
@@ -1,9 +1,14 @@
1
1
  import * as e from "react";
2
2
  import "../node_modules/@storybook/addon-docs/dist/chunk-HLWAVYOI.js";
3
- import { ArgTypes as n, Title as r, Subtitle as o, Description as l, Primary as a, Stories as i } from "../node_modules/@storybook/blocks/dist/index.js";
4
- const c = () => (window.location != window.parent.location ? document.referrer : document.location.href).startsWith("https://frankenstein.helsenorge.design") || window.location.search.includes("isSupernova"), u = (t) => c() ? /* @__PURE__ */ e.createElement(n, { of: t.component }) : /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement(r, null), /* @__PURE__ */ e.createElement(o, null), /* @__PURE__ */ e.createElement(l, null), /* @__PURE__ */ e.createElement(a, null), /* @__PURE__ */ e.createElement(n, { of: t.component }), /* @__PURE__ */ e.createElement(i, null));
3
+ import { ArgTypes as n, Title as o, Subtitle as l, Description as i, Primary as c, Stories as s } from "../node_modules/@storybook/blocks/dist/index.js";
4
+ const m = () => (window.location != window.parent.location ? document.referrer : document.location.href).startsWith("https://frankenstein.helsenorge.design") || window.location.search.includes("isSupernova"), w = (t) => {
5
+ if (m())
6
+ return /* @__PURE__ */ e.createElement(n, { of: t.component });
7
+ const r = new URLSearchParams(window.location.search), a = `${window.location.pathname}?id=${r.get("id")}&viewMode=docs`;
8
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "space-between" } }, /* @__PURE__ */ e.createElement(o, null), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("a", { target: "_blank", href: a, rel: "noreferrer" }, "Åpne i ny fane"))), /* @__PURE__ */ e.createElement(l, null), /* @__PURE__ */ e.createElement(i, null), /* @__PURE__ */ e.createElement(c, null), /* @__PURE__ */ e.createElement(n, { of: t.component }), !t.hideStories && /* @__PURE__ */ e.createElement(s, null));
9
+ };
5
10
  export {
6
- u as default,
7
- c as isSupernova
11
+ w as default,
12
+ m as isSupernova
8
13
  };
9
14
  //# sourceMappingURL=index.js.map
package/docs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/docs/index.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Title, Subtitle, Description, Primary, ArgTypes, Stories } from '@storybook/addon-docs';\n\ninterface DocsProps<T> {\n component: T;\n}\n\nexport const isSupernova = (): boolean => {\n const url = window.location != window.parent.location ? document.referrer : document.location.href;\n return url.startsWith('https://frankenstein.helsenorge.design') || window.location.search.includes('isSupernova');\n};\n\nconst Docs = <T,>(props: DocsProps<T>): React.JSX.Element => {\n if (isSupernova()) {\n return <ArgTypes of={props.component} />;\n }\n\n return (\n <>\n <Title />\n <Subtitle />\n <Description />\n <Primary />\n <ArgTypes of={props.component} />\n <Stories />\n </>\n );\n};\n\nexport default Docs;\n"],"names":["isSupernova","Docs","props","React","ArgTypes","Title","Subtitle","Description","Primary","Stories"],"mappings":";;;AAQO,MAAMA,IAAc,OACb,OAAO,YAAY,OAAO,OAAO,WAAW,SAAS,WAAW,SAAS,SAAS,MACnF,WAAW,wCAAwC,KAAK,OAAO,SAAS,OAAO,SAAS,aAAa,GAG5GC,IAAO,CAAKC,MACZF,MACM,gBAAAG,EAAA,cAAAC,GAAA,EAAS,IAAIF,EAAM,UAAW,CAAA,IAItC,gBAAAC,EAAA,cAAAA,EAAA,UAAA,sCACGE,GAAM,IAAA,mCACNC,GAAS,IAAA,mCACTC,GAAY,IAAA,mCACZC,GAAQ,IAAA,mCACRJ,GAAS,EAAA,IAAIF,EAAM,UAAW,CAAA,GAC9B,gBAAAC,EAAA,cAAAM,GAAA,IAAQ,CACX;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/docs/index.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Title, Subtitle, Description, Primary, ArgTypes, Stories } from '@storybook/addon-docs';\n\ninterface DocsProps<T> {\n component: T;\n hideStories?: boolean;\n}\n\nexport const isSupernova = (): boolean => {\n const url = window.location != window.parent.location ? document.referrer : document.location.href;\n return url.startsWith('https://frankenstein.helsenorge.design') || window.location.search.includes('isSupernova');\n};\n\nconst Docs = <T,>(props: DocsProps<T>): React.JSX.Element => {\n if (isSupernova()) {\n return <ArgTypes of={props.component} />;\n }\n\n const searchParams = new URLSearchParams(window.location.search);\n const newWindowUrl = `${window.location.pathname}?id=${searchParams.get('id')}&viewMode=docs`;\n\n return (\n <>\n <div style={{ display: 'flex', justifyContent: 'space-between' }}>\n <Title />\n <div>\n <a target=\"_blank\" href={newWindowUrl} rel=\"noreferrer\">\n {'Åpne i ny fane'}\n </a>\n </div>\n </div>\n <Subtitle />\n <Description />\n <Primary />\n <ArgTypes of={props.component} />\n {!props.hideStories && <Stories />}\n </>\n );\n};\n\nexport default Docs;\n"],"names":["isSupernova","Docs","props","React","ArgTypes","searchParams","newWindowUrl","Title","Subtitle","Description","Primary","Stories"],"mappings":";;;AASO,MAAMA,IAAc,OACb,OAAO,YAAY,OAAO,OAAO,WAAW,SAAS,WAAW,SAAS,SAAS,MACnF,WAAW,wCAAwC,KAAK,OAAO,SAAS,OAAO,SAAS,aAAa,GAG5GC,IAAO,CAAKC,MAA2C;AAC3D,MAAIF;AACF,WAAQ,gBAAAG,EAAA,cAAAC,GAAA,EAAS,IAAIF,EAAM,UAAW,CAAA;AAGxC,QAAMG,IAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM,GACzDC,IAAe,GAAG,OAAO,SAAS,QAAQ,OAAOD,EAAa,IAAI,IAAI,CAAC;AAG3E,SAAA,gBAAAF,EAAA,cAAAA,EAAA,UAAA,sCACG,OAAI,EAAA,OAAO,EAAE,SAAS,QAAQ,gBAAgB,kBAAgB,mCAC5DI,GAAM,IAAA,mCACN,OACC,MAAA,gBAAAJ,EAAA,cAAC,OAAE,QAAO,UAAS,MAAMG,GAAc,KAAI,aAAA,GACxC,gBACH,CACF,CACF,GACC,gBAAAH,EAAA,cAAAK,GAAA,IAAS,GACT,gBAAAL,EAAA,cAAAM,GAAA,IAAY,GACb,gBAAAN,EAAA,cAACO,GAAQ,IAAA,mCACRN,GAAS,EAAA,IAAIF,EAAM,UAAW,CAAA,GAC9B,CAACA,EAAM,eAAgB,gBAAAC,EAAA,cAAAQ,GAAA,IAAQ,CAClC;AAEJ;"}
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": "7.2.0",
10
+ "version": "7.3.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "peerDependencies": {