@helsenorge/designsystem-react 8.6.0-beta.1 → 9.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/Button.js +7 -7
  2. package/Button.js.map +1 -1
  3. package/CHANGELOG.md +1 -1
  4. package/Checkbox.js +42 -42
  5. package/Checkbox.js.map +1 -1
  6. package/ErrorWrapper.js.map +1 -1
  7. package/FormGroup.js +30 -30
  8. package/FormGroup.js.map +1 -1
  9. package/Icon.js +21 -21
  10. package/Icon.js.map +1 -1
  11. package/Input.js +98 -88
  12. package/Input.js.map +1 -1
  13. package/Label.js +9 -9
  14. package/Label.js.map +1 -1
  15. package/MaxCharacters.js +2 -2
  16. package/MaxCharacters.js.map +1 -1
  17. package/RadioButton.js +61 -61
  18. package/RadioButton.js.map +1 -1
  19. package/Select.js +34 -33
  20. package/Select.js.map +1 -1
  21. package/StatusDot.js +15 -15
  22. package/StatusDot.js.map +1 -1
  23. package/TabList.js +88 -53
  24. package/TabList.js.map +1 -1
  25. package/TabPanel.js +7 -7
  26. package/TabPanel.js.map +1 -1
  27. package/Textarea.js +59 -58
  28. package/Textarea.js.map +1 -1
  29. package/Trigger.js +33 -33
  30. package/Trigger.js.map +1 -1
  31. package/components/Button/Button.d.ts +2 -2
  32. package/components/Checkbox/Checkbox.d.ts +4 -3
  33. package/components/Checkbox/styles.module.scss +0 -14
  34. package/components/Checkbox/styles.module.scss.d.ts +0 -1
  35. package/components/Dropdown/Dropdown.d.ts +2 -2
  36. package/components/Dropdown/index.js +25 -25
  37. package/components/Dropdown/index.js.map +1 -1
  38. package/components/ErrorWrapper/ErrorWrapper.d.ts +3 -0
  39. package/components/ExpanderList/ExpanderList.d.ts +4 -6
  40. package/components/ExpanderList/index.js +118 -126
  41. package/components/ExpanderList/index.js.map +1 -1
  42. package/components/ExpanderList/styles.module.scss +164 -53
  43. package/components/ExpanderList/styles.module.scss.d.ts +29 -5
  44. package/components/FormGroup/FormGroup.d.ts +2 -2
  45. package/components/Icon/Icon.d.ts +4 -4
  46. package/components/Icons/NoAccess.js +7 -7
  47. package/components/Icons/NoAccess.js.map +1 -1
  48. package/components/Input/Input.d.ts +4 -3
  49. package/components/Label/Label.d.ts +4 -4
  50. package/components/Label/SubLabel.d.ts +2 -2
  51. package/components/MaxCharacters/MaxCharacters.d.ts +2 -2
  52. package/components/RadioButton/RadioButton.d.ts +5 -4
  53. package/components/RadioButton/styles.module.scss +0 -15
  54. package/components/RadioButton/styles.module.scss.d.ts +0 -1
  55. package/components/Select/Select.d.ts +4 -3
  56. package/components/SharingStatus/SharingStatus.d.ts +1 -1
  57. package/components/SharingStatus/index.js +5 -5
  58. package/components/SharingStatus/index.js.map +1 -1
  59. package/components/SharingStatus/styles.module.scss +0 -16
  60. package/components/SharingStatus/styles.module.scss.d.ts +0 -4
  61. package/components/StatusDot/StatusDot.d.ts +3 -3
  62. package/components/StatusDot/index.js +3 -3
  63. package/components/Tabs/TabList/TabList.d.ts +3 -3
  64. package/components/Tabs/TabList/styles.module.scss +63 -51
  65. package/components/Tabs/TabList/styles.module.scss.d.ts +7 -3
  66. package/components/Tabs/TabPanel/TabPanel.d.ts +1 -2
  67. package/components/Tabs/TabPanel/styles.module.scss +11 -26
  68. package/components/Tabs/TabPanel/styles.module.scss.d.ts +0 -2
  69. package/components/Tabs/Tabs.d.ts +3 -3
  70. package/components/Tabs/index.js +57 -72
  71. package/components/Tabs/index.js.map +1 -1
  72. package/components/Tabs/styles.module.scss +5 -9
  73. package/components/Tabs/styles.module.scss.d.ts +0 -1
  74. package/components/Textarea/Textarea.d.ts +4 -3
  75. package/components/Toggle/index.js +1222 -1180
  76. package/components/Toggle/index.js.map +1 -1
  77. package/components/Trigger/Trigger.d.ts +2 -2
  78. package/components/Validation/index.js +38 -32
  79. package/components/Validation/index.js.map +1 -1
  80. package/constants.d.ts +1 -1
  81. package/constants.js +1 -1
  82. package/constants.js.map +1 -1
  83. package/docs/FormExample/FormExample.d.ts +2 -1
  84. package/index.js +23 -23
  85. package/package.json +4 -4
  86. package/utils/component.d.ts +1 -0
  87. package/utils/component.js +7 -3
  88. package/utils/component.js.map +1 -1
package/Trigger.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Trigger.js","sources":["../src/components/Trigger/HelpSign.tsx","../src/components/Trigger/Trigger.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIcon, SvgPathProps } from '../Icon';\n\nconst HelpSign: React.FC<SvgPathProps> = ({ size, isHovered }: SvgPathProps): React.ReactElement => {\n const normal = (\n <path d=\"M18.854 19.678c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.222 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.84-3.424l1.042-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.136 1.022l-2.564-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 10.186c0-.908.726-1.678 1.656-1.678.908 0 1.656.77 1.656 1.678 0 .907-.748 1.657-1.656 1.657-.93 0-1.656-.75-1.656-1.657Z\" />\n );\n\n const normalHover = (\n <path d=\"M18.854 18.178c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.223 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.838-3.424l1.044-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.135 1.022l-2.563-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 11.686c0-.908.725-1.678 1.655-1.678.908 0 1.657.77 1.657 1.678 0 .907-.749 1.657-1.657 1.657-.93 0-1.655-.75-1.655-1.657Z\" />\n );\n\n const xSmall = (\n <path d=\"M23.98 14.937c-3.425 0-5.127 2.473-5.127 4.741 0 .363.047.726.137 1.044l2.563.182c-.09-.25-.136-.681-.136-1.022 0-1.292.885-2.586 2.563-2.586 1.658 0 2.45 1.112 2.45 2.291 0 .772-.317 1.43-1.065 1.974l-1.043.749c-1.317.953-1.84 2.065-1.84 3.425 0 .319.024.567.047.862h2.267c-.021-.135-.021-.25-.021-.295 0-.884.385-1.633 1.133-2.154l.976-.681c1.317-.93 2.27-2.2 2.27-3.993 0-2.314-1.816-4.537-5.174-4.537m-.294 13.248c-.93 0-1.656.773-1.656 1.678a1.65 1.65 0 0 0 1.656 1.657c.907 0 1.656-.748 1.656-1.657 0-.905-.749-1.678-1.656-1.678\" />\n );\n\n const xSmallHover = (\n <path d=\"M18.853 18.289c0-2.268 1.701-4.742 5.127-4.742 3.357 0 5.173 2.223 5.173 4.537 0 1.794-.953 3.065-2.27 3.994l-.976.681c-.747.52-1.133 1.27-1.133 2.154 0 .046 0 .16.022.295h-2.267a39.324 39.324 0 0 0-.01-.125 8.468 8.468 0 0 1-.037-.737c0-1.36.523-2.472 1.839-3.425l1.043-.75c.748-.543 1.065-1.201 1.065-1.973 0-1.18-.792-2.29-2.45-2.29-1.678 0-2.562 1.293-2.562 2.585 0 .341.045.772.135 1.022l-2.563-.183a3.914 3.914 0 0 1-.136-1.043Zm3.176 11.575c0-.907.726-1.679 1.656-1.679.908 0 1.657.772 1.657 1.68 0 .907-.749 1.656-1.657 1.656-.93 0-1.656-.749-1.656-1.657Z\" />\n );\n\n return getIcon({ size, isHovered, normal, normalHover, xSmall, xSmallHover });\n};\n\nexport default HelpSign;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HelpSign from './HelpSign';\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon, { SvgIcon } from '../Icon';\n\nimport styles from './styles.module.scss';\n\nexport type TriggerTags = 'button' | 'span';\n\nexport type TriggerVariant = 'help'; // @todo Support variant='info' in later version\n\nexport type TriggerSize = 'medium' | 'large';\n\nexport type TriggerMode = 'onlight' | 'ondark';\n\nexport interface TriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /**\n * Controls the icon and color. Default: help.\n */\n variant?: TriggerVariant;\n /**\n * Changes the design based on the background the trigger is placed on. Default: onlight.\n */\n mode?: TriggerMode;\n /**\n * Size of the trigger. Default: medium.\n */\n size?: TriggerSize;\n /**\n * Indicates that the trigger is in use.\n */\n selected?: boolean;\n /**\n * Indicates that the trigger is hovered. Used in combination with htmlMarkup=span to force visual hover state.\n */\n isHovered?: boolean;\n /**\n * Changes the underlying element of the trigger. If set to span, the trigger will be a non-interactive icon. Default: button\n */\n htmlMarkup?: TriggerTags;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst iconMap: Record<TriggerVariant, SvgIcon> = {\n help: HelpSign,\n //info: InfoSignStroke, // @todo Support variant='info' in later version\n};\n\nconst iconSizeMap: Record<TriggerSize, IconSize> = {\n medium: IconSize.XSmall,\n large: IconSize.Small,\n};\n\nconst getIconColor = (mode: TriggerMode, variant: TriggerVariant, isActive: boolean): string | undefined => {\n if (mode === 'ondark') {\n return 'white';\n }\n\n const depth = isActive ? 800 : 600;\n\n if (variant === 'help') {\n return getColor('plum', depth);\n }\n\n if (variant === 'info') {\n return getColor('blueberry', depth);\n }\n};\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(\n (\n {\n ariaLabel,\n ariaLabelledById,\n variant = 'help',\n mode = 'onlight',\n size = 'medium',\n selected = false,\n isHovered,\n htmlMarkup = 'button',\n className,\n testId,\n ...rest\n },\n ref\n ) => {\n const { isHovered: buttonIsHovered, hoverRef } = useHover<HTMLButtonElement>();\n\n const triggerClasses = classNames(\n styles.trigger,\n mode === 'onlight' && styles[`trigger--${variant}`], // variants look the same when mode=ondark\n mode === 'ondark' && styles[`trigger--${mode}`],\n styles[`trigger--${size}`],\n isHovered && styles[`trigger--hovered`],\n selected && styles[`trigger--selected`],\n className\n );\n\n const iconColor = getIconColor(mode, variant, isHovered || buttonIsHovered || selected);\n\n const icon = <Icon svgIcon={iconMap[variant]} size={iconSizeMap[size]} color={iconColor} isHovered={isHovered || buttonIsHovered} />;\n\n if (htmlMarkup === 'span') {\n return (\n <span data-testid={testId} data-analyticsid={AnalyticsId.Trigger} className={triggerClasses}>\n {icon}\n </span>\n );\n }\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.Trigger}\n className={triggerClasses}\n ref={mergeRefs([ref, hoverRef])}\n aria-expanded={selected}\n {...ariaLabelAttributes}\n {...rest}\n >\n {icon}\n </button>\n );\n }\n);\n\nTrigger.displayName = 'Trigger';\n\nexport default Trigger;\n"],"names":["HelpSign","size","isHovered","getIcon","jsx","iconMap","iconSizeMap","IconSize","getIconColor","mode","variant","isActive","depth","getColor","Trigger","React","ariaLabel","ariaLabelledById","selected","htmlMarkup","className","testId","rest","ref","buttonIsHovered","hoverRef","useHover","triggerClasses","classNames","styles","iconColor","icon","Icon","AnalyticsId","ariaLabelAttributes","getAriaLabelAttributes","mergeRefs"],"mappings":";;;;;;;;;;AAIA,MAAMA,IAAmC,CAAC,EAAE,MAAAC,GA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KAAYW,EAAO,mBAAmB;AAAA,MACtCT;AAAA,IAAA,GAGIU,IAAYtB,EAAaC,GAAMC,GAASR,KAAasB,KAAmBN,CAAQ,GAEhFa,IAAO,gBAAA3B,EAAC4B,GAAK,EAAA,SAAS3B,EAAQK,CAAO,GAAG,MAAMJ,EAAYL,CAAI,GAAG,OAAO6B,GAAW,WAAW5B,KAAasB,EAAiB,CAAA;AAElI,QAAIL,MAAe;AAEf,aAAA,gBAAAf,EAAC,UAAK,eAAaiB,GAAQ,oBAAkBY,EAAY,SAAS,WAAWN,GAC1E,UACHI,EAAA,CAAA;AAIJ,UAAMG,IAAsBC,EAAuB,EAAE,OAAOnB,GAAW,IAAIC,GAAkB;AAG3F,WAAA,gBAAAb;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,cAAYY;AAAA,QACZ,MAAK;AAAA,QACL,eAAaK;AAAA,QACb,oBAAkBY,EAAY;AAAA,QAC9B,WAAWN;AAAA,QACX,KAAKS,EAAU,CAACb,GAAKE,CAAQ,CAAC;AAAA,QAC9B,iBAAeP;AAAA,QACd,GAAGgB;AAAA,QACH,GAAGZ;AAAA,QAEH,UAAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAjB,EAAQ,cAAc;"}
1
+ {"version":3,"file":"Trigger.js","sources":["../src/components/Trigger/HelpSign.tsx","../src/components/Trigger/Trigger.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIcon, SvgPathProps } from '../Icon';\n\nconst HelpSign: React.FC<SvgPathProps> = ({ size, isHovered }: SvgPathProps): React.ReactElement => {\n const normal = (\n <path d=\"M18.854 19.678c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.222 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.84-3.424l1.042-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.136 1.022l-2.564-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 10.186c0-.908.726-1.678 1.656-1.678.908 0 1.656.77 1.656 1.678 0 .907-.748 1.657-1.656 1.657-.93 0-1.656-.75-1.656-1.657Z\" />\n );\n\n const normalHover = (\n <path d=\"M18.854 18.178c0-2.268 1.701-4.74 5.126-4.74 3.358 0 5.172 2.223 5.172 4.536 0 1.793-.952 3.064-2.268 3.992l-.976.682c-.749.521-1.134 1.27-1.134 2.154 0 .047 0 .16.023.296h-2.269a46.85 46.85 0 0 0-.01-.139 8.554 8.554 0 0 1-.036-.724c0-1.36.522-2.471 1.838-3.424l1.044-.75c.75-.544 1.066-1.201 1.066-1.974 0-1.178-.793-2.29-2.45-2.29-1.679 0-2.563 1.293-2.563 2.585 0 .34.045.772.135 1.022l-2.563-.181a3.903 3.903 0 0 1-.135-1.044Zm3.176 11.686c0-.908.725-1.678 1.655-1.678.908 0 1.657.77 1.657 1.678 0 .907-.749 1.657-1.657 1.657-.93 0-1.655-.75-1.655-1.657Z\" />\n );\n\n const xSmall = (\n <path d=\"M23.98 14.937c-3.425 0-5.127 2.473-5.127 4.741 0 .363.047.726.137 1.044l2.563.182c-.09-.25-.136-.681-.136-1.022 0-1.292.885-2.586 2.563-2.586 1.658 0 2.45 1.112 2.45 2.291 0 .772-.317 1.43-1.065 1.974l-1.043.749c-1.317.953-1.84 2.065-1.84 3.425 0 .319.024.567.047.862h2.267c-.021-.135-.021-.25-.021-.295 0-.884.385-1.633 1.133-2.154l.976-.681c1.317-.93 2.27-2.2 2.27-3.993 0-2.314-1.816-4.537-5.174-4.537m-.294 13.248c-.93 0-1.656.773-1.656 1.678a1.65 1.65 0 0 0 1.656 1.657c.907 0 1.656-.748 1.656-1.657 0-.905-.749-1.678-1.656-1.678\" />\n );\n\n const xSmallHover = (\n <path d=\"M18.853 18.289c0-2.268 1.701-4.742 5.127-4.742 3.357 0 5.173 2.223 5.173 4.537 0 1.794-.953 3.065-2.27 3.994l-.976.681c-.747.52-1.133 1.27-1.133 2.154 0 .046 0 .16.022.295h-2.267a39.324 39.324 0 0 0-.01-.125 8.468 8.468 0 0 1-.037-.737c0-1.36.523-2.472 1.839-3.425l1.043-.75c.748-.543 1.065-1.201 1.065-1.973 0-1.18-.792-2.29-2.45-2.29-1.678 0-2.562 1.293-2.562 2.585 0 .341.045.772.135 1.022l-2.563-.183a3.914 3.914 0 0 1-.136-1.043Zm3.176 11.575c0-.907.726-1.679 1.656-1.679.908 0 1.657.772 1.657 1.68 0 .907-.749 1.656-1.657 1.656-.93 0-1.656-.749-1.656-1.657Z\" />\n );\n\n return getIcon({ size, isHovered, normal, normalHover, xSmall, xSmallHover });\n};\n\nexport default HelpSign;\n","import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HelpSign from './HelpSign';\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { useHover } from '../../hooks/useHover';\nimport { getColor } from '../../theme/currys';\nimport { getAriaLabelAttributes } from '../../utils/accessibility';\nimport { mergeRefs } from '../../utils/refs';\nimport Icon, { SvgIcon } from '../Icon';\n\nimport styles from './styles.module.scss';\n\nexport type TriggerTags = 'button' | 'span';\n\nexport type TriggerVariant = 'help'; // @todo Support variant='info' in later version\n\nexport type TriggerSize = 'medium' | 'large';\n\nexport type TriggerOnColor = 'onlight' | 'ondark';\n\nexport interface TriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {\n /**\n * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabel?: string;\n /**\n * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!\n */\n ariaLabelledById?: string;\n /**\n * Controls the icon and color. Default: help.\n */\n variant?: TriggerVariant;\n /**\n * Changes the design based on the background the trigger is placed on. Default: onlight.\n */\n onColor?: TriggerOnColor;\n /**\n * Size of the trigger. Default: medium.\n */\n size?: TriggerSize;\n /**\n * Indicates that the trigger is in use.\n */\n selected?: boolean;\n /**\n * Indicates that the trigger is hovered. Used in combination with htmlMarkup=span to force visual hover state.\n */\n isHovered?: boolean;\n /**\n * Changes the underlying element of the trigger. If set to span, the trigger will be a non-interactive icon. Default: button\n */\n htmlMarkup?: TriggerTags;\n /**\n * Classname will be applied to the button element.\n */\n className?: string;\n /**\n * Optional test id.\n */\n testId?: string;\n}\n\nconst iconMap: Record<TriggerVariant, SvgIcon> = {\n help: HelpSign,\n //info: InfoSignStroke, // @todo Support variant='info' in later version\n};\n\nconst iconSizeMap: Record<TriggerSize, IconSize> = {\n medium: IconSize.XSmall,\n large: IconSize.Small,\n};\n\nconst getIconColor = (onColor: TriggerOnColor, variant: TriggerVariant, isActive: boolean): string | undefined => {\n if (onColor === 'ondark') {\n return 'white';\n }\n\n const depth = isActive ? 800 : 600;\n\n if (variant === 'help') {\n return getColor('plum', depth);\n }\n\n if (variant === 'info') {\n return getColor('blueberry', depth);\n }\n};\n\nconst Trigger = React.forwardRef<HTMLButtonElement, TriggerProps>(\n (\n {\n ariaLabel,\n ariaLabelledById,\n variant = 'help',\n onColor = 'onlight',\n size = 'medium',\n selected = false,\n isHovered,\n htmlMarkup = 'button',\n className,\n testId,\n ...rest\n },\n ref\n ) => {\n const { isHovered: buttonIsHovered, hoverRef } = useHover<HTMLButtonElement>();\n\n const triggerClasses = classNames(\n styles.trigger,\n onColor === 'onlight' && styles[`trigger--${variant}`], // variants look the same when onColor=ondark\n onColor === 'ondark' && styles[`trigger--${onColor}`],\n styles[`trigger--${size}`],\n isHovered && styles[`trigger--hovered`],\n selected && styles[`trigger--selected`],\n className\n );\n\n const iconColor = getIconColor(onColor, variant, isHovered || buttonIsHovered || selected);\n\n const icon = <Icon svgIcon={iconMap[variant]} size={iconSizeMap[size]} color={iconColor} isHovered={isHovered || buttonIsHovered} />;\n\n if (htmlMarkup === 'span') {\n return (\n <span data-testid={testId} data-analyticsid={AnalyticsId.Trigger} className={triggerClasses}>\n {icon}\n </span>\n );\n }\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n return (\n <button\n aria-label={ariaLabel}\n type=\"button\"\n data-testid={testId}\n data-analyticsid={AnalyticsId.Trigger}\n className={triggerClasses}\n ref={mergeRefs([ref, hoverRef])}\n aria-expanded={selected}\n {...ariaLabelAttributes}\n {...rest}\n >\n {icon}\n </button>\n );\n }\n);\n\nTrigger.displayName = 'Trigger';\n\nexport default Trigger;\n"],"names":["HelpSign","size","isHovered","getIcon","jsx","iconMap","iconSizeMap","IconSize","getIconColor","onColor","variant","isActive","depth","getColor","Trigger","React","ariaLabel","ariaLabelledById","selected","htmlMarkup","className","testId","rest","ref","buttonIsHovered","hoverRef","useHover","triggerClasses","classNames","styles","iconColor","icon","Icon","AnalyticsId","ariaLabelAttributes","getAriaLabelAttributes","mergeRefs"],"mappings":";;;;;;;;;;AAIA,MAAMA,IAAmC,CAAC,EAAE,MAAAC,GAAM,WAAAC,QAiBzCC,EAAQ,EAAE,MAAAF,GAAM,WAAAC,GAAW,QAfhC,gBAAAE,EAAC,QAAK,EAAA,GAAE,ijBAAijB,CAAA,GAejhB,aAXxC,gBAAAA,EAAC,QAAK,EAAA,GAAE,kjBAAkjB,CAAA,GAWrgB,QAPrD,gBAAAA,EAAC,QAAK,EAAA,GAAE,yhBAAyhB,CAAA,GAOpe,aAH7D,gBAAAA,EAAC,QAAK,EAAA,GAAE,sjBAAsjB,CAAA,GAGpf,GC4CxEC,IAA2C;AAAA,EAC/C,MAAML;AAAA;AAER,GAEMM,IAA6C;AAAA,EACjD,QAAQC,EAAS;AAAA,EACjB,OAAOA,EAAS;AAClB,GAEMC,IAAe,CAACC,GAAyBC,GAAyBC,MAA0C;AAChH,MAAIF,MAAY;AACP,WAAA;AAGH,QAAAG,IAAQD,IAAW,MAAM;AAE/B,MAAID,MAAY;AACP,WAAAG,EAAS,QAAQD,CAAK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KAAKS,EAAU,CAACb,GAAKE,CAAQ,CAAC;AAAA,QAC9B,iBAAeP;AAAA,QACd,GAAGgB;AAAA,QACH,GAAGZ;AAAA,QAEH,UAAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAGP;AACF;AAEAjB,EAAQ,cAAc;"}
@@ -3,7 +3,7 @@ import { HTMLButtonProps, HTMLAnchorProps } from '../../constants';
3
3
  export type ButtonConcept = 'normal' | 'destructive';
4
4
  export type ButtonVariant = 'fill' | 'outline' | 'borderless';
5
5
  export type ButtonSize = 'medium' | 'large';
6
- export type ButtonMode = 'onlight' | 'ondark';
6
+ export type ButtonOnColor = 'onlight' | 'ondark';
7
7
  export type ButtonTags = 'button' | 'a';
8
8
  export type ButtonArrows = 'icon' | 'accessibility-character';
9
9
  export type ButtonTextPosition = 'left' | 'centered';
@@ -29,7 +29,7 @@ export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttri
29
29
  /** Changes the underlying element of the button. */
30
30
  htmlMarkup?: ButtonTags;
31
31
  /** Changes the button colors for different backgrounds. */
32
- mode?: ButtonMode;
32
+ onColor?: ButtonOnColor;
33
33
  /** Function that is called when the Button loses focus */
34
34
  onBlur?: () => void;
35
35
  /** Function that is called when clicked */
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { FormMode, FormSize } from '../../constants';
3
- export interface CheckboxProps extends Pick<React.InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'required' | 'onChange'> {
2
+ import { FormOnColor, FormSize } from '../../constants';
3
+ import { ErrorWrapperClassNameProps } from '../ErrorWrapper';
4
+ export interface CheckboxProps extends ErrorWrapperClassNameProps, Pick<React.InputHTMLAttributes<HTMLInputElement>, 'aria-describedby' | 'name' | 'value' | 'disabled' | 'checked' | 'required' | 'onChange'> {
4
5
  /** Adds custom classes to the element. */
5
6
  className?: string;
6
7
  /** The <Label/> next to the checkbox - sublabels kan ikke kombineres med large variant */
@@ -8,7 +9,7 @@ export interface CheckboxProps extends Pick<React.InputHTMLAttributes<HTMLInputE
8
9
  /** input id of the checkbox */
9
10
  inputId?: string;
10
11
  /** Changes the visuals of the checkbox */
11
- mode?: keyof typeof FormMode;
12
+ onColor?: keyof typeof FormOnColor;
12
13
  /** Changes the visuals of the checkbox */
13
14
  size?: keyof typeof FormSize;
14
15
  /** Activates Error style for the checkbox - This is can be true while errorText is empty, when in a FormGroup */
@@ -95,20 +95,6 @@ $checkbox-icon-size: 1.625rem;
95
95
  }
96
96
 
97
97
  .checkbox-wrapper {
98
- &--with-error {
99
- padding: getSpacer(s) getSpacer(2xs) getSpacer(m);
100
- background-color: $cherry100;
101
- border-left: 0.25rem solid $cherry600;
102
-
103
- @media (min-width: map.get($grid-breakpoints, md)) {
104
- padding: getSpacer(s) getSpacer(m) getSpacer(l);
105
- }
106
- }
107
-
108
- &--with-error#{&}--large {
109
- padding: getSpacer(m);
110
- }
111
-
112
98
  &--large {
113
99
  margin: getSpacer(2xs) 0;
114
100
  }
@@ -38,7 +38,6 @@ export type Styles = {
38
38
  'checkbox-label--on-dark': string;
39
39
  'checkbox-sublabel-wrapper': string;
40
40
  'checkbox-wrapper--large': string;
41
- 'checkbox-wrapper--with-error': string;
42
41
  };
43
42
 
44
43
  export type ClassNames = keyof Styles;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare enum DropdownMode {
2
+ export declare enum DropdownOnColor {
3
3
  onwhite = "onwhite",
4
4
  ongrey = "ongrey",
5
5
  onblueberry = "onblueberry",
@@ -21,7 +21,7 @@ export interface DropdownProps {
21
21
  /** Whether the dropdown is open or not */
22
22
  open?: boolean;
23
23
  /** Changes the visuals of the dropdown */
24
- mode?: keyof typeof DropdownMode;
24
+ onColor?: keyof typeof DropdownOnColor;
25
25
  /** Makes the background of the trigger transparent */
26
26
  transparent?: boolean;
27
27
  /** Makes the width of the full component adjust to its parent */
@@ -1,6 +1,6 @@
1
1
  import { jsx as d, jsxs as g } from "react/jsx-runtime";
2
2
  import c, { useRef as _, useState as Z } from "react";
3
- import R from "classnames";
3
+ import C from "classnames";
4
4
  import { theme as A } from "../../theme/index.js";
5
5
  import "../../hooks/useBreakpoint.js";
6
6
  import { useHover as q } from "../../hooks/useHover.js";
@@ -8,8 +8,8 @@ import { useToggle as F } from "../../hooks/useToggle.js";
8
8
  import { useKeyboardEvent as G } from "../../hooks/useKeyboardEvent.js";
9
9
  import { useOutsideEvent as J } from "../../hooks/useOutsideEvent.js";
10
10
  import { useUuid as y } from "../../hooks/useUuid.js";
11
- import { ZIndex as Q, KeyboardEventKey as n, AnalyticsId as W, IconSize as Y } from "../../constants.js";
12
- import { mergeRefs as M } from "../../utils/refs.js";
11
+ import { ZIndex as M, KeyboardEventKey as n, AnalyticsId as Q, IconSize as W } from "../../constants.js";
12
+ import { mergeRefs as Y } from "../../utils/refs.js";
13
13
  import { B as ee } from "../../Button.js";
14
14
  import { I as oe } from "../../Icon.js";
15
15
  import re from "../Icons/PlusSmall.js";
@@ -19,18 +19,18 @@ const Ie = (a) => {
19
19
  const {
20
20
  label: H,
21
21
  placeholder: K,
22
- closeText: O = "Lukk",
23
- noCloseButton: S = !1,
24
- onToggle: $,
25
- open: z = !1,
22
+ closeText: S = "Lukk",
23
+ noCloseButton: $ = !1,
24
+ onToggle: z,
25
+ open: B = !1,
26
26
  children: b,
27
- mode: p = "onwhite",
28
- transparent: B = !1,
27
+ onColor: p = "onwhite",
28
+ transparent: L = !1,
29
29
  fluid: h = !1,
30
- testId: L,
30
+ testId: P,
31
31
  disabled: i,
32
- zIndex: P = Q.PopOver
33
- } = a, u = _(null), w = _(null), { hoverRef: I, isHovered: T } = q(), { value: t, toggleValue: x } = F(!i && z, $), l = _(c.Children.map(b, () => c.createRef())), [f, U] = Z(), v = y(), N = y(), E = y(), k = () => {
32
+ zIndex: T = M.PopOver
33
+ } = a, u = _(null), w = _(null), { hoverRef: I, isHovered: U } = q(), { value: t, toggleValue: x } = F(!i && B, z), l = _(c.Children.map(b, () => c.createRef())), [f, j] = Z(), v = y(), N = y(), E = y(), k = () => {
34
34
  var e;
35
35
  x(), (e = w.current) == null || e.focus();
36
36
  }, m = () => {
@@ -38,7 +38,7 @@ const Ie = (a) => {
38
38
  x(), (e = I.current) == null || e.focus();
39
39
  };
40
40
  G(u, (e) => {
41
- var C;
41
+ var R;
42
42
  if (e.preventDefault(), !l.current)
43
43
  return;
44
44
  if (t) {
@@ -52,7 +52,7 @@ const Ie = (a) => {
52
52
  }
53
53
  const r = l.current.findIndex((X) => X.current === e.target);
54
54
  let s = r;
55
- e.key === n.Home ? s = 0 : e.key === n.End ? s = l.current.length - 1 : e.key === n.ArrowDown && r < l.current.length - 1 ? s = r + 1 : e.key === n.ArrowUp && r > 0 ? s = r - 1 : e.key === n.Enter && r !== -1 && (s = r), s !== -1 && ((C = l.current[s].current) == null || C.focus(), U(s));
55
+ e.key === n.Home ? s = 0 : e.key === n.End ? s = l.current.length - 1 : e.key === n.ArrowDown && r < l.current.length - 1 ? s = r + 1 : e.key === n.ArrowUp && r > 0 ? s = r - 1 : e.key === n.Enter && r !== -1 && (s = r), s !== -1 && ((R = l.current[s].current) == null || R.focus(), j(s));
56
56
  }, [
57
57
  n.ArrowDown,
58
58
  n.ArrowUp,
@@ -61,18 +61,18 @@ const Ie = (a) => {
61
61
  n.Escape,
62
62
  n.Home
63
63
  ]), J(u, () => t && m());
64
- const j = R(
64
+ const D = C(
65
65
  o.dropdown__toggle,
66
66
  !i && {
67
67
  [o["dropdown__toggle--on-white"]]: p === "onwhite",
68
68
  [o["dropdown__toggle--on-grey"]]: p === "ongrey",
69
69
  [o["dropdown__toggle--on-blueberry"]]: p === "onblueberry",
70
70
  [o["dropdown__toggle--on-cherry"]]: p === "oncherry",
71
- [o["dropdown__toggle--transparent"]]: B,
71
+ [o["dropdown__toggle--transparent"]]: L,
72
72
  [o["dropdown__toggle--fluid"]]: h,
73
73
  [o["dropdown__toggle--open"]]: t
74
74
  }
75
- ), D = R(o.dropdown__content, t && o["dropdown__content--open"]), V = c.Children.map(b, (e, r) => /* @__PURE__ */ d("li", { className: o.dropdown__input, role: "option", id: `${E}-${r}`, "aria-selected": r === f, children: c.isValidElement(e) && l.current && l.current[r] ? c.cloneElement(e, { ref: M([e.props.ref, l.current[r]]) }) : e }));
75
+ ), O = C(o.dropdown__content, t && o["dropdown__content--open"]), V = c.Children.map(b, (e, r) => /* @__PURE__ */ d("li", { className: o.dropdown__input, role: "option", id: `${E}-${r}`, "aria-selected": r === f, children: c.isValidElement(e) && l.current && l.current[r] ? c.cloneElement(e, { ref: Y([e.props.ref, l.current[r]]) }) : e }));
76
76
  return /* @__PURE__ */ g("div", { className: o.dropdown, ref: u, children: [
77
77
  /* @__PURE__ */ d("span", { id: v, className: o.dropdown__label, children: H }),
78
78
  /* @__PURE__ */ g(
@@ -80,10 +80,10 @@ const Ie = (a) => {
80
80
  {
81
81
  type: "button",
82
82
  onClick: () => !t && k(),
83
- className: j,
83
+ className: D,
84
84
  ref: I,
85
- "data-testid": L,
86
- "data-analyticsid": W.Dropdown,
85
+ "data-testid": P,
86
+ "data-analyticsid": Q.Dropdown,
87
87
  disabled: i,
88
88
  "aria-labelledby": N,
89
89
  "aria-haspopup": "listbox",
@@ -96,14 +96,14 @@ const Ie = (a) => {
96
96
  color: i ? A.palette.neutral700 : A.palette.blueberry600,
97
97
  svgIcon: re,
98
98
  className: o.dropdown__icon,
99
- isHovered: !i && T,
100
- size: Y.XSmall
99
+ isHovered: !i && U,
100
+ size: W.XSmall
101
101
  }
102
102
  )
103
103
  ]
104
104
  }
105
105
  ),
106
- /* @__PURE__ */ g("div", { className: D, style: { width: h ? "100%" : "auto", zIndex: P }, children: [
106
+ /* @__PURE__ */ g("div", { className: O, style: { width: h ? "100%" : "auto", zIndex: T }, children: [
107
107
  /* @__PURE__ */ d(
108
108
  "ul",
109
109
  {
@@ -116,12 +116,12 @@ const Ie = (a) => {
116
116
  children: V
117
117
  }
118
118
  ),
119
- !S && /* @__PURE__ */ d("div", { className: o.dropdown__close, children: /* @__PURE__ */ d(ee, { onClick: m, "aria-expanded": t, children: O }) })
119
+ !$ && /* @__PURE__ */ d("div", { className: o.dropdown__close, children: /* @__PURE__ */ d(ee, { onClick: m, "aria-expanded": t, children: S }) })
120
120
  ] })
121
121
  ] });
122
122
  };
123
123
  export {
124
- ne as DropdownMode,
124
+ ne as DropdownOnColor,
125
125
  Ie as default
126
126
  };
127
127
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n useUuid,\n} from '../..';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Close button text */\n closeText?: string;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n mode?: keyof typeof DropdownMode;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n closeText = 'Lukk',\n noCloseButton = false,\n onToggle,\n open = false,\n children,\n mode = DropdownMode.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n } = props;\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const [currentIndex, setCurrentIndex] = useState<number>();\n const labelId = useUuid();\n const toggleLabelId = useUuid();\n const optionIdPrefix = useUuid();\n\n const handleOpen = (): void => {\n toggleIsOpen();\n optionsRef.current?.focus();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n event.preventDefault();\n\n if (!inputRefList.current) {\n return;\n }\n\n if (!isOpen) {\n handleOpen();\n return;\n } else if (event.key === KeyboardEventKey.Escape && isOpen) {\n handleClose();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n if (nextIndex !== -1) {\n inputRefList.current[nextIndex].current?.focus();\n setCurrentIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: mode === DropdownMode.onwhite,\n [styles['dropdown__toggle--on-grey']]: mode === DropdownMode.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: mode === DropdownMode.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: mode === DropdownMode.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => (\n <li className={styles.dropdown__input} role=\"option\" id={`${optionIdPrefix}-${index}`} aria-selected={index === currentIndex}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, { ref: mergeRefs([child.props.ref, inputRefList.current[index]]) })\n : child}\n </li>\n ));\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => !isOpen && handleOpen()}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div className={contentClasses} style={{ width: fluid ? '100%' : `auto`, zIndex: zIndex }}>\n <ul\n className={styles.dropdown__options}\n role=\"listbox\"\n aria-labelledby={labelId}\n tabIndex={-1}\n aria-activedescendant={typeof currentIndex !== 'undefined' ? `${optionIdPrefix}-${currentIndex}` : undefined}\n ref={optionsRef}\n >\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose} aria-expanded={isOpen}>\n {closeText}\n </Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownMode","Dropdown","props","label","placeholder","closeText","noCloseButton","onToggle","open","children","mode","transparent","fluid","testId","disabled","zIndex","ZIndex","dropdownRef","useRef","optionsRef","buttonRef","isHovered","useHover","isOpen","toggleIsOpen","useToggle","inputRefList","React","currentIndex","setCurrentIndex","useState","labelId","useUuid","toggleLabelId","optionIdPrefix","handleOpen","_a","handleClose","useKeyboardEvent","event","KeyboardEventKey","index","x","nextIndex","useOutsideEvent","toggleClasses","classNames","styles","contentClasses","renderChildren","child","jsx","mergeRefs","jsxs","AnalyticsId","Icon","theme","PlusSmall","IconSize","Button"],"mappings":";;;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,cAAc,eACdA,EAAA,WAAW,YAJDA,IAAAA,MAAA,CAAA,CAAA;AAoCZ,MAAMC,KAAoC,CAASC,MAAA;AAC3C,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC,IAAgB;AAAA,IAChB,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,OAAAC,IAAQ;AAAA,IACR,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;AAAA,EACd,IAAAd,GACEe,IAAcC,EAAuB,IAAI,GACzCC,IAAaD,EAAyB,IAAI,GAC1C,EAAE,UAAUE,GAAW,WAAAC,MAAcC,EAA4B,GACjE,EAAE,OAAOC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dropdown.tsx"],"sourcesContent":["import React, { useRef, useState } from 'react';\n\nimport classNames from 'classnames';\n\nimport {\n AnalyticsId,\n IconSize,\n KeyboardEventKey,\n ZIndex,\n theme,\n useHover,\n useKeyboardEvent,\n useOutsideEvent,\n useToggle,\n useUuid,\n} from '../..';\nimport { mergeRefs } from '../../utils/refs';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport PlusSmall from '../Icons/PlusSmall';\n\nimport styles from './styles.module.scss';\n\nexport enum DropdownOnColor {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n oncherry = 'oncherry',\n}\n\nexport interface DropdownProps {\n /** Label for dropdown. Visible for screen readers */\n label: string;\n /** Text on the trigger button that opens the dropdown */\n placeholder: string;\n /** Sets the dropdown content */\n children: React.ReactNode;\n /** Close button text */\n closeText?: string;\n /** No close button */\n noCloseButton?: boolean;\n /** Called when dropdown is open/closed */\n onToggle?: (isOpen: boolean) => void;\n /** Whether the dropdown is open or not */\n open?: boolean;\n /** Changes the visuals of the dropdown */\n onColor?: keyof typeof DropdownOnColor;\n /** Makes the background of the trigger transparent */\n transparent?: boolean;\n /** Makes the width of the full component adjust to its parent */\n fluid?: boolean;\n /** Makes the dropdown disabled */\n disabled?: boolean;\n /** Sets the data-testid attribute on the dropdown button */\n testId?: string;\n /** Overrides the default z-index of the DropDownContent */\n zIndex?: number;\n}\n\nconst Dropdown: React.FC<DropdownProps> = props => {\n const {\n label,\n placeholder,\n closeText = 'Lukk',\n noCloseButton = false,\n onToggle,\n open = false,\n children,\n onColor = DropdownOnColor.onwhite,\n transparent = false,\n fluid = false,\n testId,\n disabled,\n zIndex = ZIndex.PopOver,\n } = props;\n const dropdownRef = useRef<HTMLDivElement>(null);\n const optionsRef = useRef<HTMLUListElement>(null);\n const { hoverRef: buttonRef, isHovered } = useHover<HTMLButtonElement>();\n const { value: isOpen, toggleValue: toggleIsOpen } = useToggle(!disabled && open, onToggle);\n const inputRefList = useRef(React.Children.map(children, () => React.createRef<HTMLElement>()));\n const [currentIndex, setCurrentIndex] = useState<number>();\n const labelId = useUuid();\n const toggleLabelId = useUuid();\n const optionIdPrefix = useUuid();\n\n const handleOpen = (): void => {\n toggleIsOpen();\n optionsRef.current?.focus();\n };\n\n const handleClose = (): void => {\n toggleIsOpen();\n buttonRef.current?.focus();\n };\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n event.preventDefault();\n\n if (!inputRefList.current) {\n return;\n }\n\n if (!isOpen) {\n handleOpen();\n return;\n } else if (event.key === KeyboardEventKey.Escape && isOpen) {\n handleClose();\n return;\n }\n\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (event.key === KeyboardEventKey.ArrowDown && index < inputRefList.current.length - 1) {\n nextIndex = index + 1;\n } else if (event.key === KeyboardEventKey.ArrowUp && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter && index !== -1) {\n nextIndex = index;\n }\n if (nextIndex !== -1) {\n inputRefList.current[nextIndex].current?.focus();\n setCurrentIndex(nextIndex);\n }\n };\n\n useKeyboardEvent(dropdownRef, handleKeyboardNavigation, [\n KeyboardEventKey.ArrowDown,\n KeyboardEventKey.ArrowUp,\n KeyboardEventKey.End,\n KeyboardEventKey.Enter,\n KeyboardEventKey.Escape,\n KeyboardEventKey.Home,\n ]);\n\n useOutsideEvent(dropdownRef, () => isOpen && handleClose());\n\n const toggleClasses = classNames(\n styles.dropdown__toggle,\n !disabled && {\n [styles['dropdown__toggle--on-white']]: onColor === DropdownOnColor.onwhite,\n [styles['dropdown__toggle--on-grey']]: onColor === DropdownOnColor.ongrey,\n [styles['dropdown__toggle--on-blueberry']]: onColor === DropdownOnColor.onblueberry,\n [styles['dropdown__toggle--on-cherry']]: onColor === DropdownOnColor.oncherry,\n [styles['dropdown__toggle--transparent']]: transparent,\n [styles['dropdown__toggle--fluid']]: fluid,\n [styles['dropdown__toggle--open']]: isOpen,\n }\n );\n\n const contentClasses = classNames(styles.dropdown__content, isOpen && styles['dropdown__content--open']);\n\n const renderChildren = React.Children.map(children, (child, index) => (\n <li className={styles.dropdown__input} role=\"option\" id={`${optionIdPrefix}-${index}`} aria-selected={index === currentIndex}>\n {React.isValidElement(child) && inputRefList.current && inputRefList.current[index]\n ? React.cloneElement(child as React.ReactElement, { ref: mergeRefs([child.props.ref, inputRefList.current[index]]) })\n : child}\n </li>\n ));\n\n return (\n <div className={styles.dropdown} ref={dropdownRef}>\n <span id={labelId} className={styles.dropdown__label}>\n {label}\n </span>\n <button\n type=\"button\"\n onClick={(): false | void => !isOpen && handleOpen()}\n className={toggleClasses}\n ref={buttonRef}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Dropdown}\n disabled={disabled}\n aria-labelledby={toggleLabelId}\n aria-haspopup=\"listbox\"\n aria-expanded={isOpen}\n >\n <span id={toggleLabelId} className={styles.dropdown__toggle__label}>\n {placeholder}\n </span>\n <Icon\n color={disabled ? theme.palette.neutral700 : theme.palette.blueberry600}\n svgIcon={PlusSmall}\n className={styles.dropdown__icon}\n isHovered={!disabled && isHovered}\n size={IconSize.XSmall}\n />\n </button>\n <div className={contentClasses} style={{ width: fluid ? '100%' : `auto`, zIndex: zIndex }}>\n <ul\n className={styles.dropdown__options}\n role=\"listbox\"\n aria-labelledby={labelId}\n tabIndex={-1}\n aria-activedescendant={typeof currentIndex !== 'undefined' ? `${optionIdPrefix}-${currentIndex}` : undefined}\n ref={optionsRef}\n >\n {renderChildren}\n </ul>\n {!noCloseButton && (\n <div className={styles.dropdown__close}>\n <Button onClick={handleClose} aria-expanded={isOpen}>\n {closeText}\n </Button>\n </div>\n )}\n </div>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"names":["DropdownOnColor","Dropdown","props","label","placeholder","closeText","noCloseButton","onToggle","open","children","onColor","transparent","fluid","testId","disabled","zIndex","ZIndex","dropdownRef","useRef","optionsRef","buttonRef","isHovered","useHover","isOpen","toggleIsOpen","useToggle","inputRefList","React","currentIndex","setCurrentIndex","useState","labelId","useUuid","toggleLabelId","optionIdPrefix","handleOpen","_a","handleClose","useKeyboardEvent","event","KeyboardEventKey","index","x","nextIndex","useOutsideEvent","toggleClasses","classNames","styles","contentClasses","renderChildren","child","jsx","mergeRefs","jsxs","AnalyticsId","Icon","theme","PlusSmall","IconSize","Button"],"mappings":";;;;;;;;;;;;;;;;AAuBY,IAAAA,uBAAAA,OACVA,EAAA,UAAU,WACVA,EAAA,SAAS,UACTA,EAAA,cAAc,eACdA,EAAA,WAAW,YAJDA,IAAAA,MAAA,CAAA,CAAA;AAoCZ,MAAMC,KAAoC,CAASC,MAAA;AAC3C,QAAA;AAAA,IACJ,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC,IAAgB;AAAA,IAChB,UAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC;AAAA,IACA,SAAAC,IAAU;AAAA,IACV,aAAAC,IAAc;AAAA,IACd,OAAAC,IAAQ;AAAA,IACR,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAAC,IAASC,EAAO;AAAA,EACd,IAAAd,GACEe,IAAcC,EAAuB,IAAI,GACzCC,IAAaD,EAAyB,IAAI,GAC1C,EAAE,UAAUE,GAAW,WAAAC,MAAcC,EAA4B,GACjE,EAAE,OAAOC,GAAQ,aAAaC,EAAA,IAAiBC,EAAU,CAACX,KAAYN,GAAMD,CAAQ,GACpFmB,IAAeR,EAAOS,EAAM,SAAS,IAAIlB,GAAU,MAAMkB,EAAM,UAAwB,CAAA,CAAC,GACxF,CAACC,GAAcC,CAAe,IAAIC,EAAiB,GACnDC,IAAUC,KACVC,IAAgBD,KAChBE,IAAiBF,KAEjBG,IAAa,MAAY;;AAChB,IAAAX,MACbY,IAAAjB,EAAW,YAAX,QAAAiB,EAAoB;AAAA,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yBACxC,UACH3C,GAAA;AAAA,UACA,gBAAA+C;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,OAAOzC,IAAW0C,EAAM,QAAQ,aAAaA,EAAM,QAAQ;AAAA,cAC3D,SAASC;AAAA,cACT,WAAWV,EAAO;AAAA,cAClB,WAAW,CAACjC,KAAYO;AAAA,cACxB,MAAMqC,EAAS;AAAA,YAAA;AAAA,UACjB;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,IACA,gBAAAL,EAAC,OAAI,EAAA,WAAWL,GAAgB,OAAO,EAAE,OAAOpC,IAAQ,SAAS,QAAQ,QAAAG,EAAA,GACvE,UAAA;AAAA,MAAA,gBAAAoC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAWJ,EAAO;AAAA,UAClB,MAAK;AAAA,UACL,mBAAiBhB;AAAA,UACjB,UAAU;AAAA,UACV,yBAAuB,OAAOH,IAAiB,MAAc,GAAGM,CAAc,IAAIN,CAAY,KAAK;AAAA,UACnG,KAAKT;AAAA,UAEJ,UAAA8B;AAAA,QAAA;AAAA,MACH;AAAA,MACC,CAAC3C,KACC,gBAAA6C,EAAA,OAAA,EAAI,WAAWJ,EAAO,iBACrB,UAAC,gBAAAI,EAAAQ,IAAA,EAAO,SAAStB,GAAa,iBAAed,GAC1C,YACH,CAAA,GACF;AAAA,IAAA,GAEJ;AAAA,EACF,EAAA,CAAA;AAEJ;"}
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
+ export interface ErrorWrapperClassNameProps {
3
+ errorWrapperClassName?: string;
4
+ }
2
5
  export interface ErrorWrapperProps {
3
6
  /** Form component */
4
7
  children?: React.ReactNode;
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import { PaletteNames } from '../../theme/palette';
3
3
  import { ListHeaderType } from '../ListHeader/ListHeader';
4
4
  import { TitleTags } from '../Title';
5
- export type ExpanderListColors = PaletteNames;
5
+ export type ExpanderListColors = Extract<PaletteNames, 'white' | 'blueberry' | 'cherry' | 'neutral'>;
6
6
  export interface ExpanderType extends React.ForwardRefExoticComponent<ExpanderProps & React.RefAttributes<HTMLLIElement>> {
7
7
  ListHeader?: ListHeaderType;
8
8
  }
9
9
  export interface ExpanderListCompound extends React.ForwardRefExoticComponent<ExpanderListProps & React.RefAttributes<HTMLUListElement>> {
10
10
  Expander: ExpanderType;
11
11
  }
12
- export type ExpanderListVariant = 'line' | 'outline' | 'fill';
12
+ export type ExpanderListVariant = 'line' | 'outline' | 'fill' | 'fill-negative';
13
13
  interface ExpanderListProps {
14
14
  /** Toggles accordion functionality for the expanders. */
15
15
  accordion?: boolean;
@@ -19,14 +19,12 @@ interface ExpanderListProps {
19
19
  childPadding?: boolean;
20
20
  /** Adds custom classes to the element. */
21
21
  className?: string;
22
- /** Changes the link list background color on hover. */
22
+ /** Changes the colors of the list. */
23
23
  color?: ExpanderListColors;
24
24
  /** Changes the font size. */
25
25
  large?: boolean;
26
26
  /** Whether to render children when closed (in which case they are hidden with CSS). Default: false */
27
27
  renderChildrenWhenClosed?: boolean;
28
- /** Stick expander trigger to top of screen while scrolling down */
29
- sticky?: boolean;
30
28
  /** Sets the data-testid attribute. */
31
29
  testId?: string;
32
30
  /** Sets visual priority */
@@ -53,6 +51,6 @@ type ExpanderProps = Modify<React.HTMLAttributes<HTMLButtonElement>, {
53
51
  onExpand?: (isExpanded: boolean) => void;
54
52
  /** Overrides the default z-index of the expander header */
55
53
  zIndex?: number;
56
- }> & Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'sticky' | 'variant'>;
54
+ }> & Pick<ExpanderListProps, 'renderChildrenWhenClosed' | 'variant'>;
57
55
  export declare const ExpanderList: ExpanderListCompound;
58
56
  export default ExpanderList;