@helsenorge/designsystem-react 7.6.0 → 7.8.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/CHANGELOG.md +40 -3
- package/components/AnchorLink/styles.module.scss +6 -5
- package/components/Badge/Badge.d.ts +7 -1
- package/components/Badge/Badge.js +19 -9
- package/components/Badge/Badge.js.map +1 -1
- package/components/Badge/Badge.stories.d.ts +11 -0
- package/components/Badge/NotificationBadge.d.ts +17 -0
- package/components/Badge/NotificationBadge.js +68 -0
- package/components/Badge/NotificationBadge.js.map +1 -0
- package/components/Button/Button.d.ts +3 -0
- package/components/Button/Button.js +68 -66
- package/components/Button/Button.js.map +1 -1
- package/components/Button/styles.module.scss +6 -0
- package/components/Button/styles.module.scss.d.ts +1 -0
- package/components/Expander/styles.module.scss +4 -2
- package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +13 -12
- package/components/LinkList/LinkList.stories.d.ts +1 -0
- package/components/List/List.stories.d.ts +19 -2
- package/components/ListHeader/ListHeader.d.ts +1 -1
- package/components/ListHeader/ListHeader.js +32 -28
- package/components/ListHeader/ListHeader.js.map +1 -1
- package/components/NotificationPanel/NotificationPanel.d.ts +1 -1
- package/components/NotificationPanel/NotificationPanel.js +69 -103
- package/components/NotificationPanel/NotificationPanel.js.map +1 -1
- package/components/NotificationPanel/NotificationPanel.stories.d.ts +1 -1
- package/components/NotificationPanel/styles.module.scss +14 -0
- package/components/NotificationPanel/styles.module.scss.d.ts +1 -0
- package/components/ServiceMessage/ServiceMessage.js +66 -75
- package/components/ServiceMessage/ServiceMessage.js.map +1 -1
- package/components/ServiceMessage/ServiceMessage.stories.d.ts +1 -1
- package/components/ServiceMessage/styles.module.scss +13 -0
- package/components/ServiceMessage/styles.module.scss.d.ts +1 -0
- package/components/Tabs/Tab.d.ts +17 -0
- package/components/Tabs/Tab.js +6 -0
- package/components/Tabs/Tab.js.map +1 -0
- package/components/Tabs/TabList/TabList.d.ts +11 -0
- package/components/Tabs/TabList/TabList.js +51 -0
- package/components/Tabs/TabList/TabList.js.map +1 -0
- package/components/Tabs/TabList/index.d.ts +3 -0
- package/components/Tabs/TabList/index.js +5 -0
- package/components/Tabs/TabList/index.js.map +1 -0
- package/components/Tabs/TabList/styles.module.scss +109 -0
- package/components/Tabs/TabList/styles.module.scss.d.ts +18 -0
- package/components/Tabs/TabPanel/TabPanel.d.ts +9 -0
- package/components/Tabs/TabPanel/TabPanel.js +13 -0
- package/components/Tabs/TabPanel/TabPanel.js.map +1 -0
- package/components/Tabs/TabPanel/index.d.ts +3 -0
- package/components/Tabs/TabPanel/index.js +5 -0
- package/components/Tabs/TabPanel/index.js.map +1 -0
- package/components/Tabs/TabPanel/styles.module.scss +37 -0
- package/components/Tabs/TabPanel/styles.module.scss.d.ts +15 -0
- package/components/Tabs/Tabs.d.ts +22 -0
- package/components/Tabs/Tabs.js +19 -0
- package/components/Tabs/Tabs.js.map +1 -0
- package/components/Tabs/Tabs.stories.d.ts +50 -0
- package/components/Tabs/index.d.ts +3 -0
- package/components/Tabs/index.js +5 -0
- package/components/Tabs/index.js.map +1 -0
- package/components/Tabs/styles.module.scss +3 -0
- package/components/Tabs/styles.module.scss.d.ts +9 -0
- package/components/Tile/Tile.stories.d.ts +26 -2
- package/constants.d.ts +5 -1
- package/constants.js +1 -1
- package/constants.js.map +1 -1
- package/docs/index.js +7 -7
- package/docs/index.js.map +1 -1
- package/hooks/useRovingFocus.d.ts +1 -0
- package/hooks/useRovingFocus.js +27 -0
- package/hooks/useRovingFocus.js.map +1 -0
- package/hooks/useRovingFocus.stories.d.ts +17 -0
- package/package.json +1 -1
- package/scss/typography.module.scss +7 -5
- package/components/NotificationPanel/DetailButton/DetailButton.d.ts +0 -9
- package/components/NotificationPanel/DetailButton/DetailButton.js +0 -28
- package/components/NotificationPanel/DetailButton/DetailButton.js.map +0 -1
- package/components/NotificationPanel/DetailButton/styles.module.scss +0 -38
- package/components/NotificationPanel/DetailButton/styles.module.scss.d.ts +0 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
## [7.7.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.6.0&targetVersion=GTv7.7.0) (2024-05-28)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- ny type notification Badge og tillates flere badges i ListHeader
|
|
6
|
+
([0768e0a](https://github.com/helsenorge/designsystem/commit/0768e0ae1d137f17ecfa92aa2b708ca52862e6b2)), closes
|
|
7
|
+
[#325119](https://github.com/helsenorge/designsystem/issues/325119)
|
|
8
|
+
- **expander:** bruk token på bakgrunn for liten expander
|
|
9
|
+
([73d8531](https://github.com/helsenorge/designsystem/commit/73d8531a52ed5a6387af8fa84045a0afd620eb38)), closes
|
|
10
|
+
[#324989](https://github.com/helsenorge/designsystem/issues/324989)
|
|
11
|
+
- **notificationpanel:** bruk Expander-komponent i NotificationPanel
|
|
12
|
+
([e8d4e8d](https://github.com/helsenorge/designsystem/commit/e8d4e8d776333f243cddba8f15742dd6f271bb3d)), closes
|
|
13
|
+
[#324989](https://github.com/helsenorge/designsystem/issues/324989)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **expander:** manglende import av supernova stylesheet
|
|
18
|
+
([077ec2d](https://github.com/helsenorge/designsystem/commit/077ec2d1f59ce80076deeae5bc7911f7a9a2e431)), closes
|
|
19
|
+
[#324989](https://github.com/helsenorge/designsystem/issues/324989)
|
|
20
|
+
|
|
21
|
+
## [7.6.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.5.0&targetVersion=GTv7.6.0) (2024-05-15)
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
- **notificationpanel:** legg til prop for å sette html tag for label
|
|
26
|
+
([ebd331a](https://github.com/helsenorge/designsystem/commit/ebd331a75f04099c4ad7e552ff70df8751675734)), closes
|
|
27
|
+
[#324952](https://github.com/helsenorge/designsystem/issues/324952)
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
- skjemaelementer med error styling overlapper utifra dom rekkefølge
|
|
32
|
+
([b07b7d6](https://github.com/helsenorge/designsystem/commit/b07b7d69391b3e4296e8a8cde8b8d312f835cb03)), closes
|
|
33
|
+
[#324846](https://github.com/helsenorge/designsystem/issues/324846)
|
|
34
|
+
- **expanderlist:** fiks så variant fill ikke mister margin top ved åpning av expander
|
|
35
|
+
([d277c97](https://github.com/helsenorge/designsystem/commit/d277c97660aa8334a44b1183445f55f2037b2263)), closes
|
|
36
|
+
[#324823](https://github.com/helsenorge/designsystem/issues/324823)
|
|
37
|
+
|
|
1
38
|
## [7.5.0](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv7.4.0&targetVersion=GTv7.5.0) (2024-05-08)
|
|
2
39
|
|
|
3
40
|
### Features
|
|
@@ -1431,12 +1468,12 @@ Dette er fordi vi skal kunne dynamisk importere alt som ligger i Icons, så da b
|
|
|
1431
1468
|
|
|
1432
1469
|
### Bug Fixes
|
|
1433
1470
|
|
|
1434
|
-
- panel har avstand fra tittel til badge
|
|
1435
|
-
([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
|
|
1436
|
-
[#282359](https://github.com/helsenorge/designsystem/issues/282359)
|
|
1437
1471
|
- økt kontrast på understreking av lenker
|
|
1438
1472
|
([50b7fa4](https://github.com/helsenorge/designsystem/commit/50b7fa47fb44cb7d75fb877bd53e2309b35e1e21)), closes
|
|
1439
1473
|
[#229049](https://github.com/helsenorge/designsystem/issues/229049)
|
|
1474
|
+
- panel har avstand fra tittel til badge
|
|
1475
|
+
([09034c4](https://github.com/helsenorge/designsystem/commit/09034c4844408c7cfe8f65d7a1a0d82a7828c2ef)), closes
|
|
1476
|
+
[#282359](https://github.com/helsenorge/designsystem/issues/282359)
|
|
1440
1477
|
|
|
1441
1478
|
## [1.2.2](https://github.com/helsenorge/designsystem/branchCompare?baseVersion=GTv1.2.1&targetVersion=GTv1.2.2) (2022-08-31)
|
|
1442
1479
|
|
|
@@ -10,7 +10,7 @@ $focus-width: 0.15rem;
|
|
|
10
10
|
cursor: pointer;
|
|
11
11
|
color: $blueberry700;
|
|
12
12
|
background-color: $blueberry60010;
|
|
13
|
-
|
|
13
|
+
text-decoration-color: $blueberry600;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
@mixin anchorlink-focus {
|
|
@@ -24,12 +24,13 @@ $focus-width: 0.15rem;
|
|
|
24
24
|
overflow-wrap: break-word;
|
|
25
25
|
word-break: break-word;
|
|
26
26
|
text-align: left;
|
|
27
|
-
text-decoration: none;
|
|
28
27
|
color: $blueberry600;
|
|
29
28
|
border: $focus-width solid transparent;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
text-decoration: underline;
|
|
30
|
+
text-underline-offset: 0.16rem;
|
|
31
|
+
text-decoration-color: $blueberry400;
|
|
32
|
+
text-decoration-thickness: $underline-width;
|
|
33
|
+
padding: 0.1rem;
|
|
33
34
|
|
|
34
35
|
&:hover {
|
|
35
36
|
@include anchorlink-hover;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { BadgeNotificationVariant } from './NotificationBadge';
|
|
2
3
|
import { PaletteNames } from '../../theme/palette';
|
|
3
4
|
export type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;
|
|
4
5
|
export type BadgeChildren = string | number;
|
|
6
|
+
export type BadgeVariant = 'string' | 'notification';
|
|
5
7
|
export interface BadgeProps {
|
|
6
8
|
/** Sets the content of the badge. */
|
|
7
|
-
children
|
|
9
|
+
children?: BadgeChildren;
|
|
8
10
|
/** Adds custom classes to the element. */
|
|
9
11
|
className?: string;
|
|
10
12
|
/** Changes the badge background color. */
|
|
11
13
|
color?: BadgeColors;
|
|
12
14
|
/** Sets the data-testid attribute. */
|
|
13
15
|
testId?: string;
|
|
16
|
+
/** Changes the type of the badge. Default: string */
|
|
17
|
+
type?: BadgeVariant;
|
|
18
|
+
/** Type of notification badge. Only works if type is 'notification'. */
|
|
19
|
+
notificationVariant?: BadgeNotificationVariant;
|
|
14
20
|
}
|
|
15
21
|
export type BadgeType = React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;
|
|
16
22
|
declare const Badge: BadgeType;
|
|
@@ -1,20 +1,30 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import t from "react";
|
|
2
|
+
import m from "classnames";
|
|
3
|
+
import g from "./NotificationBadge.js";
|
|
4
|
+
import { IconSize as b, AnalyticsId as d } from "../../constants.js";
|
|
4
5
|
import e from "../Badge/styles.module.scss";
|
|
5
|
-
const
|
|
6
|
-
const { children:
|
|
6
|
+
const u = t.forwardRef(function(n, s) {
|
|
7
|
+
const { children: c, className: r = "", color: a = "blueberry", testId: i, type: l = "string", notificationVariant: o = "info" } = n, f = m(
|
|
7
8
|
e.badge,
|
|
8
9
|
{
|
|
9
10
|
[e["badge--blueberry"]]: a === "blueberry",
|
|
10
11
|
[e["badge--cherry"]]: a === "cherry",
|
|
11
12
|
[e["badge--neutral"]]: a === "neutral"
|
|
12
13
|
},
|
|
13
|
-
|
|
14
|
+
r
|
|
14
15
|
);
|
|
15
|
-
return
|
|
16
|
-
|
|
16
|
+
return l === "notification" && o !== void 0 ? /* @__PURE__ */ t.createElement(
|
|
17
|
+
g,
|
|
18
|
+
{
|
|
19
|
+
variant: o,
|
|
20
|
+
size: b.XSmall,
|
|
21
|
+
className: r,
|
|
22
|
+
testId: i,
|
|
23
|
+
"data-analyticsid": d.Badge
|
|
24
|
+
}
|
|
25
|
+
) : /* @__PURE__ */ t.createElement("span", { className: f, ref: s, "data-testid": i, "data-analyticsid": d.Badge }, c);
|
|
26
|
+
}), R = u;
|
|
17
27
|
export {
|
|
18
|
-
|
|
28
|
+
R as default
|
|
19
29
|
};
|
|
20
30
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { AnalyticsId } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\n\nimport badgeStyles from './styles.module.scss';\n\nexport type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;\nexport type BadgeChildren = string | number;\n\nexport interface BadgeProps {\n /** Sets the content of the badge. */\n children
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport NotificationBadge, { BadgeNotificationVariant } from './NotificationBadge';\nimport { AnalyticsId, IconSize } from '../../constants';\nimport { PaletteNames } from '../../theme/palette';\n\nimport badgeStyles from './styles.module.scss';\n\nexport type BadgeColors = Extract<PaletteNames, 'blueberry' | 'cherry' | 'neutral'>;\nexport type BadgeChildren = string | number;\nexport type BadgeVariant = 'string' | 'notification';\n\nexport interface BadgeProps {\n /** Sets the content of the badge. */\n children?: BadgeChildren;\n /** Adds custom classes to the element. */\n className?: string;\n /** Changes the badge background color. */\n color?: BadgeColors;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Changes the type of the badge. Default: string */\n type?: BadgeVariant;\n /** Type of notification badge. Only works if type is 'notification'. */\n notificationVariant?: BadgeNotificationVariant;\n}\n\nexport type BadgeType = React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLElement>>;\nconst Badge: BadgeType = React.forwardRef(function BadgeForwardedRef(props: BadgeProps, ref: React.ForwardedRef<HTMLElement>) {\n const { children, className = '', color = 'blueberry', testId, type = 'string', notificationVariant = 'info' } = props;\n const badgeClasses = classNames(\n badgeStyles.badge,\n {\n [badgeStyles['badge--blueberry']]: color === 'blueberry',\n [badgeStyles['badge--cherry']]: color === 'cherry',\n [badgeStyles['badge--neutral']]: color === 'neutral',\n },\n className\n );\n\n if (type === 'notification' && notificationVariant !== undefined) {\n return (\n <NotificationBadge\n variant={notificationVariant}\n size={IconSize.XSmall}\n className={className}\n testId={testId}\n data-analyticsid={AnalyticsId.Badge}\n />\n );\n }\n\n return (\n <span className={badgeClasses} ref={ref} data-testid={testId} data-analyticsid={AnalyticsId.Badge}>\n {children}\n </span>\n );\n});\n\nexport default Badge;\n"],"names":["Badge","React","props","ref","children","className","color","testId","type","notificationVariant","badgeClasses","classNames","badgeStyles","NotificationBadge","IconSize","AnalyticsId","Badge$1"],"mappings":";;;;;AA8BA,MAAMA,IAAmBC,EAAM,WAAW,SAA2BC,GAAmBC,GAAsC;AACtH,QAAA,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,OAAAC,IAAQ,aAAa,QAAAC,GAAQ,MAAAC,IAAO,UAAU,qBAAAC,IAAsB,OAAA,IAAWP,GAC3GQ,IAAeC;AAAA,IACnBC,EAAY;AAAA,IACZ;AAAA,MACE,CAACA,EAAY,kBAAkB,CAAC,GAAGN,MAAU;AAAA,MAC7C,CAACM,EAAY,eAAe,CAAC,GAAGN,MAAU;AAAA,MAC1C,CAACM,EAAY,gBAAgB,CAAC,GAAGN,MAAU;AAAA,IAC7C;AAAA,IACAD;AAAA,EAAA;AAGE,SAAAG,MAAS,kBAAkBC,MAAwB,SAEnDR,gBAAAA,EAAA;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,SAASJ;AAAA,MACT,MAAMK,EAAS;AAAA,MACf,WAAAT;AAAA,MACA,QAAAE;AAAA,MACA,oBAAkBQ,EAAY;AAAA,IAAA;AAAA,EAAA,IAMlCd,gBAAAA,EAAA,cAAC,QAAK,EAAA,WAAWS,GAAc,KAAAP,GAAU,eAAaI,GAAQ,oBAAkBQ,EAAY,MAAA,GACzFX,CACH;AAEJ,CAAC,GAEDY,IAAehB;"}
|
|
@@ -14,6 +14,8 @@ declare const meta: {
|
|
|
14
14
|
args: {
|
|
15
15
|
children: string;
|
|
16
16
|
color: "blueberry";
|
|
17
|
+
type: "string";
|
|
18
|
+
notificationVariant: "info";
|
|
17
19
|
};
|
|
18
20
|
argTypes: {
|
|
19
21
|
children: {
|
|
@@ -23,9 +25,18 @@ declare const meta: {
|
|
|
23
25
|
control: string;
|
|
24
26
|
options: string[];
|
|
25
27
|
};
|
|
28
|
+
type: {
|
|
29
|
+
control: string;
|
|
30
|
+
options: string[];
|
|
31
|
+
};
|
|
32
|
+
notificationVariant: {
|
|
33
|
+
control: string;
|
|
34
|
+
options: string[];
|
|
35
|
+
};
|
|
26
36
|
};
|
|
27
37
|
};
|
|
28
38
|
export default meta;
|
|
29
39
|
type Story = StoryObj<typeof meta>;
|
|
30
40
|
export declare const Default: Story;
|
|
31
41
|
export declare const Variants: Story;
|
|
42
|
+
export declare const Notification: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconSize } from '../../constants';
|
|
3
|
+
export type BadgeNotificationVariant = 'info' | 'warn' | 'error' | 'success';
|
|
4
|
+
export interface NotificationBadgeProps {
|
|
5
|
+
/** Changes the type of the badge */
|
|
6
|
+
variant: BadgeNotificationVariant;
|
|
7
|
+
/** Sets the size of the badge */
|
|
8
|
+
size: IconSize;
|
|
9
|
+
/** Adds custom classes to the element */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Sets the data-testid attribute. */
|
|
12
|
+
testId?: string;
|
|
13
|
+
/** Sets hover state */
|
|
14
|
+
isHovered?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare const NotificationBadge: (props: NotificationBadgeProps) => React.JSX.Element;
|
|
17
|
+
export default NotificationBadge;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import c from "react";
|
|
2
|
+
import { palette as r } from "../../theme/palette.js";
|
|
3
|
+
import { Icon as n } from "../Icon/Icon.js";
|
|
4
|
+
import s from "../Icons/CheckFill.js";
|
|
5
|
+
import m from "../Icons/ErrorSignFill.js";
|
|
6
|
+
import f from "../Icons/InfoSignFill.js";
|
|
7
|
+
import v from "../Icons/TriangleX.js";
|
|
8
|
+
const g = (i) => {
|
|
9
|
+
const { variant: l, size: e, className: o = "", testId: t, isHovered: a = !1 } = i;
|
|
10
|
+
switch (l) {
|
|
11
|
+
case "info":
|
|
12
|
+
return /* @__PURE__ */ c.createElement(
|
|
13
|
+
n,
|
|
14
|
+
{
|
|
15
|
+
svgIcon: f,
|
|
16
|
+
color: r.blueberry700,
|
|
17
|
+
hoverColor: r.blueberry700,
|
|
18
|
+
size: e,
|
|
19
|
+
className: o,
|
|
20
|
+
testId: t,
|
|
21
|
+
isHovered: a
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
case "warn":
|
|
25
|
+
return /* @__PURE__ */ c.createElement(
|
|
26
|
+
n,
|
|
27
|
+
{
|
|
28
|
+
svgIcon: m,
|
|
29
|
+
color: r.banana700,
|
|
30
|
+
hoverColor: r.banana700,
|
|
31
|
+
size: e,
|
|
32
|
+
className: o,
|
|
33
|
+
testId: t,
|
|
34
|
+
isHovered: a
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
case "error":
|
|
38
|
+
return /* @__PURE__ */ c.createElement(
|
|
39
|
+
n,
|
|
40
|
+
{
|
|
41
|
+
svgIcon: v,
|
|
42
|
+
color: r.cherry700,
|
|
43
|
+
hoverColor: r.cherry700,
|
|
44
|
+
size: e,
|
|
45
|
+
className: o,
|
|
46
|
+
testId: t,
|
|
47
|
+
isHovered: a
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
case "success":
|
|
51
|
+
return /* @__PURE__ */ c.createElement(
|
|
52
|
+
n,
|
|
53
|
+
{
|
|
54
|
+
svgIcon: s,
|
|
55
|
+
color: r.kiwi900,
|
|
56
|
+
hoverColor: r.kiwi900,
|
|
57
|
+
size: e,
|
|
58
|
+
className: o,
|
|
59
|
+
testId: t,
|
|
60
|
+
isHovered: a
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}, E = g;
|
|
65
|
+
export {
|
|
66
|
+
E as default
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=NotificationBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationBadge.js","sources":["../../../src/components/Badge/NotificationBadge.tsx"],"sourcesContent":["import React from 'react';\n\nimport { IconSize } from '../../constants';\nimport { palette } from '../../theme/palette';\nimport Icon from '../Icon';\nimport CheckFill from '../Icons/CheckFill';\nimport ErrorSignFill from '../Icons/ErrorSignFill';\nimport InfoSignFill from '../Icons/InfoSignFill';\nimport TriangleX from '../Icons/TriangleX';\n\nexport type BadgeNotificationVariant = 'info' | 'warn' | 'error' | 'success';\n\nexport interface NotificationBadgeProps {\n /** Changes the type of the badge */\n variant: BadgeNotificationVariant;\n /** Sets the size of the badge */\n size: IconSize;\n /** Adds custom classes to the element */\n className?: string;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets hover state */\n isHovered?: boolean;\n}\n\nconst NotificationBadge = (props: NotificationBadgeProps): React.JSX.Element => {\n const { variant, size, className = '', testId, isHovered = false } = props;\n switch (variant) {\n case 'info':\n return (\n <Icon\n svgIcon={InfoSignFill}\n color={palette.blueberry700}\n hoverColor={palette.blueberry700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'warn':\n return (\n <Icon\n svgIcon={ErrorSignFill}\n color={palette.banana700}\n hoverColor={palette.banana700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'error':\n return (\n <Icon\n svgIcon={TriangleX}\n color={palette.cherry700}\n hoverColor={palette.cherry700}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n case 'success':\n return (\n <Icon\n svgIcon={CheckFill}\n color={palette.kiwi900}\n hoverColor={palette.kiwi900}\n size={size}\n className={className}\n testId={testId}\n isHovered={isHovered}\n />\n );\n }\n};\n\nexport default NotificationBadge;\n"],"names":["NotificationBadge","props","variant","size","className","testId","isHovered","React","Icon","InfoSignFill","palette","ErrorSignFill","TriangleX","CheckFill","NotificationBadge$1"],"mappings":";;;;;;;AAyBA,MAAMA,IAAoB,CAACC,MAAqD;AACxE,QAAA,EAAE,SAAAC,GAAS,MAAAC,GAAM,WAAAC,IAAY,IAAI,QAAAC,GAAQ,WAAAC,IAAY,GAAU,IAAAL;AACrE,UAAQC,GAAS;AAAA,IACf,KAAK;AAED,aAAAK,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASC;AAAA,UACT,OAAOC,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASG;AAAA,UACT,OAAOD,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASI;AAAA,UACT,OAAOF,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IAGN,KAAK;AAED,aAAAC,gBAAAA,EAAA;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAASK;AAAA,UACT,OAAOH,EAAQ;AAAA,UACf,YAAYA,EAAQ;AAAA,UACpB,MAAAP;AAAA,UACA,WAAAC;AAAA,UACA,QAAAC;AAAA,UACA,WAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,EAGR;AACF,GAEAQ,IAAed;"}
|
|
@@ -6,6 +6,7 @@ export type ButtonSize = 'medium' | 'large';
|
|
|
6
6
|
export type ButtonMode = 'onlight' | 'ondark';
|
|
7
7
|
export type ButtonTags = 'button' | 'a';
|
|
8
8
|
export type ButtonArrows = 'icon' | 'accessibility-character';
|
|
9
|
+
export type ButtonTextPosition = 'left' | 'centered-mobile';
|
|
9
10
|
export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {
|
|
10
11
|
/** Sets the aria-label of the button, use when the button only includes an icon */
|
|
11
12
|
ariaLabel?: string;
|
|
@@ -41,6 +42,8 @@ export interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttri
|
|
|
41
42
|
tabIndex?: number;
|
|
42
43
|
/** Sets the data-testid attribute. */
|
|
43
44
|
testId?: string;
|
|
45
|
+
/** Sets the position of the text in the button - only applies when button is fluid */
|
|
46
|
+
textPosition?: ButtonTextPosition;
|
|
44
47
|
/** Button type. Default: button */
|
|
45
48
|
type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
|
46
49
|
}
|
|
@@ -1,116 +1,118 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { AnalyticsId as $, IconSize as
|
|
5
|
-
import { useBreakpoint as
|
|
1
|
+
import e, { useRef as it, useEffect as ct } from "react";
|
|
2
|
+
import p from "classnames";
|
|
3
|
+
import { Icon as ut } from "../Icon/Icon.js";
|
|
4
|
+
import { AnalyticsId as $, IconSize as N } from "../../constants.js";
|
|
5
|
+
import { useBreakpoint as mt } from "../../hooks/useBreakpoint.js";
|
|
6
6
|
import { useHover as D } from "../../hooks/useHover.js";
|
|
7
|
-
import { useIcons as
|
|
8
|
-
import { getColor as
|
|
9
|
-
import { breakpoints as
|
|
10
|
-
import { isTest as
|
|
11
|
-
import
|
|
7
|
+
import { useIcons as bt } from "../../hooks/useIcons.js";
|
|
8
|
+
import { getColor as c } from "../../theme/currys/color.js";
|
|
9
|
+
import { breakpoints as dt } from "../../theme/grid.js";
|
|
10
|
+
import { isTest as pt, isProd as ft } from "../../utils/environment.js";
|
|
11
|
+
import ht from "../Icons/ArrowRight.js";
|
|
12
12
|
import t from "../Button/styles.module.scss";
|
|
13
|
-
const
|
|
14
|
-
if (n &&
|
|
13
|
+
const _t = (o, r, n, f, s, _) => _ && n ? !s || o ? c("neutral", r ? 500 : 700) : c("white") : n ? !s || o ? c("neutral", 500) : `${c("white")}b3` : o && !s || !o && s ? "white" : f === "normal" ? c("blueberry", 600) : c("cherry", 500), B = (o, r) => r && o ? N.Small : o ? N.Medium : N.XSmall, gt = (o, r, n) => {
|
|
14
|
+
if (n && o && (r === void 0 || r === ""))
|
|
15
15
|
throw new Error("Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav");
|
|
16
|
-
},
|
|
16
|
+
}, wt = e.forwardRef(function(r, n) {
|
|
17
17
|
const {
|
|
18
|
-
ariaLabel:
|
|
19
|
-
id:
|
|
20
|
-
children:
|
|
18
|
+
ariaLabel: f,
|
|
19
|
+
id: s,
|
|
20
|
+
children: _,
|
|
21
21
|
wrapperClassName: O,
|
|
22
22
|
className: X,
|
|
23
|
-
arrow:
|
|
24
|
-
concept:
|
|
25
|
-
disabled:
|
|
26
|
-
ellipsis:
|
|
27
|
-
fluid:
|
|
28
|
-
htmlMarkup:
|
|
23
|
+
arrow: g,
|
|
24
|
+
concept: R = "normal",
|
|
25
|
+
disabled: u = !1,
|
|
26
|
+
ellipsis: x = !1,
|
|
27
|
+
fluid: w = !1,
|
|
28
|
+
htmlMarkup: I = "button",
|
|
29
29
|
mode: j = "onlight",
|
|
30
|
-
onBlur:
|
|
31
|
-
onClick:
|
|
30
|
+
onBlur: A,
|
|
31
|
+
onClick: E,
|
|
32
32
|
size: q = "medium",
|
|
33
|
-
variant:
|
|
33
|
+
variant: y = "fill",
|
|
34
34
|
href: G,
|
|
35
35
|
tabIndex: S,
|
|
36
36
|
testId: z,
|
|
37
37
|
target: U,
|
|
38
38
|
type: J = "button",
|
|
39
|
+
textPosition: K = "left",
|
|
39
40
|
...F
|
|
40
|
-
} = r, [
|
|
41
|
+
} = r, [m, b, H] = bt(e.Children.toArray(_)), { hoverRef: P, isHovered: Q } = I === "button" ? D(n) : D(n), Y = it(null), a = !!(m || b) && !H, L = m && (b || g) && !a, C = j === "ondark", h = mt() < dt.md, M = R === "destructive" && !u, Z = y === "outline", l = y === "borderless", T = _t(y === "fill", l, u, R, C, h), v = g === "icon" && !l, d = q === "large" && !M && !l, tt = g === "accessibility-character" && !w && !m && !b && !v && l, et = { ...F }, V = p(
|
|
41
42
|
t["button-wrapper"],
|
|
42
|
-
{ [t["button-wrapper--fluid"]]:
|
|
43
|
+
{ [t["button-wrapper--fluid"]]: w || x },
|
|
43
44
|
O
|
|
44
|
-
), ot =
|
|
45
|
+
), ot = p(
|
|
45
46
|
t.button,
|
|
46
47
|
{
|
|
47
|
-
[t["button--destructive"]]:
|
|
48
|
-
[t["button--normal"]]: !
|
|
49
|
-
[t["button--large"]]:
|
|
50
|
-
[t["button--outline"]]:
|
|
48
|
+
[t["button--destructive"]]: M,
|
|
49
|
+
[t["button--normal"]]: !d,
|
|
50
|
+
[t["button--large"]]: d,
|
|
51
|
+
[t["button--outline"]]: Z,
|
|
51
52
|
[t["button--borderless"]]: l,
|
|
52
|
-
[t["button--left-icon"]]:
|
|
53
|
-
[t["button--right-icon"]]:
|
|
54
|
-
[t["button--both-icons"]]:
|
|
55
|
-
[t["button--only-icon"]]:
|
|
56
|
-
[t["button--arrow"]]:
|
|
57
|
-
[t["button--on-dark"]]:
|
|
53
|
+
[t["button--left-icon"]]: m && !a,
|
|
54
|
+
[t["button--right-icon"]]: b && !a,
|
|
55
|
+
[t["button--both-icons"]]: L,
|
|
56
|
+
[t["button--only-icon"]]: a,
|
|
57
|
+
[t["button--arrow"]]: v,
|
|
58
|
+
[t["button--on-dark"]]: C
|
|
58
59
|
},
|
|
59
60
|
X
|
|
60
|
-
),
|
|
61
|
-
[t["button__text--ellipsis"]]:
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
), rt = p(t.button__text, {
|
|
62
|
+
[t["button__text--ellipsis"]]: x,
|
|
63
|
+
[t["button__text--centered-mobile"]]: w && K === "centered-mobile"
|
|
64
|
+
}), nt = p(t.diagonal, {
|
|
65
|
+
[t["diagonal--on-dark"]]: C
|
|
64
66
|
});
|
|
65
67
|
ct(() => {
|
|
66
|
-
gt(
|
|
68
|
+
gt(a, f, !pt() && !ft());
|
|
67
69
|
}, []);
|
|
68
|
-
const k = (
|
|
70
|
+
const k = (i, at, lt) => i ? e.cloneElement(i, {
|
|
69
71
|
size: at,
|
|
70
|
-
color:
|
|
71
|
-
isHovered:
|
|
72
|
-
className:
|
|
73
|
-
}) : null,
|
|
74
|
-
/* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
) : k(
|
|
78
|
-
return /* @__PURE__ */
|
|
72
|
+
color: i != null && i.props.color ? i.props.color : T,
|
|
73
|
+
isHovered: !u && Q,
|
|
74
|
+
className: lt
|
|
75
|
+
}) : null, st = () => /* @__PURE__ */ e.createElement("span", { className: rt, ref: Y }, u && l && /* @__PURE__ */ e.createElement("span", { className: nt }, /* @__PURE__ */ e.createElement("span", { className: t.diagonal__line })), /* @__PURE__ */ e.createElement("span", null, a ? f : H)), W = () => /* @__PURE__ */ e.createElement("span", { className: ot }, k(m, B(d, h), a ? void 0 : t["button__left-icon"]), st(), v ? k(
|
|
76
|
+
/* @__PURE__ */ e.createElement(ut, { svgIcon: ht }),
|
|
77
|
+
B(d, h),
|
|
78
|
+
p(t.button__arrow, { [t["button__arrow--both-icons"]]: L })
|
|
79
|
+
) : k(b, B(d, h), t["button__right-icon"]), tt && /* @__PURE__ */ e.createElement("span", { style: { color: T }, className: t["button__right-unicode-arrow"], "aria-hidden": !0 }, " →"));
|
|
80
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, I === "button" && /* @__PURE__ */ e.createElement(
|
|
79
81
|
"button",
|
|
80
82
|
{
|
|
81
|
-
id:
|
|
82
|
-
onBlur:
|
|
83
|
-
onClick:
|
|
84
|
-
disabled:
|
|
83
|
+
id: s,
|
|
84
|
+
onBlur: A,
|
|
85
|
+
onClick: E,
|
|
86
|
+
disabled: u,
|
|
85
87
|
"data-testid": z,
|
|
86
88
|
"data-analyticsid": $.Button,
|
|
87
89
|
className: V,
|
|
88
|
-
ref:
|
|
90
|
+
ref: P,
|
|
89
91
|
tabIndex: S,
|
|
90
92
|
type: J,
|
|
91
|
-
...
|
|
93
|
+
...et
|
|
92
94
|
},
|
|
93
95
|
W()
|
|
94
|
-
),
|
|
96
|
+
), I === "a" && /* @__PURE__ */ e.createElement(
|
|
95
97
|
"a",
|
|
96
98
|
{
|
|
97
|
-
id:
|
|
98
|
-
onBlur:
|
|
99
|
-
onClick:
|
|
99
|
+
id: s,
|
|
100
|
+
onBlur: A,
|
|
101
|
+
onClick: E,
|
|
100
102
|
"data-testid": z,
|
|
101
103
|
"data-analyticsid": $.Button,
|
|
102
104
|
className: V,
|
|
103
105
|
href: G,
|
|
104
106
|
target: U,
|
|
105
107
|
rel: U === "_blank" ? "noopener noreferrer" : r.rel,
|
|
106
|
-
ref:
|
|
108
|
+
ref: P,
|
|
107
109
|
tabIndex: S,
|
|
108
110
|
...F
|
|
109
111
|
},
|
|
110
112
|
W()
|
|
111
113
|
));
|
|
112
|
-
}),
|
|
114
|
+
}), Ut = wt;
|
|
113
115
|
export {
|
|
114
|
-
|
|
116
|
+
Ut as default
|
|
115
117
|
};
|
|
116
118
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { AriaAttributes, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from './../Icon';\nimport { HTMLButtonProps, HTMLAnchorProps, AnalyticsId } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { BaseIconElement, useIcons } from '../../hooks/useIcons';\nimport { getColor } from '../../theme/currys/color';\nimport { breakpoints } from '../../theme/grid';\nimport { isTest, isProd } from '../../utils/environment';\nimport ArrowRight from '../Icons/ArrowRight';\n\nimport buttonStyles from './styles.module.scss';\n\nexport type ButtonConcept = 'normal' | 'destructive';\nexport type ButtonVariant = 'fill' | 'outline' | 'borderless';\nexport type ButtonSize = 'medium' | 'large';\nexport type ButtonMode = 'onlight' | 'ondark';\nexport type ButtonTags = 'button' | 'a';\nexport type ButtonArrows = 'icon' | 'accessibility-character';\n\nexport interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {\n /** Sets the aria-label of the button, use when the button only includes an icon */\n ariaLabel?: string;\n /** Gives a unique id to the button */\n id?: string;\n /** Sets the content of the button. */\n children: React.ReactNode;\n /** Adds custom classes to the wrapper element. */\n wrapperClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Enables an arrow icon to the right inside the button (Not available in borderless variant) */\n arrow?: ButtonArrows;\n /** Changes the intent of the button. Mostly changes the color profile. */\n concept?: ButtonConcept;\n /** Disables text wrapping and enables ellipsis. */\n ellipsis?: boolean;\n /** Makes the button scale to full width of its parent element. */\n fluid?: boolean;\n /** Changes the underlying element of the button. */\n htmlMarkup?: ButtonTags;\n /** Changes the button colors for different backgrounds. */\n mode?: ButtonMode;\n /** Function that is called when the Button loses focus */\n onBlur?: () => void;\n /** Function that is called when clicked */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<{}> | React.KeyboardEvent<HTMLUListElement> | null) => void;\n /** Changes the button colors for different backgrounds. (Large not available in borderless variant) */\n size?: ButtonSize;\n /** Changes the visual representation of the button. */\n variant?: ButtonVariant;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Button type. Default: button */\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n}\n\nconst getIconColor = (\n fill: boolean,\n borderless: boolean,\n disabled: boolean,\n concept: ButtonConcept,\n ondark: boolean,\n mobile: boolean\n): string => {\n if (mobile && disabled) {\n return !ondark || fill ? getColor('neutral', !borderless ? 700 : 500) : getColor('white');\n }\n if (disabled) {\n return !ondark || fill ? getColor('neutral', 500) : `${getColor('white')}b3`;\n }\n if ((fill && !ondark) || (!fill && ondark)) {\n return 'white';\n }\n\n return concept === 'normal' ? getColor('blueberry', 600) : getColor('cherry', 500);\n};\nconst getLargeIconSize = (large: boolean, mobile: boolean): IconSize => {\n if (mobile && large) return IconSize.Small;\n if (large) return IconSize.Medium;\n return IconSize.XSmall;\n};\n\nconst checkOnlyIconAria = (onlyIcon: boolean, ariaLabel: string | undefined, devEnv: boolean): void => {\n if (devEnv && onlyIcon && (ariaLabel === undefined || ariaLabel === '')) {\n throw new Error('Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav');\n }\n};\n\nconst Button = React.forwardRef(function ButtonForwardedRef(\n props: ButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>\n) {\n const {\n ariaLabel,\n id,\n children,\n wrapperClassName,\n className,\n arrow,\n concept = 'normal',\n disabled = false,\n ellipsis = false,\n fluid = false,\n htmlMarkup = 'button',\n mode = 'onlight',\n onBlur,\n onClick,\n size = 'medium',\n variant = 'fill',\n href,\n tabIndex,\n testId,\n target,\n type = 'button',\n ...restProps\n } = props;\n\n const [leftIcon, rightIcon, restChildren] = useIcons(React.Children.toArray(children));\n const { hoverRef, isHovered } =\n htmlMarkup === 'button'\n ? useHover<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>)\n : useHover<HTMLAnchorElement>(ref as React.RefObject<HTMLAnchorElement>);\n const buttonContentRef = useRef<HTMLDivElement>(null);\n const onlyIcon = !!(leftIcon || rightIcon) && !restChildren;\n const bothIcons = leftIcon && (rightIcon || arrow) && !onlyIcon;\n const onDark = mode === 'ondark';\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n const destructive = concept === 'destructive' && !disabled;\n const outlineVariant = variant === 'outline';\n const borderlessVariant = variant === 'borderless';\n const iconColor = getIconColor(variant === 'fill', borderlessVariant, disabled, concept, onDark, mobile);\n const hasArrow = arrow === 'icon' && !borderlessVariant;\n const large = size === 'large' && !destructive && !borderlessVariant;\n const hasUURightArrow = arrow === 'accessibility-character' && !fluid && !leftIcon && !rightIcon && !hasArrow && borderlessVariant;\n const rest = { ...restProps };\n\n const buttonWrapperClasses = classNames(\n buttonStyles['button-wrapper'],\n { [buttonStyles['button-wrapper--fluid']]: fluid || ellipsis },\n wrapperClassName\n );\n const buttonClasses = classNames(\n buttonStyles.button,\n {\n [buttonStyles['button--destructive']]: destructive,\n [buttonStyles['button--normal']]: !large,\n [buttonStyles['button--large']]: large,\n [buttonStyles['button--outline']]: outlineVariant,\n [buttonStyles['button--borderless']]: borderlessVariant,\n [buttonStyles['button--left-icon']]: leftIcon && !onlyIcon,\n [buttonStyles['button--right-icon']]: rightIcon && !onlyIcon,\n [buttonStyles['button--both-icons']]: bothIcons,\n [buttonStyles['button--only-icon']]: onlyIcon,\n [buttonStyles['button--arrow']]: hasArrow,\n [buttonStyles['button--on-dark']]: onDark,\n },\n className\n );\n const buttonTextClasses = classNames(buttonStyles['button__text'], {\n [buttonStyles['button__text--ellipsis']]: ellipsis,\n });\n const diagonalClasses = classNames(buttonStyles['diagonal'], {\n [buttonStyles['diagonal--on-dark']]: onDark,\n });\n\n useEffect(() => {\n checkOnlyIconAria(onlyIcon, ariaLabel, !isTest() && !isProd());\n }, []);\n\n const renderIcon = (iconElement: BaseIconElement | null, iconSize: number, iconClassName?: string): BaseIconElement | null => {\n return iconElement\n ? React.cloneElement(iconElement, {\n size: iconSize,\n color: iconElement?.props.color ? iconElement.props.color : iconColor,\n isHovered,\n className: iconClassName,\n })\n : null;\n };\n\n const renderButtonContent = (): JSX.Element => {\n return (\n <span className={buttonTextClasses} ref={buttonContentRef}>\n {disabled && borderlessVariant && (\n <span className={diagonalClasses}>\n <span className={buttonStyles['diagonal__line']} />\n </span>\n )}\n <span>{onlyIcon ? ariaLabel : restChildren}</span>\n </span>\n );\n };\n\n const renderbuttonContentWrapper = (): JSX.Element => (\n <span className={buttonClasses}>\n {renderIcon(leftIcon, getLargeIconSize(large, mobile), !onlyIcon ? buttonStyles['button__left-icon'] : undefined)}\n {renderButtonContent()}\n {hasArrow\n ? renderIcon(\n <Icon svgIcon={ArrowRight} />,\n getLargeIconSize(large, mobile),\n classNames(buttonStyles['button__arrow'], { [buttonStyles['button__arrow--both-icons']]: bothIcons })\n )\n : renderIcon(rightIcon, getLargeIconSize(large, mobile), buttonStyles['button__right-icon'])}\n {hasUURightArrow && (\n <span style={{ color: iconColor }} className={buttonStyles['button__right-unicode-arrow']} aria-hidden>\n {' →'}\n </span>\n )}\n </span>\n );\n\n return (\n <>\n {htmlMarkup === 'button' && (\n <button\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n disabled={disabled}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n ref={hoverRef as React.ForwardedRef<HTMLButtonElement>}\n tabIndex={tabIndex}\n type={type}\n {...rest}\n >\n {renderbuttonContentWrapper()}\n </button>\n )}\n {htmlMarkup === 'a' && (\n <a\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : props.rel}\n ref={hoverRef as React.ForwardedRef<HTMLAnchorElement>}\n tabIndex={tabIndex}\n {...restProps}\n >\n {renderbuttonContentWrapper()}\n </a>\n )}\n </>\n );\n});\n\nexport default Button;\n"],"names":["getIconColor","fill","borderless","disabled","concept","ondark","mobile","getColor","getLargeIconSize","large","IconSize","checkOnlyIconAria","onlyIcon","ariaLabel","devEnv","Button","React","props","ref","id","children","wrapperClassName","className","arrow","ellipsis","fluid","htmlMarkup","mode","onBlur","onClick","size","variant","href","tabIndex","testId","target","type","restProps","leftIcon","rightIcon","restChildren","useIcons","hoverRef","isHovered","useHover","buttonContentRef","useRef","bothIcons","onDark","useBreakpoint","breakpoints","destructive","outlineVariant","borderlessVariant","iconColor","hasArrow","hasUURightArrow","rest","buttonWrapperClasses","classNames","buttonStyles","buttonClasses","buttonTextClasses","diagonalClasses","useEffect","isTest","isProd","renderIcon","iconElement","iconSize","iconClassName","renderButtonContent","renderbuttonContentWrapper","Icon","ArrowRight","AnalyticsId","Button$1"],"mappings":";;;;;;;;;;;;AA8DA,MAAMA,KAAe,CACnBC,GACAC,GACAC,GACAC,GACAC,GACAC,MAEIA,KAAUH,IACL,CAACE,KAAUJ,IAAOM,EAAS,WAAYL,IAAmB,MAAN,GAAS,IAAIK,EAAS,OAAO,IAEtFJ,IACK,CAACE,KAAUJ,IAAOM,EAAS,WAAW,GAAG,IAAI,GAAGA,EAAS,OAAO,CAAC,OAErEN,KAAQ,CAACI,KAAY,CAACJ,KAAQI,IAC1B,UAGFD,MAAY,WAAWG,EAAS,aAAa,GAAG,IAAIA,EAAS,UAAU,GAAG,GAE7EC,IAAmB,CAACC,GAAgBH,MACpCA,KAAUG,IAAcC,EAAS,QACjCD,IAAcC,EAAS,SACpBA,EAAS,QAGZC,KAAoB,CAACC,GAAmBC,GAA+BC,MAA0B;AACrG,MAAIA,KAAUF,MAAaC,MAAc,UAAaA,MAAc;AAC5D,UAAA,IAAI,MAAM,yEAAyE;AAE7F,GAEME,KAASC,EAAM,WAAW,SAC9BC,GACAC,GACA;AACM,QAAA;AAAA,IACJ,WAAAL;AAAA,IACA,IAAAM;AAAA,IACA,UAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,SAAAnB,IAAU;AAAA,IACV,UAAAD,IAAW;AAAA,IACX,UAAAqB,IAAW;AAAA,IACX,OAAAC,IAAQ;AAAA,IACR,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO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,KAAKA,MAAW,WAAW,wBAAwBlB,EAAM;AAAA,MACzD,KAAKyB;AAAA,MACL,UAAAT;AAAA,MACC,GAAGI;AAAA,IAAA;AAAA,IAEHmC,EAA2B;AAAA,EAAA,CAGlC;AAEJ,CAAC,GAEDI,KAAe7D;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { AriaAttributes, useEffect, useRef } from 'react';\n\nimport classNames from 'classnames';\n\nimport Icon, { IconSize } from './../Icon';\nimport { HTMLButtonProps, HTMLAnchorProps, AnalyticsId } from '../../constants';\nimport { useBreakpoint } from '../../hooks/useBreakpoint';\nimport { useHover } from '../../hooks/useHover';\nimport { BaseIconElement, useIcons } from '../../hooks/useIcons';\nimport { getColor } from '../../theme/currys/color';\nimport { breakpoints } from '../../theme/grid';\nimport { isTest, isProd } from '../../utils/environment';\nimport ArrowRight from '../Icons/ArrowRight';\n\nimport buttonStyles from './styles.module.scss';\n\nexport type ButtonConcept = 'normal' | 'destructive';\nexport type ButtonVariant = 'fill' | 'outline' | 'borderless';\nexport type ButtonSize = 'medium' | 'large';\nexport type ButtonMode = 'onlight' | 'ondark';\nexport type ButtonTags = 'button' | 'a';\nexport type ButtonArrows = 'icon' | 'accessibility-character';\nexport type ButtonTextPosition = 'left' | 'centered-mobile';\n\nexport interface ButtonProps extends HTMLButtonProps, HTMLAnchorProps, AriaAttributes {\n /** Sets the aria-label of the button, use when the button only includes an icon */\n ariaLabel?: string;\n /** Gives a unique id to the button */\n id?: string;\n /** Sets the content of the button. */\n children: React.ReactNode;\n /** Adds custom classes to the wrapper element. */\n wrapperClassName?: string;\n /** Adds custom classes to the element. */\n className?: string;\n /** Enables an arrow icon to the right inside the button (Not available in borderless variant) */\n arrow?: ButtonArrows;\n /** Changes the intent of the button. Mostly changes the color profile. */\n concept?: ButtonConcept;\n /** Disables text wrapping and enables ellipsis. */\n ellipsis?: boolean;\n /** Makes the button scale to full width of its parent element. */\n fluid?: boolean;\n /** Changes the underlying element of the button. */\n htmlMarkup?: ButtonTags;\n /** Changes the button colors for different backgrounds. */\n mode?: ButtonMode;\n /** Function that is called when the Button loses focus */\n onBlur?: () => void;\n /** Function that is called when clicked */\n onClick?: (e?: React.MouseEvent<HTMLElement, MouseEvent> | React.FormEvent<{}> | React.KeyboardEvent<HTMLUListElement> | null) => void;\n /** Changes the button colors for different backgrounds. (Large not available in borderless variant) */\n size?: ButtonSize;\n /** Changes the visual representation of the button. */\n variant?: ButtonVariant;\n /** Specifies the focus order relative to the other buttons or controls on the page */\n tabIndex?: number;\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the position of the text in the button - only applies when button is fluid */\n textPosition?: ButtonTextPosition;\n /** Button type. Default: button */\n type?: React.ButtonHTMLAttributes<HTMLButtonElement>['type'];\n}\n\nconst getIconColor = (\n fill: boolean,\n borderless: boolean,\n disabled: boolean,\n concept: ButtonConcept,\n ondark: boolean,\n mobile: boolean\n): string => {\n if (mobile && disabled) {\n return !ondark || fill ? getColor('neutral', !borderless ? 700 : 500) : getColor('white');\n }\n if (disabled) {\n return !ondark || fill ? getColor('neutral', 500) : `${getColor('white')}b3`;\n }\n if ((fill && !ondark) || (!fill && ondark)) {\n return 'white';\n }\n\n return concept === 'normal' ? getColor('blueberry', 600) : getColor('cherry', 500);\n};\nconst getLargeIconSize = (large: boolean, mobile: boolean): IconSize => {\n if (mobile && large) return IconSize.Small;\n if (large) return IconSize.Medium;\n return IconSize.XSmall;\n};\n\nconst checkOnlyIconAria = (onlyIcon: boolean, ariaLabel: string | undefined, devEnv: boolean): void => {\n if (devEnv && onlyIcon && (ariaLabel === undefined || ariaLabel === '')) {\n throw new Error('Fyll inn ariaLabel prop på Button uten tekst for å opprettholde UU krav');\n }\n};\n\nconst Button = React.forwardRef(function ButtonForwardedRef(\n props: ButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | HTMLAnchorElement>\n) {\n const {\n ariaLabel,\n id,\n children,\n wrapperClassName,\n className,\n arrow,\n concept = 'normal',\n disabled = false,\n ellipsis = false,\n fluid = false,\n htmlMarkup = 'button',\n mode = 'onlight',\n onBlur,\n onClick,\n size = 'medium',\n variant = 'fill',\n href,\n tabIndex,\n testId,\n target,\n type = 'button',\n textPosition = 'left',\n ...restProps\n } = props;\n\n const [leftIcon, rightIcon, restChildren] = useIcons(React.Children.toArray(children));\n const { hoverRef, isHovered } =\n htmlMarkup === 'button'\n ? useHover<HTMLButtonElement>(ref as React.RefObject<HTMLButtonElement>)\n : useHover<HTMLAnchorElement>(ref as React.RefObject<HTMLAnchorElement>);\n const buttonContentRef = useRef<HTMLDivElement>(null);\n const onlyIcon = !!(leftIcon || rightIcon) && !restChildren;\n const bothIcons = leftIcon && (rightIcon || arrow) && !onlyIcon;\n const onDark = mode === 'ondark';\n const breakpoint = useBreakpoint();\n const mobile = breakpoint < breakpoints.md;\n const destructive = concept === 'destructive' && !disabled;\n const outlineVariant = variant === 'outline';\n const borderlessVariant = variant === 'borderless';\n const iconColor = getIconColor(variant === 'fill', borderlessVariant, disabled, concept, onDark, mobile);\n const hasArrow = arrow === 'icon' && !borderlessVariant;\n const large = size === 'large' && !destructive && !borderlessVariant;\n const hasUURightArrow = arrow === 'accessibility-character' && !fluid && !leftIcon && !rightIcon && !hasArrow && borderlessVariant;\n const rest = { ...restProps };\n\n const buttonWrapperClasses = classNames(\n buttonStyles['button-wrapper'],\n { [buttonStyles['button-wrapper--fluid']]: fluid || ellipsis },\n wrapperClassName\n );\n const buttonClasses = classNames(\n buttonStyles.button,\n {\n [buttonStyles['button--destructive']]: destructive,\n [buttonStyles['button--normal']]: !large,\n [buttonStyles['button--large']]: large,\n [buttonStyles['button--outline']]: outlineVariant,\n [buttonStyles['button--borderless']]: borderlessVariant,\n [buttonStyles['button--left-icon']]: leftIcon && !onlyIcon,\n [buttonStyles['button--right-icon']]: rightIcon && !onlyIcon,\n [buttonStyles['button--both-icons']]: bothIcons,\n [buttonStyles['button--only-icon']]: onlyIcon,\n [buttonStyles['button--arrow']]: hasArrow,\n [buttonStyles['button--on-dark']]: onDark,\n },\n className\n );\n const buttonTextClasses = classNames(buttonStyles['button__text'], {\n [buttonStyles['button__text--ellipsis']]: ellipsis,\n [buttonStyles['button__text--centered-mobile']]: fluid && textPosition === 'centered-mobile',\n });\n const diagonalClasses = classNames(buttonStyles['diagonal'], {\n [buttonStyles['diagonal--on-dark']]: onDark,\n });\n\n useEffect(() => {\n checkOnlyIconAria(onlyIcon, ariaLabel, !isTest() && !isProd());\n }, []);\n\n const renderIcon = (iconElement: BaseIconElement | null, iconSize: number, iconClassName?: string): BaseIconElement | null => {\n return iconElement\n ? React.cloneElement(iconElement, {\n size: iconSize,\n color: iconElement?.props.color ? iconElement.props.color : iconColor,\n isHovered: !disabled && isHovered,\n className: iconClassName,\n })\n : null;\n };\n\n const renderButtonContent = (): JSX.Element => {\n return (\n <span className={buttonTextClasses} ref={buttonContentRef}>\n {disabled && borderlessVariant && (\n <span className={diagonalClasses}>\n <span className={buttonStyles['diagonal__line']} />\n </span>\n )}\n <span>{onlyIcon ? ariaLabel : restChildren}</span>\n </span>\n );\n };\n\n const renderbuttonContentWrapper = (): JSX.Element => (\n <span className={buttonClasses}>\n {renderIcon(leftIcon, getLargeIconSize(large, mobile), !onlyIcon ? buttonStyles['button__left-icon'] : undefined)}\n {renderButtonContent()}\n {hasArrow\n ? renderIcon(\n <Icon svgIcon={ArrowRight} />,\n getLargeIconSize(large, mobile),\n classNames(buttonStyles['button__arrow'], { [buttonStyles['button__arrow--both-icons']]: bothIcons })\n )\n : renderIcon(rightIcon, getLargeIconSize(large, mobile), buttonStyles['button__right-icon'])}\n {hasUURightArrow && (\n <span style={{ color: iconColor }} className={buttonStyles['button__right-unicode-arrow']} aria-hidden>\n {' →'}\n </span>\n )}\n </span>\n );\n\n return (\n <>\n {htmlMarkup === 'button' && (\n <button\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n disabled={disabled}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n ref={hoverRef as React.ForwardedRef<HTMLButtonElement>}\n tabIndex={tabIndex}\n type={type}\n {...rest}\n >\n {renderbuttonContentWrapper()}\n </button>\n )}\n {htmlMarkup === 'a' && (\n <a\n id={id}\n onBlur={onBlur}\n onClick={onClick}\n data-testid={testId}\n data-analyticsid={AnalyticsId.Button}\n className={buttonWrapperClasses}\n href={href}\n target={target}\n rel={target === '_blank' ? 'noopener noreferrer' : props.rel}\n ref={hoverRef as React.ForwardedRef<HTMLAnchorElement>}\n tabIndex={tabIndex}\n {...restProps}\n >\n {renderbuttonContentWrapper()}\n </a>\n )}\n </>\n );\n});\n\nexport default Button;\n"],"names":["getIconColor","fill","borderless","disabled","concept","ondark","mobile","getColor","getLargeIconSize","large","IconSize","checkOnlyIconAria","onlyIcon","ariaLabel","devEnv","Button","React","props","ref","id","children","wrapperClassName","className","arrow","ellipsis","fluid","htmlMarkup","mode","onBlur","onClick","size","variant","href","tabIndex","testId","target","type","textPosition","restProps","leftIcon","rightIcon","restChildren","useIcons","hoverRef","isHovered","useHover","buttonContentRef","useRef","bothIcons","onDark","useBreakpoint","breakpoints","destructive","outlineVariant","borderlessVariant","iconColor","hasArrow","hasUURightArrow","rest","buttonWrapperClasses","classNames","buttonStyles","buttonClasses","buttonTextClasses","diagonalClasses","useEffect","isTest","isProd","renderIcon","iconElement","iconSize","iconClassName","renderButtonContent","renderbuttonContentWrapper","Icon","ArrowRight","AnalyticsId","Button$1"],"mappings":";;;;;;;;;;;;AAiEA,MAAMA,KAAe,CACnBC,GACAC,GACAC,GACAC,GACAC,GACAC,MAEIA,KAAUH,IACL,CAACE,KAAUJ,IAAOM,EAAS,WAAYL,IAAmB,MAAN,GAAS,IAAIK,EAAS,OAAO,IAEtFJ,IACK,CAACE,KAAUJ,IAAOM,EAAS,WAAW,GAAG,IAAI,GAAGA,EAAS,OAAO,CAAC,OAErEN,KAAQ,CAACI,KAAY,CAACJ,KAAQI,IAC1B,UAGFD,M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,EAAA,cAAC,UAAK,OAAO,EAAE,OAAOuC,EAAA,GAAa,WAAWM,EAAa,6BAA6B,GAAG,eAAW,MACnG,KACH,CAEJ;AAIA,SAAA7C,gBAAAA,EAAA,cAAAA,EAAA,UAAA,MACGU,MAAe,YACdV,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAG;AAAA,MACA,QAAAS;AAAA,MACA,SAAAC;AAAA,MACA,UAAA1B;AAAA,MACA,eAAa+B;AAAA,MACb,oBAAkB0C,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,KAAKhB;AAAA,MACL,UAAAV;AAAA,MACA,MAAAG;AAAA,MACC,GAAGsB;AAAA,IAAA;AAAA,IAEHe,EAA2B;AAAA,EAAA,GAG/B/C,MAAe,OACdV,gBAAAA,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAAG;AAAA,MACA,QAAAS;AAAA,MACA,SAAAC;AAAA,MACA,eAAaK;AAAA,MACb,oBAAkB0C,EAAY;AAAA,MAC9B,WAAWjB;AAAA,MACX,MAAA3B;AAAA,MACA,QAAAG;AAAA,MACA,KAAKA,MAAW,WAAW,wBAAwBlB,EAAM;AAAA,MACzD,KAAK0B;AAAA,MACL,UAAAV;AAAA,MACC,GAAGK;AAAA,IAAA;AAAA,IAEHmC,EAA2B;AAAA,EAAA,CAGlC;AAEJ,CAAC,GAEDI,KAAe9D;"}
|
|
@@ -330,6 +330,12 @@ $with-icons: // icon-class, size-class, padding-left, padding-right, padding-lef
|
|
|
330
330
|
overflow: hidden;
|
|
331
331
|
text-overflow: ellipsis;
|
|
332
332
|
}
|
|
333
|
+
|
|
334
|
+
&--centered-mobile {
|
|
335
|
+
@media (max-width: map.get($grid-max-breakpoints, xs)) {
|
|
336
|
+
width: 100%;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
333
339
|
}
|
|
334
340
|
|
|
335
341
|
&__right-unicode-arrow {
|
|
@@ -8,6 +8,7 @@ export type Styles = {
|
|
|
8
8
|
'button__right-icon': string;
|
|
9
9
|
'button__right-unicode-arrow': string;
|
|
10
10
|
button__text: string;
|
|
11
|
+
'button__text--centered-mobile': string;
|
|
11
12
|
'button__text--ellipsis': string;
|
|
12
13
|
'button--arrow': string;
|
|
13
14
|
'button--arrow--both-icons': string;
|