@helsenorge/designsystem-react 1.2.0 → 1.2.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.
@@ -1,6 +1,12 @@
1
- import React from 'react';
1
+ import React, { AriaAttributes } from 'react';
2
2
  export declare type NotificationPanelVariants = 'info' | 'warn' | 'alert' | 'crisis';
3
3
  export declare type NotificationPanelSizes = 'small' | 'medium' | 'large';
4
+ interface AriaLabelAttributesConfig {
5
+ label?: string;
6
+ id?: string;
7
+ }
8
+ declare type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
9
+ export declare const getAriaLabelAttributes: (config: AriaLabelAttributesConfig) => AriaLabelAttributes | undefined;
4
10
  interface NotificationPanelProps {
5
11
  /** Adds custom classes to the element. */
6
12
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationPanel.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationPanel/NotificationPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,oBAAY,yBAAyB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC7E,oBAAY,sBAAsB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAElE,UAAU,sBAAsB;IAC9B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mEAAmE;IACnE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,sBAAsB,CAAC;IAC9B,sFAAsF;IACtF,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IACl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C,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;IAClE,8FAA8F;IAC9F,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAiBD,QAAA,MAAM,iBAAiB,+FAqDrB,CAAC;AAEH,eAAe,iBAAiB,CAAC"}
@@ -5,12 +5,12 @@
5
5
  "description": "",
6
6
  "name": "label",
7
7
  "parent": {
8
- "fileName": "src/components/NotificationPanel/utils.tsx",
8
+ "fileName": "src/components/NotificationPanel/NotificationPanel.tsx",
9
9
  "name": "AriaLabelAttributesConfig"
10
10
  },
11
11
  "declarations": [
12
12
  {
13
- "fileName": "src/components/NotificationPanel/utils.tsx",
13
+ "fileName": "src/components/NotificationPanel/NotificationPanel.tsx",
14
14
  "name": "AriaLabelAttributesConfig"
15
15
  }
16
16
  ],
@@ -24,12 +24,12 @@
24
24
  "description": "",
25
25
  "name": "id",
26
26
  "parent": {
27
- "fileName": "src/components/NotificationPanel/utils.tsx",
27
+ "fileName": "src/components/NotificationPanel/NotificationPanel.tsx",
28
28
  "name": "AriaLabelAttributesConfig"
29
29
  },
30
30
  "declarations": [
31
31
  {
32
- "fileName": "src/components/NotificationPanel/utils.tsx",
32
+ "fileName": "src/components/NotificationPanel/NotificationPanel.tsx",
33
33
  "name": "AriaLabelAttributesConfig"
34
34
  }
35
35
  ],
@@ -1,2 +1,2 @@
1
- import r from"react";import{p as o}from"../../palette-f206f488.js";import{I as e}from"../../Icon-d69d65b3.js";import"../../constants-dbdea596.js";import{I as a}from"../../InfoSignStroke-f10d62aa.js";import{A as l}from"../../AlertSignStroke-32f09751.js";import{A as t}from"../../AlertSignFill-5df5b7c7.js";import"../../_tslib-b219470a.js";import"../../index-d1c0552c.js";import"../../useUuid-3b1e73f2.js";import"../../_rollupPluginBabelHelpers-0f007973.js";import"../../uuid-11037462.js";var i={info:r.createElement(e,{svgIcon:a,color:o.kiwi900,hoverColor:o.kiwi900}),warn:r.createElement(e,{svgIcon:l,color:"black",hoverColor:"black"}),alert:r.createElement(e,{svgIcon:t,color:o.cherry500,hoverColor:o.cherry500}),alertLabel:r.createElement(e,{svgIcon:l,color:o.cherry500,hoverColor:o.cherry500}),crisis:r.createElement(e,{svgIcon:t,color:o.banana200,hoverColor:o.banana200})},c=function(r){var o=r.label,e=r.id;return e?{"aria-labelledby":e}:o?{"aria-label":o}:void 0};export{c as getAriaLabelAttributes,i as variantToIconMap};
1
+ import{d as e}from"../../_rollupPluginBabelHelpers-0f007973.js";import a from"react";import{c as o}from"../../index-d1c0552c.js";import i from"./styles.module.scss";import{C as t}from"../../Close-08d48540.js";import{A as r}from"../../constants-dbdea596.js";import{u as n}from"../../useUuid-3b1e73f2.js";import{p as l}from"../../palette-f206f488.js";import{I as s}from"../../Icon-d69d65b3.js";import{I as c}from"../../InfoSignStroke-f10d62aa.js";import{A as m}from"../../AlertSignStroke-32f09751.js";import{A as d}from"../../AlertSignFill-5df5b7c7.js";import"../../X-867957f2.js";import"../Close/styles.module.scss";import"../../useBreakpoint-a74f5af5.js";import"../../grid-c105cad1.js";import"../../uuid-11037462.js";import"../../_tslib-b219470a.js";var f={info:a.createElement(s,{svgIcon:c,color:l.kiwi900,hoverColor:l.kiwi900}),warn:a.createElement(s,{svgIcon:m,color:"black",hoverColor:"black"}),alert:a.createElement(s,{svgIcon:d,color:l.cherry500,hoverColor:l.cherry500}),alertLabel:a.createElement(s,{svgIcon:m,color:l.cherry500,hoverColor:l.cherry500}),crisis:a.createElement(s,{svgIcon:d,color:l.banana200,hoverColor:l.banana200})},p=function(e){var a=e.label,o=e.id;return o?{"aria-labelledby":o}:a?{"aria-label":a}:void 0},b=function(t){var r=t.fluid,n=t.variant,l=t.shadow,s=t.children;if(r){var c=o(i["fluid-wrapper"],i["fluid-wrapper--".concat(n)],e({},i["fluid-wrapper--shadow"],l));return a.createElement("div",{className:c},s)}return s},u=a.forwardRef((function(l,s){var c,m,d=l.children,u=l.variant,v=void 0===u?"info":u,h=l.shadow,j=void 0!==h&&h,_=l.dismissable,E=void 0!==_&&_,g=l.onClick,w=l.label,C=l.fluid,I=void 0!==C&&C,y=l.size,k=l.className,N=l.testId,S=n(),A=!!w&&!d,L=o(i["notification-panel"],y&&i["notification-panel--".concat(y)],i["notification-panel--".concat(v)],(e(c={},i["notification-panel--shadow"],!I&&j),e(c,i["notification-panel--has-children"],!!d),e(c,i["notification-panel--label-only"],A),e(c,i["notification-panel--dismissable"],!A&&E),c),k),B=p({label:w,id:S});return a.createElement(b,null,a.createElement("section",Object.assign({ref:s,"data-testid":N,"data-analyticsid":r.NotificationPanel,className:L},B),a.createElement("span",{className:i["notification-panel__icon"]},f["alert"===v&&w&&!d?"alertLabel":v]),!A&&E&&a.createElement("span",{className:i["notification-panel__close"]},a.createElement(t,{ariaLabel:l.ariaLabelCloseBtn,onClick:g})),(m=o(i["notification-panel__content"],i["notification-panel__content--".concat(v)]),a.createElement("div",{className:m,id:w?void 0:S},w&&a.createElement("h1",{className:i["notification-panel__label"],dangerouslySetInnerHTML:{__html:w},id:S}),d))))}));export{u as default,p as getAriaLabelAttributes};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@helsenorge/designsystem-react",
3
3
  "sideEffects": false,
4
- "version": "1.2.0",
4
+ "version": "1.2.1",
5
5
  "description": "The official design system for Helsenorge built with React.",
6
6
  "repository": {
7
7
  "type": "tfs",
@@ -1,16 +0,0 @@
1
- import { AriaAttributes } from 'react';
2
- export declare const variantToIconMap: {
3
- info: JSX.Element;
4
- warn: JSX.Element;
5
- alert: JSX.Element;
6
- alertLabel: JSX.Element;
7
- crisis: JSX.Element;
8
- };
9
- interface AriaLabelAttributesConfig {
10
- label?: string;
11
- id?: string;
12
- }
13
- declare type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
14
- export declare const getAriaLabelAttributes: (config: AriaLabelAttributesConfig) => AriaLabelAttributes | undefined;
15
- export {};
16
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationPanel/utils.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAQ9C,eAAO,MAAM,gBAAgB;;;;;;CAM5B,CAAC;AAEF,UAAU,yBAAyB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,aAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,iBAAiB,CAAC,CAAC;AAElF,eAAO,MAAM,sBAAsB,WAAY,yBAAyB,KAAG,mBAAmB,GAAG,SAahG,CAAC"}