@helsenorge/designsystem-react 7.3.1 → 7.5.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 (33) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/components/Checkbox/Checkbox.js +24 -23
  3. package/components/Checkbox/Checkbox.js.map +1 -1
  4. package/components/HighlightBox/styles.module.scss +11 -7
  5. package/components/Input/Input.js +25 -24
  6. package/components/Input/Input.js.map +1 -1
  7. package/components/LinkList/LinkList.js +25 -24
  8. package/components/LinkList/LinkList.js.map +1 -1
  9. package/components/NotificationPanel/NotificationPanel.js +65 -64
  10. package/components/NotificationPanel/NotificationPanel.js.map +1 -1
  11. package/components/NotificationPanel/NotificationPanel.stories.d.ts +1 -0
  12. package/components/NotificationPanel/styles.module.scss +28 -26
  13. package/components/NotificationPanel/styles.module.scss.d.ts +7 -6
  14. package/components/PopMenu/PopMenu.d.ts +12 -0
  15. package/components/PopMenu/PopMenu.js +74 -74
  16. package/components/PopMenu/PopMenu.js.map +1 -1
  17. package/components/PopMenu/PopMenu.stories.d.ts +7 -1
  18. package/components/PopMenu/index.js +3 -2
  19. package/components/PopMenu/styles.module.scss +1 -1
  20. package/components/PromoPanel/PromoPanel.stories.d.ts +1 -0
  21. package/components/RadioButton/RadioButton.js +27 -26
  22. package/components/RadioButton/RadioButton.js.map +1 -1
  23. package/components/Select/Select.js +23 -22
  24. package/components/Select/Select.js.map +1 -1
  25. package/components/ServiceMessage/ServiceMessage.stories.d.ts +1 -1
  26. package/components/Textarea/Textarea.js +34 -33
  27. package/components/Textarea/Textarea.js.map +1 -1
  28. package/package.json +1 -1
  29. package/scss/supernova/index.css +3 -0
  30. package/scss/supernova/styles/colors.css +173 -0
  31. package/utils/accessibility.d.ts +12 -0
  32. package/utils/accessibility.js +17 -8
  33. package/utils/accessibility.js.map +1 -1
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/helsenorge/designsystem.git"
8
8
  },
9
9
  "homepage": "https://helsenorge.design",
10
- "version": "7.3.1",
10
+ "version": "7.5.0",
11
11
  "author": "Helsenorge",
12
12
  "license": "MIT",
13
13
  "peerDependencies": {
@@ -0,0 +1,3 @@
1
+ /* This file was generated by Supernova and should not be changed manually */
2
+ @import "./colors.css";
3
+ @import "./typography.css";
@@ -0,0 +1,173 @@
1
+ /* stylelint-disable color-hex-length */
2
+
3
+ /* This file was generated by Supernova and should not be changed manually */
4
+ :root {
5
+ --core-color-black: #000000;
6
+ --core-color-white: #ffffff;
7
+ --core-color-blueberry-50: #e4f7f9;
8
+ --core-color-neutral-500: #989693;
9
+ --core-color-neutral-700: #62625f;
10
+ --color-action-text-ondark: #ffffff;
11
+
12
+ /* Hoverfarge for bakgrunn på interaktive elementer - onLight */
13
+ --color-action-background-transparent-onlight-hover: #126f8721;
14
+
15
+ /* Hoverfarge for bakgrunn på interaktive elementer - onLight selected */
16
+ --color-action-background-transparent-onlight-hoverselected: #126f872b;
17
+ --color-notification-background-info: #e4f7f9;
18
+ --color-notification-background-error: #fff2ea;
19
+ --color-destructive-graphics-normal: #c83521;
20
+ --color-base-text-onlight: #000000;
21
+ --color-action-background-ondark: #ffffff;
22
+ --color-action-border-ondark: #ffffff;
23
+ --color-action-border-ondark-focus: #ffffff;
24
+ --color-action-graphics-ondark: #ffffff;
25
+ --color-base-text-ondark: #ffffff;
26
+ --color-base-background-neutral: #f5f3f3;
27
+ --color-base-background-white: #ffffff;
28
+ --color-base-graphics-ondark: #ffffff;
29
+ --color-disabled-text-ondark: #ffffff;
30
+ --color-action-border-onlight: #188097;
31
+ --color-action-border-onlight-hover: #08667c;
32
+ --color-action-border-onlight-focus: #000000;
33
+ --color-action-text-onlight: #126f87;
34
+ --color-action-text-onlight-hover: #08667c;
35
+ --color-action-graphics-onlight: #188097;
36
+ --color-action-graphics-onlight-hover: #126f87;
37
+ --color-action-graphics-ondark-hover: #e4f7f9;
38
+ --color-action-background-ondark-hover: #e4f7f9;
39
+ --color-action-background-ondark-selected: #cae7ed;
40
+ --color-action-background-ondark-hoverselected: #afdae3;
41
+ --color-action-background-onlight: #188097;
42
+ --color-action-background-onlight-hover: #08667c;
43
+ --color-notification-background-warning: #fdf8df;
44
+ --color-notification-background-success: #e6f8ee;
45
+ --color-notification-border-info: #08667c;
46
+ --color-notification-border-error: #a31f0e;
47
+ --color-notification-border-warning: #ab7c00;
48
+ --color-notification-border-success: #078141;
49
+ --color-notification-graphics-info: #08667c;
50
+ --color-notification-graphics-error: #a31f0e;
51
+ --color-notification-graphics-warning: #ab7c00;
52
+ --color-notification-graphics-success: #078141;
53
+ --color-notification-status-warning: #ebc840;
54
+ --color-notification-status-success: #099150;
55
+ --color-destructive-graphics-hover: #b62e1c;
56
+ --color-destructive-text-normal: #b62e1c;
57
+ --color-destructive-text-hover: #a31f0e;
58
+ --color-disabled-background: #d6d4d3;
59
+ --color-disabled-text: #62625f;
60
+ --color-disabled-border: #7d7c79;
61
+ --color-disabled-graphics: #62625f;
62
+ --color-disabled-border-ondark: #d6d4d3;
63
+ --color-disabled-graphics-ondark: #d6d4d3;
64
+ --color-base-background-blueberry: #e4f7f9;
65
+ --color-base-background-cherry: #fff2ea;
66
+ --color-base-background-dark-blueberry: #188097;
67
+ --color-base-background-dark-cherry: #c83521;
68
+ --color-base-graphics-onlight: #000000;
69
+ --color-base-border-ondark: #d6d4d3;
70
+ --color-base-border-onlight: #989693;
71
+ --color-base-border-onlight-emphasized: #62625f;
72
+ --color-help-background: #efe4fd;
73
+ --color-help-graphics: #5b22a6;
74
+ --color-help-border: #5b22a6;
75
+ --core-color-blueberry-100: #cae7ed;
76
+ --core-color-blueberry-200: #afdae3;
77
+ --core-color-blueberry-300: #7abecc;
78
+ --core-color-blueberry-400: #58aabb;
79
+ --core-color-blueberry-500: #188097;
80
+ --core-color-blueberry-600: #126f87;
81
+ --core-color-blueberry-700: #08667c;
82
+ --core-color-blueberry-800: #06596c;
83
+ --core-color-blueberry-900: #084350;
84
+ --core-color-neutral-50: #f5f3f3;
85
+ --core-color-neutral-100: #eae7e7;
86
+ --core-color-neutral-200: #d6d4d3;
87
+ --core-color-neutral-300: #bdbab9;
88
+ --core-color-neutral-400: #aaa8a6;
89
+ --core-color-neutral-600: #7d7c79;
90
+ --core-color-neutral-800: #474745;
91
+ --core-color-neutral-900: #2b2c2b;
92
+ --core-color-banana-50: #fdf8df;
93
+ --core-color-banana-100: #fcf2bf;
94
+ --core-color-banana-200: #f9ea9f;
95
+ --core-color-banana-300: #f5e080;
96
+ --core-color-banana-400: #ebc840;
97
+ --core-color-banana-500: #ddab06;
98
+ --core-color-banana-600: #c59302;
99
+ --core-color-banana-700: #ab7c00;
100
+ --core-color-banana-800: #916500;
101
+ --core-color-banana-900: #764f00;
102
+ --core-color-cherry-50: #fff2ea;
103
+ --core-color-cherry-100: #f7e1d2;
104
+ --core-color-cherry-200: #eec0a5;
105
+ --core-color-cherry-300: #e39376;
106
+ --core-color-cherry-400: #d56147;
107
+ --core-color-cherry-500: #c83521;
108
+ --core-color-cherry-600: #b62e1c;
109
+ --core-color-cherry-700: #a31f0e;
110
+ --core-color-cherry-800: #912112;
111
+ --core-color-cherry-900: #7e1c0e;
112
+ --core-color-kiwi-50: #e6f8ee;
113
+ --core-color-kiwi-100: #c2edd6;
114
+ --core-color-kiwi-200: #9de2bf;
115
+ --core-color-kiwi-300: #79d6aa;
116
+ --core-color-kiwi-400: #56ca96;
117
+ --core-color-kiwi-500: #33be84;
118
+ --core-color-kiwi-600: #10b172;
119
+ --core-color-kiwi-700: #0ca161;
120
+ --core-color-kiwi-800: #099150;
121
+ --core-color-kiwi-900: #078141;
122
+ --core-color-plum-50: #efe4fd;
123
+ --core-color-plum-100: #d7bdf9;
124
+ --core-color-plum-200: #bf98f3;
125
+ --core-color-plum-300: #a875eb;
126
+ --core-color-plum-400: #9153e2;
127
+ --core-color-plum-500: #7a33d7;
128
+ --core-color-plum-600: #6a2abf;
129
+ --core-color-plum-700: #5b22a6;
130
+ --core-color-plum-800: #4c1b8c;
131
+ --core-color-plum-900: #3c1471;
132
+ --color-destructive-background-emphasized: #f7e1d2;
133
+ --color-destructive-background-normal: #fff2ea;
134
+ --brandcolor-white: #ffffff;
135
+ --brandcolor-black: #000000;
136
+ --brandcolor-neutral-verylight: #f5f3f3;
137
+ --brandcolor-neutral-light: #eae7e7;
138
+ --brandcolor-neutral-mediumlight: #d6d4d3;
139
+ --brandcolor-neutral-medium: #989693;
140
+ --brandcolor-neutral-dark: #62625f;
141
+ --brandcolor-neutral-verydark: #2b2c2b;
142
+ --brandcolor-blueberry-verylight: #e4f7f9;
143
+ --brandcolor-blueberry-light: #cae7ed;
144
+ --brandcolor-blueberry-mediumlight: #afdae3;
145
+ --brandcolor-blueberry-medium: #188097;
146
+ --brandcolor-blueberry-mediumdark: #126f87;
147
+ --brandcolor-blueberry-dark: #08667c;
148
+ --brandcolor-cherry-verylight: #fff2ea;
149
+ --brandcolor-cherry-light: #f7e1d2;
150
+ --brandcolor-cherry-medium: #c83521;
151
+ --brandcolor-cherry-mediumdark: #b62e1c;
152
+ --brandcolor-cherry-dark: #a31f0e;
153
+ --color-notification-status-info: #188097;
154
+ --color-notification-status-error: #c83521;
155
+ --color-destructive-border-normal: #c83521;
156
+ --color-action-border-ondark-hover: #e4f7f9;
157
+
158
+ /* Hoverfarge for bakgrunn på interaktive elementer - onDark */
159
+ --color-action-background-transparent-ondark-hover: #00000026;
160
+
161
+ /* Hoverfarge for bakgrunn på interaktive elementer - onDark selected */
162
+ --color-action-background-transparent-ondark-hoverselected: #00000040;
163
+ --color-base-background-dark-neutral: #2b2c2b;
164
+
165
+ /* Placeholdertext in input- and textarea-controls */
166
+ --color-placeholder-text-onlight: #62625f;
167
+ --color-base-border-onlight-subtle: #d6d4d3;
168
+ --color-base-border-neutral: #d6d4d3;
169
+
170
+ /* Subtle border for Blueberry 50 background */
171
+ --color-base-border-blueberry: #afdae3;
172
+ --color-base-border-cherry: #eec0a5;
173
+ }
@@ -6,4 +6,16 @@ interface AriaLabelAttributesConfig {
6
6
  }
7
7
  export type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;
8
8
  export declare const getAriaLabelAttributes: (config: AriaLabelAttributesConfig) => AriaLabelAttributes | undefined;
9
+ export interface ErrorAriaProps {
10
+ 'aria-describedby'?: string;
11
+ errorText?: string;
12
+ errorTextId?: string;
13
+ }
14
+ /**
15
+ * Get IDs to be used with aria-describedby in form components like <Input />
16
+ * @param props Props from form component
17
+ * @param errorTextUuid Unique ID of the form component's error text
18
+ * @returns Element IDs or undefined if there is no aria-description
19
+ */
20
+ export declare const getAriaDescribedBy: (props: ErrorAriaProps, errorTextUuid?: string) => string | undefined;
9
21
  export {};
@@ -1,19 +1,28 @@
1
- const l = (a) => {
2
- const { label: r, id: e, prefer: i = "id" } = a;
3
- if (e && i === "id")
1
+ const l = (e) => {
2
+ const { label: i, id: r, prefer: a = "id" } = e;
3
+ if (r && a === "id")
4
4
  return {
5
- "aria-labelledby": e
5
+ "aria-labelledby": r
6
6
  };
7
- if (r)
7
+ if (i)
8
8
  return {
9
- "aria-label": r
9
+ "aria-label": i
10
10
  };
11
- if (e)
11
+ if (r)
12
12
  return {
13
- "aria-labelledby": e
13
+ "aria-labelledby": r
14
14
  };
15
+ }, b = (e, i) => {
16
+ const r = e["aria-describedby"], t = !!(e.errorText || e.errorTextId) ? i : void 0;
17
+ if (r && !t)
18
+ return r;
19
+ if (!r && t)
20
+ return t;
21
+ if (r && t)
22
+ return r + " " + t;
15
23
  };
16
24
  export {
25
+ b as getAriaDescribedBy,
17
26
  l as getAriaLabelAttributes
18
27
  };
19
28
  //# sourceMappingURL=accessibility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n};\n"],"names":["getAriaLabelAttributes","config","label","id","prefer"],"mappings":"AAUa,MAAAA,IAAyB,CAACC,MAAuE;AAC5G,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,QAAAC,IAAS,SAASH;AAEjC,MAAAE,KAAMC,MAAW;AACZ,WAAA;AAAA,MACL,mBAAmBD;AAAA,IAAA;AAIvB,MAAID;AACK,WAAA;AAAA,MACL,cAAcA;AAAA,IAAA;AAIlB,MAAIC;AACK,WAAA;AAAA,MACL,mBAAmBA;AAAA,IAAA;AAGzB;"}
1
+ {"version":3,"file":"accessibility.js","sources":["../../src/utils/accessibility.ts"],"sourcesContent":["import { AriaAttributes } from 'react';\n\ninterface AriaLabelAttributesConfig {\n label?: string;\n id?: string;\n prefer?: 'id' | 'label';\n}\n\nexport type AriaLabelAttributes = Pick<AriaAttributes, 'aria-label' | 'aria-labelledby'>;\n\nexport const getAriaLabelAttributes = (config: AriaLabelAttributesConfig): AriaLabelAttributes | undefined => {\n const { label, id, prefer = 'id' } = config;\n\n if (id && prefer === 'id') {\n return {\n 'aria-labelledby': id,\n };\n }\n\n if (label) {\n return {\n 'aria-label': label,\n };\n }\n\n if (id) {\n return {\n 'aria-labelledby': id,\n };\n }\n};\n\nexport interface ErrorAriaProps {\n 'aria-describedby'?: string;\n errorText?: string;\n errorTextId?: string;\n}\n\n/**\n * Get IDs to be used with aria-describedby in form components like <Input />\n * @param props Props from form component\n * @param errorTextUuid Unique ID of the form component's error text\n * @returns Element IDs or undefined if there is no aria-description\n */\nexport const getAriaDescribedBy = (props: ErrorAriaProps, errorTextUuid?: string): string | undefined => {\n const ariaDescribedBy: string | undefined = props['aria-describedby'];\n const hasErrorText: boolean = !!(props.errorText || props.errorTextId);\n const errorTextId: string | undefined = hasErrorText ? errorTextUuid : undefined;\n\n if (ariaDescribedBy && !errorTextId) {\n return ariaDescribedBy;\n } else if (!ariaDescribedBy && errorTextId) {\n return errorTextId;\n } else if (ariaDescribedBy && errorTextId) {\n return ariaDescribedBy + ' ' + errorTextId;\n }\n};\n"],"names":["getAriaLabelAttributes","config","label","id","prefer","getAriaDescribedBy","props","errorTextUuid","ariaDescribedBy","errorTextId"],"mappings":"AAUa,MAAAA,IAAyB,CAACC,MAAuE;AAC5G,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,QAAAC,IAAS,SAASH;AAEjC,MAAAE,KAAMC,MAAW;AACZ,WAAA;AAAA,MACL,mBAAmBD;AAAA,IAAA;AAIvB,MAAID;AACK,WAAA;AAAA,MACL,cAAcA;AAAA,IAAA;AAIlB,MAAIC;AACK,WAAA;AAAA,MACL,mBAAmBA;AAAA,IAAA;AAGzB,GAcaE,IAAqB,CAACC,GAAuBC,MAA+C;AACjG,QAAAC,IAAsCF,EAAM,kBAAkB,GAE9DG,IADwB,CAAC,EAAEH,EAAM,aAAaA,EAAM,eACHC,IAAgB;AAEnE,MAAAC,KAAmB,CAACC;AACf,WAAAD;AACT,MAAW,CAACA,KAAmBC;AACtB,WAAAA;AACT,MAAWD,KAAmBC;AAC5B,WAAOD,IAAkB,MAAMC;AAEnC;"}