@helsenorge/designsystem-react 4.3.0 → 5.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 (44) hide show
  1. package/CHANGELOG.md +3 -11
  2. package/Panel.js +1 -1
  3. package/Panel.js.map +1 -1
  4. package/README.md +51 -9
  5. package/components/HighlightBox/HighlightBox.d.ts +1 -1
  6. package/components/HighlightBox/HighlightBox.d.ts.map +1 -1
  7. package/components/HighlightBox/componentdata.json +1 -1
  8. package/components/HighlightBox/index.js.map +1 -1
  9. package/components/HighlightBox/styles.module.scss +10 -13
  10. package/components/HighlightBox/styles.module.scss.d.ts +0 -2
  11. package/components/Label/componentdata.json +1 -1
  12. package/components/Panel/Panel.d.ts +0 -2
  13. package/components/Panel/Panel.d.ts.map +1 -1
  14. package/components/Panel/componentdata.json +1 -1
  15. package/components/Table/styles.module.scss +2 -2
  16. package/components/Tag/styles.module.scss +15 -0
  17. package/constants.d.ts +0 -2
  18. package/constants.d.ts.map +1 -1
  19. package/constants.js +1 -1
  20. package/constants.js.map +1 -1
  21. package/package.json +1 -1
  22. package/scss/_palette.scss +0 -15
  23. package/components/DictionaryTrigger/DictionaryTrigger.d.ts +0 -22
  24. package/components/DictionaryTrigger/DictionaryTrigger.d.ts.map +0 -1
  25. package/components/DictionaryTrigger/componentdata.json +0 -1
  26. package/components/DictionaryTrigger/index.d.ts +0 -4
  27. package/components/DictionaryTrigger/index.d.ts.map +0 -1
  28. package/components/DictionaryTrigger/index.js +0 -2
  29. package/components/DictionaryTrigger/index.js.map +0 -1
  30. package/components/DictionaryTrigger/styles.module.scss +0 -41
  31. package/components/DictionaryTrigger/styles.module.scss.d.ts +0 -9
  32. package/components/Trigger/HelpSign.d.ts +0 -5
  33. package/components/Trigger/HelpSign.d.ts.map +0 -1
  34. package/components/Trigger/InfoSignStroke.d.ts +0 -5
  35. package/components/Trigger/InfoSignStroke.d.ts.map +0 -1
  36. package/components/Trigger/Trigger.d.ts +0 -41
  37. package/components/Trigger/Trigger.d.ts.map +0 -1
  38. package/components/Trigger/componentdata.json +0 -1
  39. package/components/Trigger/index.d.ts +0 -4
  40. package/components/Trigger/index.d.ts.map +0 -1
  41. package/components/Trigger/index.js +0 -2
  42. package/components/Trigger/index.js.map +0 -1
  43. package/components/Trigger/styles.module.scss +0 -85
  44. package/components/Trigger/styles.module.scss.d.ts +0 -14
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { SvgPathProps } from '../Icons';
3
- declare const HelpSign: React.FC<SvgPathProps>;
4
- export default HelpSign;
5
- //# sourceMappingURL=HelpSign.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HelpSign.d.ts","sourceRoot":"","sources":["../../../src/components/Trigger/HelpSign.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAW,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAkBpC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { SvgPathProps } from '../Icons';
3
- declare const InfoSignStroke: React.FC<SvgPathProps>;
4
- export default InfoSignStroke;
5
- //# sourceMappingURL=InfoSignStroke.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InfoSignStroke.d.ts","sourceRoot":"","sources":["../../../src/components/Trigger/InfoSignStroke.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAW,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAkB1C,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1,41 +0,0 @@
1
- import React from 'react';
2
- export type TriggerVariant = 'help';
3
- export type TriggerSize = 'medium' | 'large';
4
- export type TriggerMode = 'onlight' | 'ondark';
5
- export interface TriggerProps extends Pick<React.InputHTMLAttributes<HTMLButtonElement>, 'onClick' | 'aria-haspopup' | 'aria-controls'> {
6
- /**
7
- * Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!
8
- */
9
- ariaLabel?: string;
10
- /**
11
- * Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!
12
- */
13
- ariaLabelledById?: string;
14
- /**
15
- * Controls the icon and color. Default: help.
16
- */
17
- variant?: TriggerVariant;
18
- /**
19
- * Changes the design based on the background the trigger is placed on. Default: onlight.
20
- */
21
- mode?: TriggerMode;
22
- /**
23
- * Size of the trigger. Default: medium.
24
- */
25
- size?: TriggerSize;
26
- /**
27
- * Indicates that the trigger is in use.
28
- */
29
- selected?: boolean;
30
- /**
31
- * Classname will be applied to the button element.
32
- */
33
- className?: string;
34
- /**
35
- * Optional test id.
36
- */
37
- testId?: string;
38
- }
39
- declare const Trigger: React.ForwardRefExoticComponent<TriggerProps & React.RefAttributes<HTMLButtonElement>>;
40
- export default Trigger;
41
- //# sourceMappingURL=Trigger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Trigger.d.ts","sourceRoot":"","sources":["../../../src/components/Trigger/Trigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7C,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/C,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,EAAE,SAAS,GAAG,eAAe,GAAG,eAAe,CAAC;IACrI;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA4BD,QAAA,MAAM,OAAO,wFAmCZ,CAAC;AAIF,eAAe,OAAO,CAAC"}
@@ -1 +0,0 @@
1
- {"props":{"ariaLabel":{"defaultValue":null,"description":"Sets aria-label of the trigger. ariaLabel or ariaLabelledById MUST be set!","name":"ariaLabel","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"string"}},"ariaLabelledById":{"defaultValue":null,"description":"Sets aria-labelledby of the trigger. ariaLabel or ariaLabelledById MUST be set!","name":"ariaLabelledById","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"string"}},"variant":{"defaultValue":{"value":"help"},"description":"Controls the icon and color. Default: help.","name":"variant","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"enum","raw":"\"help\"","value":[{"value":"\"help\""}]}},"mode":{"defaultValue":{"value":"onlight"},"description":"Changes the design based on the background the trigger is placed on. Default: onlight.","name":"mode","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"enum","raw":"TriggerMode","value":[{"value":"\"onlight\""},{"value":"\"ondark\""}]}},"size":{"defaultValue":{"value":"medium"},"description":"Size of the trigger. Default: medium.","name":"size","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"enum","raw":"TriggerSize","value":[{"value":"\"medium\""},{"value":"\"large\""}]}},"selected":{"defaultValue":{"value":"false"},"description":"Indicates that the trigger is in use.","name":"selected","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"boolean"}},"className":{"defaultValue":null,"description":"Classname will be applied to the button element.","name":"className","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"string"}},"testId":{"defaultValue":null,"description":"Optional test id.","name":"testId","parent":{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"},"declarations":[{"fileName":"src/components/Trigger/Trigger.tsx","name":"TriggerProps"}],"required":false,"type":{"name":"string"}},"onClick":{"defaultValue":null,"description":"","name":"onClick","parent":{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"DOMAttributes"},"declarations":[{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"DOMAttributes"}],"required":false,"type":{"name":"MouseEventHandler<HTMLButtonElement>"}},"aria-haspopup":{"defaultValue":null,"description":"Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by an element.","name":"aria-haspopup","parent":{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"AriaAttributes"},"declarations":[{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"AriaAttributes"}],"required":false,"type":{"name":"boolean | \"false\" | \"true\" | \"menu\" | \"listbox\" | \"tree\" | \"grid\" | \"dialog\""}},"aria-controls":{"defaultValue":null,"description":"Identifies the element (or elements) whose contents or presence are controlled by the current element.\n@see aria-owns.","name":"aria-controls","parent":{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"AriaAttributes"},"declarations":[{"fileName":"designsystem/node_modules/@types/react/index.d.ts","name":"AriaAttributes"}],"required":false,"type":{"name":"string"}}}}
@@ -1,4 +0,0 @@
1
- import Trigger from './Trigger';
2
- export * from './Trigger';
3
- export default Trigger;
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Trigger/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,eAAe,OAAO,CAAC"}
@@ -1,2 +0,0 @@
1
- import e from"react";import x from"classnames";import{getIcon as y,Icon as E}from"../Icons/Icon.js";import{IconSize as n,AnalyticsId as I}from"../../constants.js";import{useHover as M}from"../../hooks/useHover.js";import{getColor as s}from"../../theme/currys/color.js";import{getAriaLabelAttributes as Z}from"../../utils/accessibility.js";import{mergeRefs as v}from"../../utils/refs.js";import c from"./styles.module.scss";import"../../hooks/useUuid.js";import"../../uuid.js";import"../../utils/environment.js";import"../../theme/index.js";import"../../theme/grid.js";import"../../theme/palette.js";import"../../theme/spacers.js";const $=({size:t,isHovered:o})=>y({size:t,isHovered:o,normal:e.createElement("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"}),normalHover:e.createElement("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"}),xSmall:e.createElement("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"}),xSmallHover:e.createElement("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"})}),A=$,C={help:A},R={medium:n.XSmall,large:n.Small},T=(t,o,l)=>{if(t==="ondark")return"white";const r=l?800:600;if(o==="help")return s("plum",r);if(o==="info")return s("blueberry",r)},p=e.forwardRef(({ariaLabel:t,ariaLabelledById:o,variant:l="help",mode:r="onlight",size:a="medium",selected:m=!1,className:g,testId:f,...d},h)=>{const{isHovered:i,hoverRef:u}=M(),S=x(c.trigger,r==="onlight"&&c[`trigger--${l}`],c[`trigger--${r}`],c[`trigger--${a}`],g),b=Z({label:t,id:o}),H=T(r,l,i||m);return e.createElement("button",{"aria-label":t,type:"button","data-testid":f,"data-analyticsid":I.Trigger,className:S,ref:v([h,u]),"aria-expanded":m,...b,...d},e.createElement(E,{svgIcon:C[l],size:R[a],color:H,isHovered:i}))});p.displayName="Trigger";const Q=p;export{Q as default};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Trigger/HelpSign.tsx","../../../src/components/Trigger/Trigger.tsx"],"sourcesContent":["import React from 'react';\n\nimport { getIcon, SvgPathProps } from '../Icons';\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 '../Icons';\n\nimport styles from './styles.module.scss';\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 * 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 { ariaLabel, ariaLabelledById, variant = 'help', mode = 'onlight', size = 'medium', selected = false, className, testId, ...rest },\n ref\n ) => {\n const { isHovered, 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 styles[`trigger--${mode}`],\n styles[`trigger--${size}`],\n className\n );\n\n const ariaLabelAttributes = getAriaLabelAttributes({ label: ariaLabel, id: ariaLabelledById });\n\n const iconColor = getIconColor(mode, variant, isHovered || selected);\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 svgIcon={iconMap[variant]} size={iconSizeMap[size]} color={iconColor} isHovered={isHovered} />\n </button>\n );\n }\n);\n\nTrigger.displayName = 'Trigger';\n\nexport default Trigger;\n"],"names":["HelpSign","size","isHovered","getIcon","React","HelpSign$1","iconMap","iconSizeMap","IconSize","getIconColor","mode","variant","isActive","depth","getColor","Trigger","ariaLabel","ariaLabelledById","selected","className","testId","rest","ref","hoverRef","useHover","triggerClasses","classNames","styles","ariaLabelAttributes","getAriaLabelAttributes","iconColor","AnalyticsId","mergeRefs","Icon","Trigger$1"],"mappings":"snBAIA,MAAMA,EAAmC,CAAC,CAAE,KAAAC,EAAM,UAAAC,KAiBzCC,EAAQ,CAAE,KAAAF,EAAM,UAAAC,EAAW,OAfhCE,EAAA,cAAC,OAAK,CAAA,EAAE,gjBAAijB,CAAA,EAejhB,YAXxCA,EAAA,cAAC,OAAK,CAAA,EAAE,ijBAAkjB,CAAA,EAWrgB,OAPrDA,EAAA,cAAC,OAAK,CAAA,EAAE,whBAAyhB,CAAA,EAOpe,YAH7DA,EAAA,cAAC,OAAK,CAAA,EAAE,qjBAAsjB,CAAA,EAGpf,EAG9EC,EAAeL,EC+BTM,EAA2C,CAC/C,KAAMN,CAER,EAEMO,EAA6C,CACjD,OAAQC,EAAS,OACjB,MAAOA,EAAS,KAClB,EAEMC,EAAe,CAACC,EAAmBC,EAAyBC,IAA0C,CAC1G,GAAIF,IAAS,SACJ,MAAA,QAGH,MAAAG,EAAQD,EAAW,IAAM,IAE/B,GAAID,IAAY,OACP,OAAAG,EAAS,OAAQD,CAAK,EAG/B,GAAIF,IAAY,OACP,OAAAG,EAAS,YAAaD,CAAK,CAEtC,EAEME,EAAUX,EAAM,WACpB,CACE,CAAE,UAAAY,EAAW,iBAAAC,EAAkB,QAAAN,EAAU,OAAQ,KAAAD,EAAO,UAAW,KAAAT,EAAO,SAAU,SAAAiB,EAAW,GAAO,UAAAC,EAAW,OAAAC,EAAQ,GAAGC,GAC5HC,IACG,CACH,KAAM,CAAE,UAAApB,EAAW,SAAAqB,CAAS,EAAIC,EAA4B,EAEtDC,EAAiBC,EACrBC,EAAO,QACPjB,IAAS,WAAaiB,EAAO,YAAYhB,GAAS,EAClDgB,EAAO,YAAYjB,GAAM,EACzBiB,EAAO,YAAY1B,GAAM,EACzBkB,CAAA,EAGIS,EAAsBC,EAAuB,CAAE,MAAOb,EAAW,GAAIC,EAAkB,EAEvFa,EAAYrB,EAAaC,EAAMC,EAAST,GAAagB,CAAQ,EAGjE,OAAAd,EAAA,cAAC,SAAA,CACC,aAAYY,EACZ,KAAK,SACL,cAAaI,EACb,mBAAkBW,EAAY,QAC9B,UAAWN,EACX,IAAKO,EAAU,CAACV,EAAKC,CAAQ,CAAC,EAC9B,gBAAeL,EACd,GAAGU,EACH,GAAGP,CAAA,EAEHjB,EAAA,cAAA6B,EAAA,CAAK,QAAS3B,EAAQK,CAAO,EAAG,KAAMJ,EAAYN,CAAI,EAAG,MAAO6B,EAAW,UAAA5B,CAAsB,CAAA,CAAA,CAGxG,CACF,EAEAa,EAAQ,YAAc,UAEtB,MAAAmB,EAAenB"}
@@ -1,85 +0,0 @@
1
- @use 'sass:map';
2
- @import '../../scss/palette';
3
-
4
- .trigger {
5
- $trigger: &;
6
-
7
- vertical-align: text-bottom;
8
- display: inline-flex;
9
- align-items: center;
10
- justify-content: center;
11
- padding: 0;
12
- border-radius: 50%;
13
- border: 0;
14
- outline: none;
15
- background-color: transparent;
16
- cursor: pointer;
17
-
18
- &--medium {
19
- height: 24.18px;
20
- width: 24.18px;
21
- }
22
-
23
- &--large {
24
- height: 30.61px;
25
- width: 30.61px;
26
- }
27
-
28
- $variant-map: (
29
- 'help': 'plum',
30
- 'info': 'blueberry',
31
- );
32
-
33
- @each $variant, $color in $variant-map {
34
- &--#{$variant} {
35
- box-shadow: inset 0 0 0 1.5px map.get($palette-map, #{$color}600);
36
-
37
- &:hover {
38
- box-shadow: inset 0 0 0 1.5px map.get($palette-map, #{$color}800);
39
- background-color: rgba-to-rgb(rgba(map.get($palette-map, #{$color}600), 0.1));
40
- }
41
-
42
- &:focus-visible {
43
- box-shadow: inset 0 0 0 1.5px $black;
44
- outline: 1.5px solid $black;
45
- }
46
-
47
- &#{$trigger}[aria-expanded='true'] {
48
- box-shadow: inset 0 0 0 1.5px map.get($palette-map, #{$color}800);
49
- background-color: rgba-to-rgb(rgba(map.get($palette-map, #{$color}600), 0.1));
50
-
51
- &:hover {
52
- background-color: rgba-to-rgb(rgba(map.get($palette-map, #{$color}600), 0.2));
53
- }
54
-
55
- &:focus {
56
- background-color: rgba-to-rgb(rgba(map.get($palette-map, #{$color}600), 0.1));
57
- }
58
- }
59
- }
60
- }
61
-
62
- &--ondark {
63
- box-shadow: inset 0 0 0 1.5px $white;
64
-
65
- &:hover {
66
- background-color: rgba-to-rgb(rgba($plum50, 0.2), $plum600);
67
- }
68
-
69
- &:focus-visible {
70
- outline: 1.5px solid $white;
71
- }
72
-
73
- &#{$trigger}[aria-expanded='true'] {
74
- background-color: rgba-to-rgb(rgba($plum50, 0.1), $plum600);
75
-
76
- &:hover {
77
- background-color: rgba-to-rgb(rgba($plum50, 0.2), $plum600);
78
- }
79
-
80
- &:focus-visible {
81
- background-color: rgba-to-rgb(rgba($plum50, 0.1), $plum600);
82
- }
83
- }
84
- }
85
- }
@@ -1,14 +0,0 @@
1
- export type Styles = {
2
- trigger: string;
3
- 'trigger--help': string;
4
- 'trigger--info': string;
5
- 'trigger--large': string;
6
- 'trigger--medium': string;
7
- 'trigger--ondark': string;
8
- };
9
-
10
- export type ClassNames = keyof Styles;
11
-
12
- declare const styles: Styles;
13
-
14
- export default styles;