@helsenorge/designsystem-react 11.0.0-beta.3 → 11.0.0-beta.4
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.
- package/CHANGELOG.md +886 -1417
- package/Panel.js +207 -0
- package/Panel.js.map +1 -0
- package/PanelTitle.js +18 -0
- package/PanelTitle.js.map +1 -0
- package/StatusDot.js +3 -1
- package/StatusDot.js.map +1 -1
- package/components/ExpanderList/index.js +12 -5
- package/components/ExpanderList/index.js.map +1 -1
- package/components/Panel/Panel.d.ts +65 -0
- package/components/Panel/Panel.test.d.ts +1 -0
- package/components/Panel/PanelExamples.d.ts +7 -0
- package/components/Panel/PanelTitle/PanelTitle.d.ts +15 -0
- package/components/Panel/PanelTitle/index.d.ts +3 -0
- package/components/Panel/PanelTitle/index.js +5 -0
- package/components/Panel/PanelTitle/index.js.map +1 -0
- package/components/Panel/PanelTitle/styles.module.scss +43 -0
- package/components/Panel/PanelTitle/styles.module.scss.d.ts +13 -0
- package/components/Panel/Paneldocs.d.ts +1 -0
- package/components/Panel/index.d.ts +3 -0
- package/components/Panel/index.js +15 -0
- package/components/Panel/index.js.map +1 -0
- package/components/Panel/styles.module.scss +224 -0
- package/components/Panel/styles.module.scss.d.ts +71 -0
- package/components/PanelList/PanelList.d.ts +2 -2
- package/components/PanelList/index.js +15 -7
- package/components/PanelList/index.js.map +1 -1
- package/components/PanelList/styles.module.scss +19 -4
- package/components/PanelList/styles.module.scss.d.ts +4 -1
- package/components/PanelListOld/PanelListOld.d.ts +12 -0
- package/components/PanelListOld/PanelListOld.test.d.ts +1 -0
- package/components/PanelListOld/index.d.ts +3 -0
- package/components/PanelListOld/index.js +20 -0
- package/components/PanelListOld/index.js.map +1 -0
- package/components/PanelListOld/styles.module.scss +14 -0
- package/components/PanelListOld/styles.module.scss.d.ts +9 -0
- package/components/StatusDot/styles.module.scss +8 -16
- package/components/StatusDot/styles.module.scss.d.ts +1 -0
- package/hooks/useBreakpoint.js +3 -1
- package/hooks/useBreakpoint.js.map +1 -1
- package/package.json +1 -1
- package/scss/helsenorge.scss +7 -7
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../scss/spacers' as spacers;
|
|
3
|
+
@use '../../scss/breakpoints' as breakpoints;
|
|
4
|
+
@use '../../scss/font-settings' as fonts;
|
|
5
|
+
@use '../Button/styles.module' as button;
|
|
6
|
+
@import '../../scss/supernova/styles/colors.css';
|
|
7
|
+
|
|
8
|
+
.panel {
|
|
9
|
+
$panel: &;
|
|
10
|
+
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-flow: column;
|
|
13
|
+
padding: spacers.getSpacer(s);
|
|
14
|
+
|
|
15
|
+
& > *:not(:last-child) {
|
|
16
|
+
// because of a problem with gap this margin gives space between elements
|
|
17
|
+
margin-bottom: spacers.getSpacer(2xs);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
21
|
+
padding: spacers.getSpacer(m);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&--icon {
|
|
25
|
+
padding-left: calc(3.5rem + spacers.getSpacer(s));
|
|
26
|
+
|
|
27
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
28
|
+
padding-left: calc(4rem + spacers.getSpacer(m));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&__pre-container {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&__content {
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-flow: column;
|
|
41
|
+
gap: spacers.getSpacer(m);
|
|
42
|
+
|
|
43
|
+
&__item {
|
|
44
|
+
width: 100%;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&--b-first {
|
|
49
|
+
.panel__content__item--b {
|
|
50
|
+
order: -1;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&--horizontal {
|
|
55
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
56
|
+
flex-flow: row;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&--vertical {
|
|
61
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
62
|
+
flex-flow: column;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&--combined {
|
|
67
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-areas:
|
|
70
|
+
'contentA contentB'
|
|
71
|
+
'contentC contentC';
|
|
72
|
+
|
|
73
|
+
& .panel__content__item--a {
|
|
74
|
+
grid-area: contentA;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
& .panel__content__item--b {
|
|
78
|
+
grid-area: contentB;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
& .panel__content__item--c {
|
|
82
|
+
grid-area: contentC;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&--bAsRightCol {
|
|
88
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
89
|
+
display: grid;
|
|
90
|
+
grid-template-areas:
|
|
91
|
+
'contentA contentB'
|
|
92
|
+
'contentC contentB';
|
|
93
|
+
|
|
94
|
+
& .panel__content__item--a {
|
|
95
|
+
grid-area: contentA;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
& .panel__content__item--b {
|
|
99
|
+
grid-area: contentB;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
& .panel__content__item--c {
|
|
103
|
+
grid-area: contentC;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&--white {
|
|
110
|
+
background-color: var(--color-base-background-white);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&--neutral {
|
|
114
|
+
background-color: var(--color-base-background-neutral);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&--line {
|
|
118
|
+
background-color: transparent;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&__border {
|
|
122
|
+
&--outline {
|
|
123
|
+
&--outer {
|
|
124
|
+
border: 1px solid var(--core-color-neutral-300);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&--inner {
|
|
128
|
+
border: 8px solid var(--core-color-neutral-100);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
&--line {
|
|
133
|
+
border-top: 1px solid var(--core-color-neutral-600);
|
|
134
|
+
border-bottom: 1px solid var(--core-color-neutral-600);
|
|
135
|
+
border-right: none;
|
|
136
|
+
border-left: none;
|
|
137
|
+
padding: spacers.getSpacer(xs) 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&--fill--neutral {
|
|
141
|
+
border: 1px solid var(--core-color-neutral-300);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&--border {
|
|
146
|
+
border: 2px solid var(--color-base-background-white);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&--status {
|
|
150
|
+
border-left: 6px;
|
|
151
|
+
border-left-style: solid;
|
|
152
|
+
border-left-color: transparent;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&--new {
|
|
156
|
+
border-left-color: var(--core-color-blueberry-500);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
&--draft {
|
|
160
|
+
border-left: dotted 6px var(--core-color-neutral-500);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&--error {
|
|
164
|
+
border-left-color: var(--core-color-cherry-500);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__expander {
|
|
168
|
+
&__border {
|
|
169
|
+
&--expanded {
|
|
170
|
+
border-left: 2px solid var(--color-base-border-onlight-emphasized);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&--not-expanded {
|
|
174
|
+
&--white {
|
|
175
|
+
border-left: 2px solid var(--color-base-background-white);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&--neutral {
|
|
179
|
+
border-left: 2px solid var(--color-base-background-neutral);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
&--line {
|
|
183
|
+
border-left: 2px solid transparent;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__separator {
|
|
189
|
+
height: 1px;
|
|
190
|
+
width: 40px;
|
|
191
|
+
background-color: var(--color-base-border-onlight);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&__content {
|
|
195
|
+
margin-top: spacers.getSpacer(s);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&__button-bottom {
|
|
200
|
+
margin-top: spacers.getSpacer(2xs);
|
|
201
|
+
|
|
202
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
203
|
+
margin-top: spacers.getSpacer(s);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.expander {
|
|
209
|
+
// This is a copy of the button class in Expander
|
|
210
|
+
&__button {
|
|
211
|
+
position: relative;
|
|
212
|
+
padding-right: getSpacer(s);
|
|
213
|
+
text-align: left;
|
|
214
|
+
width: fit-content;
|
|
215
|
+
|
|
216
|
+
&--expanded {
|
|
217
|
+
@include button.outline-borderless-hover;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
&__button &__button__text {
|
|
222
|
+
@include button.outline-borderless-text-hover;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
button: string;
|
|
3
|
+
button__arrow: string;
|
|
4
|
+
'button__arrow--both-icons': string;
|
|
5
|
+
'button__both-icons': string;
|
|
6
|
+
'button__left-icon': string;
|
|
7
|
+
'button__only-icon': string;
|
|
8
|
+
'button__right-icon': string;
|
|
9
|
+
'button__right-unicode-arrow': string;
|
|
10
|
+
button__text: string;
|
|
11
|
+
'button__text--centered': string;
|
|
12
|
+
'button__text--ellipsis': string;
|
|
13
|
+
'button--arrow': string;
|
|
14
|
+
'button--arrow--both-icons': string;
|
|
15
|
+
'button--borderless': string;
|
|
16
|
+
'button--both-icons': string;
|
|
17
|
+
'button--destructive': string;
|
|
18
|
+
'button--large': string;
|
|
19
|
+
'button--left-icon': string;
|
|
20
|
+
'button--normal': string;
|
|
21
|
+
'button--on-dark': string;
|
|
22
|
+
'button--only-icon': string;
|
|
23
|
+
'button--outline': string;
|
|
24
|
+
'button--right-icon': string;
|
|
25
|
+
'button-wrapper': string;
|
|
26
|
+
'button-wrapper--fluid': string;
|
|
27
|
+
diagonal: string;
|
|
28
|
+
diagonal__line: string;
|
|
29
|
+
'diagonal--on-dark': string;
|
|
30
|
+
expander__button: string;
|
|
31
|
+
expander__button__text: string;
|
|
32
|
+
'expander__button--expanded': string;
|
|
33
|
+
panel: string;
|
|
34
|
+
'panel__border--fill--neutral': string;
|
|
35
|
+
'panel__border--line': string;
|
|
36
|
+
'panel__border--outline--inner': string;
|
|
37
|
+
'panel__border--outline--outer': string;
|
|
38
|
+
'panel__button-bottom': string;
|
|
39
|
+
panel__content: string;
|
|
40
|
+
panel__content__item: string;
|
|
41
|
+
'panel__content__item--a': string;
|
|
42
|
+
'panel__content__item--b': string;
|
|
43
|
+
'panel__content__item--c': string;
|
|
44
|
+
'panel__content--b-first': string;
|
|
45
|
+
'panel__content--bAsRightCol': string;
|
|
46
|
+
'panel__content--combined': string;
|
|
47
|
+
'panel__content--horizontal': string;
|
|
48
|
+
'panel__content--vertical': string;
|
|
49
|
+
'panel__expander__border--expanded': string;
|
|
50
|
+
'panel__expander__border--not-expanded--line': string;
|
|
51
|
+
'panel__expander__border--not-expanded--neutral': string;
|
|
52
|
+
'panel__expander__border--not-expanded--white': string;
|
|
53
|
+
panel__expander__content: string;
|
|
54
|
+
panel__expander__separator: string;
|
|
55
|
+
'panel__pre-container': string;
|
|
56
|
+
'panel--border': string;
|
|
57
|
+
'panel--draft': string;
|
|
58
|
+
'panel--error': string;
|
|
59
|
+
'panel--icon': string;
|
|
60
|
+
'panel--line': string;
|
|
61
|
+
'panel--neutral': string;
|
|
62
|
+
'panel--new': string;
|
|
63
|
+
'panel--status': string;
|
|
64
|
+
'panel--white': string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type ClassNames = keyof Styles;
|
|
68
|
+
|
|
69
|
+
declare const styles: Styles;
|
|
70
|
+
|
|
71
|
+
export default styles;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PanelVariant } from '../Panel/Panel';
|
|
3
3
|
export interface PanelListProps {
|
|
4
4
|
/** Panels to render inside the PanelList */
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
/** Changes the visual representation of the panel. Default: fill */
|
|
7
|
-
variant?:
|
|
7
|
+
variant?: PanelVariant;
|
|
8
8
|
/** Sets the data-testid attribute. */
|
|
9
9
|
testId?: string;
|
|
10
10
|
}
|
|
@@ -2,17 +2,25 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { AnalyticsId } from "../../constants.js";
|
|
5
|
-
import { b as
|
|
5
|
+
import { b as PanelVariant, P as Panel } from "../../Panel.js";
|
|
6
6
|
import styles from "./styles.module.scss";
|
|
7
|
-
const isPanelComponent = (element) => React__default.isValidElement(element) && element.type ===
|
|
7
|
+
const isPanelComponent = (element) => React__default.isValidElement(element) && element.type === Panel;
|
|
8
8
|
const PanelList = React__default.forwardRef(function BadgeForwardedRef(props, ref) {
|
|
9
|
-
const { testId, children, variant =
|
|
10
|
-
const renderPanel = (panel
|
|
9
|
+
const { testId, children, variant = PanelVariant.fill } = props;
|
|
10
|
+
const renderPanel = (panel) => React__default.cloneElement(panel, {
|
|
11
11
|
variant,
|
|
12
|
-
|
|
13
|
-
className: classNames(panel.props.className, variant !== PanelOldVariant.line && styles["panel-list__panel"])
|
|
12
|
+
className: classNames(panel.props.className, styles[`panel-list__panel--${variant}`])
|
|
14
13
|
});
|
|
15
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
ref,
|
|
18
|
+
"data-testid": testId,
|
|
19
|
+
"data-analyticsid": AnalyticsId.PanelList,
|
|
20
|
+
className: classNames({ [styles["panel-list--outline"]]: variant === PanelVariant.outline }),
|
|
21
|
+
children: React__default.Children.map(children, (child) => isPanelComponent(child) ? renderPanel(child) : child)
|
|
22
|
+
}
|
|
23
|
+
);
|
|
16
24
|
});
|
|
17
25
|
export {
|
|
18
26
|
PanelList as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/PanelList/PanelList.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/PanelList/PanelList.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport Panel, { PanelProps, PanelVariant } from '../Panel/Panel';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: PanelVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelProps> =>\n React.isValidElement<PanelProps>(element) && (element as React.ReactElement).type === Panel;\n\nconst PanelList = React.forwardRef(function BadgeForwardedRef(props: PanelListProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelVariant.fill } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelProps>): React.ReactElement<PanelProps> =>\n React.cloneElement(panel, {\n variant: variant,\n className: classNames(panel.props.className, styles[`panel-list__panel--${variant}`]),\n });\n\n return (\n <div\n ref={ref}\n data-testid={testId}\n data-analyticsid={AnalyticsId.PanelList}\n className={classNames({ [styles['panel-list--outline']]: variant === PanelVariant.outline })}\n >\n {React.Children.map(children, child => (isPanelComponent(child) ? renderPanel(child) : child))}\n </div>\n );\n});\n\nexport default PanelList;\n"],"names":["React"],"mappings":";;;;;;AAkBA,MAAM,mBAAmB,CAAC,YACxBA,eAAM,eAA2B,OAAO,KAAM,QAA+B,SAAS;AAExF,MAAM,YAAYA,eAAM,WAAW,SAAS,kBAAkB,OAAuB,KAAyC;AAC5H,QAAM,EAAE,QAAQ,UAAU,UAAU,aAAa,SAAS;AAE1D,QAAM,cAAc,CAAC,UACnBA,eAAM,aAAa,OAAO;AAAA,IACxB;AAAA,IACA,WAAW,WAAW,MAAM,MAAM,WAAW,OAAO,sBAAsB,OAAO,EAAE,CAAC;AAAA,EAAA,CACrF;AAGD,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,eAAa;AAAA,MACb,oBAAkB,YAAY;AAAA,MAC9B,WAAW,WAAW,EAAE,CAAC,OAAO,qBAAqB,CAAC,GAAG,YAAY,aAAa,SAAS;AAAA,MAE1F,UAAAA,eAAM,SAAS,IAAI,UAAU,CAAA,UAAU,iBAAiB,KAAK,IAAI,YAAY,KAAK,IAAI,KAAM;AAAA,IAAA;AAAA,EAC/F;AAEJ,CAAC;"}
|
|
@@ -4,11 +4,26 @@
|
|
|
4
4
|
@use '../../scss/breakpoints' as breakpoints;
|
|
5
5
|
|
|
6
6
|
.panel-list {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
&--outline {
|
|
8
|
+
border: 1px solid var(--core-color-neutral-300);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
& > div {
|
|
11
|
+
// overstyrer så ikke hvert panel har egen border
|
|
12
|
+
border: none;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__panel {
|
|
17
|
+
&--line:not(:last-child) {
|
|
18
|
+
margin-bottom: -1px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--outline:not(:last-child) {
|
|
22
|
+
margin-bottom: -9px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--fill:not(:last-child) {
|
|
26
|
+
margin-bottom: spacers.getSpacer(xs);
|
|
12
27
|
}
|
|
13
28
|
}
|
|
14
29
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PanelOldVariant } from '../PanelOld';
|
|
3
|
+
export interface PanelListOldProps {
|
|
4
|
+
/** Panels to render inside the PanelList */
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
/** Changes the visual representation of the panel. Default: fill */
|
|
7
|
+
variant?: keyof typeof PanelOldVariant;
|
|
8
|
+
/** Sets the data-testid attribute. */
|
|
9
|
+
testId?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const PanelListOld: React.ForwardRefExoticComponent<PanelListOldProps & React.RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export default PanelListOld;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import classNames from "classnames";
|
|
4
|
+
import { AnalyticsId } from "../../constants.js";
|
|
5
|
+
import { b as PanelOldVariant, P as PanelOld } from "../../PanelOld.js";
|
|
6
|
+
import styles from "./styles.module.scss";
|
|
7
|
+
const isPanelComponent = (element) => React__default.isValidElement(element) && element.type === PanelOld;
|
|
8
|
+
const PanelListOld = React__default.forwardRef(function BadgeForwardedRef(props, ref) {
|
|
9
|
+
const { testId, children, variant = PanelOldVariant.fill } = props;
|
|
10
|
+
const renderPanel = (panel, firstChild) => React__default.cloneElement(panel, {
|
|
11
|
+
variant,
|
|
12
|
+
noTopBorder: variant === PanelOldVariant.line && !firstChild,
|
|
13
|
+
className: classNames(panel.props.className, variant !== PanelOldVariant.line && styles["panel-list__panel"])
|
|
14
|
+
});
|
|
15
|
+
return /* @__PURE__ */ jsx("div", { ref, "data-testid": testId, "data-analyticsid": AnalyticsId.PanelList, children: React__default.Children.map(children, (child, index) => isPanelComponent(child) ? renderPanel(child, index === 0) : child) });
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
PanelListOld as default
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/PanelListOld/PanelListOld.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport PanelOld, { PanelOldProps, PanelOldVariant } from '../PanelOld';\n\nimport styles from './styles.module.scss';\n\nexport interface PanelListOldProps {\n /** Panels to render inside the PanelList */\n children?: React.ReactNode;\n /** Changes the visual representation of the panel. Default: fill */\n variant?: keyof typeof PanelOldVariant;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst isPanelComponent = (element: {} | null | undefined): element is React.ReactElement<PanelOldProps> =>\n React.isValidElement<PanelOldProps>(element) && (element as React.ReactElement).type === PanelOld;\n\nconst PanelListOld = React.forwardRef(function BadgeForwardedRef(props: PanelListOldProps, ref: React.ForwardedRef<HTMLDivElement>) {\n const { testId, children, variant = PanelOldVariant.fill } = props;\n\n const renderPanel = (panel: React.ReactElement<PanelOldProps>, firstChild: boolean) =>\n React.cloneElement(panel, {\n variant: variant,\n noTopBorder: variant === PanelOldVariant.line && !firstChild,\n className: classNames(panel.props.className, variant !== PanelOldVariant.line && styles['panel-list__panel']),\n });\n\n return (\n <div ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.PanelList}>\n {React.Children.map(children, (child, index) => (isPanelComponent(child) ? renderPanel(child, index === 0) : child))}\n </div>\n );\n});\n\nexport default PanelListOld;\n"],"names":["React"],"mappings":";;;;;;AAkBA,MAAM,mBAAmB,CAAC,YACxBA,eAAM,eAA8B,OAAO,KAAM,QAA+B,SAAS;AAE3F,MAAM,eAAeA,eAAM,WAAW,SAAS,kBAAkB,OAA0B,KAAyC;AAClI,QAAM,EAAE,QAAQ,UAAU,UAAU,gBAAgB,SAAS;AAE7D,QAAM,cAAc,CAAC,OAA0C,eAC7DA,eAAM,aAAa,OAAO;AAAA,IACxB;AAAA,IACA,aAAa,YAAY,gBAAgB,QAAQ,CAAC;AAAA,IAClD,WAAW,WAAW,MAAM,MAAM,WAAW,YAAY,gBAAgB,QAAQ,OAAO,mBAAmB,CAAC;AAAA,EAAA,CAC7G;AAGD,SAAA,oBAAC,OAAI,EAAA,KAAU,eAAa,QAAQ,oBAAkB,YAAY,WAC/D,UAAMA,eAAA,SAAS,IAAI,UAAU,CAAC,OAAO,UAAW,iBAAiB,KAAK,IAAI,YAAY,OAAO,UAAU,CAAC,IAAI,KAAM,EACrH,CAAA;AAEJ,CAAC;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../../scss/spacers' as spacers;
|
|
3
|
+
@use '../../scss/palette' as palette;
|
|
4
|
+
@use '../../scss/breakpoints' as breakpoints;
|
|
5
|
+
|
|
6
|
+
.panel-list {
|
|
7
|
+
&__panel:not(:last-child) {
|
|
8
|
+
margin-bottom: spacers.getSpacer(2xs);
|
|
9
|
+
|
|
10
|
+
@media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
|
|
11
|
+
margin-bottom: spacers.getSpacer(s);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
@use '../../scss/spacers' as spacers;
|
|
3
3
|
@use '../../scss/palette' as palette;
|
|
4
4
|
@use '../../scss/font-settings' as font-settings;
|
|
5
|
+
@use '../../scss/font-mixins' as fonts;
|
|
5
6
|
@use '../../scss/screen-reader' as *;
|
|
6
7
|
@use '../../scss/breakpoints' as breakpoints;
|
|
7
8
|
@import '../../scss/supernova/styles/colors.css';
|
|
@@ -11,32 +12,19 @@ $status-dot-size: 1rem;
|
|
|
11
12
|
.statusdot {
|
|
12
13
|
position: relative;
|
|
13
14
|
display: inline-flex;
|
|
14
|
-
align-items:
|
|
15
|
-
|
|
16
|
-
line-height: 1.4rem;
|
|
17
|
-
font-weight: 400;
|
|
18
|
-
|
|
19
|
-
@media (min-width: map.get(breakpoints.$grid-breakpoints, sm)) {
|
|
20
|
-
font-size: font-settings.$font-size-sm;
|
|
21
|
-
line-height: 1.6rem;
|
|
22
|
-
}
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: spacers.getSpacer(2xs);
|
|
23
17
|
|
|
24
18
|
&__dot {
|
|
25
19
|
display: flex;
|
|
26
20
|
align-items: center;
|
|
27
21
|
justify-content: center;
|
|
28
22
|
position: relative;
|
|
29
|
-
top: 0.15rem;
|
|
30
|
-
margin-right: spacers.getSpacer(2xs);
|
|
31
23
|
width: $status-dot-size;
|
|
32
24
|
height: $status-dot-size;
|
|
33
25
|
min-width: $status-dot-size;
|
|
34
26
|
min-height: $status-dot-size;
|
|
35
27
|
|
|
36
|
-
@media (min-width: map.get(breakpoints.$grid-breakpoints, sm)) {
|
|
37
|
-
top: spacers.getSpacer(3xs);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
28
|
&--success {
|
|
41
29
|
fill: var(--color-notification-graphics-success);
|
|
42
30
|
}
|
|
@@ -93,8 +81,12 @@ $status-dot-size: 1rem;
|
|
|
93
81
|
}
|
|
94
82
|
|
|
95
83
|
&__label {
|
|
84
|
+
color: var(--core-color-neutral-800);
|
|
85
|
+
|
|
86
|
+
@include fonts.sublabel-subdued;
|
|
87
|
+
|
|
96
88
|
&--on-dark {
|
|
97
|
-
color:
|
|
89
|
+
color: var(--color-base-text-ondark);
|
|
98
90
|
}
|
|
99
91
|
}
|
|
100
92
|
}
|
package/hooks/useBreakpoint.js
CHANGED
|
@@ -20,7 +20,9 @@ function getCurrentBreakpoint() {
|
|
|
20
20
|
return (matched == null ? void 0 : matched.breakpoint) ?? Breakpoint.xxs;
|
|
21
21
|
}
|
|
22
22
|
const useBreakpoint = () => {
|
|
23
|
-
const [breakpoint, setBreakpoint] = useState(
|
|
23
|
+
const [breakpoint, setBreakpoint] = useState(
|
|
24
|
+
typeof window.matchMedia !== "undefined" ? getCurrentBreakpoint() : Breakpoint.xxs
|
|
25
|
+
);
|
|
24
26
|
useEffect(() => {
|
|
25
27
|
const handleMediaQueryEvent = (event) => {
|
|
26
28
|
switch (event.media) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(
|
|
1
|
+
{"version":3,"file":"useBreakpoint.js","sources":["../../src/hooks/useBreakpoint.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\n\nimport { breakpoints, screen } from '../theme/grid';\n\nexport enum Breakpoint {\n xxs = breakpoints.xxs,\n xs = breakpoints.xs,\n sm = breakpoints.sm,\n md = breakpoints.md,\n lg = breakpoints.lg,\n xl = breakpoints.xl,\n}\n\nfunction getCurrentBreakpoint(): Breakpoint {\n // We read from largest -> smallest or vice versa\n // so that the first match is the \"highest\" one that applies\n const mediaQueryList = Object.entries(screen)\n .reverse() // e.g. check xl, lg, md, etc. in descending order\n .map(([size, mediaQuery]) => {\n return {\n breakpoint: Breakpoint[size as keyof typeof Breakpoint],\n mq: window.matchMedia(mediaQuery),\n };\n });\n\n const matched = mediaQueryList.find(entry => entry.mq.matches);\n return matched?.breakpoint ?? Breakpoint.xxs;\n}\n\nexport const useBreakpoint = (): Breakpoint => {\n const [breakpoint, setBreakpoint] = useState<Breakpoint>(\n typeof window.matchMedia !== 'undefined' ? getCurrentBreakpoint() : Breakpoint.xxs\n );\n\n useEffect(() => {\n const handleMediaQueryEvent = (event: MediaQueryListEvent): void => {\n switch (event.media) {\n case screen.xl:\n setBreakpoint(event.matches ? Breakpoint.xl : Breakpoint.lg);\n return;\n case screen.lg:\n setBreakpoint(event.matches ? Breakpoint.lg : Breakpoint.md);\n return;\n case screen.md:\n setBreakpoint(event.matches ? Breakpoint.md : Breakpoint.sm);\n return;\n case screen.sm:\n setBreakpoint(event.matches ? Breakpoint.sm : Breakpoint.xs);\n return;\n case screen.xs:\n setBreakpoint(event.matches ? Breakpoint.xs : Breakpoint.xxs);\n return;\n default:\n setBreakpoint(Breakpoint.xxs);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const mediaQueryList = Object.entries(screen).map(([_size, mediaQuery]) => {\n const mq = window.matchMedia(mediaQuery);\n // iOS <=13 har ikke støtte for addEventListener/removeEventListener på MediaQueryList,\n // men har støtte for addListener\n if (mq.addEventListener) {\n mq.addEventListener('change', handleMediaQueryEvent);\n } else if (mq.addListener) {\n mq.addListener(handleMediaQueryEvent);\n }\n return mq;\n });\n\n return (): void => {\n mediaQueryList.forEach(mq => {\n if (mq.removeEventListener) {\n mq.removeEventListener('change', handleMediaQueryEvent);\n } else if (mq.removeListener) {\n mq.removeListener(handleMediaQueryEvent);\n }\n });\n };\n }, []);\n\n return breakpoint;\n};\n"],"names":["Breakpoint"],"mappings":";;AAIY,IAAA,cAAL,CAAKA,gBAAL;AACLA,cAAAA,YAAA,KAAM,IAAA,YAAY,GAAlB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AACAA,cAAAA,YAAA,IAAK,IAAA,YAAY,EAAjB,IAAA;AANUA,SAAAA;AAAA,GAAA,cAAA,CAAA,CAAA;AASZ,SAAS,uBAAmC;AAG1C,QAAM,iBAAiB,OAAO,QAAQ,MAAM,EACzC,QACA,EAAA,IAAI,CAAC,CAAC,MAAM,UAAU,MAAM;AACpB,WAAA;AAAA,MACL,YAAY,WAAW,IAA+B;AAAA,MACtD,IAAI,OAAO,WAAW,UAAU;AAAA,IAClC;AAAA,EAAA,CACD;AAEH,QAAM,UAAU,eAAe,KAAK,CAAS,UAAA,MAAM,GAAG,OAAO;AACtD,UAAA,mCAAS,eAAc,WAAW;AAC3C;AAEO,MAAM,gBAAgB,MAAkB;AACvC,QAAA,CAAC,YAAY,aAAa,IAAI;AAAA,IAClC,OAAO,OAAO,eAAe,cAAc,qBAAA,IAAyB,WAAW;AAAA,EACjF;AAEA,YAAU,MAAM;AACR,UAAA,wBAAwB,CAAC,UAAqC;AAClE,cAAQ,MAAM,OAAO;AAAA,QACnB,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,EAAE;AAC3D;AAAA,QACF,KAAK,OAAO;AACV,wBAAc,MAAM,UAAU,WAAW,KAAK,WAAW,GAAG;AAC5D;AAAA,QACF;AACE,wBAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IAElC;AAGM,UAAA,iBAAiB,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,OAAO,UAAU,MAAM;AACnE,YAAA,KAAK,OAAO,WAAW,UAAU;AAGvC,UAAI,GAAG,kBAAkB;AACpB,WAAA,iBAAiB,UAAU,qBAAqB;AAAA,MAAA,WAC1C,GAAG,aAAa;AACzB,WAAG,YAAY,qBAAqB;AAAA,MAAA;AAE/B,aAAA;AAAA,IAAA,CACR;AAED,WAAO,MAAY;AACjB,qBAAe,QAAQ,CAAM,OAAA;AAC3B,YAAI,GAAG,qBAAqB;AACvB,aAAA,oBAAoB,UAAU,qBAAqB;AAAA,QAAA,WAC7C,GAAG,gBAAgB;AAC5B,aAAG,eAAe,qBAAqB;AAAA,QAAA;AAAA,MACzC,CACD;AAAA,IACH;AAAA,EACF,GAAG,EAAE;AAEE,SAAA;AACT;"}
|
package/package.json
CHANGED
package/scss/helsenorge.scss
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
@
|
|
4
|
-
@
|
|
5
|
-
@
|
|
6
|
-
@
|
|
7
|
-
@
|
|
1
|
+
@forward 'reset';
|
|
2
|
+
@forward 'spacers';
|
|
3
|
+
@forward 'breakpoints';
|
|
4
|
+
@forward 'palette';
|
|
5
|
+
@forward 'fonts';
|
|
6
|
+
@forward 'body';
|
|
7
|
+
@forward 'print';
|
|
8
8
|
@import './bootstrap/scss/bootstrap-grid';
|