@helsenorge/designsystem-react 7.7.0 → 7.8.1
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 +47 -3
- package/components/AnchorLink/styles.module.scss +6 -5
- 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 +1 -0
- package/components/ExpanderHierarchy/ExpanderHierarchy.stories.d.ts +13 -12
- package/components/List/List.stories.d.ts +19 -2
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@import '../../../scss/supernova/styles/colors';
|
|
2
|
+
|
|
3
|
+
.tab-list {
|
|
4
|
+
$tab-list: &;
|
|
5
|
+
$colors: 'blueberry', 'neutral', 'white';
|
|
6
|
+
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
gap: 0.25rem;
|
|
10
|
+
list-style-type: none;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
overflow-x: initial;
|
|
13
|
+
overflow-y: initial;
|
|
14
|
+
height: 3rem;
|
|
15
|
+
z-index: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
margin-bottom: -1px;
|
|
18
|
+
|
|
19
|
+
&__tab {
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: start;
|
|
22
|
+
background-color: transparent;
|
|
23
|
+
height: 3rem;
|
|
24
|
+
text-align: start;
|
|
25
|
+
font-size: 1.25rem;
|
|
26
|
+
text-decoration: none;
|
|
27
|
+
padding: 0.5rem 1.5rem;
|
|
28
|
+
color: var(--color-action-text-onlight);
|
|
29
|
+
border: 1px solid var(--color-action-border-onlight);
|
|
30
|
+
border-bottom: 0;
|
|
31
|
+
border-radius: 0.5rem 0.5rem 0 0;
|
|
32
|
+
position: relative;
|
|
33
|
+
z-index: 0;
|
|
34
|
+
|
|
35
|
+
@each $color in $colors {
|
|
36
|
+
&--#{$color} {
|
|
37
|
+
background-color: var(--color-base-background-#{$color});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--selected {
|
|
42
|
+
overflow: visible;
|
|
43
|
+
z-index: 2;
|
|
44
|
+
border-color: var(--color-action-border-onlight-focus);
|
|
45
|
+
color: var(--color-base-text-onlight);
|
|
46
|
+
background-color: var(--color-base-background-white);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&__title-and-icon {
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-flow: row nowrap;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 0.5rem;
|
|
54
|
+
height: 2rem;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&--normal {
|
|
59
|
+
padding-left: 1rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&--framed {
|
|
63
|
+
padding-left: 0;
|
|
64
|
+
|
|
65
|
+
#{$tab-list}__tab {
|
|
66
|
+
background-color: var(--color-base-background-white);
|
|
67
|
+
|
|
68
|
+
&--first {
|
|
69
|
+
// This is in order to look nice when the first tab is not selected
|
|
70
|
+
height: 3.5rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&--selected {
|
|
74
|
+
height: 3rem;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@each $color in $colors {
|
|
79
|
+
.tab-list__tab--selected#{$tab-list}__tab--#{$color} {
|
|
80
|
+
background-color: var(--color-base-background-#{$color});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Because the button states should be the same for all types
|
|
86
|
+
.tab-list__tab {
|
|
87
|
+
&:hover {
|
|
88
|
+
background-color: var(--color-action-background-ondark-hover);
|
|
89
|
+
|
|
90
|
+
&#{$tab-list}__tab--blueberry {
|
|
91
|
+
background-color: var(--color-action-background-ondark-selected);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active {
|
|
96
|
+
background-color: var(--color-action-background-ondark-selected);
|
|
97
|
+
|
|
98
|
+
&#{$tab-list}__tab--blueberry {
|
|
99
|
+
background-color: var(--color-action-background-ondark-hoverselected);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus-visible {
|
|
104
|
+
background-color: var(--color-base-background-blueberry);
|
|
105
|
+
outline: 4px solid var(--color-action-border-onlight-focus);
|
|
106
|
+
outline-offset: -4px;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'tab-list': string;
|
|
3
|
+
'tab-list__tab': string;
|
|
4
|
+
'tab-list__tab__title-and-icon': string;
|
|
5
|
+
'tab-list__tab--blueberry': string;
|
|
6
|
+
'tab-list__tab--first': string;
|
|
7
|
+
'tab-list__tab--neutral': string;
|
|
8
|
+
'tab-list__tab--selected': string;
|
|
9
|
+
'tab-list__tab--white': string;
|
|
10
|
+
'tab-list--framed': string;
|
|
11
|
+
'tab-list--normal': string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type ClassNames = keyof Styles;
|
|
15
|
+
|
|
16
|
+
declare const styles: Styles;
|
|
17
|
+
|
|
18
|
+
export default styles;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import r from "react";
|
|
2
|
+
import o from "classnames";
|
|
3
|
+
import a from "../../Tabs/TabPanel/styles.module.scss";
|
|
4
|
+
const m = ({ children: e, color: t = "white", type: l = "normal", isFirst: s = !1 }) => {
|
|
5
|
+
const n = o(a["tab-panel"], a[`tab-panel--${t}`], a[`tab-panel--${l}`], {
|
|
6
|
+
[a["tab-panel--first"]]: s
|
|
7
|
+
});
|
|
8
|
+
return /* @__PURE__ */ r.createElement("div", { className: n }, e);
|
|
9
|
+
}, f = m;
|
|
10
|
+
export {
|
|
11
|
+
f as default
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=TabPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabPanel.js","sources":["../../../../src/components/Tabs/TabPanel/TabPanel.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from 'classnames';\n\nimport { TabsColors, TabsType } from '../Tabs';\n\nimport styles from './styles.module.scss';\n\ninterface TabPanelProps {\n color?: TabsColors;\n type?: TabsType;\n isFirst?: boolean;\n}\n\nconst TabPanel: React.FC<TabPanelProps> = ({ children, color = 'white', type = 'normal', isFirst = false }) => {\n const tabPanelClasses = classNames(styles['tab-panel'], styles[`tab-panel--${color}`], styles[`tab-panel--${type}`], {\n [styles['tab-panel--first']]: isFirst,\n });\n return <div className={tabPanelClasses}>{children}</div>;\n};\n\nexport default TabPanel;\n"],"names":["TabPanel","children","color","type","isFirst","tabPanelClasses","classNames","styles","React","TabPanel$1"],"mappings":";;;AAcA,MAAMA,IAAoC,CAAC,EAAE,UAAAC,GAAU,OAAAC,IAAQ,SAAS,MAAAC,IAAO,UAAU,SAAAC,IAAU,SAAY;AAC7G,QAAMC,IAAkBC,EAAWC,EAAO,WAAW,GAAGA,EAAO,cAAcL,CAAK,EAAE,GAAGK,EAAO,cAAcJ,CAAI,EAAE,GAAG;AAAA,IACnH,CAACI,EAAO,kBAAkB,CAAC,GAAGH;AAAA,EAAA,CAC/B;AACD,SAAQI,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWH,EAAA,GAAkBJ,CAAS;AACpD,GAEAQ,IAAeT;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@import '../../../scss/spacers';
|
|
3
|
+
@import '../../../scss/palette';
|
|
4
|
+
@import '../../../scss/font-settings';
|
|
5
|
+
@import '../../../scss/breakpoints';
|
|
6
|
+
@import '../../../scss/supernova/styles/colors';
|
|
7
|
+
|
|
8
|
+
.tab-panel {
|
|
9
|
+
$tab-panel: &;
|
|
10
|
+
|
|
11
|
+
border-top: 1px solid var(--color-action-border-onlight-focus);
|
|
12
|
+
padding: 2rem;
|
|
13
|
+
position: relative;
|
|
14
|
+
z-index: 1;
|
|
15
|
+
|
|
16
|
+
$colors: 'blueberry', 'neutral', 'white';
|
|
17
|
+
|
|
18
|
+
&--normal {
|
|
19
|
+
padding: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--framed {
|
|
23
|
+
padding: 2rem;
|
|
24
|
+
border: 1px solid var(--color-action-border-onlight-focus);
|
|
25
|
+
border-radius: 0.5rem;
|
|
26
|
+
|
|
27
|
+
&#{$tab-panel}--first {
|
|
28
|
+
border-radius: 0 0.5rem 0.5rem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@each $color in $colors {
|
|
32
|
+
&#{$tab-panel}--#{$color} {
|
|
33
|
+
background-color: var(--color-base-background-#{$color});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
'tab-panel': string;
|
|
3
|
+
'tab-panel--blueberry': string;
|
|
4
|
+
'tab-panel--first': string;
|
|
5
|
+
'tab-panel--framed': string;
|
|
6
|
+
'tab-panel--neutral': string;
|
|
7
|
+
'tab-panel--normal': string;
|
|
8
|
+
'tab-panel--white': string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ClassNames = keyof Styles;
|
|
12
|
+
|
|
13
|
+
declare const styles: Styles;
|
|
14
|
+
|
|
15
|
+
export default styles;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Tab from './Tab';
|
|
3
|
+
import { PaletteNames } from '../../theme/palette';
|
|
4
|
+
export type { TabProps } from './Tab';
|
|
5
|
+
export type TabsColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'white'>;
|
|
6
|
+
export type TabsType = 'normal' | 'framed';
|
|
7
|
+
export interface TabsProps {
|
|
8
|
+
/** Sets the data-testid attribute. */
|
|
9
|
+
testId?: string;
|
|
10
|
+
/** Sets the color of the tabs. Default: white */
|
|
11
|
+
color?: TabsColors;
|
|
12
|
+
/** Sets the visual type of the tabs */
|
|
13
|
+
type?: TabsType;
|
|
14
|
+
/** Controlled state for Tabs component */
|
|
15
|
+
activeTab?: number;
|
|
16
|
+
}
|
|
17
|
+
declare const TabsRoot: React.FC<TabsProps>;
|
|
18
|
+
type TabsComponent = typeof TabsRoot & {
|
|
19
|
+
Tab: typeof Tab;
|
|
20
|
+
};
|
|
21
|
+
declare const Tabs: TabsComponent;
|
|
22
|
+
export default Tabs;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import t, { useState as T } from "react";
|
|
2
|
+
import f from "./Tab.js";
|
|
3
|
+
import u from "./TabList/TabList.js";
|
|
4
|
+
import p from "./TabPanel/TabPanel.js";
|
|
5
|
+
import C from "../Tabs/styles.module.scss";
|
|
6
|
+
const y = ({ children: s, testId: m, color: n = "white", type: r = "normal", activeTab: l }) => {
|
|
7
|
+
const i = l !== void 0, [b, c] = T(0), d = (o) => {
|
|
8
|
+
i || c(o);
|
|
9
|
+
}, e = i ? l : b;
|
|
10
|
+
return /* @__PURE__ */ t.createElement("div", { className: C.tabs, "data-testid": m }, /* @__PURE__ */ t.createElement(u, { onTabListClick: (o) => d(o), selectedTab: e, color: n, type: r }, s), /* @__PURE__ */ t.createElement(p, { color: n, type: r, isFirst: e == 0 }, t.Children.toArray(s)[e]));
|
|
11
|
+
}, a = y;
|
|
12
|
+
a.displayName = "Tabs";
|
|
13
|
+
a.Tab = f;
|
|
14
|
+
a.Tab.displayName = "Tabs.Tab";
|
|
15
|
+
const x = a;
|
|
16
|
+
export {
|
|
17
|
+
x as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import React, { useState } from 'react';\n\nimport Tab from './Tab';\nimport TabList from './TabList';\nimport TabPanel from './TabPanel';\nimport { PaletteNames } from '../../theme/palette';\nexport type { TabProps } from './Tab';\n\nimport styles from './styles.module.scss';\n\nexport type TabsColors = Extract<PaletteNames, 'blueberry' | 'neutral' | 'white'>;\n\nexport type TabsType = 'normal' | 'framed';\n\nexport interface TabsProps {\n /** Sets the data-testid attribute. */\n testId?: string;\n /** Sets the color of the tabs. Default: white */\n color?: TabsColors;\n /** Sets the visual type of the tabs */\n type?: TabsType;\n /** Controlled state for Tabs component */\n activeTab?: number;\n}\n\nconst TabsRoot: React.FC<TabsProps> = ({ children, testId, color = 'white', type = 'normal', activeTab }) => {\n const isControlled = activeTab !== undefined;\n const [uncontrolledValue, setUncontrolledValue] = useState(0);\n\n const onValueChange = (newValue: number): void => {\n if (!isControlled) {\n setUncontrolledValue(newValue);\n }\n };\n\n const activeTabIndex = isControlled ? activeTab : uncontrolledValue;\n\n return (\n <div className={styles.tabs} data-testid={testId}>\n <TabList onTabListClick={(index: number) => onValueChange(index)} selectedTab={activeTabIndex} color={color} type={type}>\n {children}\n </TabList>\n <TabPanel color={color} type={type} isFirst={activeTabIndex == 0}>\n {React.Children.toArray(children)[activeTabIndex]}\n </TabPanel>\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":["TabsRoot","children","testId","color","type","activeTab","isControlled","uncontrolledValue","setUncontrolledValue","useState","onValueChange","newValue","activeTabIndex","React","styles","TabList","index","TabPanel","Tabs","Tab","Tabs$1"],"mappings":";;;;;AAyBA,MAAMA,IAAgC,CAAC,EAAE,UAAAC,GAAU,QAAAC,GAAQ,OAAAC,IAAQ,SAAS,MAAAC,IAAO,UAAU,WAAAC,QAAgB;AAC3G,QAAMC,IAAeD,MAAc,QAC7B,CAACE,GAAmBC,CAAoB,IAAIC,EAAS,CAAC,GAEtDC,IAAgB,CAACC,MAA2B;AAChD,IAAKL,KACHE,EAAqBG,CAAQ;AAAA,EAC/B,GAGIC,IAAiBN,IAAeD,IAAYE;AAElD,SACGM,gBAAAA,EAAA,cAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,eAAaZ,EAAA,GACvCW,gBAAAA,EAAA,cAAAE,GAAA,EAAQ,gBAAgB,CAACC,MAAkBN,EAAcM,CAAK,GAAG,aAAaJ,GAAgB,OAAAT,GAAc,MAAAC,EAAA,GAC1GH,CACH,GACAY,gBAAAA,EAAA,cAACI,GAAS,EAAA,OAAAd,GAAc,MAAAC,GAAY,SAASQ,KAAkB,EAC5D,GAAAC,EAAM,SAAS,QAAQZ,CAAQ,EAAEW,CAAc,CAClD,CACF;AAEJ,GAKMM,IAAOlB;AACbkB,EAAK,cAAc;AACnBA,EAAK,MAAMC;AACXD,EAAK,IAAI,cAAc;AAEvB,MAAAE,IAAeF;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<import("./Tabs").TabsProps> & {
|
|
6
|
+
Tab: React.FC<import("./Tab").TabProps>;
|
|
7
|
+
};
|
|
8
|
+
subcomponents: {
|
|
9
|
+
Tab: React.FC<import("./Tab").TabProps>;
|
|
10
|
+
};
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: string;
|
|
15
|
+
};
|
|
16
|
+
page: () => React.JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
args: {
|
|
20
|
+
color: "white";
|
|
21
|
+
type: "normal";
|
|
22
|
+
};
|
|
23
|
+
argTypes: {
|
|
24
|
+
color: {
|
|
25
|
+
control: string;
|
|
26
|
+
options: string[];
|
|
27
|
+
description: string;
|
|
28
|
+
};
|
|
29
|
+
testId: {
|
|
30
|
+
control: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
type: {
|
|
34
|
+
control: string;
|
|
35
|
+
options: string[];
|
|
36
|
+
describtion: string;
|
|
37
|
+
};
|
|
38
|
+
activeTab: {
|
|
39
|
+
control: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export default meta;
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
export declare const Default: Story;
|
|
47
|
+
export declare const WithIcon: Story;
|
|
48
|
+
export declare const Framed: Story;
|
|
49
|
+
export declare const Colors: Story;
|
|
50
|
+
export declare const Controlled: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -12,23 +12,47 @@ declare const meta: {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
args: {
|
|
15
|
+
title: React.JSX.Element;
|
|
16
|
+
icon: React.JSX.Element;
|
|
15
17
|
fixed: false;
|
|
16
18
|
highlighted: false;
|
|
17
19
|
href: string;
|
|
18
20
|
description: string;
|
|
19
21
|
};
|
|
20
22
|
argTypes: {
|
|
21
|
-
|
|
23
|
+
children: {
|
|
24
|
+
control: string;
|
|
25
|
+
};
|
|
26
|
+
className: {
|
|
27
|
+
control: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
icon: {
|
|
31
|
+
control: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
title: {
|
|
22
35
|
control: string;
|
|
36
|
+
description: string;
|
|
23
37
|
};
|
|
24
38
|
highlighted: {
|
|
25
39
|
control: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
description: {
|
|
43
|
+
control: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
fixed: {
|
|
47
|
+
control: string;
|
|
48
|
+
description: string;
|
|
26
49
|
};
|
|
27
50
|
href: {
|
|
28
51
|
control: string;
|
|
29
52
|
};
|
|
30
|
-
|
|
53
|
+
testId: {
|
|
31
54
|
control: string;
|
|
55
|
+
description: string;
|
|
32
56
|
};
|
|
33
57
|
};
|
|
34
58
|
};
|
package/constants.d.ts
CHANGED
|
@@ -112,6 +112,10 @@ export declare enum KeyboardEventKey {
|
|
|
112
112
|
Escape = "Escape",
|
|
113
113
|
ArrowDown = "ArrowDown",
|
|
114
114
|
ArrowUp = "ArrowUp",
|
|
115
|
+
ArrowRight = "ArrowRight",
|
|
116
|
+
ArrowLeft = "ArrowLeft",
|
|
115
117
|
Home = "Home",
|
|
116
|
-
End = "End"
|
|
118
|
+
End = "End",
|
|
119
|
+
Space = " ",
|
|
120
|
+
Tab = "Tab"
|
|
117
121
|
}
|
package/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var e = /* @__PURE__ */ ((r) => (r[r.XXSmall = 24] = "XXSmall", r[r.XSmall = 38] = "XSmall", r[r.Small = 48] = "Small", r[r.Medium = 64] = "Medium", r[r.Large = 80] = "Large", r[r.XLarge = 130] = "XLarge", r))(e || {}), o = /* @__PURE__ */ ((r) => (r[r.Modal = 13e5] = "Modal", r[r.PopOver = 11e3] = "PopOver", r[r.ExpanderTrigger = 1e4] = "ExpanderTrigger", r))(o || {});
|
|
2
2
|
const g = 12;
|
|
3
|
-
var p = /* @__PURE__ */ ((r) => (r.onwhite = "onwhite", r.ongrey = "ongrey", r.onblueberry = "onblueberry", r.ondark = "ondark", r.oninvalid = "oninvalid", r))(p || {}), a = /* @__PURE__ */ ((r) => (r.medium = "medium", r.large = "large", r))(a || {}), t = /* @__PURE__ */ ((r) => (r.AnchorLink = "anchor-link", r.Avatar = "avatar", r.Badge = "badge", r.Button = "button", r.Checkbox = "checkbox", r.Close = "close", r.DictionaryTrigger = "dictionary-trigger", r.Dropdown = "dropdown", r.Duolist = "duolist", r.EmptyState = "empty-state", r.Expander = "expander", r.ExpanderHierarchy = "expander-hierarchy", r.ExpanderHierarchyExpander = "expander-hierarchy-expander", r.ExpanderList = "expander-list", r.ExpanderListExpander = "expander-list-expander", r.FormGroup = "form-group", r.FormLayout = "form-layout", r.HelpBubble = "help-bubble", r.HelpQuestion = "help-question", r.HighlightBox = "highlight-box", r.Icon = "icon", r.Illustration = "Illustration", r.Input = "input", r.Label = "label", r.Link = "link", r.LinkList = "link-list", r.List = "list", r.Loader = "loader", r.Logo = "logo", r.Modal = "modal", r.NotificationPanel = "notification-panel", r.Panel = "panel", r.PanelList = "panel-list", r.PopMenu = "pop-menu", r.PopOver = "pop-over", r.Portal = "portal", r.PromoPanel = "promo-panel", r.RadioButton = "radio-button", r.Select = "select", r.SharingStatus = "sharing-status", r.Slider = "slider", r.Spacer = "spacer", r.StatusDot = "status-dot", r.Step = "step", r.StepButtons = "step-buttons", r.Stepper = "stepper", r.Sublabel = "sublabel", r.Table = "table", r.Tag = "tag", r.TagList = "tag-list", r.Textarea = "textarea", r.Tile = "tile", r.Title = "title", r.Tooltip = "tooltip", r.Trigger = "trigger", r.Validation = "validation", r))(t || {}), u = /* @__PURE__ */ ((r) => (r.Enter = "Enter", r.Escape = "Escape", r.ArrowDown = "ArrowDown", r.ArrowUp = "ArrowUp", r.Home = "Home", r.End = "End", r))(u || {});
|
|
3
|
+
var p = /* @__PURE__ */ ((r) => (r.onwhite = "onwhite", r.ongrey = "ongrey", r.onblueberry = "onblueberry", r.ondark = "ondark", r.oninvalid = "oninvalid", r))(p || {}), a = /* @__PURE__ */ ((r) => (r.medium = "medium", r.large = "large", r))(a || {}), t = /* @__PURE__ */ ((r) => (r.AnchorLink = "anchor-link", r.Avatar = "avatar", r.Badge = "badge", r.Button = "button", r.Checkbox = "checkbox", r.Close = "close", r.DictionaryTrigger = "dictionary-trigger", r.Dropdown = "dropdown", r.Duolist = "duolist", r.EmptyState = "empty-state", r.Expander = "expander", r.ExpanderHierarchy = "expander-hierarchy", r.ExpanderHierarchyExpander = "expander-hierarchy-expander", r.ExpanderList = "expander-list", r.ExpanderListExpander = "expander-list-expander", r.FormGroup = "form-group", r.FormLayout = "form-layout", r.HelpBubble = "help-bubble", r.HelpQuestion = "help-question", r.HighlightBox = "highlight-box", r.Icon = "icon", r.Illustration = "Illustration", r.Input = "input", r.Label = "label", r.Link = "link", r.LinkList = "link-list", r.List = "list", r.Loader = "loader", r.Logo = "logo", r.Modal = "modal", r.NotificationPanel = "notification-panel", r.Panel = "panel", r.PanelList = "panel-list", r.PopMenu = "pop-menu", r.PopOver = "pop-over", r.Portal = "portal", r.PromoPanel = "promo-panel", r.RadioButton = "radio-button", r.Select = "select", r.SharingStatus = "sharing-status", r.Slider = "slider", r.Spacer = "spacer", r.StatusDot = "status-dot", r.Step = "step", r.StepButtons = "step-buttons", r.Stepper = "stepper", r.Sublabel = "sublabel", r.Table = "table", r.Tag = "tag", r.TagList = "tag-list", r.Textarea = "textarea", r.Tile = "tile", r.Title = "title", r.Tooltip = "tooltip", r.Trigger = "trigger", r.Validation = "validation", r))(t || {}), u = /* @__PURE__ */ ((r) => (r.Enter = "Enter", r.Escape = "Escape", r.ArrowDown = "ArrowDown", r.ArrowUp = "ArrowUp", r.ArrowRight = "ArrowRight", r.ArrowLeft = "ArrowLeft", r.Home = "Home", r.End = "End", r.Space = " ", r.Tab = "Tab", r))(u || {});
|
|
4
4
|
export {
|
|
5
5
|
g as AVERAGE_CHARACTER_WIDTH_PX,
|
|
6
6
|
t as AnalyticsId,
|
package/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n PopOver = 11000,\n ExpanderTrigger = 10000,\n // TODO: Skille mellom ExpanderTrigger isSticky og isHovered? Skulle tro isHovered trenger vesentlig mindre z-index\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HighlightBox = 'highlight-box',\n Icon = 'icon',\n Illustration = 'Illustration',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Tooltip = 'tooltip',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n Home = 'Home',\n End = 'End',\n}\n"],"names":["IconSize","ZIndex","AVERAGE_CHARACTER_WIDTH_PX","FormMode","FormSize","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,sBAAAA,OACVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,EAAT,IAAA,UACAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SACAA,EAAAA,EAAA,SAAS,GAAT,IAAA,UANUA,IAAAA,KAAA,CAAA,CAAA,GASAC,sBAAAA,OACVA,EAAAA,EAAA,QAAQ,IAAR,IAAA,SACAA,EAAAA,EAAA,UAAU,IAAV,IAAA,WACAA,EAAAA,EAAA,kBAAkB,GAAlB,IAAA,mBAHUA,IAAAA,KAAA,CAAA,CAAA;AAOL,MAAMC,IAA6B;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ACPA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,aAAa,cAxDHA,IAAAA,KAAA,CAAA,CAAA,GA2DAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,UAAU,WACVA,EAAA,OAAO,QACPA,EAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["export enum IconSize {\n XXSmall = 24,\n XSmall = 38,\n Small = 48,\n Medium = 64,\n Large = 80,\n XLarge = 130,\n}\n\nexport enum ZIndex {\n Modal = 1300000,\n PopOver = 11000,\n ExpanderTrigger = 10000,\n // TODO: Skille mellom ExpanderTrigger isSticky og isHovered? Skulle tro isHovered trenger vesentlig mindre z-index\n}\n\nexport const AVERAGE_CHARACTER_WIDTH_PX = 12;\n\nexport interface HTMLButtonProps {\n autoFocus?: boolean;\n disabled?: boolean;\n form?: string;\n formAction?: string;\n formEncType?: string;\n formMethod?: string;\n formNoValidate?: boolean;\n formTarget?: string;\n name?: string;\n type?: 'submit' | 'reset' | 'button' | string;\n value?: string | string[] | number;\n id?: string;\n}\n\nexport type AnchorTarget = '_self' | '_blank' | '_parent' | '_top';\n\nexport interface HTMLAnchorProps {\n download?: string;\n href?: string;\n hrefLang?: string;\n media?: string;\n ping?: string;\n rel?: AnchorTarget;\n target?: string;\n referrerPolicy?:\n | ''\n | 'same-origin'\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n}\n\nexport type ButtonVariant = 'secondary' | 'tertiary' | string | undefined | null;\n\nexport enum FormMode {\n onwhite = 'onwhite',\n ongrey = 'ongrey',\n onblueberry = 'onblueberry',\n ondark = 'ondark',\n oninvalid = 'oninvalid',\n}\n\nexport enum FormSize {\n medium = 'medium',\n large = 'large',\n}\n\nexport enum AnalyticsId {\n AnchorLink = 'anchor-link',\n Avatar = 'avatar',\n Badge = 'badge',\n Button = 'button',\n Checkbox = 'checkbox',\n Close = 'close',\n DictionaryTrigger = 'dictionary-trigger',\n Dropdown = 'dropdown',\n Duolist = 'duolist',\n EmptyState = 'empty-state',\n Expander = 'expander',\n ExpanderHierarchy = 'expander-hierarchy',\n ExpanderHierarchyExpander = 'expander-hierarchy-expander',\n ExpanderList = 'expander-list',\n ExpanderListExpander = 'expander-list-expander',\n FormGroup = 'form-group',\n FormLayout = 'form-layout',\n HelpBubble = 'help-bubble',\n HelpQuestion = 'help-question',\n HighlightBox = 'highlight-box',\n Icon = 'icon',\n Illustration = 'Illustration',\n Input = 'input',\n Label = 'label',\n Link = 'link',\n LinkList = 'link-list',\n List = 'list',\n Loader = 'loader',\n Logo = 'logo',\n Modal = 'modal',\n NotificationPanel = 'notification-panel',\n Panel = 'panel',\n PanelList = 'panel-list',\n PopMenu = 'pop-menu',\n PopOver = 'pop-over',\n Portal = 'portal',\n PromoPanel = 'promo-panel',\n RadioButton = 'radio-button',\n Select = 'select',\n SharingStatus = 'sharing-status',\n Slider = 'slider',\n Spacer = 'spacer',\n StatusDot = 'status-dot',\n Step = 'step',\n StepButtons = 'step-buttons',\n Stepper = 'stepper',\n Sublabel = 'sublabel',\n Table = 'table',\n Tag = 'tag',\n TagList = 'tag-list',\n Textarea = 'textarea',\n Tile = 'tile',\n Title = 'title',\n Tooltip = 'tooltip',\n Trigger = 'trigger',\n Validation = 'validation',\n}\n\nexport enum KeyboardEventKey {\n Enter = 'Enter',\n Escape = 'Escape',\n ArrowDown = 'ArrowDown',\n ArrowUp = 'ArrowUp',\n ArrowRight = 'ArrowRight',\n ArrowLeft = 'ArrowLeft',\n Home = 'Home',\n End = 'End',\n Space = ' ',\n Tab = 'Tab',\n}\n"],"names":["IconSize","ZIndex","AVERAGE_CHARACTER_WIDTH_PX","FormMode","FormSize","AnalyticsId","KeyboardEventKey"],"mappings":"AAAY,IAAAA,sBAAAA,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AAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,oBAAoB,sBACpBA,EAAA,QAAQ,SACRA,EAAA,YAAY,cACZA,EAAA,UAAU,YACVA,EAAA,UAAU,YACVA,EAAA,SAAS,UACTA,EAAA,aAAa,eACbA,EAAA,cAAc,gBACdA,EAAA,SAAS,UACTA,EAAA,gBAAgB,kBAChBA,EAAA,SAAS,UACTA,EAAA,SAAS,UACTA,EAAA,YAAY,cACZA,EAAA,OAAO,QACPA,EAAA,cAAc,gBACdA,EAAA,UAAU,WACVA,EAAA,WAAW,YACXA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,UAAU,YACVA,EAAA,WAAW,YACXA,EAAA,OAAO,QACPA,EAAA,QAAQ,SACRA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,aAAa,cAxDHA,IAAAA,KAAA,CAAA,CAAA,GA2DAC,sBAAAA,OACVA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,YAAY,aACZA,EAAA,UAAU,WACVA,EAAA,aAAa,cACbA,EAAA,YAAY,aACZA,EAAA,OAAO,QACPA,EAAA,MAAM,OACNA,EAAA,QAAQ,KACRA,EAAA,MAAM,OAVIA,IAAAA,KAAA,CAAA,CAAA;"}
|
package/docs/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import "../node_modules/@storybook/addon-docs/dist/chunk-HLWAVYOI.js";
|
|
3
|
-
import { ArgTypes as
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
6
|
-
return /* @__PURE__ */ e.createElement(
|
|
7
|
-
const
|
|
8
|
-
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "space-between" } }, /* @__PURE__ */ e.createElement(
|
|
3
|
+
import { ArgTypes as l, Title as a, Subtitle as o, Description as i, Primary as s, Controls as c, Stories as m } from "../node_modules/@storybook/blocks/dist/index.js";
|
|
4
|
+
const u = () => (window.location != window.parent.location ? document.referrer : document.location.href).startsWith("https://frankenstein.helsenorge.design") || window.location.search.includes("isSupernova"), w = (t) => {
|
|
5
|
+
if (u())
|
|
6
|
+
return /* @__PURE__ */ e.createElement(l, null);
|
|
7
|
+
const n = new URLSearchParams(window.location.search), r = `${window.location.pathname}?id=${n.get("id")}&viewMode=docs`;
|
|
8
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { display: "flex", justifyContent: "space-between" } }, /* @__PURE__ */ e.createElement(a, null), /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("a", { target: "_blank", href: r, rel: "noreferrer" }, "Åpne i ny fane"))), /* @__PURE__ */ e.createElement(o, null), /* @__PURE__ */ e.createElement(i, null), /* @__PURE__ */ e.createElement(s, null), /* @__PURE__ */ e.createElement(c, null), !t.hideStories && /* @__PURE__ */ e.createElement(m, null));
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
11
|
w as default,
|
|
12
|
-
|
|
12
|
+
u as isSupernova
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/docs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/docs/index.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Title, Subtitle, Description, Primary, ArgTypes, Stories } from '@storybook/addon-docs';\n\ninterface DocsProps<T> {\n component: T;\n hideStories?: boolean;\n}\n\nexport const isSupernova = (): boolean => {\n const url = window.location != window.parent.location ? document.referrer : document.location.href;\n return url.startsWith('https://frankenstein.helsenorge.design') || window.location.search.includes('isSupernova');\n};\n\nconst Docs = <T,>(props: DocsProps<T>): React.JSX.Element => {\n if (isSupernova()) {\n return <ArgTypes
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/docs/index.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Title, Subtitle, Description, Primary, ArgTypes, Stories, Controls } from '@storybook/addon-docs';\n\ninterface DocsProps<T> {\n component: T;\n hideStories?: boolean;\n}\n\nexport const isSupernova = (): boolean => {\n const url = window.location != window.parent.location ? document.referrer : document.location.href;\n return url.startsWith('https://frankenstein.helsenorge.design') || window.location.search.includes('isSupernova');\n};\n\nconst Docs = <T,>(props: DocsProps<T>): React.JSX.Element => {\n if (isSupernova()) {\n return <ArgTypes />;\n }\n\n const searchParams = new URLSearchParams(window.location.search);\n const newWindowUrl = `${window.location.pathname}?id=${searchParams.get('id')}&viewMode=docs`;\n\n return (\n <>\n <div style={{ display: 'flex', justifyContent: 'space-between' }}>\n <Title />\n <div>\n <a target=\"_blank\" href={newWindowUrl} rel=\"noreferrer\">\n {'Åpne i ny fane'}\n </a>\n </div>\n </div>\n <Subtitle />\n <Description />\n <Primary />\n <Controls />\n {!props.hideStories && <Stories />}\n </>\n );\n};\n\nexport default Docs;\n"],"names":["isSupernova","Docs","props","ArgTypes","searchParams","newWindowUrl","React","Title","Subtitle","Description","Primary","Controls","Stories"],"mappings":";;;AASO,MAAMA,IAAc,OACb,OAAO,YAAY,OAAO,OAAO,WAAW,SAAS,WAAW,SAAS,SAAS,MACnF,WAAW,wCAAwC,KAAK,OAAO,SAAS,OAAO,SAAS,aAAa,GAG5GC,IAAO,CAAKC,MAA2C;AAC3D,MAAIF;AACF,2CAAQG,GAAS,IAAA;AAGnB,QAAMC,IAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM,GACzDC,IAAe,GAAG,OAAO,SAAS,QAAQ,OAAOD,EAAa,IAAI,IAAI,CAAC;AAG3E,SAAA,gBAAAE,EAAA,cAAAA,EAAA,UAAA,sCACG,OAAI,EAAA,OAAO,EAAE,SAAS,QAAQ,gBAAgB,gBAAgB,EAAA,mCAC5DC,GAAM,IAAA,mCACN,OACC,MAAA,gBAAAD,EAAA,cAAC,OAAE,QAAO,UAAS,MAAMD,GAAc,KAAI,gBACxC,gBACH,CACF,CACF,GACA,gBAAAC,EAAA,cAACE,OAAS,GACV,gBAAAF,EAAA,cAACG,OAAY,GACb,gBAAAH,EAAA,cAACI,OAAQ,GACT,gBAAAJ,EAAA,cAACK,OAAS,GACT,CAACT,EAAM,eAAe,gBAAAI,EAAA,cAACM,OAAQ,CAClC;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useRovingFocus: (handleNewIndex: (index: number) => void, inputRefList: React.MutableRefObject<React.RefObject<HTMLElement>[] | null | undefined>, containerRef: React.RefObject<HTMLElement>, leftRightNavigation?: boolean) => void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect as x } from "react";
|
|
2
|
+
import { useKeyboardEvent as K } from "./useKeyboardEvent.js";
|
|
3
|
+
import { KeyboardEventKey as r } from "../constants.js";
|
|
4
|
+
const D = (k, c, m, a) => {
|
|
5
|
+
a = a ?? !1, x(() => {
|
|
6
|
+
var e, n;
|
|
7
|
+
c.current && (c.current.forEach((o) => {
|
|
8
|
+
var t;
|
|
9
|
+
(t = o.current) == null || t.setAttribute("tabIndex", "-1");
|
|
10
|
+
}), (n = (e = c.current[0]) == null ? void 0 : e.current) == null || n.setAttribute("tabIndex", "0"));
|
|
11
|
+
}, []);
|
|
12
|
+
const A = (e) => {
|
|
13
|
+
var t, d, f, s, u, w;
|
|
14
|
+
if (e.key === r.Tab || (e.preventDefault(), !c.current))
|
|
15
|
+
return;
|
|
16
|
+
const n = c.current.findIndex((y) => y.current === e.target);
|
|
17
|
+
let o = n;
|
|
18
|
+
e.key === r.Home ? o = 0 : e.key === r.End ? o = c.current.length - 1 : (e.key === r.ArrowDown || e.key === r.ArrowRight) && n < c.current.length - 1 ? o = n + 1 : (e.key === r.ArrowUp || e.key === r.ArrowLeft) && n > 0 ? o = n - 1 : (e.key === r.Enter || e.key === r.Space) && (o = n), o !== -1 && ((t = c.current) == null || t.forEach((y, l) => {
|
|
19
|
+
y.current && (y.current.tabIndex = l === o ? 0 : -1);
|
|
20
|
+
}), (f = (d = c.current[o]) == null ? void 0 : d.current) == null || f.focus(), (w = (u = (s = c.current[o]) == null ? void 0 : s.current) == null ? void 0 : u.click) == null || w.call(u), k(o));
|
|
21
|
+
}, E = [r.End, r.Enter, r.Escape, r.Home], b = a ? [r.ArrowRight, r.ArrowLeft] : [r.ArrowUp, r.ArrowDown];
|
|
22
|
+
K(m, A, [...E, ...b]);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
D as useRovingFocus
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=useRovingFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRovingFocus.js","sources":["../../src/hooks/useRovingFocus.tsx"],"sourcesContent":["// Inspiration from https://www.joshuawootonn.com/react-roving-tabindex\nimport { useEffect } from 'react';\n\nimport { useKeyboardEvent } from './useKeyboardEvent';\nimport { KeyboardEventKey } from '../constants';\n\nexport const useRovingFocus = (\n /** Function to run when new index is set */\n handleNewIndex: (index: number) => void,\n /** List of elements that should have rocing focus */\n inputRefList: React.MutableRefObject<React.RefObject<HTMLElement>[] | null | undefined>,\n /** Ref of container that should have the keyboard event handler */\n containerRef: React.RefObject<HTMLElement>,\n /** Indicated wether right/left or up/down arrows should be used for navigation. Default is up/down. */\n leftRightNavigation?: boolean\n): void => {\n leftRightNavigation = leftRightNavigation ?? false;\n\n // Initialize only first index to be tabbable\n useEffect(() => {\n if (!inputRefList.current) {\n return;\n }\n inputRefList.current.forEach(ref => {\n ref.current?.setAttribute('tabIndex', '-1');\n });\n inputRefList.current[0]?.current?.setAttribute('tabIndex', '0');\n }, []);\n\n const handleKeyboardNavigation = (event: KeyboardEvent): void => {\n if (event.key === KeyboardEventKey.Tab) {\n return;\n }\n event.preventDefault();\n\n if (!inputRefList.current) {\n return;\n }\n const index = inputRefList.current.findIndex(x => x.current === event.target);\n let nextIndex = index;\n\n if (event.key === KeyboardEventKey.Home) {\n nextIndex = 0;\n } else if (event.key === KeyboardEventKey.End) {\n nextIndex = inputRefList.current.length - 1;\n } else if (\n (event.key === KeyboardEventKey.ArrowDown || event.key === KeyboardEventKey.ArrowRight) &&\n index < inputRefList.current.length - 1\n ) {\n nextIndex = index + 1;\n } else if ((event.key === KeyboardEventKey.ArrowUp || event.key === KeyboardEventKey.ArrowLeft) && index > 0) {\n nextIndex = index - 1;\n } else if (event.key === KeyboardEventKey.Enter || event.key === KeyboardEventKey.Space) {\n nextIndex = index;\n }\n\n if (nextIndex !== -1) {\n inputRefList.current?.forEach((ref, i) => {\n if (ref.current) {\n ref.current.tabIndex = i === nextIndex ? 0 : -1;\n }\n });\n inputRefList.current[nextIndex]?.current?.focus();\n inputRefList.current[nextIndex]?.current?.click?.();\n handleNewIndex(nextIndex);\n }\n };\n\n const commonKeys = [KeyboardEventKey.End, KeyboardEventKey.Enter, KeyboardEventKey.Escape, KeyboardEventKey.Home];\n\n const arrowKeys = leftRightNavigation\n ? [KeyboardEventKey.ArrowRight, KeyboardEventKey.ArrowLeft]\n : [KeyboardEventKey.ArrowUp, KeyboardEventKey.ArrowDown];\n\n useKeyboardEvent(containerRef, handleKeyboardNavigation, [...commonKeys, ...arrowKeys]);\n};\n"],"names":["useRovingFocus","handleNewIndex","inputRefList","containerRef","leftRightNavigation","useEffect","ref","_a","_b","handleKeyboardNavigation","event","KeyboardEventKey","index","x","nextIndex","i","_c","_f","_e","_d","commonKeys","arrowKeys","useKeyboardEvent"],"mappings":";;;AAMO,MAAMA,IAAiB,CAE5BC,GAEAC,GAEAC,GAEAC,MACS;AACT,EAAAA,IAAsBA,KAAuB,IAG7CC,EAAU,MAAM;;AACV,IAACH,EAAa,YAGLA,EAAA,QAAQ,QAAQ,CAAOI,MAAA;;AAC9B,OAAAC,IAAAD,EAAA,YAAA,QAAAC,EAAS,aAAa,YAAY;AAAA,IAAI,CAC3C,IACDC,KAAAD,IAAAL,EAAa,QAAQ,CAAC,MAAtB,gBAAAK,EAAyB,YAAzB,QAAAC,EAAkC,aAAa,YAAY;AAAA,EAC7D,GAAG,CAAE,CA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CAAS,CAAC;AACxF;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: React.FC<{}>;
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Default: Story;
|
|
17
|
+
export declare const WithLeftRightNavigation: Story;
|
package/package.json
CHANGED
|
@@ -114,20 +114,22 @@ import designsystemtypography from './scss/typography.scss'
|
|
|
114
114
|
overflow-wrap: break-word;
|
|
115
115
|
word-break: break-word;
|
|
116
116
|
text-align: left;
|
|
117
|
-
text-decoration: none;
|
|
118
117
|
color: $blueberry600;
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
border: 0.15rem solid transparent;
|
|
119
|
+
text-decoration: underline;
|
|
120
|
+
text-underline-offset: 0.16rem;
|
|
121
|
+
text-decoration-color: $blueberry400;
|
|
122
|
+
text-decoration-thickness: 0.0625rem;
|
|
123
|
+
padding: 0.1rem;
|
|
121
124
|
|
|
122
125
|
&:hover {
|
|
123
126
|
cursor: pointer;
|
|
124
127
|
color: $blueberry700;
|
|
125
128
|
background-color: $blueberry50;
|
|
126
|
-
|
|
129
|
+
text-decoration-color: $blueberry600;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
&:focus {
|
|
130
|
-
padding: 0 0 0.15rem;
|
|
131
133
|
outline: none;
|
|
132
134
|
border: 0.15rem solid $black;
|
|
133
135
|
}
|