@helsenorge/designsystem-react 7.1.0 → 7.2.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [7.1.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.0.0&targetVersion=GTv7.1.0) (2024-04-17)
2
+
3
+ ### Features
4
+
5
+ - badge innstramming av tilgjengelige farger
6
+ ([193ec66](https://github.com/helsenorge/designsystem/commit/193ec6633394354505a60147668800269b51feae)), closes
7
+ [#308135](https://github.com/helsenorge/designsystem/issues/308135)
8
+ - ny default breddehåndtering for Dropdown
9
+ ([6078613](https://github.com/helsenorge/designsystem/commit/6078613bf8bae571eb582f9778b8c4a494d3339d)), closes
10
+ [#323389](https://github.com/helsenorge/designsystem/issues/323389)
11
+
1
12
  ## [7.0.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv6.6.2&targetVersion=GTv7.0.0) (2024-04-08)
2
13
 
3
14
  ## 7.0.0-beta.7 (2024-04-05)
@@ -1349,12 +1360,12 @@ Dette er fordi vi skal kunne dynamisk importere alt som ligger i Icons, så da b
1349
1360
 
1350
1361
  ### Bug Fixes
1351
1362
 
1352
- - panel har avstand fra tittel til badge
1353
- ([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
1354
- [#282359](https://github.com/helsenorge/designsystem/issues/282359)
1355
1363
  - økt kontrast på understreking av lenker
1356
1364
  ([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
1357
1365
  [#229049](https://github.com/helsenorge/designsystem/issues/229049)
1366
+ - panel har avstand fra tittel til badge
1367
+ ([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
1368
+ [#282359](https://github.com/helsenorge/designsystem/issues/282359)
1358
1369
 
1359
1370
  ## [1.2.2](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv1.2.1&targetVersion=GTv1.2.2) (2022-08-31)
1360
1371
 
@@ -23,16 +23,16 @@ const re = (d) => {
23
23
  onToggle: O,
24
24
  open: $ = !1,
25
25
  children: _,
26
- mode: c = "onwhite",
26
+ mode: i = "onwhite",
27
27
  transparent: S = !1,
28
28
  fluid: y = !1,
29
29
  testId: z,
30
- disabled: i,
30
+ disabled: c,
31
31
  zIndex: D = G.PopOver
32
- } = d, p = f(null), b = f(null), { hoverRef: w, isHovered: L } = Z(), { value: l, toggleValue: h } = j(!i && $, O), a = f(r.Children.map(_, () => r.createRef())), [u, P] = X(), E = g(), I = g(), x = g(), v = () => {
32
+ } = d, p = f(null), b = f(null), { hoverRef: w, isHovered: L } = Z(), { value: l, toggleValue: h } = j(!c && $, O), a = f(r.Children.map(_, () => r.createRef())), [m, P] = X(), E = g(), I = g(), x = g(), v = () => {
33
33
  var e;
34
34
  h(), (e = b.current) == null || e.focus();
35
- }, m = () => {
35
+ }, u = () => {
36
36
  var e;
37
37
  h(), (e = w.current) == null || e.focus();
38
38
  };
@@ -42,7 +42,7 @@ const re = (d) => {
42
42
  return;
43
43
  if (l) {
44
44
  if (e.key === n.Escape && l) {
45
- m();
45
+ u();
46
46
  return;
47
47
  }
48
48
  } else {
@@ -59,19 +59,19 @@ const re = (d) => {
59
59
  n.Enter,
60
60
  n.Escape,
61
61
  n.Home
62
- ]), F(p, () => l && m());
62
+ ]), F(p, () => l && u());
63
63
  const T = k(
64
64
  o.dropdown__toggle,
65
- !i && {
66
- [o["dropdown__toggle--on-white"]]: c === "onwhite",
67
- [o["dropdown__toggle--on-grey"]]: c === "ongrey",
68
- [o["dropdown__toggle--on-blueberry"]]: c === "onblueberry",
69
- [o["dropdown__toggle--on-cherry"]]: c === "oncherry",
65
+ !c && {
66
+ [o["dropdown__toggle--on-white"]]: i === "onwhite",
67
+ [o["dropdown__toggle--on-grey"]]: i === "ongrey",
68
+ [o["dropdown__toggle--on-blueberry"]]: i === "onblueberry",
69
+ [o["dropdown__toggle--on-cherry"]]: i === "oncherry",
70
70
  [o["dropdown__toggle--transparent"]]: S,
71
71
  [o["dropdown__toggle--fluid"]]: y,
72
72
  [o["dropdown__toggle--open"]]: l
73
73
  }
74
- ), U = k(o.dropdown__content, l && o["dropdown__content--open"]), B = r.Children.map(_, (e, t) => /* @__PURE__ */ r.createElement("li", { className: o.dropdown__input, role: "option", id: `${x}-${t}`, "aria-selected": t === u }, r.isValidElement(e) && a.current && a.current[t] ? r.cloneElement(e, { ref: W([e.props.ref, a.current[t]]) }) : e));
74
+ ), U = k(o.dropdown__content, l && o["dropdown__content--open"]), B = r.Children.map(_, (e, t) => /* @__PURE__ */ r.createElement("li", { className: o.dropdown__input, role: "option", id: `${x}-${t}`, "aria-selected": t === m }, r.isValidElement(e) && a.current && a.current[t] ? r.cloneElement(e, { ref: W([e.props.ref, a.current[t]]) }) : e));
75
75
  return /* @__PURE__ */ r.createElement("div", { className: o.dropdown, ref: p }, /* @__PURE__ */ r.createElement("span", { id: E, className: o.dropdown__label }, R), /* @__PURE__ */ r.createElement(
76
76
  "button",
77
77
  {
@@ -81,7 +81,7 @@ const re = (d) => {
81
81
  ref: w,
82
82
  "data-testid": z,
83
83
  "data-analyticsid": J.Dropdown,
84
- disabled: i,
84
+ disabled: c,
85
85
  "aria-labelledby": I,
86
86
  "aria-haspopup": "listbox",
87
87
  "aria-expanded": l
@@ -90,10 +90,10 @@ const re = (d) => {
90
90
  /* @__PURE__ */ r.createElement(
91
91
  M,
92
92
  {
93
- color: i ? C.palette.neutral700 : C.palette.blueberry600,
93
+ color: c ? C.palette.neutral700 : C.palette.blueberry600,
94
94
  svgIcon: ee,
95
95
  className: o.dropdown__icon,
96
- isHovered: !i && L,
96
+ isHovered: !c && L,
97
97
  size: Q.XSmall
98
98
  }
99
99
  )
@@ -104,11 +104,11 @@ const re = (d) => {
104
104
  role: "listbox",
105
105
  "aria-labelledby": E,
106
106
  tabIndex: -1,
107
- "aria-activedescendant": typeof u < "u" ? `${x}-${u}` : void 0,
107
+ "aria-activedescendant": typeof m < "u" ? `${x}-${m}` : void 0,
108
108
  ref: b
109
109
  },
110
110
  B
111
- ), !K && /* @__PURE__ */ r.createElement("div", { className: o.dropdown__close }, /* @__PURE__ */ r.createElement(Y, { onClick: m, fluid: !0, "aria-expanded": l }, H))));
111
+ ), !K && /* @__PURE__ */ r.createElement("div", { className: o.dropdown__close }, /* @__PURE__ */ r.createElement(Y, { onClick: u, "aria-expanded": l }, H))));
112
112
  }, we = re;
113
113
  export {
114
114
  oe as DropdownMode,
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n useUuid,\n} from '../..';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Close button text */\n closeText?: string;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n mode?: keyof typeof DropdownMode;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n closeText = 'Lukk',\n noCloseButton = false,\n onToggle,\n open = false,\n children,\n mode = DropdownMode.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n } = props;\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const [currentIndex, setCurrentIndex] = useState<number>();\n const labelId = useUuid();\n const toggleLabelId = useUuid();\n const optionIdPrefix = useUuid();\n\n const handleOpen = (): void => {\n toggleIsOpen();\n optionsRef.current?.focus();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n event.preventDefault();\n\n if (!inputRefList.current) {\n return;\n }\n\n if (!isOpen) {\n handleOpen();\n return;\n } else if (event.key === KeyboardEventKey.Escape && isOpen) {\n handleClose();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n if (nextIndex !== -1) {\n inputRefList.current[nextIndex].current?.focus();\n setCurrentIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: mode === DropdownMode.onwhite,\n [styles['dropdown__toggle--on-grey']]: mode === DropdownMode.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: mode === DropdownMode.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: mode === DropdownMode.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => (\n <li className={styles.dropdown__input} role=\"option\" id={`${optionIdPrefix}-${index}`} aria-selected={index === currentIndex}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, { ref: mergeRefs([child.props.ref, inputRefList.current[index]]) })\n : child}\n </li>\n ));\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => !isOpen && handleOpen()}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div className={contentClasses} style={{ width: fluid ? '100%' : `auto`, zIndex: zIndex }}>\n <ul\n className={styles.dropdown__options}\n role=\"listbox\"\n aria-labelledby={labelId}\n tabIndex={-1}\n aria-activedescendant={typeof currentIndex !== 'undefined' ? `${optionIdPrefix}-${currentIndex}` : undefined}\n ref={optionsRef}\n >\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose} fluid aria-expanded={isOpen}>\n {closeText}\n </Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownMode","Dropdown","props","label","placeholder","closeText","noCloseButton","onToggle","open","children","mode","transparent","fluid","testId","disabled","zIndex","ZIndex","dropdownRef","useRef","optionsRef","buttonRef","isHovered","useHover","isOpen","toggleIsOpen","useToggle","inputRefList","React","currentIndex","setCurrentIndex","useState","labelId","useUuid","toggleLabelId","optionIdPrefix","handleOpen","_a","handleClose","useKeyboardEvent","event","KeyboardEventKey","index","x","nextIndex","useOutsideEvent","toggleClasses","classNames","styles","contentClasses","renderChildren","child","mergeRefs","AnalyticsId","Icon","theme","PlusSmall","IconSize","Button","Dropdown$1"],"mappings":";;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,cAAc,eACdA,EAAA,WAAW,YAJDA,IAAAA,MAAA,CAAA,CAAA;AAoCZ,MAAMC,KAAoC,CAASC,MAAA;AAC3C,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC,IAAgB;AAAA,IAChB,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,OAAAC,IAAQ;AAAA,IACR,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;AAAA,EACd,IAAAd,GACEe,I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,GAEAqD,KAAezD;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n useUuid,\n} from '../..';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Close button text */\n closeText?: string;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n mode?: keyof typeof DropdownMode;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n closeText = 'Lukk',\n noCloseButton = false,\n onToggle,\n open = false,\n children,\n mode = DropdownMode.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n } = props;\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const [currentIndex, setCurrentIndex] = useState<number>();\n const labelId = useUuid();\n const toggleLabelId = useUuid();\n const optionIdPrefix = useUuid();\n\n const handleOpen = (): void => {\n toggleIsOpen();\n optionsRef.current?.focus();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n event.preventDefault();\n\n if (!inputRefList.current) {\n return;\n }\n\n if (!isOpen) {\n handleOpen();\n return;\n } else if (event.key === KeyboardEventKey.Escape && isOpen) {\n handleClose();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n if (nextIndex !== -1) {\n inputRefList.current[nextIndex].current?.focus();\n setCurrentIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: mode === DropdownMode.onwhite,\n [styles['dropdown__toggle--on-grey']]: mode === DropdownMode.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: mode === DropdownMode.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: mode === DropdownMode.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => (\n <li className={styles.dropdown__input} role=\"option\" id={`${optionIdPrefix}-${index}`} aria-selected={index === currentIndex}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, { ref: mergeRefs([child.props.ref, inputRefList.current[index]]) })\n : child}\n </li>\n ));\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => !isOpen && handleOpen()}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div className={contentClasses} style={{ width: fluid ? '100%' : `auto`, zIndex: zIndex }}>\n <ul\n className={styles.dropdown__options}\n role=\"listbox\"\n aria-labelledby={labelId}\n tabIndex={-1}\n aria-activedescendant={typeof currentIndex !== 'undefined' ? `${optionIdPrefix}-${currentIndex}` : undefined}\n ref={optionsRef}\n >\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose} aria-expanded={isOpen}>\n {closeText}\n </Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownMode","Dropdown","props","label","placeholder","closeText","noCloseButton","onToggle","open","children","mode","transparent","fluid","testId","disabled","zIndex","ZIndex","dropdownRef","useRef","optionsRef","buttonRef","isHovered","useHover","isOpen","toggleIsOpen","useToggle","inputRefList","React","currentIndex","setCurrentIndex","useState","labelId","useUuid","toggleLabelId","optionIdPrefix","handleOpen","_a","handleClose","useKeyboardEvent","event","KeyboardEventKey","index","x","nextIndex","useOutsideEvent","toggleClasses","classNames","styles","contentClasses","renderChildren","child","mergeRefs","AnalyticsId","Icon","theme","PlusSmall","IconSize","Button","Dropdown$1"],"mappings":";;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,cAAc,eACdA,EAAA,WAAW,YAJDA,IAAAA,MAAA,CAAA,CAAA;AAoCZ,MAAMC,KAAoC,CAASC,MAAA;AAC3C,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC,IAAgB;AAAA,IAChB,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,OAAAC,IAAQ;AAAA,IACR,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;AAAA,EACd,IAAAd,GACEe,IAAcC,EAAuB,IAAI,GACzCC,IAAaD,EAAyB,IAAI,GAC1C,EAAE,UAAUE,GAAW,WAAAC,MAAcC,EAA4B,GACjE,EAAE,OAAOC,GAAQ,aAAaC,EAAA,IAAiBC,EAAU,CAACX,KAAYN,GAAMD,CAAQ,GACpFmB,IAAeR,EAAOS,EAAM,SAAS,IAAIlB,GAAU,MAAMkB,EAAM,UAAwB,CAAA,CAAC,GACxF,CAACC,GAAcC,CAAe,IAAIC,EAAiB,GACnDC,IAAUC,KACVC,IAAgBD,KAChBE,IAAiBF,KAEjBG,IAAa,MAAY;;AAChB,IAAAX,MACbY,IAA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,QAAK,EAAA,IAAIU,GAAe,WAAWc,EAAO,2BACxC3C,CACH;AAAA,IACAuB,gBAAAA,EAAA;AAAA,MAAC0B;AAAA,MAAA;AAAA,QACC,OAAOvC,IAAWwC,EAAM,QAAQ,aAAaA,EAAM,QAAQ;AAAA,QAC3D,SAASC;AAAA,QACT,WAAWR,EAAO;AAAA,QAClB,WAAW,CAACjC,KAAYO;AAAA,QACxB,MAAMmC,EAAS;AAAA,MAAA;AAAA,IACjB;AAAA,EAAA,GAEF7B,gBAAAA,EAAA,cAAC,OAAI,EAAA,WAAWqB,GAAgB,OAAO,EAAE,OAAOpC,IAAQ,SAAS,QAAQ,QAAAG,EACvE,EAAA,GAAAY,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWoB,EAAO;AAAA,MAClB,MAAK;AAAA,MACL,mBAAiBhB;AAAA,MACjB,UAAU;AAAA,MACV,yBAAuB,OAAOH,IAAiB,MAAc,GAAGM,CAAc,IAAIN,CAAY,KAAK;AAAA,MACnG,KAAKT;AAAA,IAAA;AAAA,IAEJ8B;AAAA,EAAA,GAEF,CAAC3C,KACCqB,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWoB,EAAO,mBACpBpB,gBAAAA,EAAA,cAAA8B,GAAA,EAAO,SAASpB,GAAa,iBAAed,KAC1ClB,CACH,CACF,CAEJ,CACF;AAEJ,GAEAqD,KAAezD;"}
@@ -1,11 +1,8 @@
1
1
  import e from "react";
2
2
  import { isSupernova as r } from "../../docs/index.js";
3
- const m = ({ gridLayout: t, children: a }) => {
4
- const n = r() || t === "padding";
5
- return /* @__PURE__ */ e.createElement(e.Fragment, null, n && /* @__PURE__ */ e.createElement("div", { style: { padding: "0.5rem" } }, a), t === "helsenorge" && /* @__PURE__ */ e.createElement("div", { className: "container py-5" }, /* @__PURE__ */ e.createElement("div", { className: "row" }, /* @__PURE__ */ e.createElement("div", { className: "col" }, a))), t === "none" && a);
6
- }, c = m;
3
+ const m = ({ gridLayout: a = r(), children: t }) => r() || a === "padding" ? /* @__PURE__ */ e.createElement("div", { style: { padding: "0.5rem" } }, t) : a === "helsenorge" ? /* @__PURE__ */ e.createElement("div", { className: "container py-5" }, /* @__PURE__ */ e.createElement("div", { className: "row" }, /* @__PURE__ */ e.createElement("div", { className: "col" }, t))) : /* @__PURE__ */ e.createElement(e.Fragment, null, t), s = m;
7
4
  export {
8
5
  m as GridExample,
9
- c as default
6
+ s as default
10
7
  };
11
8
  //# sourceMappingURL=GridExample.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GridExample.js","sources":["../../../src/components/GridExample/GridExample.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSupernova } from '../../docs';\n\ntype GridLayout = 'helsenorge' | 'padding' | 'none';\ninterface GridExampleProps {\n gridLayout: GridLayout;\n}\n\nexport const GridExample: React.FC<GridExampleProps> = ({ gridLayout, children }) => {\n const returnWithPadding = isSupernova() || gridLayout === 'padding';\n\n return (\n <>\n {returnWithPadding && <div style={{ padding: '0.5rem' }}>{children}</div>}\n {gridLayout === 'helsenorge' && (\n <div className=\"container py-5\">\n <div className=\"row\">\n <div className=\"col\">{children}</div>\n </div>\n </div>\n )}\n {gridLayout === 'none' && children}\n </>\n );\n};\n\nexport default GridExample;\n"],"names":["GridExample","gridLayout","children","returnWithPadding","isSupernova","React","GridExample$1"],"mappings":";;AASO,MAAMA,IAA0C,CAAC,EAAE,YAAAC,GAAY,UAAAC,QAAe;AAC7E,QAAAC,IAAoBC,OAAiBH,MAAe;AAE1D,SAEKI,gBAAAA,EAAA,cAAAA,EAAA,UAAA,MAAAF,KAAsBE,gBAAAA,EAAA,cAAA,OAAA,EAAI,OAAO,EAAE,SAAS,SAAA,KAAaH,CAAS,GAClED,MAAe,gBACbI,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAU,oBACZA,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAU,MAAA,mCACZ,OAAI,EAAA,WAAU,MAAO,GAAAH,CAAS,CACjC,CACF,GAEDD,MAAe,UAAUC,CAC5B;AAEJ,GAEAI,IAAeN;"}
1
+ {"version":3,"file":"GridExample.js","sources":["../../../src/components/GridExample/GridExample.tsx"],"sourcesContent":["import React from 'react';\n\nimport { isSupernova } from '../../docs';\n\ntype GridLayout = 'helsenorge' | 'padding' | 'none';\n\ninterface GridExampleProps {\n gridLayout: GridLayout;\n}\n\nexport const GridExample: React.FC<GridExampleProps> = ({ gridLayout = isSupernova(), children }) => {\n if (isSupernova() || gridLayout === 'padding') {\n return <div style={{ padding: '0.5rem' }}>{children}</div>;\n }\n\n if (gridLayout === 'helsenorge') {\n return (\n <div className=\"container py-5\">\n <div className=\"row\">\n <div className=\"col\">{children}</div>\n </div>\n </div>\n );\n }\n\n return <>{children}</>;\n};\n\nexport default GridExample;\n"],"names":["GridExample","gridLayout","isSupernova","children","React","GridExample$1"],"mappings":";;AAUO,MAAMA,IAA0C,CAAC,EAAE,YAAAC,IAAaC,EAAY,GAAG,UAAAC,QAChFD,EAAA,KAAiBD,MAAe,4CAC1B,OAAI,EAAA,OAAO,EAAE,SAAS,SAAA,KAAaE,CAAS,IAGlDF,MAAe,eAEdG,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAU,oDACZ,OAAI,EAAA,WAAU,MACb,GAAAA,gBAAAA,EAAA,cAAC,OAAI,EAAA,WAAU,MAAO,GAAAD,CAAS,CACjC,CACF,sDAIMA,CAAS,GAGrBE,IAAeL;"}
package/docs/index.js CHANGED
@@ -1,7 +1,7 @@
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 l, Description as o, Primary as a, Stories as i } from "../node_modules/@storybook/blocks/dist/index.js";
4
- const c = () => window.parent.location.hostname === "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(l, null), /* @__PURE__ */ e.createElement(o, 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 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));
5
5
  export {
6
6
  u as default,
7
7
  c as isSupernova
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 window.parent.location.hostname === 'frankenstein.helsenorge.design' || window.location.search.includes('isSupernova');\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":";;;AAQa,MAAAA,IAAc,MACzB,OAAO,OAAO,SAAS,aAAa,oCAAoC,OAAO,SAAS,OAAO,SAAS,aAAa,GAEjHC,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}\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;"}
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.1.0",
10
+ "version": "7.2.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "peerDependencies": {