@helsenorge/designsystem-react 10.0.2 → 10.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.
Files changed (181) hide show
  1. package/AnchorLink.js +2 -2
  2. package/AnchorLink.js.map +1 -1
  3. package/Avatar.js +2 -2
  4. package/Avatar.js.map +1 -1
  5. package/Badge.js +3 -3
  6. package/Badge.js.map +1 -1
  7. package/Button.js +4 -4
  8. package/Button.js.map +1 -1
  9. package/CHANGELOG.md +38 -0
  10. package/Checkbox.js +2 -2
  11. package/Checkbox.js.map +1 -1
  12. package/Close.js +2 -2
  13. package/Close.js.map +1 -1
  14. package/ErrorBoundary.js +2 -2
  15. package/ErrorBoundary.js.map +1 -1
  16. package/Expander.js +2 -2
  17. package/Expander.js.map +1 -1
  18. package/FormGroup.js +12 -12
  19. package/FormGroup.js.map +1 -1
  20. package/FormLayout.js +3 -3
  21. package/FormLayout.js.map +1 -1
  22. package/HelpBubble.js +2 -2
  23. package/HelpBubble.js.map +1 -1
  24. package/HighlightPanel.js +2 -2
  25. package/HighlightPanel.js.map +1 -1
  26. package/Icon.js +3 -3
  27. package/Icon.js.map +1 -1
  28. package/Illustration.js +3 -3
  29. package/Illustration.js.map +1 -1
  30. package/Input.js +2 -2
  31. package/Input.js.map +1 -1
  32. package/Label.js +8 -8
  33. package/Label.js.map +1 -1
  34. package/LazyIcon.js +1 -1
  35. package/LazyIllustration.js +3 -3
  36. package/LazyIllustration.js.map +1 -1
  37. package/LinkList.js +6 -6
  38. package/LinkList.js.map +1 -1
  39. package/ListHeader.js +7 -7
  40. package/ListHeader.js.map +1 -1
  41. package/Panel.js +2 -2
  42. package/Panel.js.map +1 -1
  43. package/PopOver.js +2 -2
  44. package/PopOver.js.map +1 -1
  45. package/RadioButton.js +2 -2
  46. package/RadioButton.js.map +1 -1
  47. package/Select.js +2 -2
  48. package/Select.js.map +1 -1
  49. package/Slider.js +3 -3
  50. package/Slider.js.map +1 -1
  51. package/Spacer.js +2 -2
  52. package/Spacer.js.map +1 -1
  53. package/StatusDot.js +1 -1
  54. package/StepButtons.js +4 -4
  55. package/StepButtons.js.map +1 -1
  56. package/TabList.js +4 -4
  57. package/TabList.js.map +1 -1
  58. package/Table.js +2 -2
  59. package/Table.js.map +1 -1
  60. package/TableBody.js +2 -2
  61. package/TableBody.js.map +1 -1
  62. package/TableExpandedRow.js +2 -2
  63. package/TableExpandedRow.js.map +1 -1
  64. package/TableHead.js +2 -2
  65. package/TableHead.js.map +1 -1
  66. package/TableRow.js +2 -2
  67. package/TableRow.js.map +1 -1
  68. package/Textarea.js +2 -2
  69. package/Textarea.js.map +1 -1
  70. package/Title.js +2 -2
  71. package/Title.js.map +1 -1
  72. package/TooltipWord.js +2 -2
  73. package/TooltipWord.js.map +1 -1
  74. package/Trigger.js +3 -3
  75. package/Trigger.js.map +1 -1
  76. package/components/Button/styles.module.scss +5 -0
  77. package/components/DictionaryTrigger/index.js +2 -2
  78. package/components/DictionaryTrigger/index.js.map +1 -1
  79. package/components/Drawer/Drawer.d.ts +41 -0
  80. package/components/Drawer/Drawer.test.d.ts +1 -0
  81. package/components/Drawer/index.d.ts +3 -0
  82. package/components/Drawer/index.js +350 -0
  83. package/components/Drawer/index.js.map +1 -0
  84. package/components/Drawer/styles.module.scss +127 -0
  85. package/components/Drawer/styles.module.scss.d.ts +16 -0
  86. package/components/Dropdown/index.js +3 -3
  87. package/components/Dropdown/index.js.map +1 -1
  88. package/components/Duolist/index.js +4 -4
  89. package/components/Duolist/index.js.map +1 -1
  90. package/components/ExpanderHierarchy/index.js +5 -5
  91. package/components/ExpanderHierarchy/index.js.map +1 -1
  92. package/components/ExpanderList/index.js +8 -8
  93. package/components/ExpanderList/index.js.map +1 -1
  94. package/components/HelpQuestion/index.js +2 -2
  95. package/components/HelpQuestion/index.js.map +1 -1
  96. package/components/HighlightPanel/styles.module.scss +4 -36
  97. package/components/HighlightPanel/styles.module.scss.d.ts +1 -2
  98. package/components/Icons/EuropeanHealthCard.js +1 -1
  99. package/components/Icons/GroupTwins.js +1 -1
  100. package/components/Icons/Inbox.js +1 -1
  101. package/components/Icons/LawBook.js +1 -1
  102. package/components/Icons/PersonCancel.js +1 -1
  103. package/components/Icons/PersonWithBrain.js +1 -1
  104. package/components/Icons/Puzzle.js +1 -1
  105. package/components/Icons/Snapchat.js +1 -1
  106. package/components/Illustrations/IllustrationNames.d.ts +1 -1
  107. package/components/Illustrations/IllustrationNames.js +4 -2
  108. package/components/Illustrations/IllustrationNames.js.map +1 -1
  109. package/components/Illustrations/ReadLetters.d.ts +9 -0
  110. package/components/Illustrations/ReadLetters.js +11 -0
  111. package/components/Illustrations/ReadLetters.js.map +1 -0
  112. package/components/Illustrations/ReadLettersMedium.d.ts +4 -0
  113. package/components/Illustrations/ReadLettersMedium.js +110 -0
  114. package/components/Illustrations/ReadLettersMedium.js.map +1 -0
  115. package/components/Illustrations/Support2.d.ts +9 -0
  116. package/components/Illustrations/Support2.js +11 -0
  117. package/components/Illustrations/Support2.js.map +1 -0
  118. package/components/Illustrations/Support2Medium.d.ts +4 -0
  119. package/components/Illustrations/Support2Medium.js +232 -0
  120. package/components/Illustrations/Support2Medium.js.map +1 -0
  121. package/components/Label/styles.module.scss +16 -12
  122. package/components/Label/styles.module.scss.d.ts +3 -1
  123. package/components/List/styles.module.scss +7 -7
  124. package/components/Modal/index.js +71 -82
  125. package/components/Modal/index.js.map +1 -1
  126. package/components/Modal/styles.module.scss +12 -6
  127. package/components/NotificationPanel/index.js +3 -3
  128. package/components/NotificationPanel/index.js.map +1 -1
  129. package/components/PanelList/index.js +5 -5
  130. package/components/PanelList/index.js.map +1 -1
  131. package/components/PopMenu/index.js +5 -5
  132. package/components/PopMenu/index.js.map +1 -1
  133. package/components/Portal/index.js +3 -3
  134. package/components/Portal/index.js.map +1 -1
  135. package/components/PromoPanel/index.js +2 -2
  136. package/components/PromoPanel/index.js.map +1 -1
  137. package/components/StickyNote/index.js +12 -6
  138. package/components/StickyNote/index.js.map +1 -1
  139. package/components/Tabs/Tabs.d.ts +2 -0
  140. package/components/Tabs/index.js +8 -4
  141. package/components/Tabs/index.js.map +1 -1
  142. package/components/TagList/index.js +2 -2
  143. package/components/TagList/index.js.map +1 -1
  144. package/components/Tile/index.js +6 -6
  145. package/components/Tile/index.js.map +1 -1
  146. package/components/Toggle/index.js +3 -3910
  147. package/components/Toggle/index.js.map +1 -1
  148. package/components/Tooltip/index.js +2 -2
  149. package/components/Tooltip/index.js.map +1 -1
  150. package/components/Validation/index.js +6 -6
  151. package/components/Validation/index.js.map +1 -1
  152. package/constants.d.ts +1 -0
  153. package/constants.js +1 -0
  154. package/constants.js.map +1 -1
  155. package/hoc/withBreakpoint/withBreakpoint.js +2 -2
  156. package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
  157. package/hooks/useBreakpoint.d.ts +0 -4
  158. package/hooks/useBreakpoint.js +23 -18
  159. package/hooks/useBreakpoint.js.map +1 -1
  160. package/hooks/useEventListenerState.js +3 -3
  161. package/hooks/useEventListenerState.js.map +1 -1
  162. package/hooks/useOutsideEvent.d.ts +4 -4
  163. package/hooks/useOutsideEvent.js +5 -4
  164. package/hooks/useOutsideEvent.js.map +1 -1
  165. package/hooks/useReturnFocusOnUnmount.d.ts +5 -0
  166. package/hooks/useReturnFocusOnUnmount.js +20 -0
  167. package/hooks/useReturnFocusOnUnmount.js.map +1 -0
  168. package/package.json +1 -1
  169. package/scss/_breakpoints.scss +6 -0
  170. package/scss/_font-mixins.scss +55 -0
  171. package/scss/typography.module.scss +24 -0
  172. package/scss/typography.module.scss.d.ts +6 -0
  173. package/scss/typography.stories.tsx +24 -0
  174. package/theme/index.js +2 -2
  175. package/use-animate.js +3952 -0
  176. package/use-animate.js.map +1 -0
  177. package/utils/accessibility.d.ts +1 -0
  178. package/utils/accessibility.js +6 -1
  179. package/utils/accessibility.js.map +1 -1
  180. package/utils/component.js +4 -4
  181. package/utils/component.js.map +1 -1
@@ -2,6 +2,7 @@ import { AriaAttributes } from 'react';
2
2
  interface AriaLabelAttributesConfig {
3
3
  label?: string;
4
4
  id?: string;
5
+ fallbackId?: string;
5
6
  prefer?: 'id' | 'label';
6
7
  }
7
8
  export type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
@@ -1,5 +1,5 @@
1
1
  const getAriaLabelAttributes = (config) => {
2
- const { label, id, prefer = "id" } = config;
2
+ const { label, id, fallbackId, prefer = "id" } = config;
3
3
  if (id && prefer === "id") {
4
4
  return {
5
5
  "aria-labelledby": id
@@ -15,6 +15,11 @@ const getAriaLabelAttributes = (config) => {
15
15
  "aria-labelledby": id
16
16
  };
17
17
  }
18
+ if (fallbackId) {
19
+ return {
20
+ "aria-labelledby": fallbackId
21
+ };
22
+ }
18
23
  };
19
24
  const getAriaDescribedBy = (props, errorTextUuid) => {
20
25
  const ariaDescribedBy = props["aria-describedby"];
@@ -1 +1 @@
1
- {"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n};\n\nexport interface ErrorAriaProps {\n error?: boolean;\n 'aria-describedby'?: string;\n errorText?: string;\n errorTextId?: string;\n}\n\n/**\n * Get IDs to be used with aria-describedby in form components like <Input />\n * @param props Props from form component\n * @param errorTextUuid Unique ID of the form component's error text\n * @returns Element IDs or undefined if there is no aria-description\n */\nexport const getAriaDescribedBy = (props: ErrorAriaProps, errorTextUuid: string): string | undefined => {\n const ariaDescribedBy: string | undefined = props['aria-describedby'];\n const hasErrorText: boolean = !!(props.errorText || (props.error && props.errorTextId));\n const errorTextId: string | undefined = hasErrorText ? errorTextUuid : undefined;\n\n if (ariaDescribedBy && !errorTextId) {\n return ariaDescribedBy;\n } else if (!ariaDescribedBy && errorTextId) {\n return errorTextId;\n } else if (ariaDescribedBy && errorTextId) {\n return ariaDescribedBy + ' ' + errorTextId;\n }\n};\n"],"names":[],"mappings":"AAUa,MAAA,yBAAyB,CAAC,WAAuE;AAC5G,QAAM,EAAE,OAAO,IAAI,SAAS,KAAS,IAAA;AAEjC,MAAA,MAAM,WAAW,MAAM;AAClB,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAGF,MAAI,OAAO;AACF,WAAA;AAAA,MACL,cAAc;AAAA,IAChB;AAAA,EAAA;AAGF,MAAI,IAAI;AACC,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAEJ;AAea,MAAA,qBAAqB,CAAC,OAAuB,kBAA8C;AAChG,QAAA,kBAAsC,MAAM,kBAAkB;AACpE,QAAM,eAAwB,CAAC,EAAE,MAAM,aAAc,MAAM,SAAS,MAAM;AACpE,QAAA,cAAkC,eAAe,gBAAgB;AAEnE,MAAA,mBAAmB,CAAC,aAAa;AAC5B,WAAA;AAAA,EAAA,WACE,CAAC,mBAAmB,aAAa;AACnC,WAAA;AAAA,EAAA,WACE,mBAAmB,aAAa;AACzC,WAAO,kBAAkB,MAAM;AAAA,EAAA;AAEnC;"}
1
+ {"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n fallbackId?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, fallbackId, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (fallbackId) {\n return {\n 'aria-labelledby': fallbackId,\n };\n }\n};\n\nexport interface ErrorAriaProps {\n error?: boolean;\n 'aria-describedby'?: string;\n errorText?: string;\n errorTextId?: string;\n}\n\n/**\n * Get IDs to be used with aria-describedby in form components like <Input />\n * @param props Props from form component\n * @param errorTextUuid Unique ID of the form component's error text\n * @returns Element IDs or undefined if there is no aria-description\n */\nexport const getAriaDescribedBy = (props: ErrorAriaProps, errorTextUuid: string): string | undefined => {\n const ariaDescribedBy: string | undefined = props['aria-describedby'];\n const hasErrorText: boolean = !!(props.errorText || (props.error && props.errorTextId));\n const errorTextId: string | undefined = hasErrorText ? errorTextUuid : undefined;\n\n if (ariaDescribedBy && !errorTextId) {\n return ariaDescribedBy;\n } else if (!ariaDescribedBy && errorTextId) {\n return errorTextId;\n } else if (ariaDescribedBy && errorTextId) {\n return ariaDescribedBy + ' ' + errorTextId;\n }\n};\n"],"names":[],"mappings":"AAWa,MAAA,yBAAyB,CAAC,WAAuE;AAC5G,QAAM,EAAE,OAAO,IAAI,YAAY,SAAS,SAAS;AAE7C,MAAA,MAAM,WAAW,MAAM;AAClB,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAGF,MAAI,OAAO;AACF,WAAA;AAAA,MACL,cAAc;AAAA,IAChB;AAAA,EAAA;AAGF,MAAI,IAAI;AACC,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAGF,MAAI,YAAY;AACP,WAAA;AAAA,MACL,mBAAmB;AAAA,IACrB;AAAA,EAAA;AAEJ;AAea,MAAA,qBAAqB,CAAC,OAAuB,kBAA8C;AAChG,QAAA,kBAAsC,MAAM,kBAAkB;AACpE,QAAM,eAAwB,CAAC,EAAE,MAAM,aAAc,MAAM,SAAS,MAAM;AACpE,QAAA,cAAkC,eAAe,gBAAgB;AAEnE,MAAA,mBAAmB,CAAC,aAAa;AAC5B,WAAA;AAAA,EAAA,WACE,CAAC,mBAAmB,aAAa;AACnC,WAAA;AAAA,EAAA,WACE,mBAAmB,aAAa;AACzC,WAAO,kBAAkB,MAAM;AAAA,EAAA;AAEnC;"}
@@ -1,8 +1,8 @@
1
- import React from "react";
2
- const isComponent = (element, type) => React.isValidElement(element) && element.type === type;
3
- const isComponentWithChildren = (element) => React.isValidElement(element);
1
+ import React__default from "react";
2
+ const isComponent = (element, type) => React__default.isValidElement(element) && element.type === type;
3
+ const isComponentWithChildren = (element) => React__default.isValidElement(element);
4
4
  function isComponentWithDisplayName(element, displayName) {
5
- if (!React.isValidElement(element) || typeof element.type === "string") {
5
+ if (!React__default.isValidElement(element) || typeof element.type === "string") {
6
6
  return false;
7
7
  }
8
8
  const componentType = element.type;
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React, { PropsWithChildren } from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n\nexport const isComponentWithChildren = <T>(element: {} | null | undefined): element is React.ReactElement<PropsWithChildren<T>> =>\n React.isValidElement<PropsWithChildren<T>>(element);\n\nexport function isComponentWithDisplayName<T>(element: React.ReactNode, displayName: string): element is React.ReactElement<T> {\n if (!React.isValidElement(element) || typeof element.type === 'string') {\n return false;\n }\n\n const componentType = element.type as React.ComponentType<T> & { displayName?: string };\n\n return componentType.displayName === displayName;\n}\n"],"names":[],"mappings":";AAEa,MAAA,cAAc,CACzB,SACA,SACqC,MAAM,eAAkB,OAAO,KAAM,QAA+B,SAAS;AAE7G,MAAM,0BAA0B,CAAI,YACzC,MAAM,eAAqC,OAAO;AAEpC,SAAA,2BAA8B,SAA0B,aAAuD;AACzH,MAAA,CAAC,MAAM,eAAe,OAAO,KAAK,OAAO,QAAQ,SAAS,UAAU;AAC/D,WAAA;AAAA,EAAA;AAGT,QAAM,gBAAgB,QAAQ;AAE9B,SAAO,cAAc,gBAAgB;AACvC;"}
1
+ {"version":3,"file":"component.js","sources":["../../src/utils/component.ts"],"sourcesContent":["import React, { PropsWithChildren } from 'react';\n\nexport const isComponent = <T>(\n element: {} | null | undefined,\n type: React.ForwardRefExoticComponent<T> | React.FunctionComponent<T>\n): element is React.ReactElement<T> => React.isValidElement<T>(element) && (element as React.ReactElement).type === type;\n\nexport const isComponentWithChildren = <T>(element: {} | null | undefined): element is React.ReactElement<PropsWithChildren<T>> =>\n React.isValidElement<PropsWithChildren<T>>(element);\n\nexport function isComponentWithDisplayName<T>(element: React.ReactNode, displayName: string): element is React.ReactElement<T> {\n if (!React.isValidElement(element) || typeof element.type === 'string') {\n return false;\n }\n\n const componentType = element.type as React.ComponentType<T> & { displayName?: string };\n\n return componentType.displayName === displayName;\n}\n"],"names":["React"],"mappings":";AAEa,MAAA,cAAc,CACzB,SACA,SACqCA,eAAM,eAAkB,OAAO,KAAM,QAA+B,SAAS;AAE7G,MAAM,0BAA0B,CAAI,YACzCA,eAAM,eAAqC,OAAO;AAEpC,SAAA,2BAA8B,SAA0B,aAAuD;AACzH,MAAA,CAACA,eAAM,eAAe,OAAO,KAAK,OAAO,QAAQ,SAAS,UAAU;AAC/D,WAAA;AAAA,EAAA;AAGT,QAAM,gBAAgB,QAAQ;AAE9B,SAAO,cAAc,gBAAgB;AACvC;"}