@biblioteksentralen/react 3.1.0 → 4.0.0-beta.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/dist/ButtonStyles-7ASDoOwZ.d.mts +3 -0
- package/dist/ButtonStyles-7ASDoOwZ.d.ts +3 -0
- package/dist/chunk-2KZDHLEJ.mjs +10 -0
- package/dist/chunk-2KZDHLEJ.mjs.map +1 -0
- package/dist/chunk-3IJ454KG.mjs +39 -0
- package/dist/chunk-3IJ454KG.mjs.map +1 -0
- package/dist/chunk-5GJBW3WE.mjs +229 -0
- package/dist/chunk-5GJBW3WE.mjs.map +1 -0
- package/dist/chunk-7MKFY66H.mjs +44 -0
- package/dist/chunk-7MKFY66H.mjs.map +1 -0
- package/dist/chunk-BCT5QU5W.js +142 -0
- package/dist/chunk-BCT5QU5W.js.map +1 -0
- package/dist/chunk-BN5W6FVN.mjs +55 -0
- package/dist/chunk-BN5W6FVN.mjs.map +1 -0
- package/dist/chunk-BRFRPPOW.js +10 -0
- package/dist/chunk-BRFRPPOW.js.map +1 -0
- package/dist/chunk-BZS3AX26.mjs +10 -0
- package/dist/chunk-BZS3AX26.mjs.map +1 -0
- package/dist/chunk-CGCBID7S.mjs +15 -0
- package/dist/chunk-CGCBID7S.mjs.map +1 -0
- package/dist/chunk-J5IF7WUN.js +10 -0
- package/dist/chunk-J5IF7WUN.js.map +1 -0
- package/dist/chunk-NSYSPEHR.js +86 -0
- package/dist/chunk-NSYSPEHR.js.map +1 -0
- package/dist/chunk-NYKSRUWF.js +51 -0
- package/dist/chunk-NYKSRUWF.js.map +1 -0
- package/dist/chunk-O4EXBCND.js +19 -0
- package/dist/chunk-O4EXBCND.js.map +1 -0
- package/dist/chunk-PLWK7HEC.js +75 -0
- package/dist/chunk-PLWK7HEC.js.map +1 -0
- package/dist/chunk-PQLTQYZ3.mjs +15 -0
- package/dist/chunk-PQLTQYZ3.mjs.map +1 -0
- package/dist/chunk-QAW4IRLI.js +55 -0
- package/dist/chunk-QAW4IRLI.js.map +1 -0
- package/dist/chunk-QBXCCJ24.js +344 -0
- package/dist/chunk-QBXCCJ24.js.map +1 -0
- package/dist/chunk-QX75QJ7F.mjs +52 -0
- package/dist/chunk-QX75QJ7F.mjs.map +1 -0
- package/dist/chunk-RZUGRIUF.mjs +17 -0
- package/dist/chunk-RZUGRIUF.mjs.map +1 -0
- package/dist/chunk-UFIMO32F.js +275 -0
- package/dist/chunk-UFIMO32F.js.map +1 -0
- package/dist/chunk-VSICUYFB.js +51 -0
- package/dist/chunk-VSICUYFB.js.map +1 -0
- package/dist/chunk-WYQNSPEX.mjs +10 -0
- package/dist/chunk-WYQNSPEX.mjs.map +1 -0
- package/dist/components/AlertBS.d.mts +18 -0
- package/dist/components/AlertBS.d.ts +18 -0
- package/dist/components/AlertBS.js +9 -0
- package/dist/components/AlertBS.js.map +1 -0
- package/dist/components/AlertBS.mjs +9 -0
- package/dist/components/AlertBS.mjs.map +1 -0
- package/dist/components/BiblioteksentralenProvider.d.mts +10 -0
- package/dist/components/BiblioteksentralenProvider.d.ts +10 -0
- package/dist/components/BiblioteksentralenProvider.js +10 -0
- package/dist/components/BiblioteksentralenProvider.js.map +1 -0
- package/dist/components/BiblioteksentralenProvider.mjs +10 -0
- package/dist/components/BiblioteksentralenProvider.mjs.map +1 -0
- package/dist/components/ButtonBS.d.mts +16 -0
- package/dist/components/ButtonBS.d.ts +16 -0
- package/dist/components/ButtonBS.js +8 -0
- package/dist/components/ButtonBS.js.map +1 -0
- package/dist/components/ButtonBS.mjs +8 -0
- package/dist/components/ButtonBS.mjs.map +1 -0
- package/dist/components/ConditionalWrapperBS.d.mts +15 -0
- package/dist/components/ConditionalWrapperBS.d.ts +15 -0
- package/dist/components/ConditionalWrapperBS.js +8 -0
- package/dist/components/ConditionalWrapperBS.js.map +1 -0
- package/dist/components/ConditionalWrapperBS.mjs +8 -0
- package/dist/components/ConditionalWrapperBS.mjs.map +1 -0
- package/dist/components/ErrorBoundaryBS.d.mts +21 -0
- package/dist/components/ErrorBoundaryBS.d.ts +21 -0
- package/dist/components/ErrorBoundaryBS.js +10 -0
- package/dist/components/ErrorBoundaryBS.js.map +1 -0
- package/dist/components/ErrorBoundaryBS.mjs +10 -0
- package/dist/components/ErrorBoundaryBS.mjs.map +1 -0
- package/dist/components/HashLinkTargetBS.d.mts +16 -0
- package/dist/components/HashLinkTargetBS.d.ts +16 -0
- package/dist/components/HashLinkTargetBS.js +10 -0
- package/dist/components/HashLinkTargetBS.js.map +1 -0
- package/dist/components/HashLinkTargetBS.mjs +10 -0
- package/dist/components/HashLinkTargetBS.mjs.map +1 -0
- package/dist/components/IconButtonBS.d.mts +16 -0
- package/dist/components/IconButtonBS.d.ts +16 -0
- package/dist/components/IconButtonBS.js +8 -0
- package/dist/components/IconButtonBS.js.map +1 -0
- package/dist/components/IconButtonBS.mjs +8 -0
- package/dist/components/IconButtonBS.mjs.map +1 -0
- package/dist/components/InputBS.d.mts +18 -0
- package/dist/components/InputBS.d.ts +18 -0
- package/dist/components/InputBS.js +8 -0
- package/dist/components/InputBS.js.map +1 -0
- package/dist/components/InputBS.mjs +8 -0
- package/dist/components/InputBS.mjs.map +1 -0
- package/dist/components/withErrorBoundaryBS.d.mts +5 -0
- package/dist/components/withErrorBoundaryBS.d.ts +5 -0
- package/dist/components/withErrorBoundaryBS.js +11 -0
- package/dist/components/withErrorBoundaryBS.js.map +1 -0
- package/dist/components/withErrorBoundaryBS.mjs +11 -0
- package/dist/components/withErrorBoundaryBS.mjs.map +1 -0
- package/dist/index.d.mts +15 -0
- package/dist/index.d.ts +13 -106
- package/dist/index.js +38 -748
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -407
- package/dist/index.mjs.map +1 -1
- package/package.json +27 -11
- /package/{LICENSE → dist/LICENSE} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_without_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
9
|
+
}
|
|
10
|
+
function _define_property(obj, key, value) {
|
|
11
|
+
if (key in obj) {
|
|
12
|
+
Object.defineProperty(obj, key, {
|
|
13
|
+
value: value,
|
|
14
|
+
enumerable: true,
|
|
15
|
+
configurable: true,
|
|
16
|
+
writable: true
|
|
17
|
+
});
|
|
18
|
+
} else {
|
|
19
|
+
obj[key] = value;
|
|
20
|
+
}
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
function _iterable_to_array(iter) {
|
|
24
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
25
|
+
}
|
|
26
|
+
function _non_iterable_spread() {
|
|
27
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
28
|
+
}
|
|
29
|
+
function _object_spread(target) {
|
|
30
|
+
for(var i = 1; i < arguments.length; i++){
|
|
31
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
32
|
+
var ownKeys = Object.keys(source);
|
|
33
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
34
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
ownKeys.forEach(function(key) {
|
|
39
|
+
_define_property(target, key, source[key]);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return target;
|
|
43
|
+
}
|
|
44
|
+
function _to_consumable_array(arr) {
|
|
45
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
46
|
+
}
|
|
47
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
48
|
+
if (!o) return;
|
|
49
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
50
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
51
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
52
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
53
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
54
|
+
}
|
|
55
|
+
Object.defineProperty(exports, "__esModule", {
|
|
56
|
+
value: true
|
|
57
|
+
});
|
|
58
|
+
function _optionalChain(ops) {
|
|
59
|
+
var lastAccessLHS = undefined;
|
|
60
|
+
var value = ops[0];
|
|
61
|
+
var i = 1;
|
|
62
|
+
while(i < ops.length){
|
|
63
|
+
var op = ops[i];
|
|
64
|
+
var fn = ops[i + 1];
|
|
65
|
+
i += 2;
|
|
66
|
+
if ((op === "optionalAccess" || op === "optionalCall") && value == null) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
if (op === "access" || op === "optionalAccess") {
|
|
70
|
+
lastAccessLHS = value;
|
|
71
|
+
value = fn(value);
|
|
72
|
+
} else if (op === "call" || op === "optionalCall") {
|
|
73
|
+
var _value;
|
|
74
|
+
value = fn(function() {
|
|
75
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
76
|
+
args[_key] = arguments[_key];
|
|
77
|
+
}
|
|
78
|
+
return (_value = value).call.apply(_value, [
|
|
79
|
+
lastAccessLHS
|
|
80
|
+
].concat(_to_consumable_array(args)));
|
|
81
|
+
});
|
|
82
|
+
lastAccessLHS = undefined;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
}
|
|
87
|
+
"use client";
|
|
88
|
+
var _chunkQAW4IRLIjs = require("./chunk-QAW4IRLI.js");
|
|
89
|
+
// src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
|
|
90
|
+
var _react = require("@chakra-ui/react");
|
|
91
|
+
// src/styles/chakraTheme/ButtonStyles.ts
|
|
92
|
+
var variants = _object_spread({
|
|
93
|
+
primary: {
|
|
94
|
+
backgroundColor: _chunkQAW4IRLIjs.colors.black,
|
|
95
|
+
color: "white",
|
|
96
|
+
_hover: {
|
|
97
|
+
backgroundColor: "hsla(0deg, 0%, 70%, 1)",
|
|
98
|
+
color: "black"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
secondary: {
|
|
102
|
+
borderColor: "currentColor",
|
|
103
|
+
color: "currentColor",
|
|
104
|
+
backgroundColor: "transparent",
|
|
105
|
+
_hover: {
|
|
106
|
+
backgroundColor: "currentColor/7"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
tertiary: {
|
|
110
|
+
color: "currentColor",
|
|
111
|
+
backgroundColor: "transparent",
|
|
112
|
+
_hover: {
|
|
113
|
+
backgroundColor: "currentColor/7"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}, _optionalChain([
|
|
117
|
+
_react.defaultConfig,
|
|
118
|
+
"access",
|
|
119
|
+
function(_) {
|
|
120
|
+
return _.theme;
|
|
121
|
+
},
|
|
122
|
+
"optionalAccess",
|
|
123
|
+
function(_2) {
|
|
124
|
+
return _2.recipes;
|
|
125
|
+
},
|
|
126
|
+
"optionalAccess",
|
|
127
|
+
function(_3) {
|
|
128
|
+
return _3.button;
|
|
129
|
+
},
|
|
130
|
+
"optionalAccess",
|
|
131
|
+
function(_4) {
|
|
132
|
+
return _4.variants;
|
|
133
|
+
},
|
|
134
|
+
"optionalAccess",
|
|
135
|
+
function(_5) {
|
|
136
|
+
return _5.variant;
|
|
137
|
+
}
|
|
138
|
+
]));
|
|
139
|
+
var ButtonStyles = _react.defineRecipe.call(void 0, {
|
|
140
|
+
base: {
|
|
141
|
+
borderColor: "transparent",
|
|
142
|
+
borderWidth: "0.1em",
|
|
143
|
+
fontWeight: 600,
|
|
144
|
+
_disabled: {
|
|
145
|
+
backgroundColor: "".concat(_chunkQAW4IRLIjs.colors.grey45),
|
|
146
|
+
color: "white",
|
|
147
|
+
opacity: 1
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
variants: {
|
|
151
|
+
variant: variants,
|
|
152
|
+
size: {
|
|
153
|
+
sm: {
|
|
154
|
+
h: "8",
|
|
155
|
+
px: "2",
|
|
156
|
+
textStyle: "md"
|
|
157
|
+
},
|
|
158
|
+
md: {
|
|
159
|
+
textStyle: "md"
|
|
160
|
+
},
|
|
161
|
+
lg: {
|
|
162
|
+
h: "12",
|
|
163
|
+
textStyle: "lg"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
defaultVariants: {
|
|
168
|
+
variant: "primary",
|
|
169
|
+
size: "md"
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
// src/styles/chakraTheme/ContainerStyles.ts
|
|
173
|
+
var ContainerStyles = _react.defineRecipe.call(void 0, {
|
|
174
|
+
base: {
|
|
175
|
+
px: ".75rem"
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
// src/styles/chakraTheme/HeadingStyles.ts
|
|
179
|
+
var HeadingStyles = _react.defineRecipe.call(void 0, {
|
|
180
|
+
base: {
|
|
181
|
+
fontWeight: "600"
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// src/styles/chakraTheme/InputStyles.ts
|
|
185
|
+
var variants2 = {
|
|
186
|
+
subtle: {
|
|
187
|
+
backgroundColor: {
|
|
188
|
+
_light: "gray.200",
|
|
189
|
+
_dark: "whiteAlpha.100"
|
|
190
|
+
},
|
|
191
|
+
_hover: {
|
|
192
|
+
bg: {
|
|
193
|
+
_light: "gray.300",
|
|
194
|
+
_dark: "whiteAlpha.200"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
outline: {
|
|
199
|
+
borderColor: {
|
|
200
|
+
_light: "gray.300",
|
|
201
|
+
_dark: "whiteAlpha.300"
|
|
202
|
+
},
|
|
203
|
+
_hover: {
|
|
204
|
+
borderColor: {
|
|
205
|
+
_light: "gray.400",
|
|
206
|
+
_dark: "whiteAlpha.400"
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
flushed: {
|
|
211
|
+
borderColor: {
|
|
212
|
+
_light: "gray.300",
|
|
213
|
+
_dark: "whiteAlpha.300"
|
|
214
|
+
},
|
|
215
|
+
_hover: {
|
|
216
|
+
borderColor: {
|
|
217
|
+
_light: "gray.400",
|
|
218
|
+
_dark: "whiteAlpha.400"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
var InputStyles = _react.defineRecipe.call(void 0, {
|
|
224
|
+
base: {
|
|
225
|
+
_placeholder: {
|
|
226
|
+
color: {
|
|
227
|
+
_light: "gray.500",
|
|
228
|
+
_dark: "whiteAlpha.500"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
variants: {
|
|
233
|
+
variant: variants2
|
|
234
|
+
},
|
|
235
|
+
defaultVariants: {
|
|
236
|
+
variant: "subtle"
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
// src/styles/chakraTheme/SpinnerStyles.ts
|
|
240
|
+
var SpinnerStyles = _react.defineRecipe.call(void 0, {
|
|
241
|
+
base: {
|
|
242
|
+
animationDuration: ".8s",
|
|
243
|
+
color: _chunkQAW4IRLIjs.colors.accentBlueMedium,
|
|
244
|
+
// Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color
|
|
245
|
+
borderWidth: ".175em"
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
// src/styles/chakraTheme/sizes.ts
|
|
249
|
+
var container = {
|
|
250
|
+
sm: {
|
|
251
|
+
value: "40rem"
|
|
252
|
+
},
|
|
253
|
+
md: {
|
|
254
|
+
value: "48rem"
|
|
255
|
+
},
|
|
256
|
+
lg: {
|
|
257
|
+
value: "56rem"
|
|
258
|
+
},
|
|
259
|
+
// Forsøker 56rem som standardbredde etter testing med Katrine
|
|
260
|
+
xl: {
|
|
261
|
+
value: "80rem"
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var sizes = {
|
|
265
|
+
container: container
|
|
266
|
+
};
|
|
267
|
+
// src/styles/chakraTheme/LinkStyles.ts
|
|
268
|
+
var variants3 = {
|
|
269
|
+
plain: {
|
|
270
|
+
color: "currentColor",
|
|
271
|
+
textDecoration: "none",
|
|
272
|
+
textDecorationColor: "currentColor",
|
|
273
|
+
_hover: {
|
|
274
|
+
textDecorationColor: "currentColor",
|
|
275
|
+
textDecoration: "underline"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
underline: {
|
|
279
|
+
color: "currentColor",
|
|
280
|
+
textDecoration: "underline",
|
|
281
|
+
textDecorationColor: "currentColor",
|
|
282
|
+
_hover: {
|
|
283
|
+
textDecoration: "none"
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
var LinkStyles = _react.defineRecipe.call(void 0, {
|
|
288
|
+
base: {
|
|
289
|
+
_focus: {
|
|
290
|
+
outline: "none"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
variants: {
|
|
294
|
+
variant: variants3
|
|
295
|
+
},
|
|
296
|
+
defaultVariants: {
|
|
297
|
+
variant: "underline"
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
// src/styles/chakraTheme/biblioteksentralenChakraTheme.ts
|
|
301
|
+
var tokens = _react.defineTokens.call(void 0, {
|
|
302
|
+
sizes: sizes
|
|
303
|
+
});
|
|
304
|
+
var globalHyphens = {
|
|
305
|
+
hyphens: "auto",
|
|
306
|
+
hyphenateLimitChars: "8 5 3"
|
|
307
|
+
};
|
|
308
|
+
var focusStyle = {
|
|
309
|
+
outline: "none !important",
|
|
310
|
+
boxShadow: "0 0 0 .05rem ".concat(_chunkQAW4IRLIjs.colors.white, ", 0 0 0 .25rem ").concat(_chunkQAW4IRLIjs.colors.accentBlueMedium, ", 0 0 0 .3rem ").concat(_chunkQAW4IRLIjs.colors.white, " !important"),
|
|
311
|
+
transition: "box-shadow 0.1s ease-out"
|
|
312
|
+
};
|
|
313
|
+
var biblioteksentralenChakraTheme = _react.defineConfig.call(void 0, {
|
|
314
|
+
theme: {
|
|
315
|
+
tokens: tokens,
|
|
316
|
+
recipes: {
|
|
317
|
+
heading: HeadingStyles,
|
|
318
|
+
button: ButtonStyles,
|
|
319
|
+
input: InputStyles,
|
|
320
|
+
link: LinkStyles,
|
|
321
|
+
container: ContainerStyles,
|
|
322
|
+
spinner: SpinnerStyles
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
globalCss: {
|
|
326
|
+
html: {
|
|
327
|
+
fontSize: {
|
|
328
|
+
base: "112.5%",
|
|
329
|
+
md: "120%"
|
|
330
|
+
},
|
|
331
|
+
// Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,
|
|
332
|
+
// men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)
|
|
333
|
+
"&:focus-within": {
|
|
334
|
+
scrollBehavior: "smooth !important"
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
body: _object_spread({}, globalHyphens),
|
|
338
|
+
// Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus
|
|
339
|
+
"*:focus-visible": focusStyle
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
exports.focusStyle = focusStyle;
|
|
343
|
+
exports.biblioteksentralenChakraTheme = biblioteksentralenChakraTheme;
|
|
344
|
+
//# sourceMappingURL=chunk-QBXCCJ24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/styles/chakraTheme/biblioteksentralenChakraTheme.ts","../src/styles/chakraTheme/ButtonStyles.ts","../src/styles/chakraTheme/ContainerStyles.ts","../src/styles/chakraTheme/HeadingStyles.ts","../src/styles/chakraTheme/InputStyles.ts","../src/styles/chakraTheme/SpinnerStyles.ts","../src/styles/chakraTheme/sizes.ts","../src/styles/chakraTheme/LinkStyles.ts"],"names":["defineRecipe","variants"],"mappings":"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","sourcesContent":["import { defineConfig, defineTokens } from \"@chakra-ui/react\";\nimport { ButtonStyles } from \"./ButtonStyles\";\nimport { ContainerStyles } from \"./ContainerStyles\";\nimport { HeadingStyles } from \"./HeadingStyles\";\nimport { InputStyles } from \"./InputStyles\";\nimport { SpinnerStyles } from \"./SpinnerStyles\";\nimport { sizes } from \"./sizes\";\nimport { LinkStyles } from \"./LinkStyles\";\nimport { colors } from \"@biblioteksentralen/utils\";\n\nconst tokens = defineTokens({\n sizes,\n});\n\n// https://blog.logrocket.com/guide-css-word-wrap-overflow-wrap-word-break/\n// https://medium.com/clear-left-thinking/all-you-need-to-know-about-hyphenation-in-css-2baee2d89179\n// Skrur på hyphens auto som default fordi vi har masse mikrotekster og små elementer der layout knekker uten dette, og vi lager stadig nye og glemmer å ta hensyn til dette.\n// Så kan man optionaly sette hyphens: none de stedene man ikke ønsker det, men har ikke sett noe som knekker/blir rart pga dette enda\nconst globalHyphens = {\n hyphens: \"auto\",\n hyphenateLimitChars: \"8 5 3\", // minimum word-length / min letters first line / min letters second line\n};\n\nexport const focusStyle = {\n outline: \"none !important\",\n boxShadow: `0 0 0 .05rem ${colors.white}, 0 0 0 .25rem ${colors.accentBlueMedium}, 0 0 0 .3rem ${colors.white} !important`,\n transition: \"box-shadow 0.1s ease-out\", // Transition makes the newly focused element \"pop in\" and easier to spot\n};\n\nexport const biblioteksentralenChakraTheme = defineConfig({\n theme: {\n tokens,\n recipes: {\n heading: HeadingStyles,\n button: ButtonStyles,\n input: InputStyles,\n link: LinkStyles,\n container: ContainerStyles,\n spinner: SpinnerStyles,\n },\n },\n globalCss: {\n html: {\n fontSize: { base: \"112.5%\", md: \"120%\" },\n // Sørger for smooth scrolling for interne lenker som scroller til annet sted på siden,\n // men ikke hvis fokus er utenfor viduet, feks ved søk i tekst (ctrl + f)\n \"&:focus-within\": { scrollBehavior: \"smooth !important\" },\n },\n body: {\n ...globalHyphens,\n },\n // Felles fokus-styling for alle elementer for å sikre at de har en tydelig og uniform visuell indikasjon når de er i fokus\n \"*:focus-visible\": focusStyle,\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defaultConfig, defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomButtonVariants = \"primary\" | \"secondary\" | \"tertiary\";\n\nconst variants: Record<CustomButtonVariants, SystemStyleObject> = {\n primary: {\n backgroundColor: colors.black,\n color: \"white\",\n _hover: {\n backgroundColor: \"hsla(0deg, 0%, 70%, 1)\",\n color: \"black\",\n },\n },\n secondary: {\n borderColor: \"currentColor\",\n color: \"currentColor\",\n backgroundColor: \"transparent\",\n _hover: {\n backgroundColor: \"currentColor/7\",\n },\n },\n tertiary: {\n color: \"currentColor\",\n backgroundColor: \"transparent\",\n _hover: {\n backgroundColor: \"currentColor/7\",\n },\n },\n // Inherit variants from Chakra's default config. Seems like they are overridden by our custom variants by default.\n ...defaultConfig.theme?.recipes?.button?.variants?.variant,\n};\n\nexport const ButtonStyles = defineRecipe({\n base: {\n borderColor: \"transparent\",\n borderWidth: \"0.1em\",\n fontWeight: 600,\n _disabled: {\n backgroundColor: `${colors.grey45}`,\n color: \"white\",\n opacity: 1,\n },\n },\n variants: {\n variant: variants,\n size: {\n sm: {\n h: \"8\",\n px: \"2\",\n textStyle: \"md\",\n },\n md: {\n textStyle: \"md\",\n },\n lg: {\n h: \"12\",\n textStyle: \"lg\",\n },\n },\n },\n defaultVariants: {\n variant: \"primary\",\n size: \"md\",\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const ContainerStyles = defineRecipe({\n base: {\n px: \".75rem\", // Padding left/right\n },\n});\n","import { defineRecipe } from \"@chakra-ui/react\";\n\nexport const HeadingStyles = defineRecipe({\n base: {\n fontWeight: \"600\",\n },\n});\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nconst variants: Record<string, SystemStyleObject> = {\n subtle: {\n backgroundColor: { _light: \"gray.200\", _dark: \"whiteAlpha.100\" },\n _hover: {\n bg: { _light: \"gray.300\", _dark: \"whiteAlpha.200\" },\n },\n },\n outline: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n flushed: {\n borderColor: { _light: \"gray.300\", _dark: \"whiteAlpha.300\" },\n _hover: {\n borderColor: { _light: \"gray.400\", _dark: \"whiteAlpha.400\" },\n },\n },\n};\n\nexport const InputStyles = defineRecipe({\n base: {\n _placeholder: {\n color: { _light: \"gray.500\", _dark: \"whiteAlpha.500\" },\n },\n },\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"subtle\",\n },\n});\n","import { colors } from \"@biblioteksentralen/utils\";\nimport { defineRecipe } from \"@chakra-ui/react\";\n\nexport const SpinnerStyles = defineRecipe({\n base: {\n animationDuration: \".8s\",\n color: colors.accentBlueMedium,\n // Todo: Legg til trackColor: https://chakra-ui.com/docs/components/spinner#track-color\n borderWidth: \".175em\",\n },\n});\n","const container = {\n sm: { value: \"40rem\" },\n md: { value: \"48rem\" },\n lg: { value: \"56rem\" }, // Forsøker 56rem som standardbredde etter testing med Katrine\n xl: { value: \"80rem\" },\n};\n\nexport const sizes = {\n container,\n};\n","import { defineRecipe, SystemStyleObject } from \"@chakra-ui/react\";\n\nexport type CustomLinkVariants = \"plain\" | \"underline\";\n\nconst variants: Record<CustomLinkVariants, SystemStyleObject> = {\n plain: {\n color: \"currentColor\",\n textDecoration: \"none\",\n textDecorationColor: \"currentColor\",\n _hover: {\n textDecorationColor: \"currentColor\",\n textDecoration: \"underline\",\n },\n },\n underline: {\n color: \"currentColor\",\n textDecoration: \"underline\",\n textDecorationColor: \"currentColor\",\n _hover: {\n textDecoration: \"none\",\n },\n },\n};\n\nexport const LinkStyles = defineRecipe({\n base: {\n _focus: {\n outline: \"none\",\n },\n },\n variants: {\n variant: variants,\n },\n defaultVariants: {\n variant: \"underline\",\n },\n});\n"]}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
colors
|
|
4
|
+
} from "./chunk-BN5W6FVN.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/AlertBS.tsx
|
|
7
|
+
import { Alert as ChakraAlert } from "@chakra-ui/react";
|
|
8
|
+
import React from "react";
|
|
9
|
+
import { AlertCircle, CheckCircle, Info, XCircle } from "react-feather";
|
|
10
|
+
var colorLookup = {
|
|
11
|
+
info: { bg: colors.lightBlue, color: colors.accentBlueMedium },
|
|
12
|
+
warning: { bg: colors.statusYellowLight, color: colors.statusYellow },
|
|
13
|
+
success: { bg: colors.statusGreenLight, color: colors.statusGreen },
|
|
14
|
+
error: { bg: colors.statusRedLight, color: colors.statusRed }
|
|
15
|
+
};
|
|
16
|
+
var iconLookup = {
|
|
17
|
+
info: /* @__PURE__ */ React.createElement(Info, { strokeWidth: 1.75, role: "img", "aria-label": "Informasjon" }),
|
|
18
|
+
warning: /* @__PURE__ */ React.createElement(AlertCircle, { strokeWidth: 1.75, role: "img", "aria-label": "Advarsel" }),
|
|
19
|
+
success: /* @__PURE__ */ React.createElement(CheckCircle, { strokeWidth: 1.75, role: "img", "aria-label": "Suksess" }),
|
|
20
|
+
error: /* @__PURE__ */ React.createElement(XCircle, { strokeWidth: 1.75, role: "img", "aria-label": "Feil" })
|
|
21
|
+
};
|
|
22
|
+
var variantStyles = {
|
|
23
|
+
inline: {
|
|
24
|
+
borderColor: "transparent",
|
|
25
|
+
backgroundColor: "transparent",
|
|
26
|
+
padding: "0"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function AlertBS({ status, children, variant, header, ...rest }) {
|
|
30
|
+
const colors2 = colorLookup[status];
|
|
31
|
+
return /* @__PURE__ */ React.createElement(
|
|
32
|
+
ChakraAlert.Root,
|
|
33
|
+
{
|
|
34
|
+
status,
|
|
35
|
+
fontSize: "md",
|
|
36
|
+
border: `0.1rem solid`,
|
|
37
|
+
borderColor: colors2.color,
|
|
38
|
+
backgroundColor: colors2.bg,
|
|
39
|
+
display: "flex",
|
|
40
|
+
flexWrap: "wrap",
|
|
41
|
+
...variant === "inline" ? variantStyles[variant] : {},
|
|
42
|
+
...rest
|
|
43
|
+
},
|
|
44
|
+
/* @__PURE__ */ React.createElement(ChakraAlert.Indicator, { marginX: "auto" }, iconLookup[status]),
|
|
45
|
+
/* @__PURE__ */ React.createElement(ChakraAlert.Content, { color: "black" }, header && /* @__PURE__ */ React.createElement(ChakraAlert.Title, null, header), /* @__PURE__ */ React.createElement(ChakraAlert.Description, null, children))
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export {
|
|
50
|
+
AlertBS
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=chunk-QX75QJ7F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AlertBS.tsx"],"sourcesContent":["import { Modify } from \"@biblioteksentralen/types\";\nimport { colors } from \"@biblioteksentralen/utils\";\nimport { AlertRootProps, Alert as ChakraAlert, SystemStyleObject } from \"@chakra-ui/react\";\nimport React, { ReactNode } from \"react\";\nimport { AlertCircle, CheckCircle, Info, XCircle } from \"react-feather\";\n\ntype Status = \"info\" | \"warning\" | \"success\" | \"error\";\ntype CustomVariants = \"inline\";\ntype Variants = AlertRootProps[\"variant\"] | CustomVariants;\n\nconst colorLookup: Record<Status, { bg: string; color: string }> = {\n info: { bg: colors.lightBlue, color: colors.accentBlueMedium },\n warning: { bg: colors.statusYellowLight, color: colors.statusYellow },\n success: { bg: colors.statusGreenLight, color: colors.statusGreen },\n error: { bg: colors.statusRedLight, color: colors.statusRed },\n};\n\nconst iconLookup: Record<Status, React.ReactElement> = {\n info: <Info strokeWidth={1.75} role=\"img\" aria-label=\"Informasjon\" />,\n warning: <AlertCircle strokeWidth={1.75} role=\"img\" aria-label=\"Advarsel\" />,\n success: <CheckCircle strokeWidth={1.75} role=\"img\" aria-label=\"Suksess\" />,\n error: <XCircle strokeWidth={1.75} role=\"img\" aria-label=\"Feil\" />,\n};\n\ninterface Props extends Modify<AlertRootProps, { variant?: Variants }> {\n children: ReactNode;\n header?: ReactNode;\n status: Status;\n variant?: Variants;\n}\n\nconst variantStyles: Record<CustomVariants, SystemStyleObject> = {\n inline: {\n borderColor: \"transparent\",\n backgroundColor: \"transparent\",\n padding: \"0\",\n },\n};\n\nexport function AlertBS({ status, children, variant, header, ...rest }: Props) {\n const colors = colorLookup[status];\n return (\n <ChakraAlert.Root\n status={status}\n fontSize=\"md\"\n border={`0.1rem solid`}\n borderColor={colors.color}\n backgroundColor={colors.bg}\n display=\"flex\"\n flexWrap=\"wrap\"\n {...(variant === \"inline\" ? variantStyles[variant] : {})}\n {...rest}\n >\n <ChakraAlert.Indicator marginX=\"auto\">{iconLookup[status]}</ChakraAlert.Indicator>\n <ChakraAlert.Content color=\"black\">\n {header && <ChakraAlert.Title>{header}</ChakraAlert.Title>}\n <ChakraAlert.Description>{children}</ChakraAlert.Description>\n </ChakraAlert.Content>\n </ChakraAlert.Root>\n );\n}\n"],"mappings":";;;;;;AAEA,SAAyB,SAAS,mBAAsC;AACxE,OAAO,WAA0B;AACjC,SAAS,aAAa,aAAa,MAAM,eAAe;AAMxD,IAAM,cAA6D;AAAA,EACjE,MAAM,EAAE,IAAI,OAAO,WAAW,OAAO,OAAO,iBAAiB;AAAA,EAC7D,SAAS,EAAE,IAAI,OAAO,mBAAmB,OAAO,OAAO,aAAa;AAAA,EACpE,SAAS,EAAE,IAAI,OAAO,kBAAkB,OAAO,OAAO,YAAY;AAAA,EAClE,OAAO,EAAE,IAAI,OAAO,gBAAgB,OAAO,OAAO,UAAU;AAC9D;AAEA,IAAM,aAAiD;AAAA,EACrD,MAAM,oCAAC,QAAK,aAAa,MAAM,MAAK,OAAM,cAAW,eAAc;AAAA,EACnE,SAAS,oCAAC,eAAY,aAAa,MAAM,MAAK,OAAM,cAAW,YAAW;AAAA,EAC1E,SAAS,oCAAC,eAAY,aAAa,MAAM,MAAK,OAAM,cAAW,WAAU;AAAA,EACzE,OAAO,oCAAC,WAAQ,aAAa,MAAM,MAAK,OAAM,cAAW,QAAO;AAClE;AASA,IAAM,gBAA2D;AAAA,EAC/D,QAAQ;AAAA,IACN,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,SAAS;AAAA,EACX;AACF;AAEO,SAAS,QAAQ,EAAE,QAAQ,UAAU,SAAS,QAAQ,GAAG,KAAK,GAAU;AAC7E,QAAMA,UAAS,YAAY,MAAM;AACjC,SACE;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACC;AAAA,MACA,UAAS;AAAA,MACT,QAAQ;AAAA,MACR,aAAaA,QAAO;AAAA,MACpB,iBAAiBA,QAAO;AAAA,MACxB,SAAQ;AAAA,MACR,UAAS;AAAA,MACR,GAAI,YAAY,WAAW,cAAc,OAAO,IAAI,CAAC;AAAA,MACrD,GAAG;AAAA;AAAA,IAEJ,oCAAC,YAAY,WAAZ,EAAsB,SAAQ,UAAQ,WAAW,MAAM,CAAE;AAAA,IAC1D,oCAAC,YAAY,SAAZ,EAAoB,OAAM,WACxB,UAAU,oCAAC,YAAY,OAAZ,MAAmB,MAAO,GACtC,oCAAC,YAAY,aAAZ,MAAyB,QAAS,CACrC;AAAA,EACF;AAEJ;","names":["colors"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/InputBS.tsx
|
|
4
|
+
import { Input as ChakraInput, Field, VisuallyHidden } from "@chakra-ui/react";
|
|
5
|
+
import React from "react";
|
|
6
|
+
var FieldHelperText = Field.HelperText;
|
|
7
|
+
var FieldErrorText = Field.ErrorText;
|
|
8
|
+
var InputBS = (props) => {
|
|
9
|
+
const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;
|
|
10
|
+
const formLabel = /* @__PURE__ */ React.createElement(Field.Label, { ...labelProps }, label);
|
|
11
|
+
return /* @__PURE__ */ React.createElement(Field.Root, { invalid: !!errorMessage }, hideLabel ? /* @__PURE__ */ React.createElement(VisuallyHidden, null, formLabel) : formLabel, helperText && /* @__PURE__ */ React.createElement(FieldHelperText, null, helperText), /* @__PURE__ */ React.createElement(ChakraInput, { ...inputProps }), errorMessage && /* @__PURE__ */ React.createElement(FieldErrorText, null, errorMessage));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
InputBS
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-RZUGRIUF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/InputBS.tsx"],"sourcesContent":["import { Input as ChakraInput, Field, FieldLabelProps, InputProps, VisuallyHidden } from \"@chakra-ui/react\";\nimport React, { RefObject } from \"react\";\n\n// Chakra v3 Field.HelperText and Field.ErrorText don't include children in their types\nconst FieldHelperText = Field.HelperText as React.FC<React.PropsWithChildren>;\nconst FieldErrorText = Field.ErrorText as React.FC<React.PropsWithChildren>;\n\ninterface Props extends InputProps {\n label: string;\n hideLabel?: boolean;\n labelProps?: FieldLabelProps;\n helperText?: string;\n errorMessage?: string;\n ref?: RefObject<HTMLInputElement | null>;\n}\n\n/**\n * Creating custom input-component to make sure label is always set (for accessibility)\n * Also handles some common needs (helper text and error message. For more advanced input-components we leave it to the consumers to compose custom input-components based on Chakra\n */\nexport const InputBS = (props: Props) => {\n const { labelProps, label, helperText, errorMessage, hideLabel, ...inputProps } = props;\n\n const formLabel = <Field.Label {...labelProps}>{label}</Field.Label>;\n\n return (\n <Field.Root invalid={!!errorMessage}>\n {hideLabel ? <VisuallyHidden>{formLabel}</VisuallyHidden> : formLabel}\n {helperText && <FieldHelperText>{helperText}</FieldHelperText>}\n <ChakraInput {...inputProps} />\n {errorMessage && <FieldErrorText>{errorMessage}</FieldErrorText>}\n </Field.Root>\n );\n};\n"],"mappings":";;;AAAA,SAAS,SAAS,aAAa,OAAoC,sBAAsB;AACzF,OAAO,WAA0B;AAGjC,IAAM,kBAAkB,MAAM;AAC9B,IAAM,iBAAiB,MAAM;AAetB,IAAM,UAAU,CAAC,UAAiB;AACvC,QAAM,EAAE,YAAY,OAAO,YAAY,cAAc,WAAW,GAAG,WAAW,IAAI;AAElF,QAAM,YAAY,oCAAC,MAAM,OAAN,EAAa,GAAG,cAAa,KAAM;AAEtD,SACE,oCAAC,MAAM,MAAN,EAAW,SAAS,CAAC,CAAC,gBACpB,YAAY,oCAAC,sBAAgB,SAAU,IAAoB,WAC3D,cAAc,oCAAC,uBAAiB,UAAW,GAC5C,oCAAC,eAAa,GAAG,YAAY,GAC5B,gBAAgB,oCAAC,sBAAgB,YAAa,CACjD;AAEJ;","names":[]}
|