@helsenorge/designsystem-react 12.11.2-beta.0 → 12.12.2

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,8 +1,17 @@
1
- import type { StorybookConfig } from '@storybook/react-vite';
1
+ import { createRequire } from 'node:module';
2
+ import { fileURLToPath } from 'node:url';
2
3
  import path, { dirname, join } from 'path';
4
+
3
5
  import yargs from 'yargs';
4
6
  import { hideBin } from 'yargs/helpers';
5
7
 
8
+ import type { StorybookConfig } from '@storybook/react-vite';
9
+
10
+ // This part has been automatically migrated to valid ESM format by Storybook.
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ const require = createRequire(import.meta.url);
14
+
6
15
  const { base } = yargs(hideBin(process.argv).filter(x => x !== '--'))
7
16
  .options({
8
17
  base: {
@@ -27,12 +36,7 @@ const config: StorybookConfig = {
27
36
  },
28
37
  },
29
38
 
30
- addons: [
31
- getAbsolutePath('@storybook/addon-a11y'),
32
- getAbsolutePath('@storybook/addon-docs'),
33
- getAbsolutePath('@chromatic-com/storybook'),
34
- getAbsolutePath('storybook-addon-tag-badges'),
35
- ],
39
+ addons: [getAbsolutePath('@storybook/addon-a11y'), getAbsolutePath('@storybook/addon-docs'), getAbsolutePath('@chromatic-com/storybook')],
36
40
 
37
41
  // Oppsett for å serve storybook fra subfolder hentet fra: https://github.com/storybookjs/storybook/issues/1291
38
42
  // This is to change configurations of building process of storybook's main frame
@@ -1,6 +1,5 @@
1
1
  import { addons } from 'storybook/manager-api';
2
2
  import { create } from 'storybook/theming';
3
- import { defaultConfig, type TagBadgeParameters } from 'storybook-addon-tag-badges';
4
3
 
5
4
  import { palette } from '../src/theme/palette';
6
5
 
@@ -13,77 +12,4 @@ const theme = create({
13
12
 
14
13
  addons.setConfig({
15
14
  theme,
16
- tagBadges: [
17
- {
18
- tags: 'breaking',
19
- badge: {
20
- text: 'Breaking',
21
- style: {
22
- backgroundColor: '#fcf2bf',
23
- color: '#764f00',
24
- },
25
- tooltip: 'Breaking changes added to this component',
26
- },
27
- },
28
- {
29
- tags: 'not-supernova',
30
- badge: {
31
- text: 'Not in documentation',
32
- style: {
33
- backgroundColor: '#eec0a5',
34
- color: '#912112',
35
- },
36
- tooltip: 'This component is not documented in Supernova',
37
- },
38
- display: {
39
- sidebar: [],
40
- toolbar: ['docs'],
41
- },
42
- },
43
- {
44
- tags: 'new',
45
- badge: {
46
- text: 'New',
47
- style: {
48
- backgroundColor: '#afdae3',
49
- color: '#06596c',
50
- },
51
- tooltip: 'New component',
52
- },
53
- },
54
- {
55
- tags: 'beta',
56
- badge: {
57
- text: 'Beta',
58
- style: {
59
- backgroundColor: '#bf98f3',
60
- color: '#4c1b8c',
61
- },
62
- tooltip: 'New component',
63
- },
64
- },
65
- {
66
- tags: 'deprecated',
67
- badge: {
68
- text: 'Deprecated',
69
- style: {
70
- backgroundColor: '#eec0a5',
71
- color: '#912112',
72
- },
73
- tooltip: 'Deprecated component that will be removed in a future release',
74
- },
75
- },
76
- {
77
- tags: 'outdated',
78
- badge: {
79
- text: 'Outdated',
80
- style: {
81
- backgroundColor: '#d6d4d3',
82
- color: '#474745',
83
- },
84
- tooltip: 'This component has new features in Figma that is not yet implemented',
85
- },
86
- },
87
- ...defaultConfig,
88
- ] satisfies TagBadgeParameters,
89
15
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@helsenorge/designsystem-react",
3
3
  "sideEffects": false,
4
4
  "private": false,
5
- "version": "12.11.2-beta.0",
5
+ "version": "12.12.2",
6
6
  "description": "The official design system for Helsenorge built with React.",
7
7
  "repository": {
8
8
  "type": "git",
@@ -56,8 +56,7 @@
56
56
  "import": "./lib/utils/*.js"
57
57
  },
58
58
  "./scss/*": "./lib/scss/*",
59
- "./fonts/*": "./lib/fonts/*",
60
- "./package.json": "./package.json"
59
+ "./fonts/*": "./lib/fonts/*"
61
60
  },
62
61
  "scripts": {
63
62
  "start": "storybook dev",
@@ -94,12 +93,12 @@
94
93
  "motion": "^11.14.3"
95
94
  },
96
95
  "devDependencies": {
97
- "@chromatic-com/storybook": "^4.0.1",
96
+ "@chromatic-com/storybook": "^4.1.2",
98
97
  "@helsenorge/typed-scss-modules": "^9.0.0",
99
98
  "@rollup/plugin-replace": "^6.0.1",
100
- "@storybook/addon-a11y": "^9.0.18",
101
- "@storybook/addon-docs": "^9.0.18",
102
- "@storybook/react-vite": "^9.0.18",
99
+ "@storybook/addon-a11y": "^10.0.5",
100
+ "@storybook/addon-docs": "^10.0.5",
101
+ "@storybook/react-vite": "^10.0.5",
103
102
  "@testing-library/jest-dom": "^6.5.0",
104
103
  "@testing-library/react": "^16.0.1",
105
104
  "@testing-library/user-event": "^14.6.1",
@@ -123,13 +122,17 @@
123
122
  "rollup-plugin-peer-deps-external": "^2.2.4",
124
123
  "rollup-plugin-visualizer": "^5.12.0",
125
124
  "sass": "^1.79.5",
126
- "storybook": "^9.0.18",
127
- "storybook-addon-tag-badges": "^2.0.1",
125
+ "storybook": "^10.0.5",
128
126
  "style-dictionary": "^4.1.3",
129
127
  "token-transformer": "^0.0.33",
130
128
  "typescript": "~5.8.2",
131
129
  "vite": "^6.2.1",
132
130
  "vite-plugin-dts": "^4.3.0",
133
131
  "vitest": "^3.1.2"
132
+ },
133
+ "overrides": {
134
+ "@helsenorge/typed-scss-modules": {
135
+ "glob": "7.2.3"
136
+ }
134
137
  }
135
138
  }
@@ -225,6 +225,7 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
225
225
  line-height: 1.375rem;
226
226
  align-items: center;
227
227
  width: 100%;
228
+ min-width: 2.75rem;
228
229
  min-height: 2.75rem;
229
230
  box-sizing: border-box;
230
231
  outline: none;
@@ -96,6 +96,10 @@
96
96
  &__chevron {
97
97
  grid-area: chevron;
98
98
 
99
+ svg {
100
+ fill: var(--color-action-graphics-onlight);
101
+ }
102
+
99
103
  &[data-parenttype='linklist'] {
100
104
  align-self: center;
101
105
  height: 100%;
@@ -51,6 +51,8 @@
51
51
  .sublabel {
52
52
  @include fonts.sublabel;
53
53
 
54
+ color: var(--color-base-text-onlight-subdued);
55
+
54
56
  &--subdued {
55
57
  @include fonts.sublabel-subdued;
56
58
  }
@@ -116,7 +116,7 @@
116
116
  &--fill-negative {
117
117
  // listeelement settes til div om man er i edit mode, og styles da via ListEditMode
118
118
  &:not(div) {
119
- margin-top: spacers.getSpacer(s);
119
+ margin-top: spacers.getSpacer(2xs);
120
120
  }
121
121
 
122
122
  &--blueberry {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { Meta, StoryObj } from '@storybook/react-vite';
4
4
  import { Docs } from 'frankenstein-build-tools';
5
- import { action } from 'storybook/internal/actions';
5
+ import { action } from 'storybook/actions';
6
6
 
7
7
  import List from './List';
8
8
  import { mediumLoremText } from '../../utils/loremtext';
@@ -6,8 +6,8 @@ import { AnalyticsId, IconSize } from '../../constants';
6
6
  import { useHover } from '../../hooks/useHover';
7
7
  import { useIsMobileBreakpoint } from '../../hooks/useIsMobileBreakpoint';
8
8
  import { useOutsideEvent } from '../../hooks/useOutsideEvent';
9
- import { getColor } from '../../theme/currys';
10
9
  import { isComponent } from '../../utils/component';
10
+ import Button from '../Button';
11
11
  import Icon, { SvgIcon } from '../Icon';
12
12
  import { IconName } from '../Icons/IconNames';
13
13
  import VerticalDots from '../Icons/VerticalDots';
@@ -36,7 +36,7 @@ export interface PopMenuProps {
36
36
  popOverClassName?: string;
37
37
  /** Adds custom classes to the element. */
38
38
  popMenuClassName?: string;
39
- /** Changes responsive design for the trigger buttons. */
39
+ /** @deprecated Changes responsive design for the trigger buttons. */
40
40
  popMenuVariant?: PopMenuVariant;
41
41
  /** Sets the data-testid attribute for the button that opens. */
42
42
  openButtonTestId?: string;
@@ -58,7 +58,7 @@ export interface PopMenuProps {
58
58
 
59
59
  export const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {
60
60
  const triggerButtonRef = useRef<HTMLButtonElement>(null);
61
- const iconRef = useRef<HTMLDivElement>(null);
61
+ const iconRef = useRef(null);
62
62
  const outerRef = useRef<HTMLDivElement>(null);
63
63
  const [isOpen, setIsOpen] = useState(false);
64
64
  const {
@@ -68,16 +68,12 @@ export const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {
68
68
  openButtonTestId,
69
69
  closeButtonTestId,
70
70
  popOverTestId,
71
- popMenuVariant = PopMenuVariant.onWhite,
72
71
  openButtonAriaLabel,
73
72
  closeButtonAriaLabel,
74
73
  svgIcon,
75
74
  labelText,
76
75
  labelTextPosition = PopMenuLabelPosition.right,
77
76
  } = props;
78
- const buttonClasses = classNames(styles['pop-menu-button'], {
79
- [styles[`pop-menu-button--${popMenuVariant}`]]: popMenuVariant,
80
- });
81
77
  const isMobile = useIsMobileBreakpoint();
82
78
 
83
79
  useOutsideEvent(outerRef, () => {
@@ -119,8 +115,7 @@ export const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {
119
115
  }
120
116
  };
121
117
 
122
- const toggleOpenOnClick = (e?: React.MouseEvent<HTMLElement, MouseEvent>): void => {
123
- if (e) e.stopPropagation();
118
+ const toggleOpenOnClick = (): void => {
124
119
  setIsOpen(!isOpen);
125
120
  };
126
121
 
@@ -134,34 +129,25 @@ export const PopMenu: React.FC<PopMenuProps> = (props: PopMenuProps) => {
134
129
  const openIcon = svgIcon ? (
135
130
  iconComponent
136
131
  ) : (
137
- <Icon svgIcon={svgIcon ?? VerticalDots} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />
132
+ <Icon ref={iconRef} svgIcon={svgIcon ?? VerticalDots} size={mobileIconSize} isHovered={triggerButtonIsHovered} />
138
133
  );
139
134
 
140
- const closeIcon = <Icon svgIcon={X} color={getColor('black')} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;
141
-
142
- const triggerButton = (
143
- <button
144
- ref={triggerButtonRef}
145
- data-testid={isOpen ? closeButtonTestId : openButtonTestId}
146
- className={buttonClasses}
147
- aria-label={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}
148
- aria-expanded={isOpen}
149
- onClick={toggleOpenOnClick}
150
- type="button"
151
- >
152
- {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}
153
- {
154
- <div className={styles['pop-menu-button__icon-wrapper']} ref={iconRef}>
155
- {isOpen ? closeIcon : openIcon}
156
- </div>
157
- }
158
- {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}
159
- </button>
160
- );
135
+ const closeIcon = <Icon svgIcon={X} ref={iconRef} size={mobileIconSize} isHovered={triggerButtonIsHovered} />;
161
136
 
162
137
  return (
163
- <div ref={outerRef} className={classNames(styles['pop-menu-button'], popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>
164
- {triggerButton}
138
+ <div ref={outerRef} className={classNames(popMenuClassName)} data-analyticsid={AnalyticsId.PopMenu}>
139
+ <Button
140
+ variant="borderless"
141
+ aria-expanded={isOpen}
142
+ onClick={toggleOpenOnClick}
143
+ ref={triggerButtonRef}
144
+ ariaLabel={isOpen ? closeButtonAriaLabel : openButtonAriaLabel}
145
+ testId={isOpen ? closeButtonTestId : openButtonTestId}
146
+ >
147
+ {labelText && labelTextPosition == PopMenuLabelPosition.left && <span>{labelText}</span>}
148
+ {isOpen ? closeIcon : openIcon}
149
+ {labelText && labelTextPosition == PopMenuLabelPosition.right && <span>{labelText}</span>}
150
+ </Button>
165
151
  {isOpen && renderChildren()}
166
152
  </div>
167
153
  );
@@ -2,114 +2,6 @@
2
2
  @use '../../scss/palette' as palette;
3
3
  @use '../../scss/breakpoints' as breakpoints;
4
4
 
5
- .pop-menu-button {
6
- padding: 0;
7
- border: 0;
8
- background-color: transparent;
9
- cursor: pointer;
10
- display: flex;
11
- justify-content: center;
12
- align-items: center;
13
- height: 3rem;
14
- min-width: 3rem;
15
-
16
- &:focus {
17
- border: 0.1875rem solid palette.$black;
18
- box-shadow: none;
19
- outline: none;
20
- }
21
-
22
- &__icon-wrapper {
23
- display: flex;
24
- }
25
- }
26
-
27
- html :focus > .pop-menu-button {
28
- box-shadow: none;
29
- border: solid;
30
- }
31
-
32
- .pop-menu-button :focus > .pop-menu-button {
33
- box-shadow: none;
34
- }
35
-
36
- // overrides
37
- :focus > .pop-menu-button:hover {
38
- box-shadow: none;
39
- }
40
-
41
- .pop-menu-button--on-white {
42
- &:focus {
43
- background-color: transparent;
44
- }
45
-
46
- &:active {
47
- background-color: palette.$neutral50;
48
- border: none;
49
- }
50
-
51
- &:hover {
52
- background-color: palette.$neutral50;
53
- }
54
-
55
- &:active:hover {
56
- background-color: transparent;
57
- }
58
-
59
- &:active:focus {
60
- background-color: palette.$neutral50;
61
- border: 0.1875rem solid palette.$black;
62
- }
63
- }
64
-
65
- .pop-menu-button--on-gray {
66
- &:focus {
67
- background-color: transparent;
68
- }
69
-
70
- &:active {
71
- background-color: palette.$neutral100;
72
- border: none;
73
- }
74
-
75
- &:hover {
76
- background-color: palette.$neutral100;
77
- }
78
-
79
- &:active:hover {
80
- background-color: transparent;
81
- }
82
-
83
- &:active:focus {
84
- background-color: palette.$neutral100;
85
- border: 0.1875rem solid palette.$black;
86
- }
87
- }
88
-
89
- .pop-menu-button--on-blueberry {
90
- &:focus {
91
- background-color: transparent;
92
- }
93
-
94
- &:active {
95
- background-color: palette.$blueberry100;
96
- border: none;
97
- }
98
-
99
- &:hover {
100
- background-color: palette.$blueberry100;
101
- }
102
-
103
- &:active:hover {
104
- background-color: transparent;
105
- }
106
-
107
- &:active:focus {
108
- background-color: palette.$blueberry100;
109
- border: 0.1875rem solid palette.$black;
110
- }
111
- }
112
-
113
5
  .pop-menu__pop-over {
114
6
  width: 20.875rem;
115
7
  padding: 0;
@@ -1,10 +1,5 @@
1
1
  export type Styles = {
2
2
  'pop-menu__pop-over': string;
3
- 'pop-menu-button': string;
4
- 'pop-menu-button__icon-wrapper': string;
5
- 'pop-menu-button--on-blueberry': string;
6
- 'pop-menu-button--on-gray': string;
7
- 'pop-menu-button--on-white': string;
8
3
  };
9
4
 
10
5
  export type ClassNames = keyof Styles;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { Meta, StoryObj } from '@storybook/react-vite';
4
4
  import { Docs } from 'frankenstein-build-tools';
5
- import { action, HandlerFunction } from 'storybook/internal/actions';
5
+ import { action, HandlerFunction } from 'storybook/actions';
6
6
 
7
7
  import Toast from './Toast';
8
8
 
@@ -4,6 +4,6 @@
4
4
  "optional": "Valgfritt",
5
5
  "allOptional": "Alle felt er valgfrie",
6
6
  "requiredRadiobuttonList": "Velg én",
7
- "requiredCheckboxList": "Velg en eller flere",
7
+ "requiredCheckboxList": "Velg én eller flere",
8
8
  "requiredSingleCheckbox": "Må velges"
9
9
  }
@@ -112,7 +112,7 @@ export type HNDesignsystemFormFieldTag = {
112
112
  */
113
113
  requiredRadiobuttonList: string;
114
114
  /**
115
- * Velg en eller flere
115
+ * Velg én eller flere
116
116
  */
117
117
  requiredCheckboxList: string;
118
118
  /**
@@ -210,7 +210,7 @@
210
210
  --component-stickynote-background-error-dark: #eec0a5;
211
211
  --component-stickynote-background-error-medium: #f7e1d2;
212
212
  --component-stickynote-background-error-light: #fff2ea;
213
- --color-base-text-onlight-subdued: #000000;
213
+ --color-base-text-onlight-subdued: #474745;
214
214
  --component-stickynote-background-fold-error-dark: #e39376;
215
215
  --component-stickynote-background-fold-error-light: #f7e1d2;
216
216
  --component-stickynote-background-fold-error-medium: #eec0a5;
@@ -246,4 +246,13 @@
246
246
  --component-statusdot-graphics-kiwi-onlight: #078141;
247
247
  --component-statusdot-graphics-neutral-ondark: #f5f3f3;
248
248
  --component-statusdot-graphics-neutral-onlight: #7d7c79;
249
+ --color-action-graphics-emphasized-onlight: #08667c;
250
+ --color-base-background-stroke-dark-cherry: #b62e1c;
251
+ --color-base-background-stroke-dark-blueberry: #126f87;
252
+ --color-base-background-stroke-dark-neutral: #000000;
253
+ --color-destructive-graphics-emphasized-onlight: #a31f0e;
254
+ --component-listelements-background-neutral-verydark: #bdbab9;
255
+ --component-listelements-background-blueberry-verydark: #7abecc;
256
+ --component-listelements-border-neutral-ondark: #ffffff;
257
+ --component-listelements-background-cherry-verydark: #e39376;
249
258
  }