@dnb/eufemia 10.71.2 → 10.72.1

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 (354) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/cjs/components/anchor/Anchor.js +1 -0
  3. package/cjs/components/anchor/Anchor.js.map +1 -1
  4. package/cjs/components/card/CardDocs.js +1 -1
  5. package/cjs/components/card/CardDocs.js.map +1 -1
  6. package/cjs/components/help-button/HelpButtonInline.js +1 -1
  7. package/cjs/components/help-button/HelpButtonInline.js.map +1 -1
  8. package/cjs/components/section/Section.d.ts +2 -1
  9. package/cjs/components/section/Section.js +2 -2
  10. package/cjs/components/section/Section.js.map +1 -1
  11. package/cjs/components/section/style/dnb-section.css +4 -0
  12. package/cjs/components/section/style/dnb-section.min.css +1 -1
  13. package/cjs/components/section/style/dnb-section.scss +5 -0
  14. package/cjs/components/step-indicator/StepIndicator.d.ts +23 -5
  15. package/cjs/components/step-indicator/StepIndicator.js +66 -21
  16. package/cjs/components/step-indicator/StepIndicator.js.map +1 -1
  17. package/cjs/components/step-indicator/StepIndicatorContext.d.ts +2 -14
  18. package/cjs/components/step-indicator/StepIndicatorContext.js +9 -56
  19. package/cjs/components/step-indicator/StepIndicatorContext.js.map +1 -1
  20. package/cjs/components/step-indicator/StepIndicatorDocs.d.ts +5 -0
  21. package/cjs/components/step-indicator/StepIndicatorDocs.js +145 -0
  22. package/cjs/components/step-indicator/StepIndicatorDocs.js.map +1 -0
  23. package/cjs/components/step-indicator/StepIndicatorItem.d.ts +10 -10
  24. package/cjs/components/step-indicator/StepIndicatorItem.js +87 -98
  25. package/cjs/components/step-indicator/StepIndicatorItem.js.map +1 -1
  26. package/cjs/components/step-indicator/StepIndicatorList.js +33 -36
  27. package/cjs/components/step-indicator/StepIndicatorList.js.map +1 -1
  28. package/cjs/components/step-indicator/StepIndicatorProps.js +2 -1
  29. package/cjs/components/step-indicator/StepIndicatorProps.js.map +1 -1
  30. package/cjs/components/step-indicator/StepIndicatorSidebar.d.ts +8 -8
  31. package/cjs/components/step-indicator/StepIndicatorSidebar.js +6 -63
  32. package/cjs/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  33. package/cjs/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -7
  34. package/cjs/components/step-indicator/StepIndicatorTriggerButton.js +70 -38
  35. package/cjs/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  36. package/cjs/components/step-indicator/style/dnb-step-indicator.css +97 -56
  37. package/cjs/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
  38. package/cjs/components/step-indicator/style/dnb-step-indicator.scss +109 -67
  39. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.css +5 -62
  40. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.min.css +1 -1
  41. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.scss +5 -89
  42. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.css +1 -65
  43. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.min.css +0 -1
  44. package/cjs/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.scss +0 -91
  45. package/cjs/elements/Element.d.ts +16 -2
  46. package/cjs/elements/Element.js +1 -1
  47. package/cjs/elements/Element.js.map +1 -1
  48. package/cjs/elements/lib.d.ts +1 -1
  49. package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  50. package/cjs/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  51. package/cjs/extensions/forms/Field/Indeterminate/IndeterminateDocs.js +1 -1
  52. package/cjs/extensions/forms/Field/Indeterminate/IndeterminateDocs.js.map +1 -1
  53. package/cjs/extensions/forms/Wizard/Buttons/ButtonsDocs.js +1 -1
  54. package/cjs/extensions/forms/Wizard/Buttons/ButtonsDocs.js.map +1 -1
  55. package/cjs/extensions/forms/Wizard/Container/DisplaySteps.d.ts +3 -3
  56. package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js +14 -10
  57. package/cjs/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  58. package/cjs/extensions/forms/Wizard/Container/WizardContainer.d.ts +12 -0
  59. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js +24 -13
  60. package/cjs/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  61. package/cjs/extensions/forms/Wizard/Container/WizardContainerDocs.js +21 -11
  62. package/cjs/extensions/forms/Wizard/Container/WizardContainerDocs.js.map +1 -1
  63. package/cjs/extensions/forms/Wizard/style/dnb-wizard-layout.css +2 -14
  64. package/cjs/extensions/forms/Wizard/style/dnb-wizard-layout.min.css +1 -1
  65. package/cjs/extensions/forms/Wizard/style/dnb-wizard-layout.scss +3 -18
  66. package/cjs/extensions/forms/style/dnb-forms.css +2 -13
  67. package/cjs/extensions/forms/style/dnb-forms.min.css +1 -1
  68. package/cjs/shared/Eufemia.d.ts +1 -1
  69. package/cjs/shared/Eufemia.js +2 -2
  70. package/cjs/shared/Eufemia.js.map +1 -1
  71. package/cjs/shared/locales/en-GB.d.ts +0 -1
  72. package/cjs/shared/locales/en-GB.js +1 -2
  73. package/cjs/shared/locales/en-GB.js.map +1 -1
  74. package/cjs/shared/locales/en-US.d.ts +0 -1
  75. package/cjs/shared/locales/index.d.ts +0 -2
  76. package/cjs/shared/locales/nb-NO.d.ts +0 -1
  77. package/cjs/shared/locales/nb-NO.js +1 -2
  78. package/cjs/shared/locales/nb-NO.js.map +1 -1
  79. package/cjs/shared/locales/sv-SE.d.ts +0 -1
  80. package/cjs/shared/locales/sv-SE.js +0 -1
  81. package/cjs/shared/locales/sv-SE.js.map +1 -1
  82. package/cjs/style/core/scopes.scss +1 -1
  83. package/cjs/style/dnb-ui-basis.css +1 -1
  84. package/cjs/style/dnb-ui-basis.min.css +1 -1
  85. package/cjs/style/dnb-ui-body.css +1 -1
  86. package/cjs/style/dnb-ui-body.min.css +1 -1
  87. package/cjs/style/dnb-ui-components.css +99 -65
  88. package/cjs/style/dnb-ui-components.min.css +3 -3
  89. package/cjs/style/dnb-ui-core.css +1 -1
  90. package/cjs/style/dnb-ui-core.min.css +1 -1
  91. package/cjs/style/dnb-ui-extensions.css +2 -13
  92. package/cjs/style/dnb-ui-extensions.min.css +1 -1
  93. package/cjs/style/dnb-ui-forms.css +2 -13
  94. package/cjs/style/dnb-ui-forms.min.css +1 -1
  95. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.css +100 -142
  96. package/cjs/style/themes/theme-eiendom/eiendom-theme-components.min.css +4 -4
  97. package/cjs/style/themes/theme-eiendom/eiendom-theme-extensions.css +2 -13
  98. package/cjs/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  99. package/cjs/style/themes/theme-eiendom/eiendom-theme-forms.css +2 -13
  100. package/cjs/style/themes/theme-eiendom/eiendom-theme-forms.min.css +1 -1
  101. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.css +105 -139
  102. package/cjs/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  103. package/cjs/style/themes/theme-sbanken/sbanken-theme-extensions.css +2 -13
  104. package/cjs/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  105. package/cjs/style/themes/theme-sbanken/sbanken-theme-forms.css +2 -13
  106. package/cjs/style/themes/theme-sbanken/sbanken-theme-forms.min.css +1 -1
  107. package/cjs/style/themes/theme-ui/ui-theme-components.css +100 -142
  108. package/cjs/style/themes/theme-ui/ui-theme-components.min.css +4 -4
  109. package/cjs/style/themes/theme-ui/ui-theme-extensions.css +2 -13
  110. package/cjs/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  111. package/cjs/style/themes/theme-ui/ui-theme-forms.css +2 -13
  112. package/cjs/style/themes/theme-ui/ui-theme-forms.min.css +1 -1
  113. package/components/anchor/Anchor.js +1 -0
  114. package/components/anchor/Anchor.js.map +1 -1
  115. package/components/card/CardDocs.js +1 -1
  116. package/components/card/CardDocs.js.map +1 -1
  117. package/components/help-button/HelpButtonInline.js +1 -1
  118. package/components/help-button/HelpButtonInline.js.map +1 -1
  119. package/components/section/Section.d.ts +2 -1
  120. package/components/section/Section.js +2 -2
  121. package/components/section/Section.js.map +1 -1
  122. package/components/section/style/dnb-section.css +4 -0
  123. package/components/section/style/dnb-section.min.css +1 -1
  124. package/components/section/style/dnb-section.scss +5 -0
  125. package/components/step-indicator/StepIndicator.d.ts +23 -5
  126. package/components/step-indicator/StepIndicator.js +64 -21
  127. package/components/step-indicator/StepIndicator.js.map +1 -1
  128. package/components/step-indicator/StepIndicatorContext.d.ts +2 -14
  129. package/components/step-indicator/StepIndicatorContext.js +9 -53
  130. package/components/step-indicator/StepIndicatorContext.js.map +1 -1
  131. package/components/step-indicator/StepIndicatorDocs.d.ts +5 -0
  132. package/components/step-indicator/StepIndicatorDocs.js +139 -0
  133. package/components/step-indicator/StepIndicatorDocs.js.map +1 -0
  134. package/components/step-indicator/StepIndicatorItem.d.ts +10 -10
  135. package/components/step-indicator/StepIndicatorItem.js +88 -99
  136. package/components/step-indicator/StepIndicatorItem.js.map +1 -1
  137. package/components/step-indicator/StepIndicatorList.js +33 -35
  138. package/components/step-indicator/StepIndicatorList.js.map +1 -1
  139. package/components/step-indicator/StepIndicatorProps.js +2 -1
  140. package/components/step-indicator/StepIndicatorProps.js.map +1 -1
  141. package/components/step-indicator/StepIndicatorSidebar.d.ts +8 -8
  142. package/components/step-indicator/StepIndicatorSidebar.js +6 -59
  143. package/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  144. package/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -7
  145. package/components/step-indicator/StepIndicatorTriggerButton.js +71 -39
  146. package/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  147. package/components/step-indicator/style/dnb-step-indicator.css +97 -56
  148. package/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
  149. package/components/step-indicator/style/dnb-step-indicator.scss +109 -67
  150. package/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.css +5 -62
  151. package/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.min.css +1 -1
  152. package/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.scss +5 -89
  153. package/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.css +1 -65
  154. package/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.min.css +0 -1
  155. package/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.scss +0 -91
  156. package/elements/Element.d.ts +16 -2
  157. package/elements/Element.js +1 -1
  158. package/elements/Element.js.map +1 -1
  159. package/elements/lib.d.ts +1 -1
  160. package/es/components/anchor/Anchor.js +1 -0
  161. package/es/components/anchor/Anchor.js.map +1 -1
  162. package/es/components/card/CardDocs.js +1 -1
  163. package/es/components/card/CardDocs.js.map +1 -1
  164. package/es/components/help-button/HelpButtonInline.js +1 -1
  165. package/es/components/help-button/HelpButtonInline.js.map +1 -1
  166. package/es/components/section/Section.d.ts +2 -1
  167. package/es/components/section/Section.js +2 -2
  168. package/es/components/section/Section.js.map +1 -1
  169. package/es/components/section/style/dnb-section.css +4 -0
  170. package/es/components/section/style/dnb-section.min.css +1 -1
  171. package/es/components/section/style/dnb-section.scss +5 -0
  172. package/es/components/step-indicator/StepIndicator.d.ts +23 -5
  173. package/es/components/step-indicator/StepIndicator.js +63 -21
  174. package/es/components/step-indicator/StepIndicator.js.map +1 -1
  175. package/es/components/step-indicator/StepIndicatorContext.d.ts +2 -14
  176. package/es/components/step-indicator/StepIndicatorContext.js +5 -49
  177. package/es/components/step-indicator/StepIndicatorContext.js.map +1 -1
  178. package/es/components/step-indicator/StepIndicatorDocs.d.ts +5 -0
  179. package/es/components/step-indicator/StepIndicatorDocs.js +139 -0
  180. package/es/components/step-indicator/StepIndicatorDocs.js.map +1 -0
  181. package/es/components/step-indicator/StepIndicatorItem.d.ts +10 -10
  182. package/es/components/step-indicator/StepIndicatorItem.js +80 -88
  183. package/es/components/step-indicator/StepIndicatorItem.js.map +1 -1
  184. package/es/components/step-indicator/StepIndicatorList.js +33 -35
  185. package/es/components/step-indicator/StepIndicatorList.js.map +1 -1
  186. package/es/components/step-indicator/StepIndicatorProps.js +2 -1
  187. package/es/components/step-indicator/StepIndicatorProps.js.map +1 -1
  188. package/es/components/step-indicator/StepIndicatorSidebar.d.ts +8 -8
  189. package/es/components/step-indicator/StepIndicatorSidebar.js +6 -58
  190. package/es/components/step-indicator/StepIndicatorSidebar.js.map +1 -1
  191. package/es/components/step-indicator/StepIndicatorTriggerButton.d.ts +1 -7
  192. package/es/components/step-indicator/StepIndicatorTriggerButton.js +71 -39
  193. package/es/components/step-indicator/StepIndicatorTriggerButton.js.map +1 -1
  194. package/es/components/step-indicator/style/dnb-step-indicator.css +97 -56
  195. package/es/components/step-indicator/style/dnb-step-indicator.min.css +1 -1
  196. package/es/components/step-indicator/style/dnb-step-indicator.scss +109 -67
  197. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.css +5 -62
  198. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.min.css +1 -1
  199. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-sbanken.scss +5 -89
  200. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.css +1 -65
  201. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.min.css +0 -1
  202. package/es/components/step-indicator/style/themes/dnb-step-indicator-theme-ui.scss +0 -91
  203. package/es/elements/Element.d.ts +16 -2
  204. package/es/elements/Element.js +1 -1
  205. package/es/elements/Element.js.map +1 -1
  206. package/es/elements/lib.d.ts +1 -1
  207. package/es/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  208. package/es/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  209. package/es/extensions/forms/Field/Indeterminate/IndeterminateDocs.js +1 -1
  210. package/es/extensions/forms/Field/Indeterminate/IndeterminateDocs.js.map +1 -1
  211. package/es/extensions/forms/Wizard/Buttons/ButtonsDocs.js +1 -1
  212. package/es/extensions/forms/Wizard/Buttons/ButtonsDocs.js.map +1 -1
  213. package/es/extensions/forms/Wizard/Container/DisplaySteps.d.ts +3 -3
  214. package/es/extensions/forms/Wizard/Container/DisplaySteps.js +14 -10
  215. package/es/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  216. package/es/extensions/forms/Wizard/Container/WizardContainer.d.ts +12 -0
  217. package/es/extensions/forms/Wizard/Container/WizardContainer.js +24 -13
  218. package/es/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  219. package/es/extensions/forms/Wizard/Container/WizardContainerDocs.js +21 -11
  220. package/es/extensions/forms/Wizard/Container/WizardContainerDocs.js.map +1 -1
  221. package/es/extensions/forms/Wizard/style/dnb-wizard-layout.css +2 -14
  222. package/es/extensions/forms/Wizard/style/dnb-wizard-layout.min.css +1 -1
  223. package/es/extensions/forms/Wizard/style/dnb-wizard-layout.scss +3 -18
  224. package/es/extensions/forms/style/dnb-forms.css +2 -13
  225. package/es/extensions/forms/style/dnb-forms.min.css +1 -1
  226. package/es/shared/Eufemia.d.ts +1 -1
  227. package/es/shared/Eufemia.js +2 -2
  228. package/es/shared/Eufemia.js.map +1 -1
  229. package/es/shared/locales/en-GB.d.ts +0 -1
  230. package/es/shared/locales/en-GB.js +1 -2
  231. package/es/shared/locales/en-GB.js.map +1 -1
  232. package/es/shared/locales/en-US.d.ts +0 -1
  233. package/es/shared/locales/index.d.ts +0 -2
  234. package/es/shared/locales/nb-NO.d.ts +0 -1
  235. package/es/shared/locales/nb-NO.js +1 -2
  236. package/es/shared/locales/nb-NO.js.map +1 -1
  237. package/es/shared/locales/sv-SE.d.ts +0 -1
  238. package/es/shared/locales/sv-SE.js +0 -1
  239. package/es/shared/locales/sv-SE.js.map +1 -1
  240. package/es/style/core/scopes.scss +1 -1
  241. package/es/style/dnb-ui-basis.css +1 -1
  242. package/es/style/dnb-ui-basis.min.css +1 -1
  243. package/es/style/dnb-ui-body.css +1 -1
  244. package/es/style/dnb-ui-body.min.css +1 -1
  245. package/es/style/dnb-ui-components.css +99 -65
  246. package/es/style/dnb-ui-components.min.css +3 -3
  247. package/es/style/dnb-ui-core.css +1 -1
  248. package/es/style/dnb-ui-core.min.css +1 -1
  249. package/es/style/dnb-ui-extensions.css +2 -13
  250. package/es/style/dnb-ui-extensions.min.css +1 -1
  251. package/es/style/dnb-ui-forms.css +2 -13
  252. package/es/style/dnb-ui-forms.min.css +1 -1
  253. package/es/style/themes/theme-eiendom/eiendom-theme-components.css +100 -142
  254. package/es/style/themes/theme-eiendom/eiendom-theme-components.min.css +4 -4
  255. package/es/style/themes/theme-eiendom/eiendom-theme-extensions.css +2 -13
  256. package/es/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  257. package/es/style/themes/theme-eiendom/eiendom-theme-forms.css +2 -13
  258. package/es/style/themes/theme-eiendom/eiendom-theme-forms.min.css +1 -1
  259. package/es/style/themes/theme-sbanken/sbanken-theme-components.css +105 -139
  260. package/es/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  261. package/es/style/themes/theme-sbanken/sbanken-theme-extensions.css +2 -13
  262. package/es/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  263. package/es/style/themes/theme-sbanken/sbanken-theme-forms.css +2 -13
  264. package/es/style/themes/theme-sbanken/sbanken-theme-forms.min.css +1 -1
  265. package/es/style/themes/theme-ui/ui-theme-components.css +100 -142
  266. package/es/style/themes/theme-ui/ui-theme-components.min.css +4 -4
  267. package/es/style/themes/theme-ui/ui-theme-extensions.css +2 -13
  268. package/es/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  269. package/es/style/themes/theme-ui/ui-theme-forms.css +2 -13
  270. package/es/style/themes/theme-ui/ui-theme-forms.min.css +1 -1
  271. package/esm/dnb-ui-basis.min.mjs +1 -1
  272. package/esm/dnb-ui-components.min.mjs +1 -1
  273. package/esm/dnb-ui-elements.min.mjs +1 -1
  274. package/esm/dnb-ui-extensions.min.mjs +1 -1
  275. package/esm/dnb-ui-lib.min.mjs +1 -1
  276. package/extensions/forms/DataContext/Provider/ProviderDocs.js +1 -1
  277. package/extensions/forms/DataContext/Provider/ProviderDocs.js.map +1 -1
  278. package/extensions/forms/Field/Indeterminate/IndeterminateDocs.js +1 -1
  279. package/extensions/forms/Field/Indeterminate/IndeterminateDocs.js.map +1 -1
  280. package/extensions/forms/Wizard/Buttons/ButtonsDocs.js +1 -1
  281. package/extensions/forms/Wizard/Buttons/ButtonsDocs.js.map +1 -1
  282. package/extensions/forms/Wizard/Container/DisplaySteps.d.ts +3 -3
  283. package/extensions/forms/Wizard/Container/DisplaySteps.js +14 -10
  284. package/extensions/forms/Wizard/Container/DisplaySteps.js.map +1 -1
  285. package/extensions/forms/Wizard/Container/WizardContainer.d.ts +12 -0
  286. package/extensions/forms/Wizard/Container/WizardContainer.js +24 -13
  287. package/extensions/forms/Wizard/Container/WizardContainer.js.map +1 -1
  288. package/extensions/forms/Wizard/Container/WizardContainerDocs.js +21 -11
  289. package/extensions/forms/Wizard/Container/WizardContainerDocs.js.map +1 -1
  290. package/extensions/forms/Wizard/style/dnb-wizard-layout.css +2 -14
  291. package/extensions/forms/Wizard/style/dnb-wizard-layout.min.css +1 -1
  292. package/extensions/forms/Wizard/style/dnb-wizard-layout.scss +3 -18
  293. package/extensions/forms/style/dnb-forms.css +2 -13
  294. package/extensions/forms/style/dnb-forms.min.css +1 -1
  295. package/package.json +1 -1
  296. package/shared/Eufemia.d.ts +1 -1
  297. package/shared/Eufemia.js +2 -2
  298. package/shared/Eufemia.js.map +1 -1
  299. package/shared/locales/en-GB.d.ts +0 -1
  300. package/shared/locales/en-GB.js +1 -2
  301. package/shared/locales/en-GB.js.map +1 -1
  302. package/shared/locales/en-US.d.ts +0 -1
  303. package/shared/locales/index.d.ts +0 -2
  304. package/shared/locales/nb-NO.d.ts +0 -1
  305. package/shared/locales/nb-NO.js +1 -2
  306. package/shared/locales/nb-NO.js.map +1 -1
  307. package/shared/locales/sv-SE.d.ts +0 -1
  308. package/shared/locales/sv-SE.js +0 -1
  309. package/shared/locales/sv-SE.js.map +1 -1
  310. package/style/core/scopes.scss +1 -1
  311. package/style/dnb-ui-basis.css +1 -1
  312. package/style/dnb-ui-basis.min.css +1 -1
  313. package/style/dnb-ui-body.css +1 -1
  314. package/style/dnb-ui-body.min.css +1 -1
  315. package/style/dnb-ui-components.css +99 -65
  316. package/style/dnb-ui-components.min.css +3 -3
  317. package/style/dnb-ui-core.css +1 -1
  318. package/style/dnb-ui-core.min.css +1 -1
  319. package/style/dnb-ui-extensions.css +2 -13
  320. package/style/dnb-ui-extensions.min.css +1 -1
  321. package/style/dnb-ui-forms.css +2 -13
  322. package/style/dnb-ui-forms.min.css +1 -1
  323. package/style/themes/theme-eiendom/eiendom-theme-components.css +100 -142
  324. package/style/themes/theme-eiendom/eiendom-theme-components.min.css +4 -4
  325. package/style/themes/theme-eiendom/eiendom-theme-extensions.css +2 -13
  326. package/style/themes/theme-eiendom/eiendom-theme-extensions.min.css +1 -1
  327. package/style/themes/theme-eiendom/eiendom-theme-forms.css +2 -13
  328. package/style/themes/theme-eiendom/eiendom-theme-forms.min.css +1 -1
  329. package/style/themes/theme-sbanken/sbanken-theme-components.css +105 -139
  330. package/style/themes/theme-sbanken/sbanken-theme-components.min.css +4 -4
  331. package/style/themes/theme-sbanken/sbanken-theme-extensions.css +2 -13
  332. package/style/themes/theme-sbanken/sbanken-theme-extensions.min.css +1 -1
  333. package/style/themes/theme-sbanken/sbanken-theme-forms.css +2 -13
  334. package/style/themes/theme-sbanken/sbanken-theme-forms.min.css +1 -1
  335. package/style/themes/theme-ui/ui-theme-components.css +100 -142
  336. package/style/themes/theme-ui/ui-theme-components.min.css +4 -4
  337. package/style/themes/theme-ui/ui-theme-extensions.css +2 -13
  338. package/style/themes/theme-ui/ui-theme-extensions.min.css +1 -1
  339. package/style/themes/theme-ui/ui-theme-forms.css +2 -13
  340. package/style/themes/theme-ui/ui-theme-forms.min.css +1 -1
  341. package/umd/dnb-ui-basis.min.js +1 -1
  342. package/umd/dnb-ui-components.min.js +1 -1
  343. package/umd/dnb-ui-elements.min.js +1 -1
  344. package/umd/dnb-ui-extensions.min.js +1 -1
  345. package/umd/dnb-ui-lib.min.js +1 -1
  346. package/cjs/components/step-indicator/StepIndicatorModal.d.ts +0 -6
  347. package/cjs/components/step-indicator/StepIndicatorModal.js +0 -62
  348. package/cjs/components/step-indicator/StepIndicatorModal.js.map +0 -1
  349. package/components/step-indicator/StepIndicatorModal.d.ts +0 -6
  350. package/components/step-indicator/StepIndicatorModal.js +0 -54
  351. package/components/step-indicator/StepIndicatorModal.js.map +0 -1
  352. package/es/components/step-indicator/StepIndicatorModal.d.ts +0 -6
  353. package/es/components/step-indicator/StepIndicatorModal.js +0 -53
  354. package/es/components/step-indicator/StepIndicatorModal.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"HelpButtonInline.js","names":["React","useCallback","useContext","useEffect","useRef","classnames","HelpButtonInstance","HeightAnimation","useSharedState","convertJsxToString","useId","Section","P","Flex","CardContext","Dialog","question","QuestionIcon","close","CloseIcon","HelpButtonInline","props","_help$open","contentId","size","help","focusWhenOpen","className","children","rest","_objectWithoutProperties","_excluded","controlId","data","update","isOpen","open","isUserIntent","wasOpenRef","undefined","buttonRef","toggleOpen","current","onClickHandler","event","preventDefault","onKeyDownHandler","currentTarget","target","key","trim","code","window","requestAnimationFrame","title","createElement","Fragment","_extends","bounding","icon","HelpButtonIcon","id","on_click","onKeyDown","innerRef","HelpButtonInlineContent","_ref","element","helpProp","breakout","outset","roundedCorner","focusWhenOpenProp","_excluded2","content","renderAs","breakoutProp","outsetProp","cardContext","breakoutFromLayout","Boolean","outsetFromLayout","_innerRef$current","focus","preventScroll","onClose","_buttonRef$current","omitTriggerButton","openState","focusParams","tabIndex","innerSpace","top","bottom","left","right","backgroundColor","Vertical","gap","weight","_Fragment","_supportsSpacingProps"],"sources":["../../../../src/components/help-button/HelpButtonInline.tsx"],"sourcesContent":["import React, {\n AriaAttributes,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport { HelpButtonProps } from './HelpButton'\nimport HelpButtonInstance from './HelpButtonInstance'\nimport HeightAnimation from '../HeightAnimation'\nimport { useSharedState } from '../../shared/helpers/useSharedState'\nimport { convertJsxToString } from '../../shared/component-helper'\nimport useId from '../../shared/helpers/useId'\nimport Section from '../Section'\nimport { P } from '../../elements'\nimport Flex from '../Flex'\nimport CardContext from '../card/CardContext'\nimport { SpacingProps } from '../space/types'\nimport Dialog from '../Dialog'\nimport { question as QuestionIcon, close as CloseIcon } from '../../icons'\n\nexport type HelpProps = {\n title?: React.ReactNode\n content?: React.ReactNode\n renderAs?: 'inline' | 'dialog'\n /** Only for the \"inline\" variant */\n open?: boolean\n /** Only for the \"inline\" variant */\n breakout?: boolean\n /** Only for the \"inline\" variant */\n outset?: boolean\n}\n\nexport type HelpButtonInlineProps = HelpButtonProps & {\n contentId?: string\n help?: HelpProps\n\n /**\n * If set to `true`, the content will get focus when the help content is opened.\n */\n focusWhenOpen?: boolean\n}\n\nexport type HelpButtonInlineSharedStateDataProps = {\n isOpen: boolean\n isUserIntent?: boolean\n buttonRef?: React.RefObject<HTMLButtonElement>\n focusWhenOpen?: boolean\n}\n\nexport default function HelpButtonInline(props: HelpButtonInlineProps) {\n const {\n contentId,\n size,\n help,\n focusWhenOpen,\n className,\n children,\n ...rest\n } = props\n const controlId = useId(contentId)\n\n const { data, update } =\n useSharedState<HelpButtonInlineSharedStateDataProps>(controlId, {\n isOpen: help?.open ?? false,\n })\n const { isOpen, isUserIntent } = data || {}\n const wasOpenRef = useRef(undefined)\n const buttonRef = useRef<HTMLButtonElement>(null)\n\n const toggleOpen = useCallback(() => {\n update({\n isOpen: !isOpen,\n isUserIntent: !isOpen,\n buttonRef,\n focusWhenOpen,\n })\n wasOpenRef.current = !isOpen\n }, [focusWhenOpen, isOpen, update])\n\n const onClickHandler = useCallback(\n ({ event }: { event: React.MouseEvent<HTMLButtonElement> }) => {\n event.preventDefault() // Because when used inside a FormLabel\n toggleOpen()\n },\n [toggleOpen]\n )\n\n const onKeyDownHandler = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.currentTarget === event.target) {\n switch (event.key.trim() || event.code) {\n case 'Escape':\n if (isOpen) {\n event.preventDefault()\n window.requestAnimationFrame(() => {\n toggleOpen()\n })\n }\n break\n }\n }\n },\n [isOpen, toggleOpen]\n )\n\n const title = convertJsxToString(help?.title)\n\n return (\n <>\n <HelpButtonInstance\n bounding\n size={size ?? 'small'}\n icon={HelpButtonIcon}\n title={!isOpen && !wasOpenRef.current ? title : undefined}\n {...rest}\n id={controlId}\n className={classnames(\n 'dnb-help-button__inline',\n isOpen && 'dnb-help-button__inline--open',\n isUserIntent && 'dnb-help-button__inline--user-intent',\n typeof wasOpenRef.current === 'boolean' &&\n 'dnb-help-button__inline--was-open',\n className\n )}\n aria-controls={`${controlId}-content`}\n aria-expanded={isOpen}\n aria-label={title}\n on_click={onClickHandler}\n onKeyDown={onKeyDownHandler}\n innerRef={buttonRef}\n />\n\n {!contentId && (\n <HelpButtonInlineContent\n contentId={controlId}\n help={help}\n focusWhenOpen={focusWhenOpen}\n >\n {children}\n </HelpButtonInlineContent>\n )}\n </>\n )\n}\n\nexport type HelpButtonInlineContentProps = SpacingProps & {\n contentId: string\n className?: string\n element?: React.ElementType\n children?: React.ReactNode\n help?: HelpProps\n breakout?: boolean\n outset?: boolean\n roundedCorner?: boolean\n focusWhenOpen?: boolean\n}\n\nexport function HelpButtonInlineContent(\n props: HelpButtonInlineContentProps\n) {\n const {\n contentId,\n className,\n element,\n children,\n help: helpProp,\n breakout = true,\n outset = true,\n roundedCorner = true,\n focusWhenOpen: focusWhenOpenProp,\n ...rest\n } = props\n const { data, update } =\n useSharedState<HelpButtonInlineSharedStateDataProps>(contentId)\n const {\n isOpen,\n focusWhenOpen = focusWhenOpenProp,\n isUserIntent,\n buttonRef,\n } = data || {}\n const {\n open,\n title,\n content,\n renderAs,\n breakout: breakoutProp = true,\n outset: outsetProp = true,\n } = helpProp || {}\n\n const innerRef = useRef<HTMLDivElement>(null)\n const cardContext = useContext(CardContext)\n const breakoutFromLayout =\n Boolean(cardContext) && breakout && breakoutProp\n const outsetFromLayout = outset && outsetProp\n\n useEffect(() => {\n if (isOpen && isUserIntent && focusWhenOpen) {\n window.requestAnimationFrame(() => {\n innerRef.current?.focus({ preventScroll: true })\n })\n }\n }, [focusWhenOpen, isOpen, isUserIntent])\n\n const onClose = useCallback(() => {\n update({ isOpen: false, isUserIntent: false })\n }, [update])\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.currentTarget === event.target) {\n // Firefox returns a whitespace (\" \") on event.key when pressing space,\n // therefore using .trim() can help normalize this.\n // While userEvent.keyboard('{Space}') might return 'Unknown' on event.code,\n // making a direct comparison less reliable across all platforms.\n switch (event.key.trim() || event.code) {\n case 'Enter':\n case 'Space':\n case 'Escape':\n event.preventDefault()\n window.requestAnimationFrame(() => {\n onClose()\n buttonRef.current?.focus()\n })\n break\n }\n }\n },\n [buttonRef, onClose]\n )\n\n if (renderAs === 'dialog') {\n return (\n <Dialog\n title={title}\n omitTriggerButton\n openState={isOpen ?? open}\n onClose={onClose}\n >\n {content}\n {children}\n </Dialog>\n )\n }\n\n const focusParams = focusWhenOpen\n ? {\n 'aria-label': convertJsxToString(title),\n className: 'dnb-no-focus',\n tabIndex: -1,\n onKeyDown,\n }\n : ({\n 'aria-live': 'polite',\n 'aria-atomic': 'true',\n } as AriaAttributes)\n\n return (\n <HeightAnimation\n element={element}\n className={classnames('dnb-help-button__content', className)}\n open={isOpen ?? open ?? false}\n >\n <Section\n id={`${contentId}-content`}\n {...focusParams}\n innerRef={innerRef}\n outset={outsetFromLayout}\n breakout={breakoutFromLayout}\n roundedCorner={roundedCorner ?? !breakoutFromLayout}\n innerSpace={\n breakoutFromLayout\n ? { top: 'small', bottom: 'medium' }\n : {\n top: 'small',\n bottom: 'medium',\n left: 'medium',\n right: 'x-small',\n }\n }\n backgroundColor=\"lavender\"\n {...rest}\n >\n <Flex.Vertical gap=\"x-small\">\n {title && <P weight=\"medium\">{title}</P>}\n {content && <P>{content}</P>}\n </Flex.Vertical>\n {children}\n </Section>\n </HeightAnimation>\n )\n}\n\nfunction HelpButtonIcon() {\n return (\n <>\n <QuestionIcon />\n <CloseIcon />\n </>\n )\n}\n\nHelpButtonInline._supportsSpacingProps = true\nHelpButtonInlineContent._supportsSpacingProps = true\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,cAAc,QAAQ,qCAAqC;AACpE,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,OAAOC,KAAK,MAAM,4BAA4B;AAC9C,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,CAAC,QAAQ,gBAAgB;AAClC,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,WAAW,MAAM,qBAAqB;AAE7C,OAAOC,MAAM,MAAM,WAAW;AAC9B,SAASC,QAAQ,IAAIC,YAAY,EAAEC,KAAK,IAAIC,SAAS,QAAQ,aAAa;AA+B1E,eAAe,SAASC,gBAAgBA,CAACC,KAA4B,EAAE;EAAA,IAAAC,UAAA;EACrE,MAAM;MACJC,SAAS;MACTC,IAAI;MACJC,IAAI;MACJC,aAAa;MACbC,SAAS;MACTC;IAEF,CAAC,GAAGP,KAAK;IADJQ,IAAI,GAAAC,wBAAA,CACLT,KAAK,EAAAU,SAAA;EACT,MAAMC,SAAS,GAAGtB,KAAK,CAACa,SAAS,CAAC;EAElC,MAAM;IAAEU,IAAI;IAAEC;EAAO,CAAC,GACpB1B,cAAc,CAAuCwB,SAAS,EAAE;IAC9DG,MAAM,GAAAb,UAAA,GA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ButtonInline.js","names":["React","useCallback","useContext","useEffect","useRef","classnames","HelpButtonInstance","HeightAnimation","useSharedState","convertJsxToString","useId","Section","P","Flex","CardContext","Dialog","question","QuestionIcon","close","CloseIcon","HelpButtonInline","props","_help$open","contentId","size","help","focusWhenOpen","className","children","rest","_objectWithoutProperties","_excluded","controlId","data","update","isOpen","open","isUserIntent","wasOpenRef","undefined","buttonRef","toggleOpen","current","onClickHandler","event","preventDefault","onKeyDownHandler","currentTarget","target","key","trim","code","window","requestAnimationFrame","title","createElement","Fragment","_extends","bounding","icon","HelpButtonIcon","id","on_click","onKeyDown","innerRef","HelpButtonInlineContent","_ref","element","helpProp","breakout","outset","roundedCorner","focusWhenOpenProp","_excluded2","content","renderAs","breakoutProp","outsetProp","cardContext","breakoutFromLayout","Boolean","outsetFromLayout","_innerRef$current","focus","preventScroll","onClose","_buttonRef$current","omitTriggerButton","openState","focusParams","tabIndex","innerSpace","top","bottom","left","right","backgroundColor","Vertical","gap","weight","_Fragment","_supportsSpacingProps"],"sources":["../../../../src/components/help-button/HelpButtonInline.tsx"],"sourcesContent":["import React, {\n AriaAttributes,\n useCallback,\n useContext,\n useEffect,\n useRef,\n} from 'react'\nimport classnames from 'classnames'\nimport { HelpButtonProps } from './HelpButton'\nimport HelpButtonInstance from './HelpButtonInstance'\nimport HeightAnimation from '../HeightAnimation'\nimport { useSharedState } from '../../shared/helpers/useSharedState'\nimport { convertJsxToString } from '../../shared/component-helper'\nimport useId from '../../shared/helpers/useId'\nimport Section from '../Section'\nimport { P } from '../../elements'\nimport Flex from '../Flex'\nimport CardContext from '../card/CardContext'\nimport { SpacingProps } from '../space/types'\nimport Dialog from '../Dialog'\nimport { question as QuestionIcon, close as CloseIcon } from '../../icons'\n\nexport type HelpProps = {\n title?: React.ReactNode\n content?: React.ReactNode\n renderAs?: 'inline' | 'dialog'\n /** Only for the \"inline\" variant */\n open?: boolean\n /** Only for the \"inline\" variant */\n breakout?: boolean\n /** Only for the \"inline\" variant */\n outset?: boolean\n}\n\nexport type HelpButtonInlineProps = HelpButtonProps & {\n contentId?: string\n help?: HelpProps\n\n /**\n * If set to `true`, the content will get focus when the help content is opened.\n */\n focusWhenOpen?: boolean\n}\n\nexport type HelpButtonInlineSharedStateDataProps = {\n isOpen: boolean\n isUserIntent?: boolean\n buttonRef?: React.RefObject<HTMLButtonElement>\n focusWhenOpen?: boolean\n}\n\nexport default function HelpButtonInline(props: HelpButtonInlineProps) {\n const {\n contentId,\n size,\n help,\n focusWhenOpen,\n className,\n children,\n ...rest\n } = props\n const controlId = useId(contentId)\n\n const { data, update } =\n useSharedState<HelpButtonInlineSharedStateDataProps>(controlId, {\n isOpen: help?.open ?? false,\n })\n const { isOpen, isUserIntent } = data || {}\n const wasOpenRef = useRef(undefined)\n const buttonRef = useRef<HTMLButtonElement>(null)\n\n const toggleOpen = useCallback(() => {\n update({\n isOpen: !isOpen,\n isUserIntent: !isOpen,\n buttonRef,\n focusWhenOpen,\n })\n wasOpenRef.current = !isOpen\n }, [focusWhenOpen, isOpen, update])\n\n const onClickHandler = useCallback(\n ({ event }: { event: React.MouseEvent<HTMLButtonElement> }) => {\n event.preventDefault() // Because when used inside a FormLabel\n toggleOpen()\n },\n [toggleOpen]\n )\n\n const onKeyDownHandler = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.currentTarget === event.target) {\n switch (event.key.trim() || event.code) {\n case 'Escape':\n if (isOpen) {\n event.preventDefault()\n window.requestAnimationFrame(() => {\n toggleOpen()\n })\n }\n break\n }\n }\n },\n [isOpen, toggleOpen]\n )\n\n const title = convertJsxToString(help?.title)\n\n return (\n <>\n <HelpButtonInstance\n bounding\n size={size ?? 'small'}\n icon={HelpButtonIcon}\n title={!isOpen && !wasOpenRef.current ? title : undefined}\n {...rest}\n id={controlId}\n className={classnames(\n 'dnb-help-button__inline',\n isOpen && 'dnb-help-button__inline--open',\n isUserIntent && 'dnb-help-button__inline--user-intent',\n typeof wasOpenRef.current === 'boolean' &&\n 'dnb-help-button__inline--was-open',\n className\n )}\n aria-controls={`${controlId}-content`}\n aria-expanded={isOpen}\n aria-label={title}\n on_click={onClickHandler}\n onKeyDown={onKeyDownHandler}\n innerRef={buttonRef}\n />\n\n {!contentId && (\n <HelpButtonInlineContent\n contentId={controlId}\n help={help}\n focusWhenOpen={focusWhenOpen}\n >\n {children}\n </HelpButtonInlineContent>\n )}\n </>\n )\n}\n\nexport type HelpButtonInlineContentProps = SpacingProps & {\n contentId: string\n className?: string\n element?: React.ElementType\n children?: React.ReactNode\n help?: HelpProps\n breakout?: boolean\n outset?: boolean\n roundedCorner?: boolean\n focusWhenOpen?: boolean\n}\n\nexport function HelpButtonInlineContent(\n props: HelpButtonInlineContentProps\n) {\n const {\n contentId,\n className,\n element,\n children,\n help: helpProp,\n breakout = true,\n outset = true,\n roundedCorner,\n focusWhenOpen: focusWhenOpenProp,\n ...rest\n } = props\n const { data, update } =\n useSharedState<HelpButtonInlineSharedStateDataProps>(contentId)\n const {\n isOpen,\n focusWhenOpen = focusWhenOpenProp,\n isUserIntent,\n buttonRef,\n } = data || {}\n const {\n open,\n title,\n content,\n renderAs,\n breakout: breakoutProp = true,\n outset: outsetProp = true,\n } = helpProp || {}\n\n const innerRef = useRef<HTMLDivElement>(null)\n const cardContext = useContext(CardContext)\n const breakoutFromLayout =\n Boolean(cardContext) && breakout && breakoutProp\n const outsetFromLayout = outset && outsetProp\n\n useEffect(() => {\n if (isOpen && isUserIntent && focusWhenOpen) {\n window.requestAnimationFrame(() => {\n innerRef.current?.focus({ preventScroll: true })\n })\n }\n }, [focusWhenOpen, isOpen, isUserIntent])\n\n const onClose = useCallback(() => {\n update({ isOpen: false, isUserIntent: false })\n }, [update])\n\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.currentTarget === event.target) {\n // Firefox returns a whitespace (\" \") on event.key when pressing space,\n // therefore using .trim() can help normalize this.\n // While userEvent.keyboard('{Space}') might return 'Unknown' on event.code,\n // making a direct comparison less reliable across all platforms.\n switch (event.key.trim() || event.code) {\n case 'Enter':\n case 'Space':\n case 'Escape':\n event.preventDefault()\n window.requestAnimationFrame(() => {\n onClose()\n buttonRef.current?.focus()\n })\n break\n }\n }\n },\n [buttonRef, onClose]\n )\n\n if (renderAs === 'dialog') {\n return (\n <Dialog\n title={title}\n omitTriggerButton\n openState={isOpen ?? open}\n onClose={onClose}\n >\n {content}\n {children}\n </Dialog>\n )\n }\n\n const focusParams = focusWhenOpen\n ? {\n 'aria-label': convertJsxToString(title),\n className: 'dnb-no-focus',\n tabIndex: -1,\n onKeyDown,\n }\n : ({\n 'aria-live': 'polite',\n 'aria-atomic': 'true',\n } as AriaAttributes)\n\n return (\n <HeightAnimation\n element={element}\n className={classnames('dnb-help-button__content', className)}\n open={isOpen ?? open ?? false}\n >\n <Section\n id={`${contentId}-content`}\n {...focusParams}\n innerRef={innerRef}\n outset={outsetFromLayout}\n breakout={breakoutFromLayout}\n roundedCorner={roundedCorner ?? !breakoutFromLayout}\n innerSpace={\n breakoutFromLayout\n ? { top: 'small', bottom: 'medium' }\n : {\n top: 'small',\n bottom: 'medium',\n left: 'medium',\n right: 'x-small',\n }\n }\n backgroundColor=\"lavender\"\n {...rest}\n >\n <Flex.Vertical gap=\"x-small\">\n {title && <P weight=\"medium\">{title}</P>}\n {content && <P>{content}</P>}\n </Flex.Vertical>\n {children}\n </Section>\n </HeightAnimation>\n )\n}\n\nfunction HelpButtonIcon() {\n return (\n <>\n <QuestionIcon />\n <CloseIcon />\n </>\n )\n}\n\nHelpButtonInline._supportsSpacingProps = true\nHelpButtonInlineContent._supportsSpacingProps = true\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAK,IAEVC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,OAAO;AACd,OAAOC,UAAU,MAAM,YAAY;AAEnC,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,eAAe,MAAM,oBAAoB;AAChD,SAASC,cAAc,QAA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,eAAe,EAAC;EAAU,GACtBnE,IAAI,GAER7B,KAAA,CAAAuD,aAAA,CAAC1C,IAAI,CAACoF,QAAQ;IAACC,GAAG,EAAC;EAAS,GACzB5C,KAAK,IAAItD,KAAA,CAAAuD,aAAA,CAAC3C,CAAC;IAACuF,MAAM,EAAC;EAAQ,GAAE7C,KAAS,CAAC,EACvCoB,OAAO,IAAI1E,KAAA,CAAAuD,aAAA,CAAC3C,CAAC,QAAE8D,OAAW,CACd,CAAC,EACf9C,QACM,CACM,CAAC;AAEtB;AAEA,SAASgC,cAAcA,CAAA,EAAG;EACxB,OAAAwC,SAAA,KAAAA,SAAA,GACEpG,KAAA,CAAAuD,aAAA,CAAAvD,KAAA,CAAAwD,QAAA,QACExD,KAAA,CAAAuD,aAAA,CAACtC,YAAY,MAAE,CAAC,EAChBjB,KAAA,CAAAuD,aAAA,CAACpC,SAAS,MAAE,CACZ,CAAC;AAEP;AAEAC,gBAAgB,CAACiF,qBAAqB,GAAG,IAAI;AAC7CpC,uBAAuB,CAACoC,qBAAqB,GAAG,IAAI","ignoreList":[]}
@@ -31,6 +31,7 @@ export type TextColor = string;
31
31
  export type OutlineColor = string | boolean;
32
32
  export type BackgroundColor = string;
33
33
  export type DropShadow = boolean;
34
+ export type RoundedCorner = boolean | [boolean, boolean, boolean, boolean];
34
35
  export type SectionProps = {
35
36
  /**
36
37
  * Defines the semantic purpose and subsequently the style of the visual helper. Will take precedence over the style_type prop
@@ -48,7 +49,7 @@ export type SectionProps = {
48
49
  /**
49
50
  * Define if the section should have rounded corners. Defaults to `false`.
50
51
  */
51
- roundedCorner?: boolean | ResponsiveProp<boolean>;
52
+ roundedCorner?: RoundedCorner | ResponsiveProp<RoundedCorner>;
52
53
  /**
53
54
  * Define a custom border color. Use a Eufemia color.
54
55
  */
@@ -41,14 +41,14 @@ export function SectionParams(localProps) {
41
41
  const elementRef = innerRef || inner_ref || internalRef;
42
42
  return Object.freeze(_objectSpread(_objectSpread({}, attributes), {}, {
43
43
  className: classnames(`dnb-section dnb-section--${variant ? variant : style_type || 'default'}`, className, spacing && `dnb-section--spacing-${isTrue(spacing) ? 'large' : spacing}`),
44
- style: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, computeStyle(breakout, 'breakout', value => `var(--breakout--${value ? 'on' : 'off'})`)), computeStyle(outset, 'outset', value => value ? '1' : '0')), computeStyle(roundedCorner, 'rounded-corner', value => value && 'var(--rounded-corner--value)')), computeStyle(textColor, 'text-color', value => getColor(value))), computeStyle(backgroundColor, 'background-color', value => getColor(value))), computeStyle(dropShadow, 'drop-shadow', value => value && 'var(--shadow-default)')), computeStyle(outline, 'outline-color', value => String(value) === 'true' ? 'var(--outline-color--value)' : getColor(value))), attributes === null || attributes === void 0 ? void 0 : attributes.style),
44
+ style: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, computeStyle(breakout, 'breakout', value => `var(--breakout--${value ? 'on' : 'off'})`)), computeStyle(outset, 'outset', value => value ? '1' : '0')), computeStyle(roundedCorner, 'rounded-corner', value => typeof value === 'boolean' ? value && 'var(--rounded-corner--value)' : value.map(v => v ? 'var(--rounded-corner--value)' : '0').join(' '))), computeStyle(textColor, 'text-color', value => getColor(value))), computeStyle(backgroundColor, 'background-color', value => getColor(value))), computeStyle(dropShadow, 'drop-shadow', value => value && 'var(--shadow-default)')), computeStyle(outline, 'outline-color', value => typeof value === 'boolean' ? value && 'var(--outline-color--value)' : getColor(value))), attributes === null || attributes === void 0 ? void 0 : attributes.style),
45
45
  innerRef: elementRef,
46
46
  children
47
47
  }));
48
48
  }
49
49
  function computeStyle(property, name, valueCallback) {
50
50
  let media = property;
51
- if (media !== null && typeof media !== 'object') {
51
+ if (media !== null && (Array.isArray(media) || typeof media !== 'object')) {
52
52
  media = {
53
53
  small: property,
54
54
  medium: property,
@@ -1 +1 @@
1
- {"version":3,"file":"Section.js","names":["React","classnames","Context","isTrue","extendPropsWithContext","Space","getColor","defaultProps","element","Section","localProps","createElement","SectionParams","context","useContext","props","variant","breakout","outset","roundedCorner","textColor","backgroundColor","dropShadow","outline","innerRef","className","children","spacing","style_type","inner_ref","attributes","_objectWithoutProperties","_excluded","internalRef","useRef","elementRef","Object","freeze","_objectSpread","style","computeStyle","value","String","property","name","valueCallback","media","small","medium","large","result","size","_media","_media2","_name","_supportsSpacingProps"],"sources":["../../../../src/components/section/Section.tsx"],"sourcesContent":["/**\n * Web Section Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport {\n isTrue,\n extendPropsWithContext,\n} from '../../shared/component-helper'\nimport type {\n DynamicElement,\n ResponsiveProp,\n SpacingProps,\n} from '../../shared/types'\nimport Space from '../space/Space'\nimport { getColor } from '../../shared/helpers'\n\nexport type SectionVariants = 'error' | 'info' | 'warning' | 'success'\n\nexport type SectionStyleTypes =\n | 'divider'\n | 'white'\n | 'transparent'\n\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'lavender'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'pistachio'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'emerald-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'sea-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'fire-red'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'fire-red-8'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'sand-yellow'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'black-3'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'mint-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'mint-green-12'\n\nexport type SectionSpacing =\n | boolean\n | 'x-small'\n | 'small'\n | 'medium'\n | 'large'\n | 'x-large'\n | 'xx-large'\n\nexport type TextColor = string\nexport type OutlineColor = string | boolean\nexport type BackgroundColor = string\nexport type DropShadow = boolean\n\nexport type SectionProps = {\n /**\n * Defines the semantic purpose and subsequently the style of the visual helper. Will take precedence over the style_type prop\n */\n variant?: SectionVariants | string\n\n /**\n * Define if the background color should break-out to a fullscreen view. Defaults to `true`.\n */\n breakout?: boolean | ResponsiveProp<boolean>\n\n /**\n * Define if the Card should break out negatively on larger screens. You cannot use `breakout` and `outset` together.\n * Defaults to `false`\n */\n outset?: boolean | ResponsiveProp<boolean>\n\n /**\n * Define if the section should have rounded corners. Defaults to `false`.\n */\n roundedCorner?: boolean | ResponsiveProp<boolean>\n\n /**\n * Define a custom border color. Use a Eufemia color.\n */\n outline?: OutlineColor | ResponsiveProp<OutlineColor>\n\n /**\n * Define a custom text color to compliment the backgroundColor. Use a Eufemia color.\n */\n textColor?: TextColor | ResponsiveProp<TextColor>\n\n /**\n * Define a custom background color, instead of a variant. Use a Eufemia color.\n */\n backgroundColor?: BackgroundColor | ResponsiveProp<BackgroundColor>\n\n /**\n * Define a custom drop-shadow.\n */\n dropShadow?: DropShadow | ResponsiveProp<DropShadow>\n\n /**\n * Define what HTML element should be used. Defaults to `<section>`.\n */\n element?: DynamicElement\n\n /**\n * Define a React.Ref.\n */\n innerRef?: React.RefObject<HTMLElement>\n\n /**\n * @deprecated in v11 use \"innerSpace\" prop instead\n */\n spacing?: SectionSpacing | ResponsiveProp<SectionSpacing>\n /**\n * @deprecated in v11 use \"background\" prop instead\n */\n style_type?: SectionStyleTypes | string\n /**\n * @deprecated in v11 use \"innerRef\" prop instead\n */\n inner_ref?: React.RefObject<HTMLElement>\n}\n\nexport type SectionAllProps = SectionProps &\n SpacingProps &\n Omit<React.HTMLProps<HTMLElement>, 'ref'>\n\ntype SectionReturnParams = Record<string, unknown> & {\n className: string\n innerRef: React.RefObject<HTMLElement>\n children: React.ReactNode\n style: React.CSSProperties\n}\n\nconst defaultProps = {\n element: 'section',\n}\n\nexport default function Section(localProps: SectionAllProps) {\n return <Space {...SectionParams(localProps)} />\n}\n\nexport function SectionParams(\n localProps: SectionAllProps\n): SectionReturnParams {\n const context = React.useContext(Context)\n\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContext(\n localProps,\n defaultProps,\n context.Section\n )\n\n const {\n variant,\n breakout = !props.outset,\n outset,\n roundedCorner,\n textColor,\n backgroundColor,\n dropShadow,\n outline,\n innerRef,\n\n className,\n children,\n\n spacing,\n style_type,\n inner_ref,\n\n ...attributes\n } = props\n\n const internalRef = React.useRef<HTMLElement>()\n const elementRef = innerRef || inner_ref || internalRef\n\n return Object.freeze({\n ...attributes,\n className: classnames(\n 'dnb-section',\n `dnb-section--${variant ? variant : style_type || 'default'}`,\n spacing &&\n `dnb-section--spacing-${isTrue(spacing) ? 'large' : spacing}`,\n className\n ),\n style: {\n ...computeStyle(\n breakout,\n 'breakout',\n (value) => `var(--breakout--${value ? 'on' : 'off'})`\n ),\n ...computeStyle(outset, 'outset', (value) => (value ? '1' : '0')),\n ...computeStyle(\n roundedCorner,\n 'rounded-corner',\n (value) => value && 'var(--rounded-corner--value)'\n ),\n ...computeStyle(textColor, 'text-color', (value) => getColor(value)),\n ...computeStyle(backgroundColor, 'background-color', (value) =>\n getColor(value)\n ),\n ...computeStyle(\n dropShadow,\n 'drop-shadow',\n (value) => value && 'var(--shadow-default)'\n ),\n ...computeStyle(outline, 'outline-color', (value) =>\n String(value) === 'true'\n ? 'var(--outline-color--value)'\n : getColor(value)\n ),\n ...attributes?.style,\n } as React.CSSProperties,\n innerRef: elementRef,\n children,\n })\n}\n\nfunction computeStyle(\n property: ResponsiveProp<unknown> | boolean | string,\n name: string,\n valueCallback: (value: string) => string | undefined\n) {\n let media = property as ResponsiveProp<unknown>\n\n if (media !== null && typeof media !== 'object') {\n media = {\n small: property,\n medium: property,\n large: property,\n } as ResponsiveProp<unknown>\n }\n\n const result = {}\n\n for (const size in media as ResponsiveProp<unknown>) {\n if (typeof media?.[size] !== 'undefined') {\n const value = valueCallback(media?.[size])\n if (typeof value === 'string') {\n result[`--${name}--${size}`] = value\n }\n }\n }\n\n return result\n}\n\nSection._name = 'Section'\nSection._supportsSpacingProps = true\n"],"mappings":";;;;;;;AAKA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,SACEC,MAAM,EACNC,sBAAsB,QACjB,+BAA+B;AAMtC,OAAOC,KAAK,MAAM,gBAAgB;AAClC,SAASC,QAAQ,QAAQ,sBAAsB;AAyH/C,MAAMC,YAAY,GAAG;EACnBC,OAAO,EAAE;AACX,CAAC;AAED,eAAe,SAASC,OAAOA,CAACC,UAA2B,EAAE;EAC3D,OAAOV,KAAA,CAAAW,aAAA,CAACN,KAAK,EAAKO,aAAa,CAACF,UAAU,CAAI,CAAC;AACjD;AAEA,OAAO,SAASE,aAAaA,CAC3BF,UAA2B,EACN;EACrB,MAAMG,OAAO,GAAGb,KAAK,CAACc,UAAU,CAACZ,OAAO,CAAC;EAGzC,MAAMa,KAAK,GAAGX,sBAAsB,CAClCM,UAAU,EACVH,YAAY,EACZM,OAAO,CAACJ,OACV,CAAC;EAED,MAAM;MACJO,OAAO;MACPC,QAAQ,GAAG,CAACF,KAAK,CAACG,MAAM;MACxBA,MAAM;MACNC,aAAa;MACbC,SAAS;MACTC,eAAe;MACfC,UAAU;MACVC,OAAO;MACPC,QAAQ;MAERC,SAAS;MACTC,QAAQ;MAERC,OAAO;MACPC,UAAU;MACVC;IAGF,CAAC,GAAGd,KAAK;IADJe,UAAU,GAAAC,wBAAA,CACXhB,KAAK,EAAAiB,SAAA;EAET,MAAMC,WAAW,GAAGjC,KAAK,CAACkC,MAAM,CAAc,CAAC;EAC/C,MAAMC,UAAU,GAAGX,QAAQ,IAAIK,SAAS,IAAII,WAAW;EAEvD,OAAOG,MAAM,CAACC,MAAM,CAAAC,aAAA,CAAAA,aAAA,KACfR,UA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/C,IAAIG,KAAK,KAAK,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC/CA,KAAK,GAAG;MACNC,KAAK,EAAEJ,QAAQ;MACfK,MAAM,EAAEL,QAAQ;MAChBM,KAAK,EAAEN;IACT,CAA4B;EAC9B;EAEA,MAAMO,MAAM,GAAG,CAAC,CAAC;EAEjB,KAAK,MAAMC,IAAI,IAAIL,KAAK,EAA6B;IAAA,IAAAM,MAAA;IACnD,IAAI,SAAAA,MAAA,GAAON,KAAK,cAAAM,MAAA,uBAALA,MAAA,CAAQD,IAAI,CAAC,MAAK,WAAW,EAAE;MAAA,IAAAE,OAAA;MACxC,MAAMZ,KAAK,GAAGI,aAAa,EAAAQ,OAAA,GAACP,KAAK,cAAAO,OAAA,uBAALA,OAAA,CAAQF,IAAI,CAAC,CAAC;MAC1C,IAAI,OAAOV,KAAK,KAAK,QAAQ,EAAE;QAC7BS,MAAM,CAAC,KAAKN,IAAI,KAAKO,IAAI,EAAE,CAAC,GAAGV,KAAK;MACtC;IACF;EACF;EAEA,OAAOS,MAAM;AACf;AAEAzC,OAAO,CAAC6C,KAAK,GAAG,SAAS;AACzB7C,OAAO,CAAC8C,qBAAqB,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"file":"Section.js","names":["React","classnames","Context","isTrue","extendPropsWithContext","Space","getColor","defaultProps","element","Section","localProps","createElement","SectionParams","context","useContext","props","variant","breakout","outset","roundedCorner","textColor","backgroundColor","dropShadow","outline","innerRef","className","children","spacing","style_type","inner_ref","attributes","_objectWithoutProperties","_excluded","internalRef","useRef","elementRef","Object","freeze","_objectSpread","style","computeStyle","value","map","v","join","property","name","valueCallback","media","Array","isArray","small","medium","large","result","size","_media","_media2","_name","_supportsSpacingProps"],"sources":["../../../../src/components/section/Section.tsx"],"sourcesContent":["/**\n * Web Section Component\n *\n */\n\nimport React from 'react'\nimport classnames from 'classnames'\nimport Context from '../../shared/Context'\nimport {\n isTrue,\n extendPropsWithContext,\n} from '../../shared/component-helper'\nimport type {\n DynamicElement,\n ResponsiveProp,\n SpacingProps,\n} from '../../shared/types'\nimport Space from '../space/Space'\nimport { getColor } from '../../shared/helpers'\n\nexport type SectionVariants = 'error' | 'info' | 'warning' | 'success'\n\nexport type SectionStyleTypes =\n | 'divider'\n | 'white'\n | 'transparent'\n\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'lavender'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'pistachio'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'emerald-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'sea-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'fire-red'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'fire-red-8'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'sand-yellow'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'black-3'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'mint-green'\n /** @deprecated in v11 use \"variant\" or \"backgroundColor\" prop instead */\n | 'mint-green-12'\n\nexport type SectionSpacing =\n | boolean\n | 'x-small'\n | 'small'\n | 'medium'\n | 'large'\n | 'x-large'\n | 'xx-large'\n\nexport type TextColor = string\nexport type OutlineColor = string | boolean\nexport type BackgroundColor = string\nexport type DropShadow = boolean\nexport type RoundedCorner = boolean | [boolean, boolean, boolean, boolean]\n\nexport type SectionProps = {\n /**\n * Defines the semantic purpose and subsequently the style of the visual helper. Will take precedence over the style_type prop\n */\n variant?: SectionVariants | string\n\n /**\n * Define if the background color should break-out to a fullscreen view. Defaults to `true`.\n */\n breakout?: boolean | ResponsiveProp<boolean>\n\n /**\n * Define if the Card should break out negatively on larger screens. You cannot use `breakout` and `outset` together.\n * Defaults to `false`\n */\n outset?: boolean | ResponsiveProp<boolean>\n\n /**\n * Define if the section should have rounded corners. Defaults to `false`.\n */\n roundedCorner?: RoundedCorner | ResponsiveProp<RoundedCorner>\n\n /**\n * Define a custom border color. Use a Eufemia color.\n */\n outline?: OutlineColor | ResponsiveProp<OutlineColor>\n\n /**\n * Define a custom text color to compliment the backgroundColor. Use a Eufemia color.\n */\n textColor?: TextColor | ResponsiveProp<TextColor>\n\n /**\n * Define a custom background color, instead of a variant. Use a Eufemia color.\n */\n backgroundColor?: BackgroundColor | ResponsiveProp<BackgroundColor>\n\n /**\n * Define a custom drop-shadow.\n */\n dropShadow?: DropShadow | ResponsiveProp<DropShadow>\n\n /**\n * Define what HTML element should be used. Defaults to `<section>`.\n */\n element?: DynamicElement\n\n /**\n * Define a React.Ref.\n */\n innerRef?: React.RefObject<HTMLElement>\n\n /**\n * @deprecated in v11 use \"innerSpace\" prop instead\n */\n spacing?: SectionSpacing | ResponsiveProp<SectionSpacing>\n /**\n * @deprecated in v11 use \"background\" prop instead\n */\n style_type?: SectionStyleTypes | string\n /**\n * @deprecated in v11 use \"innerRef\" prop instead\n */\n inner_ref?: React.RefObject<HTMLElement>\n}\n\nexport type SectionAllProps = SectionProps &\n SpacingProps &\n Omit<React.HTMLProps<HTMLElement>, 'ref'>\n\ntype SectionReturnParams = Record<string, unknown> & {\n className: string\n innerRef: React.RefObject<HTMLElement>\n children: React.ReactNode\n style: React.CSSProperties\n}\n\nconst defaultProps = {\n element: 'section',\n}\n\nexport default function Section(localProps: SectionAllProps) {\n return <Space {...SectionParams(localProps)} />\n}\n\nexport function SectionParams(\n localProps: SectionAllProps\n): SectionReturnParams {\n const context = React.useContext(Context)\n\n // use only the props from context, who are available here anyway\n const props = extendPropsWithContext(\n localProps,\n defaultProps,\n context.Section\n )\n\n const {\n variant,\n breakout = !props.outset,\n outset,\n roundedCorner,\n textColor,\n backgroundColor,\n dropShadow,\n outline,\n innerRef,\n\n className,\n children,\n\n spacing,\n style_type,\n inner_ref,\n\n ...attributes\n } = props\n\n const internalRef = React.useRef<HTMLElement>()\n const elementRef = innerRef || inner_ref || internalRef\n\n return Object.freeze({\n ...attributes,\n className: classnames(\n 'dnb-section',\n `dnb-section--${variant ? variant : style_type || 'default'}`,\n spacing &&\n `dnb-section--spacing-${isTrue(spacing) ? 'large' : spacing}`,\n className\n ),\n style: {\n ...computeStyle(\n breakout,\n 'breakout',\n (value) => `var(--breakout--${value ? 'on' : 'off'})`\n ),\n ...computeStyle(outset, 'outset', (value) => (value ? '1' : '0')),\n ...computeStyle(roundedCorner, 'rounded-corner', (value) =>\n typeof value === 'boolean'\n ? value && 'var(--rounded-corner--value)'\n : value\n .map((v) => (v ? 'var(--rounded-corner--value)' : '0'))\n .join(' ')\n ),\n ...computeStyle(textColor, 'text-color', (value) => getColor(value)),\n ...computeStyle(backgroundColor, 'background-color', (value) =>\n getColor(value)\n ),\n ...computeStyle(\n dropShadow,\n 'drop-shadow',\n (value) => value && 'var(--shadow-default)'\n ),\n ...computeStyle(outline, 'outline-color', (value) =>\n typeof value === 'boolean'\n ? value && 'var(--outline-color--value)'\n : getColor(value)\n ),\n ...attributes?.style,\n } as React.CSSProperties,\n innerRef: elementRef,\n children,\n })\n}\n\nfunction computeStyle<T extends boolean | string | boolean[]>(\n property: T | ResponsiveProp<T>,\n name: string,\n valueCallback: (value: T) => string | undefined\n) {\n let media = property as ResponsiveProp<T>\n\n if (\n media !== null &&\n (Array.isArray(media) || typeof media !== 'object')\n ) {\n media = {\n small: property,\n medium: property,\n large: property,\n } as ResponsiveProp<T>\n }\n\n const result = {}\n\n for (const size in media as ResponsiveProp<T>) {\n if (typeof media?.[size] !== 'undefined') {\n const value = valueCallback(media?.[size])\n if (typeof value === 'string') {\n result[`--${name}--${size}`] = value\n }\n }\n }\n\n return result\n}\n\nSection._name = 'Section'\nSection._supportsSpacingProps = true\n"],"mappings":";;;;;;;AAKA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,OAAO,MAAM,sBAAsB;AAC1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,CAAC,EACnD;IACAA,KAAK,GAAG;MACNG,KAAK,EAAEN,QAAQ;MACfO,MAAM,EAAEP,QAAQ;MAChBQ,KAAK,EAAER;IACT,CAAsB;EACxB;EAEA,MAAMS,MAAM,GAAG,CAAC,CAAC;EAEjB,KAAK,MAAMC,IAAI,IAAIP,KAAK,EAAuB;IAAA,IAAAQ,MAAA;IAC7C,IAAI,SAAAA,MAAA,GAAOR,KAAK,cAAAQ,MAAA,uBAALA,MAAA,CAAQD,IAAI,CAAC,MAAK,WAAW,EAAE;MAAA,IAAAE,OAAA;MACxC,MAAMhB,KAAK,GAAGM,aAAa,EAAAU,OAAA,GAACT,KAAK,cAAAS,OAAA,uBAALA,OAAA,CAAQF,IAAI,CAAC,CAAC;MAC1C,IAAI,OAAOd,KAAK,KAAK,QAAQ,EAAE;QAC7Ba,MAAM,CAAC,KAAKR,IAAI,KAAKS,IAAI,EAAE,CAAC,GAAGd,KAAK;MACtC;IACF;EACF;EAEA,OAAOa,MAAM;AACf;AAEA7C,OAAO,CAACiD,KAAK,GAAG,SAAS;AACzBjD,OAAO,CAACkD,qBAAqB,GAAG,IAAI","ignoreList":[]}
@@ -19,6 +19,9 @@
19
19
  --width: 100vw;
20
20
  --height: 100%;
21
21
  --color-transparent: transparent;
22
+ --rounded-corner--small: 0;
23
+ --rounded-corner--medium: 0;
24
+ --rounded-corner--large: 0;
22
25
  color: var(--text-color, black);
23
26
  border-radius: var(--rounded-corner, 0);
24
27
  }
@@ -50,6 +53,7 @@
50
53
  --box-shadow: 99vw 0 0 0 currentcolor, 198vw 0 0 0 currentcolor,
51
54
  297vw 0 0 0 currentcolor, 396vw 0 0 0 currentcolor;
52
55
  box-shadow: var(--box-shadow);
56
+ border-radius: var(--rounded-corner, 0);
53
57
  }
54
58
  .dnb-section:not([style*="--breakout"]) {
55
59
  --breakout: var(--breakout--on);
@@ -1,4 +1,4 @@
1
- .dnb-section{--breakout--on:visible;--breakout--off:hidden;--rounded-corner--value:0.5rem;--outline:0 0 0 var(--outline-width,1px) var(--outline-color,transparent);--outline-none:0 0 0 0 transparent;--top:0;--left:-100vw;--width:100vw;--height:100%;--color-transparent:transparent;border-radius:var(--rounded-corner,0);color:var(--text-color,#000);display:flow-root;position:relative}.dnb-section[style*="--background-color"]{background-color:var(--background-color,#fff)}.dnb-section:before{border-radius:var(--rounded-corner,0);bottom:0;box-shadow:var(--drop-shadow,var(--outline-none)),var(--outline,var(--outline-none));content:"";left:0;position:absolute;right:0;top:0;z-index:-1}.dnb-section:after{--box-shadow:99vw 0 0 0 currentcolor,198vw 0 0 0 currentcolor,297vw 0 0 0 currentcolor,396vw 0 0 0 currentcolor;background-color:currentcolor;box-shadow:var(--box-shadow);color:var(--background-color,currentcolor);content:"";height:var(--height);left:var(--left);position:absolute;top:var(--top);visibility:var(--breakout,hidden);width:var(--width);z-index:-15}.dnb-section:not([style*="--breakout"]){--breakout:var(--breakout--on)}.dnb-section[style*="--outset"].dnb-space[style]:not(.dnb-card){padding-left:calc(var(--padding-left)*(1 - var(--outset)));padding-right:calc(var(--padding-right)*(1 - var(--outset)))}.dnb-section[style*="--outset"]:before{background-color:inherit;margin-left:calc(var(--outset-left, var(--padding-left))*-1*var(--outset));margin-right:calc(var(--outset-right, var(--padding-right))*-1*var(--outset))}@media screen and (max-width:60em){.dnb-section{--breakout:var(--breakout--small,var(--breakout--fallback));--outset:var(--outset--small,var(--outset--fallback));--background-color--value:var(--background-color--small);--text-color--value:var(--text-color--small);--outline-color:var(--outline-color--small);--drop-shadow:var(--drop-shadow--small);--rounded-corner:var(
1
+ .dnb-section{--breakout--on:visible;--breakout--off:hidden;--rounded-corner--value:0.5rem;--outline:0 0 0 var(--outline-width,1px) var(--outline-color,transparent);--outline-none:0 0 0 0 transparent;--top:0;--left:-100vw;--width:100vw;--height:100%;--color-transparent:transparent;--rounded-corner--small:0;--rounded-corner--medium:0;--rounded-corner--large:0;border-radius:var(--rounded-corner,0);color:var(--text-color,#000);display:flow-root;position:relative}.dnb-section[style*="--background-color"]{background-color:var(--background-color,#fff)}.dnb-section:before{bottom:0;box-shadow:var(--drop-shadow,var(--outline-none)),var(--outline,var(--outline-none));left:0;right:0;top:0;z-index:-1}.dnb-section:after,.dnb-section:before{border-radius:var(--rounded-corner,0);content:"";position:absolute}.dnb-section:after{--box-shadow:99vw 0 0 0 currentcolor,198vw 0 0 0 currentcolor,297vw 0 0 0 currentcolor,396vw 0 0 0 currentcolor;background-color:currentcolor;box-shadow:var(--box-shadow);color:var(--background-color,currentcolor);height:var(--height);left:var(--left);top:var(--top);visibility:var(--breakout,hidden);width:var(--width);z-index:-15}.dnb-section:not([style*="--breakout"]){--breakout:var(--breakout--on)}.dnb-section[style*="--outset"].dnb-space[style]:not(.dnb-card){padding-left:calc(var(--padding-left)*(1 - var(--outset)));padding-right:calc(var(--padding-right)*(1 - var(--outset)))}.dnb-section[style*="--outset"]:before{background-color:inherit;margin-left:calc(var(--outset-left, var(--padding-left))*-1*var(--outset));margin-right:calc(var(--outset-right, var(--padding-right))*-1*var(--outset))}@media screen and (max-width:60em){.dnb-section{--breakout:var(--breakout--small,var(--breakout--fallback));--outset:var(--outset--small,var(--outset--fallback));--background-color--value:var(--background-color--small);--text-color--value:var(--text-color--small);--outline-color:var(--outline-color--small);--drop-shadow:var(--drop-shadow--small);--rounded-corner:var(
2
2
  --rounded-corner--small,var(--rounded-corner--fallback)
3
3
  )}}@media screen and (max-width:60em) and (min-width:40.00625em){.dnb-section{--breakout:var(--breakout--medium,var(--breakout--fallback));--outset:var(--outset--medium,var(--outset--fallback));--background-color--value:var(--background-color--medium);--text-color--value:var(--text-color--medium);--outline-color:var(--outline-color--medium);--drop-shadow:var(--drop-shadow--medium);--rounded-corner:var(
4
4
  --rounded-corner--medium,var(--rounded-corner--fallback)
@@ -23,6 +23,10 @@
23
23
  --width: 100vw;
24
24
  --height: 100%;
25
25
  --color-transparent: transparent;
26
+ // reset to prevent inheriting from parent
27
+ --rounded-corner--small: 0;
28
+ --rounded-corner--medium: 0;
29
+ --rounded-corner--large: 0;
26
30
 
27
31
  color: var(--text-color, black);
28
32
  border-radius: var(--rounded-corner, 0);
@@ -61,6 +65,7 @@
61
65
  // we use box-shadow to avoid a horizontal scrollbar
62
66
  // We lower the left position, so we get an overlap
63
67
  box-shadow: var(--box-shadow);
68
+ border-radius: var(--rounded-corner, 0);
64
69
  }
65
70
 
66
71
  &:not([style*='--breakout']) {
@@ -8,7 +8,7 @@ import { StepIndicatorContextValues } from './StepIndicatorContext';
8
8
  import type { SpacingProps } from '../../shared/types';
9
9
  import type { SkeletonShow } from '../Skeleton';
10
10
  import type { StepIndicatorItemProps, StepItemWrapper } from './StepIndicatorItem';
11
- import { StepIndicatorTriggerButtonProps } from './StepIndicatorTriggerButton';
11
+ import { FormStatusState, FormStatusText } from '../form-status/FormStatus';
12
12
  export type StepIndicatorMode = 'static' | 'strict' | 'loose';
13
13
  export type StepIndicatorDataItem = Pick<StepIndicatorItemProps, 'title' | 'is_current' | 'inactive' | 'disabled' | 'status' | 'status_state' | 'on_click' | 'on_render'>;
14
14
  export type StepIndicatorData = string | string[] | StepIndicatorDataItem[];
@@ -19,8 +19,11 @@ export type StepIndicatorMouseEvent = {
19
19
  current_step: number;
20
20
  };
21
21
  export type StepIndicatorRenderCallback = {
22
+ /** A component that will render the item with the correct props. */
22
23
  StepItem: typeof StepItemWrapper;
24
+ /** Element that was originally going to be rendered */
23
25
  element: React.ReactNode;
26
+ /** @deprecated never has values */
24
27
  attributes: React.HTMLProps<HTMLElement>;
25
28
  props: StepIndicatorItemProps;
26
29
  context: StepIndicatorContextValues;
@@ -28,6 +31,7 @@ export type StepIndicatorRenderCallback = {
28
31
  export type StepIndicatorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'ref' | 'data'> & SpacingProps & {
29
32
  /**
30
33
  * <em>(required with `<StepIndicator.Sidebar />`)</em> a unique string-based ID in order to bind together the main component and the sidebar (`<StepIndicator.Sidebar />`). Both have to get the same ID.
34
+ * @deprecated StepIndicator.Sidebar variant is no longer supported
31
35
  */
32
36
  sidebar_id?: string;
33
37
  /**
@@ -57,6 +61,7 @@ export type StepIndicatorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'ref'
57
61
  * `%step` is used to place the current step into the text
58
62
  * `%count` is used to place the step total into the text
59
63
  * Defaults to `You are on step %step of %count`
64
+ * @deprecated only `step_title`is used
60
65
  */
61
66
  step_title_extended?: string;
62
67
  /**
@@ -73,6 +78,7 @@ export type StepIndicatorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'ref'
73
78
  on_click?: ({ event, item, current_step, currentStep, }: StepIndicatorMouseEvent) => void;
74
79
  /**
75
80
  * Callback function to manipulate or wrap every item. Has to return a React Node. You receive an object you can use in your custom HOC `{ StepItem, element, attributes, props, context }`.
81
+ * @deprecated no longer does anything other than the step item `title` prop
76
82
  */
77
83
  on_item_render?: ({ StepItem, element, attributes, props, context, }: StepIndicatorRenderCallback) => React.ReactNode;
78
84
  /**
@@ -80,19 +86,31 @@ export type StepIndicatorProps = Omit<React.HTMLProps<HTMLAnchorElement>, 'ref'
80
86
  */
81
87
  on_change?: ({ event, item, current_step, currentStep, }: StepIndicatorMouseEvent) => void;
82
88
  /**
83
- * The props for the trigger button.
84
- * Used internally to pass the props such as a status to the trigger button.
89
+ * Status text. Status is only shown if this prop has text. Defaults to `undefined`
85
90
  */
86
- triggerButtonProps?: StepIndicatorTriggerButtonProps;
91
+ status?: FormStatusText;
92
+ /**
93
+ * The type of status for the `status` prop. Is either `info`, `error` or `warn`.
94
+ * Defaults to `warn`.
95
+ */
96
+ status_state?: FormStatusState;
87
97
  /**
88
98
  * If set to `true`, the height animation on the step items and the drawer button will be omitted. Defaults to `false`.
89
99
  */
90
100
  no_animation?: boolean;
101
+ /**
102
+ * Set to `true` to have the list be expanded initially. Defaults to `false`.
103
+ */
104
+ expandedInitially?: boolean;
105
+ /**
106
+ * Whether or not to break out (using negative margins) on larger screens. Defaults to `false`.
107
+ */
108
+ outset?: boolean;
91
109
  skeleton?: SkeletonShow;
92
110
  className?: string;
93
111
  children?: React.ReactNode;
94
112
  };
95
- declare function StepIndicator({ data, skeleton, current_step, hide_numbers, no_animation, ...restOfProps }: StepIndicatorProps): import("react/jsx-runtime").JSX.Element;
113
+ declare function StepIndicator({ status, status_state, data, skeleton, current_step, hide_numbers, no_animation, expandedInitially, ...restOfProps }: StepIndicatorProps): import("react/jsx-runtime").JSX.Element;
96
114
  declare namespace StepIndicator {
97
115
  var Sidebar: typeof StepIndicatorSidebar;
98
116
  var _supportsSpacingProps: boolean;
@@ -1,38 +1,80 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
1
+ "use client";
2
+
2
3
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
4
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _div;
5
- const _excluded = ["data", "skeleton", "current_step", "hide_numbers", "no_animation"];
5
+ var _StepIndicatorTrigger, _StepIndicatorList;
6
+ const _excluded = ["sidebar_id", "step_title_extended"],
7
+ _excluded2 = ["status", "status_state", "data", "skeleton", "current_step", "hide_numbers", "no_animation", "expandedInitially"],
8
+ _excluded3 = ["outset"];
6
9
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
10
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
- import React from 'react';
11
+ import React, { useContext } from 'react';
12
+ import classnames from 'classnames';
13
+ import { createSpacingClasses } from '../space/SpacingHelper';
14
+ import Card from '../Card';
15
+ import StepIndicatorTriggerButton from './StepIndicatorTriggerButton';
9
16
  import StepIndicatorSidebar from './StepIndicatorSidebar';
10
- import StepIndicatorModal from './StepIndicatorModal';
11
- import { StepIndicatorProvider } from './StepIndicatorContext';
17
+ import StepIndicatorList from './StepIndicatorList';
18
+ import StepIndicatorContext, { StepIndicatorProvider } from './StepIndicatorContext';
12
19
  import { stepIndicatorDefaultProps } from './StepIndicatorProps';
13
- import useId from '../../shared/helpers/useId';
20
+ import FormStatus from '../form-status/FormStatus';
21
+ function handleDeprecatedProps(props) {
22
+ const {
23
+ sidebar_id,
24
+ step_title_extended
25
+ } = props,
26
+ rest = _objectWithoutProperties(props, _excluded);
27
+ return rest;
28
+ }
14
29
  function StepIndicator(_ref) {
15
30
  let {
31
+ status,
32
+ status_state = 'warn',
16
33
  data = stepIndicatorDefaultProps.data,
17
34
  skeleton = stepIndicatorDefaultProps.skeleton,
18
35
  current_step = stepIndicatorDefaultProps.current_step,
19
36
  hide_numbers = stepIndicatorDefaultProps.hide_numbers,
20
- no_animation = stepIndicatorDefaultProps.no_animation
37
+ no_animation = stepIndicatorDefaultProps.no_animation,
38
+ expandedInitially = stepIndicatorDefaultProps.expandedInitially
21
39
  } = _ref,
22
- restOfProps = _objectWithoutProperties(_ref, _excluded);
23
- const props = _objectSpread({
24
- data,
25
- skeleton,
26
- current_step,
27
- hide_numbers,
28
- no_animation
29
- }, restOfProps);
30
- const sidebarId = useId(props.sidebar_id);
31
- return React.createElement(StepIndicatorProvider, _extends({}, props, {
32
- sidebar_id: sidebarId
33
- }), _div || (_div = React.createElement("div", {
40
+ restOfProps = _objectWithoutProperties(_ref, _excluded2);
41
+ const _handleDeprecatedProp = handleDeprecatedProps(_objectSpread({
42
+ data,
43
+ skeleton,
44
+ current_step,
45
+ hide_numbers,
46
+ no_animation,
47
+ expandedInitially
48
+ }, restOfProps)),
49
+ {
50
+ outset
51
+ } = _handleDeprecatedProp,
52
+ props = _objectWithoutProperties(_handleDeprecatedProp, _excluded3);
53
+ return React.createElement(StepIndicatorProvider, props, React.createElement("div", {
34
54
  className: "dnb-step-indicator-wrapper"
35
- }, React.createElement(StepIndicatorModal, null))));
55
+ }, React.createElement(Card, {
56
+ align: "stretch",
57
+ className: classnames('dnb-step-indicator', createSpacingClasses(restOfProps)),
58
+ outset: outset
59
+ }, _StepIndicatorTrigger || (_StepIndicatorTrigger = React.createElement(StepIndicatorTriggerButton, null)), _StepIndicatorList || (_StepIndicatorList = React.createElement(StepIndicatorList, null))), React.createElement(StepIndicatorStatus, {
60
+ status: status,
61
+ status_state: status_state
62
+ })));
63
+ }
64
+ function StepIndicatorStatus({
65
+ status,
66
+ status_state
67
+ }) {
68
+ const {
69
+ openState,
70
+ no_animation
71
+ } = useContext(StepIndicatorContext);
72
+ const show = !openState && !!status;
73
+ return React.createElement(FormStatus, {
74
+ show: show,
75
+ no_animation: no_animation,
76
+ state: status && status_state
77
+ }, status);
36
78
  }
37
79
  StepIndicator.Sidebar = StepIndicatorSidebar;
38
80
  StepIndicator._supportsSpacingProps = true;
@@ -1 +1 @@
1
- {"version":3,"file":"StepIndicator.js","names":["React","StepIndicatorSidebar","StepIndicatorModal","StepIndicatorProvider","stepIndicatorDefaultProps","useId","StepIndicator","_ref","data","skeleton","current_step","hide_numbers","no_animation","restOfProps","_objectWithoutProperties","_excluded","props","_objectSpread","sidebarId","sidebar_id","createElement","_extends","_div","className","Sidebar","_supportsSpacingProps"],"sources":["../../../../src/components/step-indicator/StepIndicator.tsx"],"sourcesContent":["/**\n * Web StepIndicator Component\n *\n */\n\nimport React from 'react'\n\nimport StepIndicatorSidebar from './StepIndicatorSidebar'\n\nimport StepIndicatorModal from './StepIndicatorModal'\nimport {\n StepIndicatorContextValues,\n StepIndicatorProvider,\n} from './StepIndicatorContext'\n\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../Skeleton'\nimport type {\n StepIndicatorItemProps,\n StepItemWrapper,\n} from './StepIndicatorItem'\nimport { stepIndicatorDefaultProps } from './StepIndicatorProps'\nimport useId from '../../shared/helpers/useId'\nimport { StepIndicatorTriggerButtonProps } from './StepIndicatorTriggerButton'\n\nexport type StepIndicatorMode = 'static' | 'strict' | 'loose'\nexport type StepIndicatorDataItem = Pick<\n StepIndicatorItemProps,\n | 'title'\n | 'is_current'\n | 'inactive'\n | 'disabled'\n | 'status'\n | 'status_state'\n | 'on_click'\n | 'on_render'\n>\nexport type StepIndicatorData = string | string[] | StepIndicatorDataItem[]\n\nexport type StepIndicatorMouseEvent = {\n event: React.MouseEvent<HTMLButtonElement>\n item: StepIndicatorItemProps\n currentStep: number\n current_step: number\n}\n\nexport type StepIndicatorRenderCallback = {\n StepItem: typeof StepItemWrapper\n element: React.ReactNode\n attributes: React.HTMLProps<HTMLElement>\n props: StepIndicatorItemProps\n context: StepIndicatorContextValues\n}\n\nexport type StepIndicatorProps = Omit<\n React.HTMLProps<HTMLAnchorElement>,\n 'ref' | 'data'\n> &\n SpacingProps & {\n /**\n * <em>(required with `<StepIndicator.Sidebar />`)</em> a unique string-based ID in order to bind together the main component and the sidebar (`<StepIndicator.Sidebar />`). Both have to get the same ID.\n */\n sidebar_id?: string\n /**\n * <em>(required)</em> defines how the StepIndicator should work. Use `static` for non-interactive steps. Use `strict` for a chronological step order, also, the user can navigate between visited steps. Use `loose` if the user should be able to navigate freely.\n */\n mode: StepIndicatorMode\n /**\n * <em>(required)</em> defines the data/steps showing up in a JavaScript Array or JSON format like `[{title,is_current}]`. See parameters and the example above.\n */\n data: StepIndicatorData\n /**\n * The title shown inside the `<StepIndicatorModal />` supplemental screen reader text for the `<StepIndicatorTriggerButton />`\n * Defaults to `Steps Overview`\n */\n overview_title?: string\n /**\n * The label for `<StepIndicatorTriggerButton />` and supplemental screen reader text for `<StepIndicatorItem />`\n * This value need to contain `%step` and `%count` if you want to display the current step and total amount of steps\n * `%step` is used to place the current step into the text\n * `%count` is used to place the step total into the text\n * Defaults to `Step %step of %count`\n */\n step_title?: string\n /**\n * A descriptive label used in `<StepIndicatorModal />`\n * This value need to contain `%step` and `%count` if you want to display the current step and total amount of steps\n * `%step` is used to place the current step into the text\n * `%count` is used to place the step total into the text\n * Defaults to `You are on step %step of %count`\n */\n step_title_extended?: string\n /**\n * Defines the active number marked step starting by 0. Defaults to `0`.\n */\n current_step?: number\n /**\n * Define whether to show automatically counted numbers or not. Defaults to `false`.\n */\n hide_numbers?: boolean\n /**\n * Will be called once the user clicks on the current or another step. Will be emitted on every click. Returns an object `{ event, item, current_step, currentStep }`.\n */\n on_click?: ({\n event,\n item,\n current_step,\n currentStep,\n }: StepIndicatorMouseEvent) => void\n /**\n * Callback function to manipulate or wrap every item. Has to return a React Node. You receive an object you can use in your custom HOC `{ StepItem, element, attributes, props, context }`.\n */\n on_item_render?: ({\n StepItem,\n element,\n attributes,\n props,\n context,\n }: StepIndicatorRenderCallback) => React.ReactNode\n /**\n * Will be called once the user visits actively a new step. Will be emitted only once. Returns an object `{ event, item, current_step, currentStep }`.\n */\n on_change?: ({\n event,\n item,\n current_step,\n currentStep,\n }: StepIndicatorMouseEvent) => void\n\n /**\n * The props for the trigger button.\n * Used internally to pass the props such as a status to the trigger button.\n */\n triggerButtonProps?: StepIndicatorTriggerButtonProps\n\n /**\n * If set to `true`, the height animation on the step items and the drawer button will be omitted. Defaults to `false`.\n */\n no_animation?: boolean\n skeleton?: SkeletonShow\n className?: string\n children?: React.ReactNode\n }\n\nfunction StepIndicator({\n data = stepIndicatorDefaultProps.data,\n skeleton = stepIndicatorDefaultProps.skeleton,\n current_step = stepIndicatorDefaultProps.current_step,\n hide_numbers = stepIndicatorDefaultProps.hide_numbers,\n no_animation = stepIndicatorDefaultProps.no_animation,\n ...restOfProps\n}: StepIndicatorProps) {\n const props = {\n data,\n skeleton,\n current_step,\n hide_numbers,\n no_animation,\n ...restOfProps,\n }\n\n const sidebarId = useId(props.sidebar_id)\n\n return (\n <StepIndicatorProvider {...props} sidebar_id={sidebarId}>\n <div className=\"dnb-step-indicator-wrapper\">\n <StepIndicatorModal />\n </div>\n </StepIndicatorProvider>\n )\n}\n\nStepIndicator.Sidebar = StepIndicatorSidebar\n\nStepIndicator._supportsSpacingProps = true\n\nexport default StepIndicator\n"],"mappings":";;;;;;;AAKA,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,OAAOC,kBAAkB,MAAM,sBAAsB;AACrD,SAEEC,qBAAqB,QAChB,wBAAwB;AAQ/B,SAASC,yBAAyB,QAAQ,sBAAsB;AAChE,OAAOC,KAAK,MAAM,4BAA4B;AA0H9C,SAASC,aAAaA,CAAAC,IAAA,EAOC;EAAA,IAPA;MACrBC,IAAI,GAAGJ,yBAAyB,CAACI,IAAI;MACrCC,QAAQ,GAAGL,yBAAyB,CAACK,QAAQ;MAC7CC,YAAY,GAAGN,yBAAyB,CAACM,YAAY;MACrDC,YAAY,GAAGP,yBAAyB,CAACO,YAAY;MACrDC,YAAY,GAAGR,yBAAyB,CAACQ;IAEvB,CAAC,GAAAL,IAAA;IADhBM,WAAW,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EAEd,MAAMC,KAAK,GAAAC,aAAA;IACTT,IAAI;IACJC,QAAQ;IACRC,YAAY;IACZC,YAAY;IACZC;EAAY,GACTC,WAAW,CACf;EAED,MAAMK,SAAS,GAAGb,KAAK,CAACW,KAAK,CAACG,UAAU,CAAC;EAEzC,OACEnB,KAAA,CAAAoB,aAAA,CAACjB,qBAAqB,EAAAkB,QAAA,KAAKL,KAAK;IAAEG,UAAU,EAAED;EAAU,IAAAI,IAAA,KAAAA,IAAA,GACtDtB,KAAA,CAAAoB,aAAA;IAAKG,SAAS,EAAC;EAA4B,GACzCvB,KAAA,CAAAoB,aAAA,CAAClB,kBAAkB,MAAE,CAClB,CAAC,CACe,CAAC;AAE5B;AAEAI,aAAa,CAACkB,OAAO,GAAGvB,oBAAoB;AAE5CK,aAAa,CAACmB,qBAAqB,GAAG,IAAI;AAE1C,eAAenB,aAAa","ignoreList":[]}
1
+ {"version":3,"file":"StepIndicator.js","names":["React","useContext","classnames","createSpacingClasses","Card","StepIndicatorTriggerButton","StepIndicatorSidebar","StepIndicatorList","StepIndicatorContext","StepIndicatorProvider","stepIndicatorDefaultProps","FormStatus","handleDeprecatedProps","props","sidebar_id","step_title_extended","rest","_objectWithoutProperties","_excluded","StepIndicator","_ref","status","status_state","data","skeleton","current_step","hide_numbers","no_animation","expandedInitially","restOfProps","_excluded2","_handleDeprecatedProp","_objectSpread","outset","_excluded3","createElement","className","align","_StepIndicatorTrigger","_StepIndicatorList","StepIndicatorStatus","openState","show","state","Sidebar","_supportsSpacingProps"],"sources":["../../../../src/components/step-indicator/StepIndicator.tsx"],"sourcesContent":["/**\n * Web StepIndicator Component\n *\n */\n\nimport React, { useContext } from 'react'\nimport classnames from 'classnames'\n\nimport { createSpacingClasses } from '../space/SpacingHelper'\nimport Card from '../Card'\nimport StepIndicatorTriggerButton from './StepIndicatorTriggerButton'\nimport StepIndicatorSidebar from './StepIndicatorSidebar'\nimport StepIndicatorList from './StepIndicatorList'\nimport StepIndicatorContext, {\n StepIndicatorContextValues,\n StepIndicatorProvider,\n} from './StepIndicatorContext'\n\nimport type { SpacingProps } from '../../shared/types'\nimport type { SkeletonShow } from '../Skeleton'\nimport type {\n StepIndicatorItemProps,\n StepItemWrapper,\n} from './StepIndicatorItem'\nimport { stepIndicatorDefaultProps } from './StepIndicatorProps'\nimport FormStatus, {\n FormStatusState,\n FormStatusText,\n} from '../form-status/FormStatus'\n\nexport type StepIndicatorMode = 'static' | 'strict' | 'loose'\nexport type StepIndicatorDataItem = Pick<\n StepIndicatorItemProps,\n | 'title'\n | 'is_current'\n | 'inactive'\n | 'disabled'\n | 'status'\n | 'status_state'\n | 'on_click'\n | 'on_render'\n>\nexport type StepIndicatorData = string | string[] | StepIndicatorDataItem[]\n\nexport type StepIndicatorMouseEvent = {\n event: React.MouseEvent<HTMLButtonElement>\n item: StepIndicatorItemProps\n currentStep: number\n current_step: number\n}\n\nexport type StepIndicatorRenderCallback = {\n /** A component that will render the item with the correct props. */\n StepItem: typeof StepItemWrapper\n /** Element that was originally going to be rendered */\n element: React.ReactNode\n /** @deprecated never has values */\n attributes: React.HTMLProps<HTMLElement>\n props: StepIndicatorItemProps\n context: StepIndicatorContextValues\n}\n\nexport type StepIndicatorProps = Omit<\n React.HTMLProps<HTMLAnchorElement>,\n 'ref' | 'data'\n> &\n SpacingProps & {\n /**\n * <em>(required with `<StepIndicator.Sidebar />`)</em> a unique string-based ID in order to bind together the main component and the sidebar (`<StepIndicator.Sidebar />`). Both have to get the same ID.\n * @deprecated StepIndicator.Sidebar variant is no longer supported\n */\n sidebar_id?: string\n /**\n * <em>(required)</em> defines how the StepIndicator should work. Use `static` for non-interactive steps. Use `strict` for a chronological step order, also, the user can navigate between visited steps. Use `loose` if the user should be able to navigate freely.\n */\n mode: StepIndicatorMode\n /**\n * <em>(required)</em> defines the data/steps showing up in a JavaScript Array or JSON format like `[{title,is_current}]`. See parameters and the example above.\n */\n data: StepIndicatorData\n /**\n * The title shown inside the `<StepIndicatorModal />` supplemental screen reader text for the `<StepIndicatorTriggerButton />`\n * Defaults to `Steps Overview`\n */\n overview_title?: string\n /**\n * The label for `<StepIndicatorTriggerButton />` and supplemental screen reader text for `<StepIndicatorItem />`\n * This value need to contain `%step` and `%count` if you want to display the current step and total amount of steps\n * `%step` is used to place the current step into the text\n * `%count` is used to place the step total into the text\n * Defaults to `Step %step of %count`\n */\n step_title?: string\n /**\n * A descriptive label used in `<StepIndicatorModal />`\n * This value need to contain `%step` and `%count` if you want to display the current step and total amount of steps\n * `%step` is used to place the current step into the text\n * `%count` is used to place the step total into the text\n * Defaults to `You are on step %step of %count`\n * @deprecated only `step_title`is used\n */\n step_title_extended?: string\n /**\n * Defines the active number marked step starting by 0. Defaults to `0`.\n */\n current_step?: number\n /**\n * Define whether to show automatically counted numbers or not. Defaults to `false`.\n */\n hide_numbers?: boolean\n /**\n * Will be called once the user clicks on the current or another step. Will be emitted on every click. Returns an object `{ event, item, current_step, currentStep }`.\n */\n on_click?: ({\n event,\n item,\n current_step,\n currentStep,\n }: StepIndicatorMouseEvent) => void\n /**\n * Callback function to manipulate or wrap every item. Has to return a React Node. You receive an object you can use in your custom HOC `{ StepItem, element, attributes, props, context }`.\n * @deprecated no longer does anything other than the step item `title` prop\n */\n on_item_render?: ({\n StepItem,\n element,\n attributes,\n props,\n context,\n }: StepIndicatorRenderCallback) => React.ReactNode\n /**\n * Will be called once the user visits actively a new step. Will be emitted only once. Returns an object `{ event, item, current_step, currentStep }`.\n */\n on_change?: ({\n event,\n item,\n current_step,\n currentStep,\n }: StepIndicatorMouseEvent) => void\n /**\n * Status text. Status is only shown if this prop has text. Defaults to `undefined`\n */\n status?: FormStatusText\n /**\n * The type of status for the `status` prop. Is either `info`, `error` or `warn`.\n * Defaults to `warn`.\n */\n status_state?: FormStatusState\n /**\n * If set to `true`, the height animation on the step items and the drawer button will be omitted. Defaults to `false`.\n */\n no_animation?: boolean\n /**\n * Set to `true` to have the list be expanded initially. Defaults to `false`.\n */\n expandedInitially?: boolean\n /**\n * Whether or not to break out (using negative margins) on larger screens. Defaults to `false`.\n */\n outset?: boolean\n skeleton?: SkeletonShow\n className?: string\n children?: React.ReactNode\n }\n\nfunction handleDeprecatedProps(\n props: StepIndicatorProps\n): Omit<StepIndicatorProps, 'sidebar_id' | 'step_title_extended'> {\n const { sidebar_id, step_title_extended, ...rest } = props\n return rest\n}\n\nfunction StepIndicator({\n status,\n status_state = 'warn',\n data = stepIndicatorDefaultProps.data,\n skeleton = stepIndicatorDefaultProps.skeleton,\n current_step = stepIndicatorDefaultProps.current_step,\n hide_numbers = stepIndicatorDefaultProps.hide_numbers,\n no_animation = stepIndicatorDefaultProps.no_animation,\n expandedInitially = stepIndicatorDefaultProps.expandedInitially,\n ...restOfProps\n}: StepIndicatorProps) {\n const { outset, ...props } = handleDeprecatedProps({\n data,\n skeleton,\n current_step,\n hide_numbers,\n no_animation,\n expandedInitially,\n ...restOfProps,\n })\n\n return (\n <StepIndicatorProvider {...props}>\n <div className=\"dnb-step-indicator-wrapper\">\n <Card\n align=\"stretch\"\n className={classnames(\n 'dnb-step-indicator',\n createSpacingClasses(restOfProps)\n )}\n outset={outset}\n >\n <StepIndicatorTriggerButton />\n <StepIndicatorList />\n </Card>\n <StepIndicatorStatus status={status} status_state={status_state} />\n </div>\n </StepIndicatorProvider>\n )\n}\n\nfunction StepIndicatorStatus({ status, status_state }) {\n const { openState, no_animation } = useContext(StepIndicatorContext)\n const show = !openState && !!status\n return (\n <FormStatus\n show={show}\n no_animation={no_animation}\n state={status && status_state}\n >\n {status}\n </FormStatus>\n )\n}\n/**\n * @deprecated StepIndicator.Sidebar variant is no longer supported\n */\nStepIndicator.Sidebar = StepIndicatorSidebar\n\nStepIndicator._supportsSpacingProps = true\n\nexport default StepIndicator\n"],"mappings":";;;;;;;;;;AAKA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,oBAAoB,IAEzBC,qBAAqB,QAChB,wBAAwB;AAQ/B,SAASC,yBAAyB,QAAQ,sBAAsB;AAChE,OAAOC,UAAU,MAGV,2BAA2B;AAyIlC,SAASC,qBAAqBA,CAC5BC,KAAyB,EACuC;EAChE,MAAM;MAAEC,UAAU;MAAEC;IAA6B,CAAC,GAAGF,KAAK;IAAdG,IAAI,GAAAC,wBAAA,CAAKJ,KAAK,EAAAK,SAAA;EAC1D,OAAOF,IAAI;AACb;AAEA,SAASG,aAAaA,CAAAC,IAAA,EAUC;EAAA,IAVA;MACrBC,MAAM;MACNC,YAAY,GA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EnB,MAAM;EAAEC;AAAa,CAAC,EAAE;EACrD,MAAM;IAAEmB,SAAS;IAAEd;EAAa,CAAC,GAAG1B,UAAU,CAACO,oBAAoB,CAAC;EACpE,MAAMkC,IAAI,GAAG,CAACD,SAAS,IAAI,CAAC,CAACpB,MAAM;EACnC,OACErB,KAAA,CAAAmC,aAAA,CAACxB,UAAU;IACT+B,IAAI,EAAEA,IAAK;IACXf,YAAY,EAAEA,YAAa;IAC3BgB,KAAK,EAAEtB,MAAM,IAAIC;EAAa,GAE7BD,MACS,CAAC;AAEjB;AAIAF,aAAa,CAACyB,OAAO,GAAGtC,oBAAoB;AAE5Ca,aAAa,CAAC0B,qBAAqB,GAAG,IAAI;AAE1C,eAAe1B,aAAa","ignoreList":[]}
@@ -6,15 +6,10 @@ import React from 'react';
6
6
  import { ContextProps } from '../../shared/Context';
7
7
  import { StepIndicatorData, StepIndicatorMode, StepIndicatorProps } from './StepIndicator';
8
8
  import { StepIndicatorItemProps } from './StepIndicatorItem';
9
- import { StepIndicatorTriggerButtonProps } from './StepIndicatorTriggerButton';
10
9
  export type StepIndicatorContextValues = StepIndicatorProviderProps & StepIndicatorProviderStates & ContextProps;
11
10
  declare const StepIndicatorContext: React.Context<StepIndicatorContextValues>;
12
11
  export default StepIndicatorContext;
13
- export type StepIndicatorProviderProps = Omit<StepIndicatorProps, 'mode' | 'data'> & {
14
- /**
15
- * <em>(required)</em> a unique string-based ID in order to bind together the main component and the sidebar (`<StepIndicator.Sidebar />`). Both have to get the same ID.
16
- */
17
- sidebar_id: string;
12
+ export type StepIndicatorProviderProps = Omit<StepIndicatorProps, 'mode' | 'data' | 'sidebar_id' | 'step_title_extended'> & {
18
13
  /**
19
14
  * <em>(required)</em> defines the data/steps showing up in a JavaScript Array or JSON format like `[{title,is_current}]`. See parameters and the example above.
20
15
  */
@@ -24,24 +19,17 @@ export type StepIndicatorProviderProps = Omit<StepIndicatorProps, 'mode' | 'data
24
19
  */
25
20
  mode?: StepIndicatorMode;
26
21
  children: React.ReactNode;
27
- isSidebar?: boolean;
28
- triggerButtonProps?: StepIndicatorTriggerButtonProps;
29
22
  };
30
23
  export type StepIndicatorProviderStates = {
31
24
  data: (string | StepIndicatorItemProps)[];
32
- hasSidebar: boolean;
33
- hideSidebar: boolean;
34
25
  activeStep: number;
35
26
  openState: boolean;
36
27
  listOfReachedSteps: number[];
37
28
  countSteps: number;
38
29
  stepsLabel: string;
39
- stepsLabelExtended: string;
40
30
  filterAttributes: string[];
41
31
  setActiveStep: React.Dispatch<React.SetStateAction<number>>;
42
- sidebarIsVisible: boolean;
43
- onChangeState: () => void;
44
32
  openHandler: () => void;
45
33
  closeHandler: () => void;
46
34
  };
47
- export declare function StepIndicatorProvider({ isSidebar, ...restOfProps }: StepIndicatorProviderProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare function StepIndicatorProvider(props: StepIndicatorProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -1,42 +1,22 @@
1
1
  "use client";
2
2
 
3
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- const _excluded = ["isSidebar"];
6
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
3
  import React, { useCallback, useContext, useEffect, useMemo, useReducer, useRef, useState } from 'react';
9
4
  import Context from '../../shared/Context';
10
5
  import { stepIndicatorDefaultProps } from './StepIndicatorProps';
11
6
  import { extendPropsWithContext } from '../../shared/component-helper';
12
- import { onMediaQueryChange } from '../../shared/MediaQueryUtils';
13
7
  const filterAttributes = Object.keys(stepIndicatorDefaultProps).filter(item => {
14
8
  return !['class', 'className'].includes(item);
15
- }).concat(['internalId', 'isSidebar', 'hasSidebar', 'hideSidebar', 'sidebarIsVisible', 'mainTitle', 'stepsLabel', 'stepsLabelExtended', 'listOfReachedSteps', 'setActiveStep', 'activeStep', 'countSteps', 'openState', 'onChangeState', 'openHandler', 'closeHandler', 'innerRef', 'hasSkeletonData', 'filterAttributes', 'onChangeState']);
9
+ }).concat(['internalId', 'mainTitle', 'stepsLabel', 'listOfReachedSteps', 'setActiveStep', 'activeStep', 'countSteps', 'openState', 'openHandler', 'closeHandler', 'innerRef', 'hasSkeletonData', 'filterAttributes']);
16
10
  const StepIndicatorContext = React.createContext(null);
17
11
  export default StepIndicatorContext;
18
- export function StepIndicatorProvider(_ref) {
19
- let {
20
- isSidebar = false
21
- } = _ref,
22
- restOfProps = _objectWithoutProperties(_ref, _excluded);
23
- const props = useMemo(() => {
24
- return _objectSpread({
25
- isSidebar
26
- }, restOfProps);
27
- }, [isSidebar, restOfProps]);
12
+ export function StepIndicatorProvider(props) {
28
13
  const data = useMemo(() => {
29
14
  if (typeof props.data === 'string') {
30
15
  return props.data[0] === '[' ? JSON.parse(props.data) : [];
31
16
  }
32
17
  return props.data || [];
33
18
  }, [props]);
34
- const [hasSidebar, setHasSidebar] = useState(true);
35
- const [hideSidebar, setHideSidebar] = useState(false);
36
- const [openState, setOpenState] = useState(false);
37
- const onChangeState = useCallback(() => {
38
- setOpenState(false);
39
- }, []);
19
+ const [openState, setOpenState] = useState(props.expandedInitially);
40
20
  const openHandler = useCallback(() => {
41
21
  setOpenState(true);
42
22
  }, []);
@@ -59,7 +39,6 @@ export function StepIndicatorProvider(_ref) {
59
39
  forceUpdate();
60
40
  }, []);
61
41
  const listOfReachedSteps = useRef([activeStepRef.current].filter(Boolean)).current;
62
- const mediaQueryListener = useRef(null);
63
42
  const context = useContext(Context);
64
43
  const updateStepTitle = useCallback(title => {
65
44
  return title === null || title === void 0 ? void 0 : title.replace('%step', String((activeStepRef.current || 0) + 1)).replace('%count', String((data === null || data === void 0 ? void 0 : data.length) || 1));
@@ -74,43 +53,20 @@ export function StepIndicatorProvider(_ref) {
74
53
  defaultProps: stepIndicatorDefaultProps,
75
54
  props
76
55
  }, {
77
- hasSidebar,
78
- hideSidebar,
79
56
  activeStep: activeStepRef.current,
80
57
  openState,
81
58
  listOfReachedSteps,
82
59
  data,
83
60
  countSteps,
84
- stepsLabel: updateStepTitle(globalContext.step_title),
85
- stepsLabelExtended: updateStepTitle(globalContext.step_title_extended)
61
+ stepsLabel: updateStepTitle(globalContext.step_title)
86
62
  }, {
87
63
  setActiveStep,
88
- onChangeState,
89
64
  openHandler,
90
65
  closeHandler
91
66
  });
92
- value.sidebarIsVisible = value.hasSidebar && !value.hideSidebar;
93
67
  return value;
94
- }, [closeHandler, context, countSteps, data, hasSidebar, hideSidebar, listOfReachedSteps, onChangeState, openHandler, openState, props, setActiveStep, updateStepTitle]);
68
+ }, [closeHandler, context, countSteps, data, listOfReachedSteps, openHandler, openState, props, setActiveStep, updateStepTitle]);
95
69
  const contextValue = makeContextValue();
96
- useEffect(() => {
97
- var _document;
98
- const container = (_document = document) === null || _document === void 0 ? void 0 : _document.getElementById('sidebar__' + props.sidebar_id);
99
- setHasSidebar(Boolean(container));
100
- mediaQueryListener.current = onMediaQueryChange({
101
- min: '0',
102
- max: 'medium'
103
- }, hideSidebar => {
104
- setHideSidebar(hideSidebar);
105
- }, {
106
- runOnInit: true
107
- });
108
- return () => {
109
- if (mediaQueryListener.current) {
110
- mediaQueryListener.current();
111
- }
112
- };
113
- }, [props.sidebar_id]);
114
70
  useEffect(() => {
115
71
  const currentStepFromProps = getActiveStepFromProps();
116
72
  if (currentStepFromProps !== activeStepRef.current) {