@helsenorge/designsystem-react 1.0.0-beta95 → 1.0.0-beta99
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/Button-f6698126.js +2 -0
- package/Button-f6698126.js.map +1 -0
- package/Checkbox-d9b564fd.js +2 -0
- package/Checkbox-d9b564fd.js.map +1 -0
- package/ChevronUp-4b6797ef.js +2 -0
- package/ChevronUp-4b6797ef.js.map +1 -0
- package/Close-007fca15.js +2 -0
- package/Close-007fca15.js.map +1 -0
- package/FormGroup-9ff588a2.js +2 -0
- package/FormGroup-9ff588a2.js.map +1 -0
- package/Icon-89da8de4.js +2 -0
- package/Icon-89da8de4.js.map +1 -0
- package/Input-f331efd2.js +2 -0
- package/Input-f331efd2.js.map +1 -0
- package/Loader-e5b166ea.js +2 -0
- package/Loader-e5b166ea.js.map +1 -0
- package/Modal-08f3c55b.js +2 -0
- package/Modal-08f3c55b.js.map +1 -0
- package/RadioButton-e41b1319.js +2 -0
- package/RadioButton-e41b1319.js.map +1 -0
- package/Textarea-74f821a2.js +2 -0
- package/Textarea-74f821a2.js.map +1 -0
- package/Title-fab4097d.js +2 -0
- package/Title-fab4097d.js.map +1 -0
- package/Validation-c41fc494.js +2 -0
- package/Validation-c41fc494.js.map +1 -0
- package/components/AnchorLink/AnchorLink.d.ts.map +1 -1
- package/components/AnchorLink/index.js +1 -1
- package/components/Avatar/Avatar.d.ts.map +1 -1
- package/components/Avatar/index.js +1 -1
- package/components/Badge/Badge.d.ts.map +1 -1
- package/components/Badge/index.js +1 -1
- package/components/Button/Button.d.ts.map +1 -1
- package/components/Button/index.js +1 -1
- package/components/Button/styles.module.scss +8 -0
- package/components/ButtonWithModal/componentdata.json +19 -0
- package/components/ButtonWithModal/index.js +1 -1
- package/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/components/Checkbox/index.js +1 -1
- package/components/Checkbox/styles.module.scss +2 -1
- package/components/Close/Close.d.ts.map +1 -1
- package/components/Close/index.js +1 -1
- package/components/Expander/Expander.d.ts +33 -0
- package/components/Expander/Expander.d.ts.map +1 -0
- package/components/Expander/componentdata.json +237 -0
- package/components/Expander/index.d.ts +4 -0
- package/components/Expander/index.d.ts.map +1 -0
- package/components/Expander/index.js +2 -0
- package/components/Expander/index.js.map +1 -0
- package/components/Expander/styles.module.scss +165 -0
- package/components/Expander/styles.module.scss.d.ts +42 -0
- package/components/ExpanderList/ExpanderList.d.ts.map +1 -1
- package/components/ExpanderList/index.js +1 -1
- package/components/FormExample/index.js +1 -1
- package/components/FormGroup/FormGroup.d.ts.map +1 -1
- package/components/FormGroup/index.js +1 -1
- package/components/FormGroup/styles.module.scss +1 -1
- package/components/HighlightBox/HighlightBox.d.ts.map +1 -1
- package/components/HighlightBox/index.js +1 -1
- package/components/Icons/AcupunctureBack.js +1 -1
- package/components/Icons/Icon.d.ts.map +1 -1
- package/components/Icons/Icon.js +1 -1
- package/components/Icons/NoEye.js +1 -1
- package/components/Icons/SectionSign.js +1 -1
- package/components/Icons/SpeechBubble.js +1 -1
- package/components/Icons/SupportingPerson.js +1 -1
- package/components/Icons/Syringe.js +1 -1
- package/components/Icons/index.js +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/index.js +1 -1
- package/components/LinkList/LinkList.d.ts.map +1 -1
- package/components/LinkList/index.js +1 -1
- package/components/List/List.d.ts.map +1 -1
- package/components/List/index.js +1 -1
- package/components/Loader/Loader.d.ts.map +1 -1
- package/components/Loader/index.js +1 -1
- package/components/Loader/styles.module.scss +3 -2
- package/components/Logo/Logo.d.ts.map +1 -1
- package/components/Logo/index.js +1 -1
- package/components/Modal/Modal.d.ts +2 -0
- package/components/Modal/Modal.d.ts.map +1 -1
- package/components/Modal/componentdata.json +19 -0
- package/components/Modal/index.js +1 -1
- package/components/NotificationPanel/NotificationPanel.d.ts.map +1 -1
- package/components/NotificationPanel/index.js +1 -1
- package/components/Portal/index.d.ts.map +1 -1
- package/components/Portal/index.js +1 -1
- package/components/RadioButton/RadioButton.d.ts.map +1 -1
- package/components/RadioButton/index.js +1 -1
- package/components/RadioButton/styles.module.scss +2 -2
- package/components/Slider/Slider.d.ts.map +1 -1
- package/components/Slider/index.js +1 -1
- package/components/Spacer/Spacer.d.ts.map +1 -1
- package/components/Spacer/index.js +1 -1
- package/components/Textarea/Textarea.d.ts.map +1 -1
- package/components/Textarea/index.js +1 -1
- package/components/Tile/Tile.d.ts.map +1 -1
- package/components/Tile/index.js +1 -1
- package/components/Title/Title.d.ts.map +1 -1
- package/components/Title/index.js +1 -1
- package/components/Validation/Validation.d.ts.map +1 -1
- package/components/Validation/index.js +1 -1
- package/constants-ad6c82db.js +2 -0
- package/constants-ad6c82db.js.map +1 -0
- package/constants.d.ts +31 -1
- package/constants.d.ts.map +1 -1
- package/hooks/useFocusToggle.d.ts +14 -0
- package/hooks/useFocusToggle.d.ts.map +1 -0
- package/hooks/useIntersectionObserver.d.ts +11 -0
- package/hooks/useIntersectionObserver.d.ts.map +1 -0
- package/hooks/useIsVisible.d.ts +10 -0
- package/hooks/useIsVisible.d.ts.map +1 -0
- package/hooks/useLayoutEvent.d.ts +9 -0
- package/hooks/useLayoutEvent.d.ts.map +1 -0
- package/hooks/useSticky.d.ts +21 -0
- package/hooks/useSticky.d.ts.map +1 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/utils/debounce.d.ts +8 -0
- package/utils/debounce.d.ts.map +1 -0
- package/Button-8af0be6e.js +0 -2
- package/Button-8af0be6e.js.map +0 -1
- package/Checkbox-fb5dff56.js +0 -2
- package/Checkbox-fb5dff56.js.map +0 -1
- package/Close-9f68bcd0.js +0 -2
- package/Close-9f68bcd0.js.map +0 -1
- package/FormGroup-6c545646.js +0 -2
- package/FormGroup-6c545646.js.map +0 -1
- package/Icon-04613a89.js +0 -2
- package/Icon-04613a89.js.map +0 -1
- package/Input-adeb7f88.js +0 -2
- package/Input-adeb7f88.js.map +0 -1
- package/Loader-b3fd59f4.js +0 -2
- package/Loader-b3fd59f4.js.map +0 -1
- package/Modal-b7d10081.js +0 -2
- package/Modal-b7d10081.js.map +0 -1
- package/RadioButton-d90884c9.js +0 -2
- package/RadioButton-d90884c9.js.map +0 -1
- package/Textarea-05e33ba3.js +0 -2
- package/Textarea-05e33ba3.js.map +0 -1
- package/Title-90910763.js +0 -2
- package/Title-90910763.js.map +0 -1
- package/Validation-9bf0c0ec.js +0 -2
- package/Validation-9bf0c0ec.js.map +0 -1
- package/constants-42547490.js +0 -2
- package/constants-42547490.js.map +0 -1
- package/hooks/useVisibility.d.ts +0 -3
- package/hooks/useVisibility.d.ts.map +0 -1
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
{
|
|
2
|
+
"props": {
|
|
3
|
+
"title": {
|
|
4
|
+
"defaultValue": null,
|
|
5
|
+
"description": "Sets the trigger title",
|
|
6
|
+
"name": "title",
|
|
7
|
+
"parent": {
|
|
8
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
9
|
+
"name": "ExpanderProps"
|
|
10
|
+
},
|
|
11
|
+
"declarations": [
|
|
12
|
+
{
|
|
13
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
14
|
+
"name": "ExpanderProps"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"required": true,
|
|
18
|
+
"type": {
|
|
19
|
+
"name": "string"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"children": {
|
|
23
|
+
"defaultValue": null,
|
|
24
|
+
"description": "Sets the expanded content",
|
|
25
|
+
"name": "children",
|
|
26
|
+
"parent": {
|
|
27
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
28
|
+
"name": "ExpanderProps"
|
|
29
|
+
},
|
|
30
|
+
"declarations": [
|
|
31
|
+
{
|
|
32
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
33
|
+
"name": "ExpanderProps"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"fileName": "designsystem/node_modules/@types/react/index.d.ts",
|
|
37
|
+
"name": "TypeLiteral"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"required": false,
|
|
41
|
+
"type": {
|
|
42
|
+
"name": "ReactNode"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"size": {
|
|
46
|
+
"defaultValue": null,
|
|
47
|
+
"description": "Sets the size of the expander. Default: ExpanderSize.small",
|
|
48
|
+
"name": "size",
|
|
49
|
+
"parent": {
|
|
50
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
51
|
+
"name": "ExpanderProps"
|
|
52
|
+
},
|
|
53
|
+
"declarations": [
|
|
54
|
+
{
|
|
55
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
56
|
+
"name": "ExpanderProps"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"required": false,
|
|
60
|
+
"type": {
|
|
61
|
+
"name": "enum",
|
|
62
|
+
"raw": "ExpanderSize | undefined",
|
|
63
|
+
"value": [
|
|
64
|
+
{
|
|
65
|
+
"value": "undefined"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"value": "\"small\""
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"value": "\"large\""
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"color": {
|
|
77
|
+
"defaultValue": null,
|
|
78
|
+
"description": "Sets the background of the expander. Requires size=ExpanderSize.large.",
|
|
79
|
+
"name": "color",
|
|
80
|
+
"parent": {
|
|
81
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
82
|
+
"name": "ExpanderProps"
|
|
83
|
+
},
|
|
84
|
+
"declarations": [
|
|
85
|
+
{
|
|
86
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
87
|
+
"name": "ExpanderProps"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"required": false,
|
|
91
|
+
"type": {
|
|
92
|
+
"name": "enum",
|
|
93
|
+
"raw": "\"banana\" | \"blueberry\" | \"cherry\" | \"kiwi\" | \"neutral\" | \"plum\" | \"white\" | undefined",
|
|
94
|
+
"value": [
|
|
95
|
+
{
|
|
96
|
+
"value": "undefined"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"value": "\"banana\""
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"value": "\"blueberry\""
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"value": "\"cherry\""
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"value": "\"kiwi\""
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"value": "\"neutral\""
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"value": "\"plum\""
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"value": "\"white\""
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"svgIcon": {
|
|
123
|
+
"defaultValue": null,
|
|
124
|
+
"description": "Adds an icon to the expander trigger. Requires size=ExpanderSize.large.",
|
|
125
|
+
"name": "svgIcon",
|
|
126
|
+
"parent": {
|
|
127
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
128
|
+
"name": "ExpanderProps"
|
|
129
|
+
},
|
|
130
|
+
"declarations": [
|
|
131
|
+
{
|
|
132
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
133
|
+
"name": "ExpanderProps"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"required": false,
|
|
137
|
+
"type": {
|
|
138
|
+
"name": "FC<SvgPathProps>"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"expanded": {
|
|
142
|
+
"defaultValue": null,
|
|
143
|
+
"description": "Adds an icon to the expander trigger",
|
|
144
|
+
"name": "expanded",
|
|
145
|
+
"parent": {
|
|
146
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
147
|
+
"name": "ExpanderProps"
|
|
148
|
+
},
|
|
149
|
+
"declarations": [
|
|
150
|
+
{
|
|
151
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
152
|
+
"name": "ExpanderProps"
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"required": false,
|
|
156
|
+
"type": {
|
|
157
|
+
"name": "boolean"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"noNestedLine": {
|
|
161
|
+
"defaultValue": null,
|
|
162
|
+
"description": "Removes border to the left of the content. Requires size=ExpanderSize.small.",
|
|
163
|
+
"name": "noNestedLine",
|
|
164
|
+
"parent": {
|
|
165
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
166
|
+
"name": "ExpanderProps"
|
|
167
|
+
},
|
|
168
|
+
"declarations": [
|
|
169
|
+
{
|
|
170
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
171
|
+
"name": "ExpanderProps"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"required": false,
|
|
175
|
+
"type": {
|
|
176
|
+
"name": "boolean"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"sticky": {
|
|
180
|
+
"defaultValue": null,
|
|
181
|
+
"description": "Stick expander trigger to top of screen while scrolling down",
|
|
182
|
+
"name": "sticky",
|
|
183
|
+
"parent": {
|
|
184
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
185
|
+
"name": "ExpanderProps"
|
|
186
|
+
},
|
|
187
|
+
"declarations": [
|
|
188
|
+
{
|
|
189
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
190
|
+
"name": "ExpanderProps"
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"required": false,
|
|
194
|
+
"type": {
|
|
195
|
+
"name": "boolean"
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
"onExpand": {
|
|
199
|
+
"defaultValue": null,
|
|
200
|
+
"description": "Called when expander is open/closed.",
|
|
201
|
+
"name": "onExpand",
|
|
202
|
+
"parent": {
|
|
203
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
204
|
+
"name": "ExpanderProps"
|
|
205
|
+
},
|
|
206
|
+
"declarations": [
|
|
207
|
+
{
|
|
208
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
209
|
+
"name": "ExpanderProps"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"required": false,
|
|
213
|
+
"type": {
|
|
214
|
+
"name": "((isExpanded: boolean) => void)"
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"testId": {
|
|
218
|
+
"defaultValue": null,
|
|
219
|
+
"description": "Sets the data-testid attribute on the expander button.",
|
|
220
|
+
"name": "testId",
|
|
221
|
+
"parent": {
|
|
222
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
223
|
+
"name": "ExpanderProps"
|
|
224
|
+
},
|
|
225
|
+
"declarations": [
|
|
226
|
+
{
|
|
227
|
+
"fileName": "src/components/Expander/Expander.tsx",
|
|
228
|
+
"name": "ExpanderProps"
|
|
229
|
+
}
|
|
230
|
+
],
|
|
231
|
+
"required": false,
|
|
232
|
+
"type": {
|
|
233
|
+
"name": "string"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Expander/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,YAAY,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e}from"../../_rollupPluginBabelHelpers-d0752906.js";import t,{useState as n,useEffect as a,useRef as o}from"react";import{I as r}from"../../Icon-89da8de4.js";import{Z as i,A as d,I as s}from"../../constants-ad6c82db.js";import{u as c}from"../../useHover-037be19d.js";import l from"./styles.module.scss";import{c as u}from"../../index-9b84fabc.js";import{C as p,a as m}from"../../ChevronUp-4b6797ef.js";import{B as x}from"../../Button-f6698126.js";import"../../_tslib-51c8a283.js";import"../../color-acb834c6.js";import"../../index-19b48c51.js";import"../../palette-f206f488.js";import"../../grid-11a70eb7.js";import"../../Loader-e5b166ea.js";import"../../uuid-8870ab4b.js";import"../Loader/styles.module.scss";import"../../useWindowSize-73b47451.js";import"../Button/styles.module.scss";var b=['a[href]:not([tabindex^="-"])','area[href]:not([tabindex^="-"])','input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])','input[type="radio"]:not([disabled]):not([tabindex^="-"])','select:not([disabled]):not([tabindex^="-"])','textarea:not([disabled]):not([tabindex^="-"])','button:not([disabled]):not([tabindex^="-"])','iframe:not([tabindex^="-"])','audio[controls]:not([tabindex^="-"])','video[controls]:not([tabindex^="-"])','[contenteditable]:not([tabindex^="-"])','[tabindex]:not([tabindex^="-"])'].join(",");function f(e,t,n){var a;return function(){var o=this,r=arguments,i=function(){a=null,n||e.apply(o,r)},d=n&&!a;a&&clearTimeout(a),a=setTimeout(i,t),d&&e.apply(o,r)}}var v,g=function(t,o){var r=n(!1),i=e(r,2),d=i[0],s=i[1],c=n(!1),l=e(c,2),u=l[0],p=l[1],m=n(),x=e(m,2),b=x[0],v=x[1],g=n(),_=e(g,2),h=_[0],E=_[1];return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:["layoutchange","resize","orientationchange"],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;a((function(){var a=f(e,n);return t.forEach((function(e){return window.addEventListener(e,a)})),a(),function(){t.forEach((function(e){return window.removeEventListener(e,a)}))}}),[])}((function(){var e,n,a,r=(null===(e=t.current)||void 0===e?void 0:e.getBoundingClientRect())||{},i=r.top,d=void 0===i?0:i,c=r.width,l=void 0===c?0:c,u=r.bottom,m=void 0===u?0:u,x=null!==(a=null===(n=o.current)||void 0===n?void 0:n.getBoundingClientRect().height)&&void 0!==a?a:0;s(d<=0),p(m<=x),E(l),v(x)}),["resize","scroll"]),{isOutsideWindow:d,isLeavingWindow:u,offsetHeight:b,contentWidth:h}};!function(e){e.small="small",e.large="large"}(v||(v={}));export default function(f){var _=f.title,h=f.children,E=f.size,y=void 0===E?v.small:E,j=f.color,w=f.svgIcon,I=f.expanded,z=void 0!==I&&I,L=f.noNestedLine,A=void 0!==L&&L,H=f.sticky,N=void 0!==H&&H,W=f.testId,B=f.onExpand,C=n(z),k=e(C,2),S=k[0],T=k[1],O=o(null),X=o(null),R=o(null),q=c(X).isHovered,M=g(O,X),P=M.isOutsideWindow,U=M.isLeavingWindow,Z=M.offsetHeight,D=M.contentWidth;!function(t,o){var r=n(),i=e(r,2),d=i[0],s=i[1];a((function(){var e=function(){var e,n=null===(e=t.current)||void 0===e?void 0:e.querySelectorAll(b);s(n)},n=new MutationObserver(e);return(null==t?void 0:t.current)&&n.observe(t.current,{subtree:!0,childList:!0}),e(),function(){n.disconnect()}}),[t]),a((function(){o?null==d||d.forEach((function(e){var t=e.getAttribute("data-tabindex");t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})):null==d||d.forEach((function(e){e.hasAttribute("tabindex")&&e.setAttribute("data-tabindex","".concat(e.tabIndex)),e.tabIndex=-1}))}),[o,d])}(R,S);var F=N&&S&&P;a((function(){z!==S&&T(z)}),[z]),a((function(){B&&B(!!S)}),[S,B]);var G=function(e){return t.createElement("span",{className:u(l.expander__icon,l["expander__icon--".concat(e)])},t.createElement(r,{svgIcon:S?p:m,size:s.XSmall,isHovered:q}))},J=u(l.expander__trigger,l["expander__trigger--".concat(y)],y===v.large&&l["expander__trigger--".concat(j||"neutral")],y===v.large&&w&&l["expander__trigger--icon"],S&&l["expander__trigger--expanded"],F&&!U&&l["expander__trigger--sticky"],F&&U&&l["expander__trigger--absolute"]),K=u(l.expander__button,S&&l["expander__button--expanded"],F&&!U&&l["expander__button--sticky"],F&&U&&l["expander__button--absolute"]),Q=u(l.expander__content,l["expander__content--".concat(y)],y===v.large&&l["expander__content--".concat(j||"neutral")],y===v.large&&w&&l["expander__content--icon"],S&&l["expander__content--expanded"],y===v.small&&!A&&l["expander__content--nested-line"]);return t.createElement("div",{className:l.expander,ref:O,style:{paddingTop:F&&Z?"".concat(Z,"px"):void 0}},y===v.large?t.createElement("button",{className:J,style:{zIndex:q||F?i.ExpanderTrigger:void 0,width:F&&D?"".concat(D,"px"):void 0},"aria-expanded":S,ref:X,onClick:function(){return T(!S)},"data-testid":W,"data-analyticsid":d.Expander},y===v.small&&G("left"),w&&t.createElement("span",{className:u(l.expander__icon,l["expander__icon--left"])},t.createElement(r,{svgIcon:w,size:s.XSmall,isHovered:q})),_,y===v.large&&G("right")):t.createElement(x,{variant:"borderless",className:K,"aria-expanded":S,ref:X,onClick:function(){return T(!S)},testId:W,"data-analyticsid":d.Expander},t.createElement(r,{svgIcon:S?p:m,size:s.XSmall}),_),t.createElement("div",{className:Q,ref:R},h))}export{v as ExpanderSize};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
@import '../../scss/_spacers.scss';
|
|
2
|
+
@import '../../scss/_breakpoints.scss';
|
|
3
|
+
@import '../../scss/_palette.scss';
|
|
4
|
+
@import '../../scss/_font-settings.scss';
|
|
5
|
+
|
|
6
|
+
.expander {
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 100%;
|
|
9
|
+
&__icon {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
&--left {
|
|
13
|
+
margin-right: getSpacer(xs);
|
|
14
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
15
|
+
margin-right: getSpacer(s);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
&--right {
|
|
19
|
+
margin-left: auto;
|
|
20
|
+
padding-left: getSpacer(xs);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&__button {
|
|
24
|
+
position: relative;
|
|
25
|
+
&:hover {
|
|
26
|
+
background-color: $blueberry50;
|
|
27
|
+
}
|
|
28
|
+
&--expanded {
|
|
29
|
+
background-color: $blueberry50;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
&__trigger {
|
|
33
|
+
$trigger: &;
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
border: none;
|
|
38
|
+
outline: none;
|
|
39
|
+
font-size: $font-size-sm;
|
|
40
|
+
line-height: $lineheight-size-sm;
|
|
41
|
+
font-weight: 600;
|
|
42
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
43
|
+
font-size: $font-size-md;
|
|
44
|
+
line-height: $lineheight-size-md;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&--large {
|
|
48
|
+
width: 100%;
|
|
49
|
+
padding: 12px getSpacer(xs) 12px getSpacer(s); // TODO: Bruk ny getspacer her i stedet for 12px
|
|
50
|
+
|
|
51
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
52
|
+
padding: 12px getSpacer(s) 12px getSpacer(l);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
&--icon {
|
|
56
|
+
padding-left: getSpacer(xs);
|
|
57
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
58
|
+
padding-left: getSpacer(s);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
$colors: 'neutral', 'blueberry', 'cherry', 'kiwi', 'banana', 'plum';
|
|
63
|
+
|
|
64
|
+
@each $color in $colors {
|
|
65
|
+
&--#{$color} {
|
|
66
|
+
background-color: map-get($palette-map, #{$color}50);
|
|
67
|
+
&:hover {
|
|
68
|
+
background-color: map-get($palette-map, #{$color}100);
|
|
69
|
+
}
|
|
70
|
+
&:focus {
|
|
71
|
+
box-shadow: 0 0 0 1.5px $neutral600, inset 0 0 0 1.5px $neutral600;
|
|
72
|
+
}
|
|
73
|
+
&#{$trigger}--expanded {
|
|
74
|
+
background-color: map-get($palette-map, #{$color}100);
|
|
75
|
+
&:hover {
|
|
76
|
+
background-color: map-get($palette-map, #{$color}200);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Hvit bakgrunn har egne regler for bakgrunnsfarge, hover og fokus
|
|
83
|
+
&--white {
|
|
84
|
+
background-color: $white;
|
|
85
|
+
&:hover {
|
|
86
|
+
background-color: $neutral100;
|
|
87
|
+
}
|
|
88
|
+
&:focus {
|
|
89
|
+
box-shadow: 0 0 0 1.5px $neutral600, inset 0 0 0 1.5px $neutral600;
|
|
90
|
+
}
|
|
91
|
+
&#{$trigger}--expanded {
|
|
92
|
+
box-shadow: inset 0 0 0 6px $neutral100;
|
|
93
|
+
&:focus {
|
|
94
|
+
box-shadow: 0 0 0 1.5px $neutral600, inset 0 0 0 1.5px $neutral600, inset 0 0 0 6px $neutral100;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
&__button,
|
|
100
|
+
&__trigger {
|
|
101
|
+
&--sticky {
|
|
102
|
+
position: fixed;
|
|
103
|
+
top: 0;
|
|
104
|
+
}
|
|
105
|
+
&--absolute {
|
|
106
|
+
position: absolute;
|
|
107
|
+
bottom: 0;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
&__content {
|
|
111
|
+
$content: &;
|
|
112
|
+
display: none;
|
|
113
|
+
width: 100%;
|
|
114
|
+
|
|
115
|
+
&--expanded {
|
|
116
|
+
display: block;
|
|
117
|
+
}
|
|
118
|
+
&--small {
|
|
119
|
+
margin-top: getSpacer(s);
|
|
120
|
+
}
|
|
121
|
+
&--nested-line {
|
|
122
|
+
padding-left: getSpacer(s);
|
|
123
|
+
border-left: solid 3px $neutral200;
|
|
124
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
125
|
+
margin-left: calc(38px / 2); // Halvparten av chevron-ikonets bredde
|
|
126
|
+
padding-left: calc(
|
|
127
|
+
38px / 2 + 12px - 3px
|
|
128
|
+
); // Halvparten av chevron-ikonets bredde, pluss ikonets margin-right på tablet, minus bredden på border
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
&--large {
|
|
132
|
+
padding: getSpacer(s) getSpacer(m) getSpacer(l) getSpacer(s);
|
|
133
|
+
|
|
134
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
135
|
+
padding: getSpacer(m) getSpacer(l) getSpacer(xl) getSpacer(l);
|
|
136
|
+
}
|
|
137
|
+
&#{$content}--icon {
|
|
138
|
+
@media (min-width: map-get($grid-breakpoints, md)) {
|
|
139
|
+
padding-left: 70px;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
&--neutral {
|
|
144
|
+
background-color: $neutral50;
|
|
145
|
+
}
|
|
146
|
+
&--blueberry {
|
|
147
|
+
background-color: $blueberry50;
|
|
148
|
+
}
|
|
149
|
+
&--cherry {
|
|
150
|
+
background-color: $cherry50;
|
|
151
|
+
}
|
|
152
|
+
&--kiwi {
|
|
153
|
+
background-color: $kiwi50;
|
|
154
|
+
}
|
|
155
|
+
&--banana {
|
|
156
|
+
background-color: $banana50;
|
|
157
|
+
}
|
|
158
|
+
&--plum {
|
|
159
|
+
background-color: $plum50;
|
|
160
|
+
}
|
|
161
|
+
&--white {
|
|
162
|
+
background-color: $white;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type Styles = {
|
|
2
|
+
expander: string;
|
|
3
|
+
expander__button: string;
|
|
4
|
+
'expander__button--absolute': string;
|
|
5
|
+
'expander__button--expanded': string;
|
|
6
|
+
'expander__button--sticky': string;
|
|
7
|
+
expander__content: string;
|
|
8
|
+
'expander__content--banana': string;
|
|
9
|
+
'expander__content--blueberry': string;
|
|
10
|
+
'expander__content--cherry': string;
|
|
11
|
+
'expander__content--expanded': string;
|
|
12
|
+
'expander__content--icon': string;
|
|
13
|
+
'expander__content--kiwi': string;
|
|
14
|
+
'expander__content--large': string;
|
|
15
|
+
'expander__content--nested-line': string;
|
|
16
|
+
'expander__content--neutral': string;
|
|
17
|
+
'expander__content--plum': string;
|
|
18
|
+
'expander__content--small': string;
|
|
19
|
+
'expander__content--white': string;
|
|
20
|
+
expander__icon: string;
|
|
21
|
+
'expander__icon--left': string;
|
|
22
|
+
'expander__icon--right': string;
|
|
23
|
+
expander__trigger: string;
|
|
24
|
+
'expander__trigger--absolute': string;
|
|
25
|
+
'expander__trigger--banana': string;
|
|
26
|
+
'expander__trigger--blueberry': string;
|
|
27
|
+
'expander__trigger--cherry': string;
|
|
28
|
+
'expander__trigger--expanded': string;
|
|
29
|
+
'expander__trigger--icon': string;
|
|
30
|
+
'expander__trigger--kiwi': string;
|
|
31
|
+
'expander__trigger--large': string;
|
|
32
|
+
'expander__trigger--neutral': string;
|
|
33
|
+
'expander__trigger--plum': string;
|
|
34
|
+
'expander__trigger--sticky': string;
|
|
35
|
+
'expander__trigger--white': string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type ClassNames = keyof Styles;
|
|
39
|
+
|
|
40
|
+
declare const styles: Styles;
|
|
41
|
+
|
|
42
|
+
export default styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpanderList.d.ts","sourceRoot":"","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpanderList.d.ts","sourceRoot":"","sources":["../../../src/components/ExpanderList/ExpanderList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAanD,oBAAY,kBAAkB,GAAG,YAAY,CAAC;AAC9C,oBAAY,YAAY,GAAG,KAAK,CAAC,yBAAyB,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AAE/G,MAAM,WAAW,oBAAqB,SAAQ,KAAK,CAAC,yBAAyB,CAAC,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACtI,QAAQ,EAAE,YAAY,CAAC;CACxB;AAMD,UAAU,iBAAiB;IACzB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,wCAAwC;IACxC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,aAAK,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;AAEzC,aAAK,aAAa,GAAG,MAAM,CACzB,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,EACvC;IACE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;CAClF,CACF,CAAC;AAwDF,eAAO,MAAM,YAAY,sBAoEC,CAAC;AAK3B,eAAe,YAAY,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as
|
|
1
|
+
import{_ as e,a as n}from"../../_rollupPluginBabelHelpers-d0752906.js";import t,{useState as a,useEffect as i}from"react";import{I as r}from"../../Icon-89da8de4.js";import{A as o,I as d}from"../../constants-ad6c82db.js";import{C as s,a as l}from"../../ChevronUp-4b6797ef.js";import{u as c}from"../../useHover-037be19d.js";import{u as m,B as p}from"../../useBreakpoint-324a9b14.js";import{c as u}from"../../index-9b84fabc.js";import f from"./styles.module.scss";import"../../_tslib-51c8a283.js";import"../../useWindowSize-73b47451.js";import"../../grid-11a70eb7.js";var x=t.forwardRef((function(e,a){var i,x=e.id,v=e.children,g=e.padding,E=void 0===g||g,_=e.color,b=void 0===_?"neutral":_,h=e.className,j=void 0===h?"":h,k=e.icon,N=e.large,w=void 0!==N&&N,C=e.title,H=e.isExpanded,I=void 0!==H&&H,y=e.testId,B=e.handleExpanderClick,O=c(),R=O.hoverRef,S=O.isHovered,z=m(),W=u(f["expander-list-link"],f["expander-list-link--".concat(b)],(n(i={},f["expander-list-link--closed"],!I),n(i,f["expander-list-link--large"],w),i)),X=u(f["expander-list-link__main-content"],E?f["expander-list-link__main-content--padding"]:"");return t.createElement("li",{className:j,ref:a},t.createElement("button",{id:x,onClick:B,"data-testid":y,"data-analyticsid":o.Expander,className:W,ref:R},k&&t.createElement("span",{className:f["expander-list-link__icon"]},t.cloneElement(k,{size:z===p.Xs?d.XSmall:d.Small,isHovered:S})),t.createElement("span",{className:f["expander-list-link__title"]},C),t.createElement("span",{className:f["expander-list-link__chevron"]},t.createElement(r,{size:d.XSmall,svgIcon:I?s:l,isHovered:S}))),I?t.createElement("div",{className:X},v):null)})),v=t.forwardRef((function(r,d){var s=r.children,l=r.childPadding,c=void 0===l||l,m=r.large,p=r.isOpen,v=void 0!==p&&p,g=r.color,E=r.className,_=void 0===E?"":E,b=r.accordion,h=void 0!==b&&b,j=r.topBorder,k=void 0===j||j,N=r.bottomBorder,w=void 0===N||N,C=r.testId,H=a({}),I=e(H,2),y=I[0],B=I[1],O=a(),R=e(O,2),S=R[0],z=R[1],W=t.Children.count(s),X=u(f["expander-list"],_);return i((function(){var e,n,t,a,i;!h||!S||(e=S.getBoundingClientRect(),n=e.top,t=e.left,a=e.bottom,i=e.right,n>=0&&t>=0&&a<=(window.innerHeight||document.documentElement.clientHeight)&&i<=(window.innerWidth||document.documentElement.clientWidth))||S.scrollIntoView()}),[h,S]),i((function(){if(v){var e="expander-0";B((function(t){return h?n({},e,!t[e]):Object.assign(Object.assign({},t),n({},e,!t[e]))}))}}),[v]),t.createElement("ul",{className:X,ref:d,"data-testid":C,"data-analyticsid":o.ExpanderList},t.Children.map(s,(function(e,a){if(e.type===x){var i=y["expander-".concat(a)],r=function(e){var t;return u(f["expander-list__item"],(n(t={},f["expander-list__item--top"],0===e&&k),n(t,f["expander-list__item--no-bottom"],e===W-1&&!w),t))}(a);return t.cloneElement(e,{id:"expander-".concat(a),key:"expander-".concat(a),isExpanded:i,padding:c,color:g,large:m,"aria-expanded":i,className:r,handleExpanderClick:function(e){return function(e,t){B((function(e){return h?n({},t,!e[t]):Object.assign(Object.assign({},e),n({},t,!e[t]))})),z(e.currentTarget)}(e,"expander-".concat(a))}})}return e})))}));v.Expander=x,x.displayName="ExpanderList.Expander";export default v;export{v as ExpanderList};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|