@helsenorge/designsystem-react 9.0.0 → 9.2.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.
- package/Avatar.js +15 -14
- package/Avatar.js.map +1 -1
- package/Button.js +46 -41
- package/Button.js.map +1 -1
- package/CHANGELOG.md +754 -1172
- package/Expander.js +22 -21
- package/Expander.js.map +1 -1
- package/HighlightPanel.js.map +1 -1
- package/Slider.js.map +1 -1
- package/Textarea.js +48 -50
- package/Textarea.js.map +1 -1
- package/components/Avatar/Avatar.d.ts +2 -0
- package/components/Avatar/styles.module.scss +4 -0
- package/components/Avatar/styles.module.scss.d.ts +1 -0
- package/components/Button/Button.d.ts +2 -0
- package/components/Button/styles.module.scss +28 -25
- package/components/Expander/styles.module.scss +6 -5
- package/components/Expander/styles.module.scss.d.ts +29 -0
- package/components/HelpPanel/index.js +17 -20
- package/components/HelpPanel/index.js.map +1 -1
- package/components/HighlightPanel/HighlightPanel.d.ts +1 -1
- package/components/Slider/Slider.d.ts +1 -1
- package/components/Tabs/TabList/styles.module.scss +6 -1
- package/components/Tabs/Tabs.d.ts +2 -0
- package/components/Tabs/index.js +40 -38
- package/components/Tabs/index.js.map +1 -1
- package/package.json +1 -1
- package/scss/layout.module.scss +14 -0
- package/scss/layout.module.scss.d.ts +9 -0
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
@import '../../scss/palette';
|
|
5
5
|
@import '../../scss/font-settings';
|
|
6
6
|
@import '../../scss/screen-reader';
|
|
7
|
+
@import '../../scss/supernova/styles/colors';
|
|
7
8
|
|
|
8
9
|
$dark-mode-disabled-transparrent: #ffffffb3;
|
|
9
10
|
$with-icons: // icon-class, size-class, padding-left, padding-right, padding-left desktop, padding-right desktop, svg-margin-left, svg-margin-right, svg-margin-left desktop, svg-margin-right desktop
|
|
@@ -20,6 +21,18 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
20
21
|
'both-icons' 'normal' getSpacer(xs) getSpacer(xs) getSpacer(xs) getSpacer(xs) 0 0 0 0,
|
|
21
22
|
'both-icons' 'large' getSpacer(xs) getSpacer(xs) getSpacer(xs) getSpacer(xs) 0 0 0 0;
|
|
22
23
|
|
|
24
|
+
// Brukes til å aktivere hover styling uten at button hovres
|
|
25
|
+
@mixin outline-borderless-hover {
|
|
26
|
+
@include outline-borderless-background(
|
|
27
|
+
var(--color-action-background-transparent-onlight-hover),
|
|
28
|
+
var(--color-action-background-transparent-onlight-hover)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@mixin outline-borderless-text-hover {
|
|
33
|
+
@include text-color(var(--color-action-text-onlight-hover), var(--color-action-text-onlight-hover));
|
|
34
|
+
}
|
|
35
|
+
|
|
23
36
|
@mixin focus-shadow {
|
|
24
37
|
box-shadow: 0 0 0 getSpacer(3xs) $black;
|
|
25
38
|
}
|
|
@@ -28,11 +41,11 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
28
41
|
box-shadow: 0 0 0 getSpacer(3xs) $white;
|
|
29
42
|
}
|
|
30
43
|
|
|
31
|
-
@mixin outline-borderless($background-color) {
|
|
32
|
-
background-color:
|
|
44
|
+
@mixin outline-borderless-background($background-color, $hover-background-color) {
|
|
45
|
+
background-color: $background-color;
|
|
33
46
|
|
|
34
47
|
&:hover {
|
|
35
|
-
background-color: $background-color;
|
|
48
|
+
background-color: $hover-background-color;
|
|
36
49
|
}
|
|
37
50
|
|
|
38
51
|
:disabled > & {
|
|
@@ -57,9 +70,13 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
57
70
|
}
|
|
58
71
|
}
|
|
59
72
|
|
|
60
|
-
@mixin
|
|
73
|
+
@mixin text-color($color, $hover-color) {
|
|
61
74
|
color: $color;
|
|
62
75
|
|
|
76
|
+
:hover > & {
|
|
77
|
+
color: $hover-color;
|
|
78
|
+
}
|
|
79
|
+
|
|
63
80
|
:disabled > & {
|
|
64
81
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
65
82
|
color: $neutral700;
|
|
@@ -67,14 +84,6 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
67
84
|
}
|
|
68
85
|
}
|
|
69
86
|
|
|
70
|
-
@mixin borderless-text($color) {
|
|
71
|
-
color: $color;
|
|
72
|
-
|
|
73
|
-
:disabled > & {
|
|
74
|
-
color: $neutral700;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
87
|
@mixin fill-on-dark($background-color) {
|
|
79
88
|
background-color: $white;
|
|
80
89
|
|
|
@@ -113,7 +122,7 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
113
122
|
|
|
114
123
|
@mixin on-dark {
|
|
115
124
|
&--on-dark {
|
|
116
|
-
@include fill-on-dark(
|
|
125
|
+
@include fill-on-dark(var(--color-action-background-ondark-hover));
|
|
117
126
|
}
|
|
118
127
|
&--on-dark#{&}--destructive {
|
|
119
128
|
@include fill-on-dark($cherry50);
|
|
@@ -272,11 +281,11 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
272
281
|
|
|
273
282
|
&--outline,
|
|
274
283
|
&--borderless {
|
|
275
|
-
@include outline-borderless(
|
|
284
|
+
@include outline-borderless-background(transparent, var(--color-action-background-transparent-onlight-hover));
|
|
276
285
|
}
|
|
277
286
|
&--outline#{&}--destructive,
|
|
278
287
|
&--borderless#{&}--destructive {
|
|
279
|
-
@include outline-borderless($cherry50);
|
|
288
|
+
@include outline-borderless-background(transparent, $cherry50);
|
|
280
289
|
}
|
|
281
290
|
|
|
282
291
|
&--outline {
|
|
@@ -341,19 +350,13 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
341
350
|
}
|
|
342
351
|
|
|
343
352
|
/* stylelint-disable-next-line */
|
|
344
|
-
&--outline &__text
|
|
345
|
-
@include outline-text($blueberry600);
|
|
346
|
-
}
|
|
347
|
-
&--outline#{&}--destructive &__text {
|
|
348
|
-
@include outline-text($cherry600);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
/* stylelint-disable-next-line */
|
|
353
|
+
&--outline &__text,
|
|
352
354
|
&--borderless &__text {
|
|
353
|
-
@include
|
|
355
|
+
@include text-color(var(--color-action-text-onlight), var(--color-action-text-onlight-hover));
|
|
354
356
|
}
|
|
357
|
+
&--outline#{&}--destructive &__text,
|
|
355
358
|
&--borderless#{&}--destructive &__text {
|
|
356
|
-
@include
|
|
359
|
+
@include text-color($cherry600, $cherry700);
|
|
357
360
|
}
|
|
358
361
|
|
|
359
362
|
/* stylelint-disable-next-line */
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@import '../../scss/palette';
|
|
6
6
|
@import '../../scss/font-settings';
|
|
7
7
|
@import '../../scss/supernova/styles/colors';
|
|
8
|
+
@import '../Button/styles.module';
|
|
8
9
|
|
|
9
10
|
.expander {
|
|
10
11
|
position: initial;
|
|
@@ -37,15 +38,15 @@
|
|
|
37
38
|
padding-right: getSpacer(s);
|
|
38
39
|
text-align: left;
|
|
39
40
|
|
|
40
|
-
&:hover {
|
|
41
|
-
background-color: var(--color-action-background-transparent-onlight-hover);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
41
|
&--expanded {
|
|
45
|
-
|
|
42
|
+
@include outline-borderless-hover;
|
|
46
43
|
}
|
|
47
44
|
}
|
|
48
45
|
|
|
46
|
+
&__button &__button__text {
|
|
47
|
+
@include outline-borderless-text-hover;
|
|
48
|
+
}
|
|
49
|
+
|
|
49
50
|
&__trigger {
|
|
50
51
|
$trigger: &;
|
|
51
52
|
|
|
@@ -1,6 +1,35 @@
|
|
|
1
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;
|
|
2
30
|
expander: string;
|
|
3
31
|
expander__button: string;
|
|
32
|
+
expander__button__text: string;
|
|
4
33
|
'expander__button--expanded': string;
|
|
5
34
|
'expander__button--sticky': string;
|
|
6
35
|
expander__content: string;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { H as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
);
|
|
20
|
-
};
|
|
2
|
+
import s from "classnames";
|
|
3
|
+
import { H as t } from "../../HighlightPanel.js";
|
|
4
|
+
import n from "../Icons/HandWaving.js";
|
|
5
|
+
import e from "./styles.module.scss";
|
|
6
|
+
const H = ({ className: r, testId: l, size: a, children: o, title: m }) => /* @__PURE__ */ p(
|
|
7
|
+
t,
|
|
8
|
+
{
|
|
9
|
+
className: s(r, { [e["help-panel"]]: a === "fluid" }),
|
|
10
|
+
contentWrapperClassName: e["help-panel"],
|
|
11
|
+
testId: l,
|
|
12
|
+
size: a,
|
|
13
|
+
svgIcon: n,
|
|
14
|
+
title: m,
|
|
15
|
+
children: o
|
|
16
|
+
}
|
|
17
|
+
);
|
|
21
18
|
export {
|
|
22
|
-
|
|
19
|
+
H as default
|
|
23
20
|
};
|
|
24
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightPanel, { HighlightPanelSize } from '../HighlightPanel';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightPanelSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, testId, size, children, title }) => {\n
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/HelpPanel/HelpPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport HighlightPanel, { HighlightPanelSize } from '../HighlightPanel';\nimport HandWaving from '../Icons/HandWaving';\n\nimport styles from './styles.module.scss';\n\nexport interface HelpPanelProps {\n /** What's in the box? */\n children: React.ReactNode;\n /** Changes the size. Default: medium */\n size?: keyof typeof HighlightPanelSize;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets title if needed */\n title?: string;\n}\n\nconst HelpPanel: React.FC<HelpPanelProps> = ({ className, testId, size, children, title }) => {\n return (\n <HighlightPanel\n className={classNames(className, { [styles['help-panel']]: size === 'fluid' })}\n contentWrapperClassName={styles['help-panel']}\n testId={testId}\n size={size}\n svgIcon={HandWaving}\n title={title}\n >\n {children}\n </HighlightPanel>\n );\n};\n\nexport default HelpPanel;\n"],"names":["HelpPanel","className","testId","size","children","title","jsx","HighlightPanel","classNames","styles","HandWaving"],"mappings":";;;;;AAsBM,MAAAA,IAAsC,CAAC,EAAE,WAAAC,GAAW,QAAAC,GAAQ,MAAAC,GAAM,UAAAC,GAAU,OAAAC,QAE9E,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAWC,EAAWP,GAAW,EAAE,CAACQ,EAAO,YAAY,CAAC,GAAGN,MAAS,SAAS;AAAA,IAC7E,yBAAyBM,EAAO,YAAY;AAAA,IAC5C,QAAAP;AAAA,IACA,MAAAC;AAAA,IACA,SAASO;AAAA,IACT,OAAAL;AAAA,IAEC,UAAAD;AAAA,EAAA;AAAA;"}
|
|
@@ -23,7 +23,7 @@ export interface HighlightPanelProps {
|
|
|
23
23
|
htmlMarkup?: HighlightPanelTags;
|
|
24
24
|
/** Adds custom classes to the element. */
|
|
25
25
|
className?: string;
|
|
26
|
-
/** Adds custom classes to the content-wrapper */
|
|
26
|
+
/** Adds custom classes to the content-wrapper. Not used for fluid size. */
|
|
27
27
|
contentWrapperClassName?: string;
|
|
28
28
|
/** Sets the data-testid attribute. */
|
|
29
29
|
testId?: string;
|
|
@@ -4,7 +4,7 @@ export type SliderStep = {
|
|
|
4
4
|
label?: number | string;
|
|
5
5
|
emojiUniCode?: string;
|
|
6
6
|
};
|
|
7
|
-
export interface SliderProps extends ErrorWrapperClassNameProps, Pick<React.InputHTMLAttributes<HTMLInputElement>, 'name' | 'onChange' | 'onBlur'> {
|
|
7
|
+
export interface SliderProps extends ErrorWrapperClassNameProps, Pick<React.InputHTMLAttributes<HTMLInputElement>, 'id' | 'name' | 'onChange' | 'onBlur'> {
|
|
8
8
|
/** Activates Error style for the input */
|
|
9
9
|
error?: boolean;
|
|
10
10
|
/** Error text to show above the component */
|
|
@@ -12,13 +12,18 @@
|
|
|
12
12
|
gap: 0.25rem;
|
|
13
13
|
list-style-type: none;
|
|
14
14
|
white-space: nowrap;
|
|
15
|
-
overflow: hidden;
|
|
15
|
+
overflow: auto hidden;
|
|
16
16
|
height: 3rem;
|
|
17
17
|
margin: 0;
|
|
18
18
|
background-color: var(--color-base-background-white);
|
|
19
19
|
padding-left: 0.5rem;
|
|
20
20
|
padding-right: 0.5rem;
|
|
21
21
|
margin-bottom: -1px;
|
|
22
|
+
scrollbar-width: none;
|
|
23
|
+
|
|
24
|
+
&::-webkit-scrollbar {
|
|
25
|
+
display: none; /* Safari */
|
|
26
|
+
}
|
|
22
27
|
|
|
23
28
|
@media (min-width: map.get($grid-breakpoints, md)) {
|
|
24
29
|
padding-left: 0;
|
|
@@ -13,6 +13,8 @@ export interface TabsProps {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
/** Sets the color of the tabs. Default: white */
|
|
15
15
|
color?: TabsColors;
|
|
16
|
+
/** Sets wether the component should use the container-breakout class. Default: true */
|
|
17
|
+
containerBreakout?: boolean;
|
|
16
18
|
/** Sets the background color of the tabs. Can only be used when the color is set to white. Default: onwhite */
|
|
17
19
|
onColor?: TabsOnColor;
|
|
18
20
|
/** Whether the tab list should be sticky */
|
package/components/Tabs/index.js
CHANGED
|
@@ -1,63 +1,65 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import b, { useState as i, useRef as v, useEffect as
|
|
3
|
-
import
|
|
4
|
-
import { a as
|
|
5
|
-
import { T as
|
|
6
|
-
import
|
|
1
|
+
import { jsxs as A, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import b, { useState as i, useRef as v, useEffect as N } from "react";
|
|
3
|
+
import w from "classnames";
|
|
4
|
+
import { a as J, T as K } from "../../TabList.js";
|
|
5
|
+
import { T as O } from "../../TabPanel.js";
|
|
6
|
+
import Q from "../../scss/layout.module.scss";
|
|
7
|
+
import { isMobileUA as V } from "../../utils/mobile.js";
|
|
7
8
|
import m from "./styles.module.scss";
|
|
8
|
-
const
|
|
9
|
-
activeTab:
|
|
9
|
+
const W = 75, Y = ({
|
|
10
|
+
activeTab: L,
|
|
10
11
|
children: c,
|
|
11
|
-
className:
|
|
12
|
+
className: S,
|
|
12
13
|
color: l = "white",
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
containerBreakout: g = !0,
|
|
15
|
+
onColor: M = "onwhite",
|
|
16
|
+
sticky: k = !0,
|
|
15
17
|
testId: D,
|
|
16
|
-
touchBehaviour:
|
|
18
|
+
touchBehaviour: X = "none"
|
|
17
19
|
}) => {
|
|
18
|
-
const
|
|
20
|
+
const y = L !== void 0, [P, U] = i(0), [u, j] = i(0), [h, F] = i(0), [I, s] = i(0), [$, f] = i(null), C = V(), n = v(null), r = v(null), q = v(null);
|
|
19
21
|
let R = "onwhite";
|
|
20
|
-
l === "white" && (R =
|
|
22
|
+
l === "white" && (R = M);
|
|
21
23
|
const p = (e, o) => {
|
|
22
|
-
|
|
23
|
-
}, q = () => {
|
|
24
|
-
C && f("right");
|
|
24
|
+
y || (U(e), e > o ? (s(0), G()) : e < o && (s(0), z()));
|
|
25
25
|
}, z = () => {
|
|
26
|
-
C && f("
|
|
26
|
+
C && f("right");
|
|
27
27
|
}, G = () => {
|
|
28
|
+
C && f("left");
|
|
29
|
+
}, H = () => {
|
|
28
30
|
f(null);
|
|
29
|
-
}, t =
|
|
30
|
-
return
|
|
31
|
+
}, t = y ? L : P;
|
|
32
|
+
return N(() => {
|
|
31
33
|
const e = (a) => {
|
|
32
34
|
j(a.touches[0].clientX);
|
|
33
35
|
}, o = (a) => {
|
|
34
|
-
|
|
36
|
+
F(a.touches[0].clientX);
|
|
35
37
|
const T = a.touches[0].clientX - u;
|
|
36
38
|
t === 0 && T > 0 || t === b.Children.count(c) - 1 && T < 0 ? s(0) : s(T);
|
|
37
39
|
}, x = () => {
|
|
38
|
-
Math.abs(h - u) >=
|
|
40
|
+
Math.abs(h - u) >= W && (h > u ? p(Math.max(0, t - 1), t) : p(Math.min(b.Children.count(c) - 1, t + 1), t)), s(0);
|
|
39
41
|
};
|
|
40
|
-
return
|
|
42
|
+
return X === "swipe" && n.current && (n.current.addEventListener("touchstart", e), n.current.addEventListener("touchmove", o), n.current.addEventListener("touchend", x)), () => {
|
|
41
43
|
n.current && (n.current.removeEventListener("touchstart", e), n.current.removeEventListener("touchmove", o), n.current.removeEventListener("touchend", x));
|
|
42
44
|
};
|
|
43
|
-
}, [
|
|
45
|
+
}, [X, u, h, t]), N(() => {
|
|
44
46
|
const e = () => {
|
|
45
|
-
|
|
47
|
+
H();
|
|
46
48
|
};
|
|
47
49
|
return r.current && r.current.addEventListener("animationend", e), () => {
|
|
48
50
|
r.current && r.current.removeEventListener("animationend", e);
|
|
49
51
|
};
|
|
50
|
-
}, []), /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
}, []), /* @__PURE__ */ A("div", { className: w(S, g && Q["container-breakout"]), "data-testid": D, children: [
|
|
53
|
+
/* @__PURE__ */ A(
|
|
52
54
|
"div",
|
|
53
55
|
{
|
|
54
|
-
ref:
|
|
55
|
-
className:
|
|
56
|
-
[m["tab-list-wrapper--sticky"]]:
|
|
56
|
+
ref: q,
|
|
57
|
+
className: w(m["tab-list-wrapper"], {
|
|
58
|
+
[m["tab-list-wrapper--sticky"]]: k
|
|
57
59
|
}),
|
|
58
60
|
children: [
|
|
59
61
|
/* @__PURE__ */ d(
|
|
60
|
-
|
|
62
|
+
K,
|
|
61
63
|
{
|
|
62
64
|
onTabListClick: (e) => p(e, t),
|
|
63
65
|
selectedTab: t,
|
|
@@ -66,17 +68,17 @@ const Q = 75, V = ({
|
|
|
66
68
|
children: c
|
|
67
69
|
}
|
|
68
70
|
),
|
|
69
|
-
/* @__PURE__ */ d("div", { className:
|
|
71
|
+
/* @__PURE__ */ d("div", { className: w(m["panel-wrapper"], m[`panel-wrapper--${l}`]) })
|
|
70
72
|
]
|
|
71
73
|
}
|
|
72
74
|
),
|
|
73
|
-
/* @__PURE__ */ d("div", { ref: n, style: { marginTop: "-50px" }, children: /* @__PURE__ */ d(
|
|
75
|
+
/* @__PURE__ */ d("div", { ref: n, style: { marginTop: "-50px" }, children: /* @__PURE__ */ d(O, { ref: r, color: l, isFirst: t == 0, translateX: I, animate: $, children: b.Children.toArray(c)[t] }) })
|
|
74
76
|
] });
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
}, E = Y;
|
|
78
|
+
E.displayName = "Tabs";
|
|
79
|
+
E.Tab = J;
|
|
80
|
+
E.Tab.displayName = "Tabs.Tab";
|
|
79
81
|
export {
|
|
80
|
-
|
|
82
|
+
E as default
|
|
81
83
|
};
|
|
82
84
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Tab from './Tab';\nimport TabList from './TabList';\nimport TabPanel from './TabPanel';\nimport { PaletteNames } from '../../theme/palette';\nimport { isMobileUA } from '../../utils/mobile';\n\nimport styles from './styles.module.scss';\n\nexport type { TabProps } from './Tab';\nexport type TabsColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'white'>;\nexport type TabsOnColor = 'onblueberry' | 'onneutral' | 'onwhite';\nexport type TabsTouchBehaviour = 'swipe' | 'none';\n\nexport interface TabsProps {\n children?: React.ReactNode;\n /** Controlled state for Tabs component */\n activeTab?: number;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the color of the tabs. Default: white */\n color?: TabsColors;\n /** Sets the background color of the tabs. Can only be used when the color is set to white. Default: onwhite */\n onColor?: TabsOnColor;\n /** Whether the tab list should be sticky */\n sticky?: boolean;\n /** Determines how Tabs respons to touch events. */\n touchBehaviour?: TabsTouchBehaviour;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst swipeDistanceThreshold = 75;\n\nconst TabsRoot: React.FC<TabsProps> = ({\n activeTab,\n children,\n className,\n color = 'white',\n onColor = 'onwhite',\n sticky = true,\n testId,\n touchBehaviour = 'none',\n}) => {\n const isControlled = activeTab !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(0);\n const [touchStartX, setTouchStartX] = useState(0);\n const [touchEndX, setTouchEndX] = useState(0);\n const [translateX, setTranslateX] = useState(0);\n const [panelAnimation, setPanelAnimation] = useState<'left' | 'right' | null>(null);\n const mobile = isMobileUA();\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabPanelRef = useRef<HTMLDivElement>(null);\n const tabListRef = useRef<HTMLDivElement>(null);\n\n let onColorUsed: TabsOnColor = 'onwhite';\n if (color === 'white') {\n onColorUsed = onColor;\n }\n\n const onValueChange = (newValue: number, oldValue: number): void => {\n if (!isControlled) {\n setUncontrolledValue(newValue);\n if (newValue > oldValue) {\n // make sure that the translateX is reset so the animation does not go outside the screen\n setTranslateX(0);\n onLeftSwipe();\n } else if (newValue < oldValue) {\n // make sure that the translateX is reset so the animation does not go outside the screen\n setTranslateX(0);\n onRightSwipe();\n }\n }\n };\n\n const onRightSwipe = (): void => {\n mobile && setPanelAnimation('right');\n };\n\n const onLeftSwipe = (): void => {\n mobile && setPanelAnimation('left');\n };\n\n const resetAnimation = (): void => {\n setPanelAnimation(null);\n };\n\n const activeTabIndex = isControlled ? activeTab : uncontrolledValue;\n\n useEffect(() => {\n const handleTouchStart = (event: TouchEvent): void => {\n setTouchStartX(event.touches[0].clientX);\n };\n\n const handleTouchMove = (event: TouchEvent): void => {\n setTouchEndX(event.touches[0].clientX);\n const newTranslateX = event.touches[0].clientX - touchStartX;\n\n if (activeTabIndex === 0 && newTranslateX > 0) {\n setTranslateX(0);\n } else if (activeTabIndex === React.Children.count(children) - 1 && newTranslateX < 0) {\n setTranslateX(0);\n } else {\n setTranslateX(newTranslateX);\n }\n };\n\n const handleTouchEnd = (): void => {\n const swipeDistance = Math.abs(touchEndX - touchStartX);\n if (swipeDistance >= swipeDistanceThreshold) {\n if (touchEndX > touchStartX) {\n // User swiped right\n onValueChange(Math.max(0, activeTabIndex - 1), activeTabIndex);\n } else {\n // User swiped left\n onValueChange(Math.min(React.Children.count(children) - 1, activeTabIndex + 1), activeTabIndex);\n }\n }\n setTranslateX(0);\n };\n\n if (touchBehaviour === 'swipe' && tabsRef.current) {\n tabsRef.current.addEventListener('touchstart', handleTouchStart);\n tabsRef.current.addEventListener('touchmove', handleTouchMove);\n tabsRef.current.addEventListener('touchend', handleTouchEnd);\n }\n return () => {\n if (tabsRef.current) {\n tabsRef.current.removeEventListener('touchstart', handleTouchStart);\n tabsRef.current.removeEventListener('touchmove', handleTouchMove);\n tabsRef.current.removeEventListener('touchend', handleTouchEnd);\n }\n };\n }, [touchBehaviour, touchStartX, touchEndX, activeTabIndex]);\n\n useEffect(() => {\n const handleAnimationEnd = (): void => {\n resetAnimation();\n };\n\n if (tabPanelRef.current) {\n tabPanelRef.current.addEventListener('animationend', handleAnimationEnd);\n }\n\n return () => {\n if (tabPanelRef.current) {\n tabPanelRef.current.removeEventListener('animationend', handleAnimationEnd);\n }\n };\n }, []);\n\n return (\n <div className={className} data-testid={testId}>\n <div\n ref={tabListRef}\n className={classNames(styles['tab-list-wrapper'], {\n [styles['tab-list-wrapper--sticky']]: sticky,\n })}\n >\n <TabList\n onTabListClick={(index: number) => onValueChange(index, activeTabIndex)}\n selectedTab={activeTabIndex}\n color={color}\n onColor={onColorUsed}\n >\n {children}\n </TabList>\n <div className={classNames(styles['panel-wrapper'], styles[`panel-wrapper--${color}`])}></div>\n </div>\n <div ref={tabsRef} style={{ marginTop: '-50px' }}>\n <TabPanel ref={tabPanelRef} color={color} isFirst={activeTabIndex == 0} translateX={translateX} animate={panelAnimation}>\n {React.Children.toArray(children)[activeTabIndex]}\n </TabPanel>\n </div>\n </div>\n );\n};\n\ntype TabsComponent = typeof TabsRoot & {\n Tab: typeof Tab;\n};\nconst Tabs = TabsRoot as TabsComponent;\nTabs.displayName = 'Tabs';\nTabs.Tab = Tab;\nTabs.Tab.displayName = 'Tabs.Tab';\n\nexport default Tabs;\n"],"names":["swipeDistanceThreshold","TabsRoot","activeTab","children","className","color","onColor","sticky","testId","touchBehaviour","isControlled","uncontrolledValue","setUncontrolledValue","useState","touchStartX","setTouchStartX","touchEndX","setTouchEndX","translateX","setTranslateX","panelAnimation","setPanelAnimation","mobile","isMobileUA","tabsRef","useRef","tabPanelRef","tabListRef","onColorUsed","onValueChange","newValue","oldValue","onLeftSwipe","onRightSwipe","resetAnimation","activeTabIndex","useEffect","handleTouchStart","event","handleTouchMove","newTranslateX","React","handleTouchEnd","handleAnimationEnd","jsxs","classNames","styles","jsx","TabList","index","TabPanel","Tabs","Tab"],"mappings":";;;;;;;AAmCA,MAAMA,IAAyB,IAEzBC,IAAgC,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,SAAAC,IAAU;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,QAAAC;AAAA,EACA,gBAAAC,IAAiB;AACnB,MAAM;AACJ,QAAMC,IAAeR,MAAc,QAC7B,CAACS,GAAmBC,CAAoB,IAAIC,EAAS,CAAC,GACtD,CAACC,GAAaC,CAAc,IAAIF,EAAS,CAAC,GAC1C,CAACG,GAAWC,CAAY,IAAIJ,EAAS,CAAC,GACtC,CAACK,GAAYC,CAAa,IAAIN,EAAS,CAAC,GACxC,CAACO,GAAgBC,CAAiB,IAAIR,EAAkC,IAAI,GAC5ES,IAASC,KACTC,IAAUC,EAAuB,IAAI,GACrCC,IAAcD,EAAuB,IAAI,GACzCE,IAAaF,EAAuB,IAAI;AAE9C,MAAIG,IAA2B;AAC/B,EAAIvB,MAAU,YACEuB,IAAAtB;AAGV,QAAAuB,IAAgB,CAACC,GAAkBC,MAA2B;AAClE,IAAKrB,MACHE,EAAqBkB,CAAQ,GACzBA,IAAWC,KAEbZ,EAAc,CAAC,GACHa,OACHF,IAAWC,MAEpBZ,EAAc,C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A;AAAA,EACF,EAAA,CAAA;AAEJ,GAKMgB,IAAOlD;AACbkD,EAAK,cAAc;AACnBA,EAAK,MAAMC;AACXD,EAAK,IAAI,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Tab from './Tab';\nimport TabList from './TabList';\nimport TabPanel from './TabPanel';\nimport designsystemlayout from '../../scss/layout.module.scss';\nimport { PaletteNames } from '../../theme/palette';\nimport { isMobileUA } from '../../utils/mobile';\n\nimport styles from './styles.module.scss';\n\nexport type { TabProps } from './Tab';\nexport type TabsColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'white'>;\nexport type TabsOnColor = 'onblueberry' | 'onneutral' | 'onwhite';\nexport type TabsTouchBehaviour = 'swipe' | 'none';\n\nexport interface TabsProps {\n children?: React.ReactNode;\n /** Controlled state for Tabs component */\n activeTab?: number;\n /** Adds custom classes to the element. */\n className?: string;\n /** Sets the color of the tabs. Default: white */\n color?: TabsColors;\n /** Sets wether the component should use the container-breakout class. Default: true */\n containerBreakout?: boolean;\n /** Sets the background color of the tabs. Can only be used when the color is set to white. Default: onwhite */\n onColor?: TabsOnColor;\n /** Whether the tab list should be sticky */\n sticky?: boolean;\n /** Determines how Tabs respons to touch events. */\n touchBehaviour?: TabsTouchBehaviour;\n /** Sets the data-testid attribute. */\n testId?: string;\n}\n\nconst swipeDistanceThreshold = 75;\n\nconst TabsRoot: React.FC<TabsProps> = ({\n activeTab,\n children,\n className,\n color = 'white',\n containerBreakout = true,\n onColor = 'onwhite',\n sticky = true,\n testId,\n touchBehaviour = 'none',\n}) => {\n const isControlled = activeTab !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(0);\n const [touchStartX, setTouchStartX] = useState(0);\n const [touchEndX, setTouchEndX] = useState(0);\n const [translateX, setTranslateX] = useState(0);\n const [panelAnimation, setPanelAnimation] = useState<'left' | 'right' | null>(null);\n const mobile = isMobileUA();\n const tabsRef = useRef<HTMLDivElement>(null);\n const tabPanelRef = useRef<HTMLDivElement>(null);\n const tabListRef = useRef<HTMLDivElement>(null);\n\n let onColorUsed: TabsOnColor = 'onwhite';\n if (color === 'white') {\n onColorUsed = onColor;\n }\n\n const onValueChange = (newValue: number, oldValue: number): void => {\n if (!isControlled) {\n setUncontrolledValue(newValue);\n if (newValue > oldValue) {\n // make sure that the translateX is reset so the animation does not go outside the screen\n setTranslateX(0);\n onLeftSwipe();\n } else if (newValue < oldValue) {\n // make sure that the translateX is reset so the animation does not go outside the screen\n setTranslateX(0);\n onRightSwipe();\n }\n }\n };\n\n const onRightSwipe = (): void => {\n mobile && setPanelAnimation('right');\n };\n\n const onLeftSwipe = (): void => {\n mobile && setPanelAnimation('left');\n };\n\n const resetAnimation = (): void => {\n setPanelAnimation(null);\n };\n\n const activeTabIndex = isControlled ? activeTab : uncontrolledValue;\n\n useEffect(() => {\n const handleTouchStart = (event: TouchEvent): void => {\n setTouchStartX(event.touches[0].clientX);\n };\n\n const handleTouchMove = (event: TouchEvent): void => {\n setTouchEndX(event.touches[0].clientX);\n const newTranslateX = event.touches[0].clientX - touchStartX;\n\n if (activeTabIndex === 0 && newTranslateX > 0) {\n setTranslateX(0);\n } else if (activeTabIndex === React.Children.count(children) - 1 && newTranslateX < 0) {\n setTranslateX(0);\n } else {\n setTranslateX(newTranslateX);\n }\n };\n\n const handleTouchEnd = (): void => {\n const swipeDistance = Math.abs(touchEndX - touchStartX);\n if (swipeDistance >= swipeDistanceThreshold) {\n if (touchEndX > touchStartX) {\n // User swiped right\n onValueChange(Math.max(0, activeTabIndex - 1), activeTabIndex);\n } else {\n // User swiped left\n onValueChange(Math.min(React.Children.count(children) - 1, activeTabIndex + 1), activeTabIndex);\n }\n }\n setTranslateX(0);\n };\n\n if (touchBehaviour === 'swipe' && tabsRef.current) {\n tabsRef.current.addEventListener('touchstart', handleTouchStart);\n tabsRef.current.addEventListener('touchmove', handleTouchMove);\n tabsRef.current.addEventListener('touchend', handleTouchEnd);\n }\n return () => {\n if (tabsRef.current) {\n tabsRef.current.removeEventListener('touchstart', handleTouchStart);\n tabsRef.current.removeEventListener('touchmove', handleTouchMove);\n tabsRef.current.removeEventListener('touchend', handleTouchEnd);\n }\n };\n }, [touchBehaviour, touchStartX, touchEndX, activeTabIndex]);\n\n useEffect(() => {\n const handleAnimationEnd = (): void => {\n resetAnimation();\n };\n\n if (tabPanelRef.current) {\n tabPanelRef.current.addEventListener('animationend', handleAnimationEnd);\n }\n\n return () => {\n if (tabPanelRef.current) {\n tabPanelRef.current.removeEventListener('animationend', handleAnimationEnd);\n }\n };\n }, []);\n\n return (\n <div className={classNames(className, containerBreakout && designsystemlayout['container-breakout'])} data-testid={testId}>\n <div\n ref={tabListRef}\n className={classNames(styles['tab-list-wrapper'], {\n [styles['tab-list-wrapper--sticky']]: sticky,\n })}\n >\n <TabList\n onTabListClick={(index: number) => onValueChange(index, activeTabIndex)}\n selectedTab={activeTabIndex}\n color={color}\n onColor={onColorUsed}\n >\n {children}\n </TabList>\n <div className={classNames(styles['panel-wrapper'], styles[`panel-wrapper--${color}`])}></div>\n </div>\n <div ref={tabsRef} style={{ marginTop: '-50px' }}>\n <TabPanel ref={tabPanelRef} color={color} isFirst={activeTabIndex == 0} translateX={translateX} animate={panelAnimation}>\n {React.Children.toArray(children)[activeTabIndex]}\n </TabPanel>\n </div>\n </div>\n );\n};\n\ntype TabsComponent = typeof TabsRoot & {\n Tab: typeof Tab;\n};\nconst Tabs = TabsRoot as TabsComponent;\nTabs.displayName = 'Tabs';\nTabs.Tab = Tab;\nTabs.Tab.displayName = 'Tabs.Tab';\n\nexport default Tabs;\n"],"names":["swipeDistanceThreshold","TabsRoot","activeTab","children","className","color","containerBreakout","onColor","sticky","testId","touchBehaviour","isControlled","uncontrolledValue","setUncontrolledValue","useState","touchStartX","setTouchStartX","touchEndX","setTouchEndX","translateX","setTranslateX","panelAnimation","setPanelAnimation","mobile","isMobileUA","tabsRef","useRef","tabPanelRef","tabListRef","onColorUsed","onValueChange","newValue","oldValue","onLeftSwipe","onRightSwipe","resetAnimation","activeTabIndex","useEffect","handleTouchStart","event","handleTouchMove","newTranslateX","React","handleTouchEnd","handleAnimationEnd","jsxs","classNames","designsystemlayout","styles","jsx","TabList","index","TabPanel","Tabs","Tab"],"mappings":";;;;;;;;AAsCA,MAAMA,IAAyB,IAEzBC,IAAgC,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,mBAAAC,IAAoB;AAAA,EACpB,SAAAC,IAAU;AAAA,EACV,QAAAC,IAAS;AAAA,EACT,QAAAC;AAAA,EACA,gBAAAC,IAAiB;AACnB,MAAM;AACJ,QAAMC,IAAeT,MAAc,QAC7B,CAACU,GAAmBC,CAAoB,IAAIC,EAAS,CAAC,GACtD,CAACC,GAAaC,CAAc,IAAIF,EAAS,CAAC,GAC1C,CAACG,GAAWC,CAAY,IAAIJ,EAAS,CAAC,GACtC,CAACK,GAAYC,CAAa,IAAIN,EAAS,CAAC,GACxC,CAACO,GAAgBC,CAAiB,IAAIR,EAAkC,IAAI,GAC5ES,IAASC,KACTC,IAAUC,EAAuB,IAAI,GACrCC,IAAcD,EAAuB,IAAI,GACzCE,IAAaF,EAAuB,IAAI;AAE9C,MAAIG,IAA2B;AAC/B,EAAIxB,MAAU,YACEwB,IAAAtB;AAGV,QAAAuB,IAAgB,CAACC,GAAkBC,MAA2B;AAClE,IAAKrB,MACHE,EAAqBkB,CAAQ,GACzBA,IAAWC,KAEbZ,EAAc,CAAC,GACHa,OACHF,IAAWC,MAEpBZ,EAAc,CAAC,GACFc;EAEjB,GAGIA,IAAe,MAAY;AAC/B,IAAAX,KAAUD,EAAkB,OAAO;AAAA,EAAA,GAG/BW,IAAc,MAAY;AAC9B,IAAAV,KAAUD,EAAkB,MAAM;AAAA,EAAA,GAG9Ba,IAAiB,M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CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@import './breakpoints';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
Denne filen er ment til å importeres som en css module:
|
|
5
|
+
import designsystemlayout from './scss/layout.scss'
|
|
6
|
+
<div className={designsystemlayout['container-breakout']}></div>
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.container-breakout {
|
|
10
|
+
// This is a copy of how bootstrap's row class sets margins inside a container
|
|
11
|
+
// https://github.com/twbs/bootstrap/blob/e5643aaa89eb67327a5b4abe7db976f0ea276b70/scss/mixins/_grid.scss#L16C1-L17C30
|
|
12
|
+
margin-right: -$grid-gutter-width * 0.5;
|
|
13
|
+
margin-left: -$grid-gutter-width * 0.5;
|
|
14
|
+
}
|