@allxsmith/bestax-bulma 1.0.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/index.cjs.js +3799 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm.js +3701 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/types/columns/Column.d.ts +73 -0
- package/dist/types/columns/Columns.d.ts +55 -0
- package/dist/types/components/Breadcrumb.d.ts +45 -0
- package/dist/types/components/Card.d.ts +44 -0
- package/dist/types/components/Dropdown.d.ts +72 -0
- package/dist/types/components/Menu.d.ts +79 -0
- package/dist/types/components/Message.d.ts +34 -0
- package/dist/types/components/Modal.d.ts +36 -0
- package/dist/types/components/Navbar.d.ts +229 -0
- package/dist/types/components/Pagination.d.ts +117 -0
- package/dist/types/components/Panel.d.ts +136 -0
- package/dist/types/components/Tab.d.ts +79 -0
- package/dist/types/components/Tabs.d.ts +79 -0
- package/dist/types/elements/Block.d.ts +30 -0
- package/dist/types/elements/Box.d.ts +33 -0
- package/dist/types/elements/Button.d.ts +64 -0
- package/dist/types/elements/Buttons.d.ts +36 -0
- package/dist/types/elements/Content.d.ts +33 -0
- package/dist/types/elements/Delete.d.ts +36 -0
- package/dist/types/elements/Icon.d.ts +41 -0
- package/dist/types/elements/IconText.d.ts +45 -0
- package/dist/types/elements/Image.d.ts +44 -0
- package/dist/types/elements/Notification.d.ts +31 -0
- package/dist/types/elements/Progress.d.ts +31 -0
- package/dist/types/elements/SubTitle.d.ts +38 -0
- package/dist/types/elements/Table.d.ts +38 -0
- package/dist/types/elements/Tag.d.ts +46 -0
- package/dist/types/elements/Tags.d.ts +27 -0
- package/dist/types/elements/Tbody.d.ts +26 -0
- package/dist/types/elements/Td.d.ts +33 -0
- package/dist/types/elements/Tfoot.d.ts +26 -0
- package/dist/types/elements/Th.d.ts +39 -0
- package/dist/types/elements/Thead.d.ts +26 -0
- package/dist/types/elements/Title.d.ts +40 -0
- package/dist/types/elements/Tr.d.ts +31 -0
- package/dist/types/form/Checkbox.d.ts +25 -0
- package/dist/types/form/Checkboxes.d.ts +23 -0
- package/dist/types/form/Control.d.ts +61 -0
- package/dist/types/form/Field.d.ts +96 -0
- package/dist/types/form/File.d.ts +45 -0
- package/dist/types/form/Input.d.ts +38 -0
- package/dist/types/form/Radio.d.ts +25 -0
- package/dist/types/form/Radios.d.ts +23 -0
- package/dist/types/form/Select.d.ts +38 -0
- package/dist/types/form/TextArea.d.ts +44 -0
- package/dist/types/grid/Cell.d.ts +43 -0
- package/dist/types/grid/Grid.d.ts +65 -0
- package/dist/types/helpers/classNames.d.ts +16 -0
- package/dist/types/helpers/useBulmaClasses.d.ts +194 -0
- package/dist/types/index.d.ts +54 -0
- package/dist/types/layout/Container.d.ts +43 -0
- package/dist/types/layout/Footer.d.ts +31 -0
- package/dist/types/layout/Hero.d.ts +98 -0
- package/dist/types/layout/Level.d.ts +104 -0
- package/dist/types/layout/Media.d.ts +96 -0
- package/dist/types/layout/Section.d.ts +34 -0
- package/package.json +95 -0
|
@@ -0,0 +1,3701 @@
|
|
|
1
|
+
import React, { useMemo, useState, useRef, useEffect, createContext, useContext, forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = {exports: {}};
|
|
4
|
+
|
|
5
|
+
var reactJsxRuntime_production_min = {};
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license React
|
|
9
|
+
* react-jsx-runtime.production.min.js
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the MIT license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
var hasRequiredReactJsxRuntime_production_min;
|
|
18
|
+
|
|
19
|
+
function requireReactJsxRuntime_production_min () {
|
|
20
|
+
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
21
|
+
hasRequiredReactJsxRuntime_production_min = 1;
|
|
22
|
+
var f=React,k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:true,ref:true,__self:true,__source:true};
|
|
23
|
+
function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a) void 0===d[b]&&(d[b]=a[b]);return {$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}reactJsxRuntime_production_min.Fragment=l;reactJsxRuntime_production_min.jsx=q;reactJsxRuntime_production_min.jsxs=q;
|
|
24
|
+
return reactJsxRuntime_production_min;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var reactJsxRuntime_development = {};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @license React
|
|
31
|
+
* react-jsx-runtime.development.js
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the MIT license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
var hasRequiredReactJsxRuntime_development;
|
|
40
|
+
|
|
41
|
+
function requireReactJsxRuntime_development () {
|
|
42
|
+
if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
|
|
43
|
+
hasRequiredReactJsxRuntime_development = 1;
|
|
44
|
+
|
|
45
|
+
if (process.env.NODE_ENV !== "production") {
|
|
46
|
+
(function() {
|
|
47
|
+
|
|
48
|
+
var React$1 = React;
|
|
49
|
+
|
|
50
|
+
// ATTENTION
|
|
51
|
+
// When adding new symbols to this file,
|
|
52
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
53
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
54
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
55
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
56
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
57
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
58
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
59
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
60
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
61
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
62
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
63
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
64
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
65
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
66
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
67
|
+
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
68
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
69
|
+
function getIteratorFn(maybeIterable) {
|
|
70
|
+
if (maybeIterable === null || typeof maybeIterable !== 'object') {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
75
|
+
|
|
76
|
+
if (typeof maybeIterator === 'function') {
|
|
77
|
+
return maybeIterator;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
var ReactSharedInternals = React$1.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
84
|
+
|
|
85
|
+
function error(format) {
|
|
86
|
+
{
|
|
87
|
+
{
|
|
88
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
89
|
+
args[_key2 - 1] = arguments[_key2];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
printWarning('error', format, args);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function printWarning(level, format, args) {
|
|
98
|
+
// When changing this logic, you might want to also
|
|
99
|
+
// update consoleWithStackDev.www.js as well.
|
|
100
|
+
{
|
|
101
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
102
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
103
|
+
|
|
104
|
+
if (stack !== '') {
|
|
105
|
+
format += '%s';
|
|
106
|
+
args = args.concat([stack]);
|
|
107
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var argsWithFormat = args.map(function (item) {
|
|
111
|
+
return String(item);
|
|
112
|
+
}); // Careful: RN currently depends on this prefix
|
|
113
|
+
|
|
114
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
115
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
116
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
117
|
+
|
|
118
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// -----------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
125
|
+
var enableCacheElement = false;
|
|
126
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
127
|
+
|
|
128
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
129
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
130
|
+
// issues in DEV builds.
|
|
131
|
+
|
|
132
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
133
|
+
|
|
134
|
+
var REACT_MODULE_REFERENCE;
|
|
135
|
+
|
|
136
|
+
{
|
|
137
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
function isValidElementType(type) {
|
|
141
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
142
|
+
return true;
|
|
143
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (typeof type === 'object' && type !== null) {
|
|
151
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
152
|
+
// types supported by any Flight configuration anywhere since
|
|
153
|
+
// we don't know which Flight build this will end up being used
|
|
154
|
+
// with.
|
|
155
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function getWrappedName(outerType, innerType, wrapperName) {
|
|
164
|
+
var displayName = outerType.displayName;
|
|
165
|
+
|
|
166
|
+
if (displayName) {
|
|
167
|
+
return displayName;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
var functionName = innerType.displayName || innerType.name || '';
|
|
171
|
+
return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
172
|
+
} // Keep in sync with react-reconciler/getComponentNameFromFiber
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
function getContextName(type) {
|
|
176
|
+
return type.displayName || 'Context';
|
|
177
|
+
} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead.
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
function getComponentNameFromType(type) {
|
|
181
|
+
if (type == null) {
|
|
182
|
+
// Host root, text node or just invalid type.
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
{
|
|
187
|
+
if (typeof type.tag === 'number') {
|
|
188
|
+
error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (typeof type === 'function') {
|
|
193
|
+
return type.displayName || type.name || null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (typeof type === 'string') {
|
|
197
|
+
return type;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
switch (type) {
|
|
201
|
+
case REACT_FRAGMENT_TYPE:
|
|
202
|
+
return 'Fragment';
|
|
203
|
+
|
|
204
|
+
case REACT_PORTAL_TYPE:
|
|
205
|
+
return 'Portal';
|
|
206
|
+
|
|
207
|
+
case REACT_PROFILER_TYPE:
|
|
208
|
+
return 'Profiler';
|
|
209
|
+
|
|
210
|
+
case REACT_STRICT_MODE_TYPE:
|
|
211
|
+
return 'StrictMode';
|
|
212
|
+
|
|
213
|
+
case REACT_SUSPENSE_TYPE:
|
|
214
|
+
return 'Suspense';
|
|
215
|
+
|
|
216
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
217
|
+
return 'SuspenseList';
|
|
218
|
+
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (typeof type === 'object') {
|
|
222
|
+
switch (type.$$typeof) {
|
|
223
|
+
case REACT_CONTEXT_TYPE:
|
|
224
|
+
var context = type;
|
|
225
|
+
return getContextName(context) + '.Consumer';
|
|
226
|
+
|
|
227
|
+
case REACT_PROVIDER_TYPE:
|
|
228
|
+
var provider = type;
|
|
229
|
+
return getContextName(provider._context) + '.Provider';
|
|
230
|
+
|
|
231
|
+
case REACT_FORWARD_REF_TYPE:
|
|
232
|
+
return getWrappedName(type, type.render, 'ForwardRef');
|
|
233
|
+
|
|
234
|
+
case REACT_MEMO_TYPE:
|
|
235
|
+
var outerName = type.displayName || null;
|
|
236
|
+
|
|
237
|
+
if (outerName !== null) {
|
|
238
|
+
return outerName;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return getComponentNameFromType(type.type) || 'Memo';
|
|
242
|
+
|
|
243
|
+
case REACT_LAZY_TYPE:
|
|
244
|
+
{
|
|
245
|
+
var lazyComponent = type;
|
|
246
|
+
var payload = lazyComponent._payload;
|
|
247
|
+
var init = lazyComponent._init;
|
|
248
|
+
|
|
249
|
+
try {
|
|
250
|
+
return getComponentNameFromType(init(payload));
|
|
251
|
+
} catch (x) {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// eslint-disable-next-line no-fallthrough
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
var assign = Object.assign;
|
|
264
|
+
|
|
265
|
+
// Helpers to patch console.logs to avoid logging during side-effect free
|
|
266
|
+
// replaying on render function. This currently only patches the object
|
|
267
|
+
// lazily which won't cover if the log function was extracted eagerly.
|
|
268
|
+
// We could also eagerly patch the method.
|
|
269
|
+
var disabledDepth = 0;
|
|
270
|
+
var prevLog;
|
|
271
|
+
var prevInfo;
|
|
272
|
+
var prevWarn;
|
|
273
|
+
var prevError;
|
|
274
|
+
var prevGroup;
|
|
275
|
+
var prevGroupCollapsed;
|
|
276
|
+
var prevGroupEnd;
|
|
277
|
+
|
|
278
|
+
function disabledLog() {}
|
|
279
|
+
|
|
280
|
+
disabledLog.__reactDisabledLog = true;
|
|
281
|
+
function disableLogs() {
|
|
282
|
+
{
|
|
283
|
+
if (disabledDepth === 0) {
|
|
284
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
285
|
+
prevLog = console.log;
|
|
286
|
+
prevInfo = console.info;
|
|
287
|
+
prevWarn = console.warn;
|
|
288
|
+
prevError = console.error;
|
|
289
|
+
prevGroup = console.group;
|
|
290
|
+
prevGroupCollapsed = console.groupCollapsed;
|
|
291
|
+
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
|
|
292
|
+
|
|
293
|
+
var props = {
|
|
294
|
+
configurable: true,
|
|
295
|
+
enumerable: true,
|
|
296
|
+
value: disabledLog,
|
|
297
|
+
writable: true
|
|
298
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
299
|
+
|
|
300
|
+
Object.defineProperties(console, {
|
|
301
|
+
info: props,
|
|
302
|
+
log: props,
|
|
303
|
+
warn: props,
|
|
304
|
+
error: props,
|
|
305
|
+
group: props,
|
|
306
|
+
groupCollapsed: props,
|
|
307
|
+
groupEnd: props
|
|
308
|
+
});
|
|
309
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
disabledDepth++;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
function reenableLogs() {
|
|
316
|
+
{
|
|
317
|
+
disabledDepth--;
|
|
318
|
+
|
|
319
|
+
if (disabledDepth === 0) {
|
|
320
|
+
/* eslint-disable react-internal/no-production-logging */
|
|
321
|
+
var props = {
|
|
322
|
+
configurable: true,
|
|
323
|
+
enumerable: true,
|
|
324
|
+
writable: true
|
|
325
|
+
}; // $FlowFixMe Flow thinks console is immutable.
|
|
326
|
+
|
|
327
|
+
Object.defineProperties(console, {
|
|
328
|
+
log: assign({}, props, {
|
|
329
|
+
value: prevLog
|
|
330
|
+
}),
|
|
331
|
+
info: assign({}, props, {
|
|
332
|
+
value: prevInfo
|
|
333
|
+
}),
|
|
334
|
+
warn: assign({}, props, {
|
|
335
|
+
value: prevWarn
|
|
336
|
+
}),
|
|
337
|
+
error: assign({}, props, {
|
|
338
|
+
value: prevError
|
|
339
|
+
}),
|
|
340
|
+
group: assign({}, props, {
|
|
341
|
+
value: prevGroup
|
|
342
|
+
}),
|
|
343
|
+
groupCollapsed: assign({}, props, {
|
|
344
|
+
value: prevGroupCollapsed
|
|
345
|
+
}),
|
|
346
|
+
groupEnd: assign({}, props, {
|
|
347
|
+
value: prevGroupEnd
|
|
348
|
+
})
|
|
349
|
+
});
|
|
350
|
+
/* eslint-enable react-internal/no-production-logging */
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (disabledDepth < 0) {
|
|
354
|
+
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
360
|
+
var prefix;
|
|
361
|
+
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
362
|
+
{
|
|
363
|
+
if (prefix === undefined) {
|
|
364
|
+
// Extract the VM specific prefix used by each line.
|
|
365
|
+
try {
|
|
366
|
+
throw Error();
|
|
367
|
+
} catch (x) {
|
|
368
|
+
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
369
|
+
prefix = match && match[1] || '';
|
|
370
|
+
}
|
|
371
|
+
} // We use the prefix to ensure our stacks line up with native stack frames.
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
return '\n' + prefix + name;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
var reentry = false;
|
|
378
|
+
var componentFrameCache;
|
|
379
|
+
|
|
380
|
+
{
|
|
381
|
+
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
|
|
382
|
+
componentFrameCache = new PossiblyWeakMap();
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function describeNativeComponentFrame(fn, construct) {
|
|
386
|
+
// If something asked for a stack inside a fake render, it should get ignored.
|
|
387
|
+
if ( !fn || reentry) {
|
|
388
|
+
return '';
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
{
|
|
392
|
+
var frame = componentFrameCache.get(fn);
|
|
393
|
+
|
|
394
|
+
if (frame !== undefined) {
|
|
395
|
+
return frame;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
var control;
|
|
400
|
+
reentry = true;
|
|
401
|
+
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
|
|
402
|
+
|
|
403
|
+
Error.prepareStackTrace = undefined;
|
|
404
|
+
var previousDispatcher;
|
|
405
|
+
|
|
406
|
+
{
|
|
407
|
+
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function
|
|
408
|
+
// for warnings.
|
|
409
|
+
|
|
410
|
+
ReactCurrentDispatcher.current = null;
|
|
411
|
+
disableLogs();
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
try {
|
|
415
|
+
// This should throw.
|
|
416
|
+
if (construct) {
|
|
417
|
+
// Something should be setting the props in the constructor.
|
|
418
|
+
var Fake = function () {
|
|
419
|
+
throw Error();
|
|
420
|
+
}; // $FlowFixMe
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
Object.defineProperty(Fake.prototype, 'props', {
|
|
424
|
+
set: function () {
|
|
425
|
+
// We use a throwing setter instead of frozen or non-writable props
|
|
426
|
+
// because that won't throw in a non-strict mode function.
|
|
427
|
+
throw Error();
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
if (typeof Reflect === 'object' && Reflect.construct) {
|
|
432
|
+
// We construct a different control for this case to include any extra
|
|
433
|
+
// frames added by the construct call.
|
|
434
|
+
try {
|
|
435
|
+
Reflect.construct(Fake, []);
|
|
436
|
+
} catch (x) {
|
|
437
|
+
control = x;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
Reflect.construct(fn, [], Fake);
|
|
441
|
+
} else {
|
|
442
|
+
try {
|
|
443
|
+
Fake.call();
|
|
444
|
+
} catch (x) {
|
|
445
|
+
control = x;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
fn.call(Fake.prototype);
|
|
449
|
+
}
|
|
450
|
+
} else {
|
|
451
|
+
try {
|
|
452
|
+
throw Error();
|
|
453
|
+
} catch (x) {
|
|
454
|
+
control = x;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
fn();
|
|
458
|
+
}
|
|
459
|
+
} catch (sample) {
|
|
460
|
+
// This is inlined manually because closure doesn't do it for us.
|
|
461
|
+
if (sample && control && typeof sample.stack === 'string') {
|
|
462
|
+
// This extracts the first frame from the sample that isn't also in the control.
|
|
463
|
+
// Skipping one frame that we assume is the frame that calls the two.
|
|
464
|
+
var sampleLines = sample.stack.split('\n');
|
|
465
|
+
var controlLines = control.stack.split('\n');
|
|
466
|
+
var s = sampleLines.length - 1;
|
|
467
|
+
var c = controlLines.length - 1;
|
|
468
|
+
|
|
469
|
+
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
470
|
+
// We expect at least one stack frame to be shared.
|
|
471
|
+
// Typically this will be the root most one. However, stack frames may be
|
|
472
|
+
// cut off due to maximum stack limits. In this case, one maybe cut off
|
|
473
|
+
// earlier than the other. We assume that the sample is longer or the same
|
|
474
|
+
// and there for cut off earlier. So we should find the root most frame in
|
|
475
|
+
// the sample somewhere in the control.
|
|
476
|
+
c--;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
for (; s >= 1 && c >= 0; s--, c--) {
|
|
480
|
+
// Next we find the first one that isn't the same which should be the
|
|
481
|
+
// frame that called our sample function and the control.
|
|
482
|
+
if (sampleLines[s] !== controlLines[c]) {
|
|
483
|
+
// In V8, the first line is describing the message but other VMs don't.
|
|
484
|
+
// If we're about to return the first line, and the control is also on the same
|
|
485
|
+
// line, that's a pretty good indicator that our sample threw at same line as
|
|
486
|
+
// the control. I.e. before we entered the sample frame. So we ignore this result.
|
|
487
|
+
// This can happen if you passed a class to function component, or non-function.
|
|
488
|
+
if (s !== 1 || c !== 1) {
|
|
489
|
+
do {
|
|
490
|
+
s--;
|
|
491
|
+
c--; // We may still have similar intermediate frames from the construct call.
|
|
492
|
+
// The next one that isn't the same should be our match though.
|
|
493
|
+
|
|
494
|
+
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
495
|
+
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
|
|
496
|
+
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>"
|
|
497
|
+
// but we have a user-provided "displayName"
|
|
498
|
+
// splice it in to make the stack more readable.
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
if (fn.displayName && _frame.includes('<anonymous>')) {
|
|
502
|
+
_frame = _frame.replace('<anonymous>', fn.displayName);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
{
|
|
506
|
+
if (typeof fn === 'function') {
|
|
507
|
+
componentFrameCache.set(fn, _frame);
|
|
508
|
+
}
|
|
509
|
+
} // Return the line we found.
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
return _frame;
|
|
513
|
+
}
|
|
514
|
+
} while (s >= 1 && c >= 0);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
break;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
} finally {
|
|
522
|
+
reentry = false;
|
|
523
|
+
|
|
524
|
+
{
|
|
525
|
+
ReactCurrentDispatcher.current = previousDispatcher;
|
|
526
|
+
reenableLogs();
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
530
|
+
} // Fallback to just using the name if we couldn't make it throw.
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
var name = fn ? fn.displayName || fn.name : '';
|
|
534
|
+
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
|
|
535
|
+
|
|
536
|
+
{
|
|
537
|
+
if (typeof fn === 'function') {
|
|
538
|
+
componentFrameCache.set(fn, syntheticFrame);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return syntheticFrame;
|
|
543
|
+
}
|
|
544
|
+
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
545
|
+
{
|
|
546
|
+
return describeNativeComponentFrame(fn, false);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function shouldConstruct(Component) {
|
|
551
|
+
var prototype = Component.prototype;
|
|
552
|
+
return !!(prototype && prototype.isReactComponent);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
556
|
+
|
|
557
|
+
if (type == null) {
|
|
558
|
+
return '';
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
if (typeof type === 'function') {
|
|
562
|
+
{
|
|
563
|
+
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
if (typeof type === 'string') {
|
|
568
|
+
return describeBuiltInComponentFrame(type);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
switch (type) {
|
|
572
|
+
case REACT_SUSPENSE_TYPE:
|
|
573
|
+
return describeBuiltInComponentFrame('Suspense');
|
|
574
|
+
|
|
575
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
576
|
+
return describeBuiltInComponentFrame('SuspenseList');
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (typeof type === 'object') {
|
|
580
|
+
switch (type.$$typeof) {
|
|
581
|
+
case REACT_FORWARD_REF_TYPE:
|
|
582
|
+
return describeFunctionComponentFrame(type.render);
|
|
583
|
+
|
|
584
|
+
case REACT_MEMO_TYPE:
|
|
585
|
+
// Memo may contain any component type so we recursively resolve it.
|
|
586
|
+
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
587
|
+
|
|
588
|
+
case REACT_LAZY_TYPE:
|
|
589
|
+
{
|
|
590
|
+
var lazyComponent = type;
|
|
591
|
+
var payload = lazyComponent._payload;
|
|
592
|
+
var init = lazyComponent._init;
|
|
593
|
+
|
|
594
|
+
try {
|
|
595
|
+
// Lazy may contain any component type so we recursively resolve it.
|
|
596
|
+
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
597
|
+
} catch (x) {}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
return '';
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
606
|
+
|
|
607
|
+
var loggedTypeFailures = {};
|
|
608
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
609
|
+
|
|
610
|
+
function setCurrentlyValidatingElement(element) {
|
|
611
|
+
{
|
|
612
|
+
if (element) {
|
|
613
|
+
var owner = element._owner;
|
|
614
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
615
|
+
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
616
|
+
} else {
|
|
617
|
+
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
623
|
+
{
|
|
624
|
+
// $FlowFixMe This is okay but Flow doesn't know it.
|
|
625
|
+
var has = Function.call.bind(hasOwnProperty);
|
|
626
|
+
|
|
627
|
+
for (var typeSpecName in typeSpecs) {
|
|
628
|
+
if (has(typeSpecs, typeSpecName)) {
|
|
629
|
+
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
|
|
630
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
631
|
+
// After these have been cleaned up, we'll let them throw.
|
|
632
|
+
|
|
633
|
+
try {
|
|
634
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
635
|
+
// behavior as without this statement except with a better message.
|
|
636
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
637
|
+
// eslint-disable-next-line react-internal/prod-error-codes
|
|
638
|
+
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
|
|
639
|
+
err.name = 'Invariant Violation';
|
|
640
|
+
throw err;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
|
|
644
|
+
} catch (ex) {
|
|
645
|
+
error$1 = ex;
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
if (error$1 && !(error$1 instanceof Error)) {
|
|
649
|
+
setCurrentlyValidatingElement(element);
|
|
650
|
+
|
|
651
|
+
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
|
|
652
|
+
|
|
653
|
+
setCurrentlyValidatingElement(null);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
657
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
658
|
+
// same error.
|
|
659
|
+
loggedTypeFailures[error$1.message] = true;
|
|
660
|
+
setCurrentlyValidatingElement(element);
|
|
661
|
+
|
|
662
|
+
error('Failed %s type: %s', location, error$1.message);
|
|
663
|
+
|
|
664
|
+
setCurrentlyValidatingElement(null);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare
|
|
672
|
+
|
|
673
|
+
function isArray(a) {
|
|
674
|
+
return isArrayImpl(a);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/*
|
|
678
|
+
* The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol
|
|
679
|
+
* and Temporal.* types. See https://github.com/facebook/react/pull/22064.
|
|
680
|
+
*
|
|
681
|
+
* The functions in this module will throw an easier-to-understand,
|
|
682
|
+
* easier-to-debug exception with a clear errors message message explaining the
|
|
683
|
+
* problem. (Instead of a confusing exception thrown inside the implementation
|
|
684
|
+
* of the `value` object).
|
|
685
|
+
*/
|
|
686
|
+
// $FlowFixMe only called in DEV, so void return is not possible.
|
|
687
|
+
function typeName(value) {
|
|
688
|
+
{
|
|
689
|
+
// toStringTag is needed for namespaced types like Temporal.Instant
|
|
690
|
+
var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag;
|
|
691
|
+
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object';
|
|
692
|
+
return type;
|
|
693
|
+
}
|
|
694
|
+
} // $FlowFixMe only called in DEV, so void return is not possible.
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
function willCoercionThrow(value) {
|
|
698
|
+
{
|
|
699
|
+
try {
|
|
700
|
+
testStringCoercion(value);
|
|
701
|
+
return false;
|
|
702
|
+
} catch (e) {
|
|
703
|
+
return true;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
function testStringCoercion(value) {
|
|
709
|
+
// If you ended up here by following an exception call stack, here's what's
|
|
710
|
+
// happened: you supplied an object or symbol value to React (as a prop, key,
|
|
711
|
+
// DOM attribute, CSS property, string ref, etc.) and when React tried to
|
|
712
|
+
// coerce it to a string using `'' + value`, an exception was thrown.
|
|
713
|
+
//
|
|
714
|
+
// The most common types that will cause this exception are `Symbol` instances
|
|
715
|
+
// and Temporal objects like `Temporal.Instant`. But any object that has a
|
|
716
|
+
// `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this
|
|
717
|
+
// exception. (Library authors do this to prevent users from using built-in
|
|
718
|
+
// numeric operators like `+` or comparison operators like `>=` because custom
|
|
719
|
+
// methods are needed to perform accurate arithmetic or comparison.)
|
|
720
|
+
//
|
|
721
|
+
// To fix the problem, coerce this object or symbol value to a string before
|
|
722
|
+
// passing it to React. The most reliable way is usually `String(value)`.
|
|
723
|
+
//
|
|
724
|
+
// To find which value is throwing, check the browser or debugger console.
|
|
725
|
+
// Before this exception was thrown, there should be `console.error` output
|
|
726
|
+
// that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the
|
|
727
|
+
// problem and how that type was used: key, atrribute, input value prop, etc.
|
|
728
|
+
// In most cases, this console output also shows the component and its
|
|
729
|
+
// ancestor components where the exception happened.
|
|
730
|
+
//
|
|
731
|
+
// eslint-disable-next-line react-internal/safe-string-coercion
|
|
732
|
+
return '' + value;
|
|
733
|
+
}
|
|
734
|
+
function checkKeyStringCoercion(value) {
|
|
735
|
+
{
|
|
736
|
+
if (willCoercionThrow(value)) {
|
|
737
|
+
error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value));
|
|
738
|
+
|
|
739
|
+
return testStringCoercion(value); // throw (to help callers find troubleshooting comments)
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
745
|
+
var RESERVED_PROPS = {
|
|
746
|
+
key: true,
|
|
747
|
+
ref: true,
|
|
748
|
+
__self: true,
|
|
749
|
+
__source: true
|
|
750
|
+
};
|
|
751
|
+
var specialPropKeyWarningShown;
|
|
752
|
+
var specialPropRefWarningShown;
|
|
753
|
+
|
|
754
|
+
function hasValidRef(config) {
|
|
755
|
+
{
|
|
756
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
757
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
758
|
+
|
|
759
|
+
if (getter && getter.isReactWarning) {
|
|
760
|
+
return false;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
return config.ref !== undefined;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
function hasValidKey(config) {
|
|
769
|
+
{
|
|
770
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
771
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
772
|
+
|
|
773
|
+
if (getter && getter.isReactWarning) {
|
|
774
|
+
return false;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
return config.key !== undefined;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function warnIfStringRefCannotBeAutoConverted(config, self) {
|
|
783
|
+
{
|
|
784
|
+
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self) ;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
789
|
+
{
|
|
790
|
+
var warnAboutAccessingKey = function () {
|
|
791
|
+
if (!specialPropKeyWarningShown) {
|
|
792
|
+
specialPropKeyWarningShown = true;
|
|
793
|
+
|
|
794
|
+
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
799
|
+
Object.defineProperty(props, 'key', {
|
|
800
|
+
get: warnAboutAccessingKey,
|
|
801
|
+
configurable: true
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
807
|
+
{
|
|
808
|
+
var warnAboutAccessingRef = function () {
|
|
809
|
+
if (!specialPropRefWarningShown) {
|
|
810
|
+
specialPropRefWarningShown = true;
|
|
811
|
+
|
|
812
|
+
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
|
|
813
|
+
}
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
817
|
+
Object.defineProperty(props, 'ref', {
|
|
818
|
+
get: warnAboutAccessingRef,
|
|
819
|
+
configurable: true
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
825
|
+
* the class pattern, so do not use new to call it. Also, instanceof check
|
|
826
|
+
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
827
|
+
* if something is a React Element.
|
|
828
|
+
*
|
|
829
|
+
* @param {*} type
|
|
830
|
+
* @param {*} props
|
|
831
|
+
* @param {*} key
|
|
832
|
+
* @param {string|object} ref
|
|
833
|
+
* @param {*} owner
|
|
834
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
835
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
836
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
837
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
838
|
+
* change in behavior.
|
|
839
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
840
|
+
* indicating filename, line number, and/or other information.
|
|
841
|
+
* @internal
|
|
842
|
+
*/
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
846
|
+
var element = {
|
|
847
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
848
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
849
|
+
// Built-in properties that belong on the element
|
|
850
|
+
type: type,
|
|
851
|
+
key: key,
|
|
852
|
+
ref: ref,
|
|
853
|
+
props: props,
|
|
854
|
+
// Record the component responsible for creating this element.
|
|
855
|
+
_owner: owner
|
|
856
|
+
};
|
|
857
|
+
|
|
858
|
+
{
|
|
859
|
+
// The validation flag is currently mutative. We put it on
|
|
860
|
+
// an external backing store so that we can freeze the whole object.
|
|
861
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
862
|
+
// commonly used development environments.
|
|
863
|
+
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
|
|
864
|
+
// the validation flag non-enumerable (where possible, which should
|
|
865
|
+
// include every environment we run tests in), so the test framework
|
|
866
|
+
// ignores it.
|
|
867
|
+
|
|
868
|
+
Object.defineProperty(element._store, 'validated', {
|
|
869
|
+
configurable: false,
|
|
870
|
+
enumerable: false,
|
|
871
|
+
writable: true,
|
|
872
|
+
value: false
|
|
873
|
+
}); // self and source are DEV only properties.
|
|
874
|
+
|
|
875
|
+
Object.defineProperty(element, '_self', {
|
|
876
|
+
configurable: false,
|
|
877
|
+
enumerable: false,
|
|
878
|
+
writable: false,
|
|
879
|
+
value: self
|
|
880
|
+
}); // Two elements created in two different places should be considered
|
|
881
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
882
|
+
|
|
883
|
+
Object.defineProperty(element, '_source', {
|
|
884
|
+
configurable: false,
|
|
885
|
+
enumerable: false,
|
|
886
|
+
writable: false,
|
|
887
|
+
value: source
|
|
888
|
+
});
|
|
889
|
+
|
|
890
|
+
if (Object.freeze) {
|
|
891
|
+
Object.freeze(element.props);
|
|
892
|
+
Object.freeze(element);
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
return element;
|
|
897
|
+
};
|
|
898
|
+
/**
|
|
899
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
900
|
+
* @param {*} type
|
|
901
|
+
* @param {object} props
|
|
902
|
+
* @param {string} key
|
|
903
|
+
*/
|
|
904
|
+
|
|
905
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
906
|
+
{
|
|
907
|
+
var propName; // Reserved names are extracted
|
|
908
|
+
|
|
909
|
+
var props = {};
|
|
910
|
+
var key = null;
|
|
911
|
+
var ref = null; // Currently, key can be spread in as a prop. This causes a potential
|
|
912
|
+
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" />
|
|
913
|
+
// or <div key="Hi" {...props} /> ). We want to deprecate key spread,
|
|
914
|
+
// but as an intermediary step, we will use jsxDEV for everything except
|
|
915
|
+
// <div {...props} key="Hi" />, because we aren't currently able to tell if
|
|
916
|
+
// key is explicitly declared to be undefined or not.
|
|
917
|
+
|
|
918
|
+
if (maybeKey !== undefined) {
|
|
919
|
+
{
|
|
920
|
+
checkKeyStringCoercion(maybeKey);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
key = '' + maybeKey;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
if (hasValidKey(config)) {
|
|
927
|
+
{
|
|
928
|
+
checkKeyStringCoercion(config.key);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
key = '' + config.key;
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
if (hasValidRef(config)) {
|
|
935
|
+
ref = config.ref;
|
|
936
|
+
warnIfStringRefCannotBeAutoConverted(config, self);
|
|
937
|
+
} // Remaining properties are added to a new props object
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
for (propName in config) {
|
|
941
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
942
|
+
props[propName] = config[propName];
|
|
943
|
+
}
|
|
944
|
+
} // Resolve default props
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
if (type && type.defaultProps) {
|
|
948
|
+
var defaultProps = type.defaultProps;
|
|
949
|
+
|
|
950
|
+
for (propName in defaultProps) {
|
|
951
|
+
if (props[propName] === undefined) {
|
|
952
|
+
props[propName] = defaultProps[propName];
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
if (key || ref) {
|
|
958
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
959
|
+
|
|
960
|
+
if (key) {
|
|
961
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
if (ref) {
|
|
965
|
+
defineRefPropWarningGetter(props, displayName);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
974
|
+
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
975
|
+
|
|
976
|
+
function setCurrentlyValidatingElement$1(element) {
|
|
977
|
+
{
|
|
978
|
+
if (element) {
|
|
979
|
+
var owner = element._owner;
|
|
980
|
+
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
981
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
982
|
+
} else {
|
|
983
|
+
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
var propTypesMisspellWarningShown;
|
|
989
|
+
|
|
990
|
+
{
|
|
991
|
+
propTypesMisspellWarningShown = false;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Verifies the object is a ReactElement.
|
|
995
|
+
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
|
996
|
+
* @param {?object} object
|
|
997
|
+
* @return {boolean} True if `object` is a ReactElement.
|
|
998
|
+
* @final
|
|
999
|
+
*/
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
function isValidElement(object) {
|
|
1003
|
+
{
|
|
1004
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function getDeclarationErrorAddendum() {
|
|
1009
|
+
{
|
|
1010
|
+
if (ReactCurrentOwner$1.current) {
|
|
1011
|
+
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
1012
|
+
|
|
1013
|
+
if (name) {
|
|
1014
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
return '';
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1023
|
+
{
|
|
1024
|
+
|
|
1025
|
+
return '';
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1030
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1031
|
+
* updates.
|
|
1032
|
+
*/
|
|
1033
|
+
|
|
1034
|
+
|
|
1035
|
+
var ownerHasKeyUseWarning = {};
|
|
1036
|
+
|
|
1037
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1038
|
+
{
|
|
1039
|
+
var info = getDeclarationErrorAddendum();
|
|
1040
|
+
|
|
1041
|
+
if (!info) {
|
|
1042
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1043
|
+
|
|
1044
|
+
if (parentName) {
|
|
1045
|
+
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
return info;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1054
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1055
|
+
* reordered. All children that haven't already been validated are required to
|
|
1056
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1057
|
+
* will only be shown once.
|
|
1058
|
+
*
|
|
1059
|
+
* @internal
|
|
1060
|
+
* @param {ReactElement} element Element that requires a key.
|
|
1061
|
+
* @param {*} parentType element's parent's type.
|
|
1062
|
+
*/
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
function validateExplicitKey(element, parentType) {
|
|
1066
|
+
{
|
|
1067
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1068
|
+
return;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
element._store.validated = true;
|
|
1072
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1073
|
+
|
|
1074
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
|
|
1079
|
+
// property, it may be the creator of the child that's responsible for
|
|
1080
|
+
// assigning it a key.
|
|
1081
|
+
|
|
1082
|
+
var childOwner = '';
|
|
1083
|
+
|
|
1084
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
1085
|
+
// Give the component that originally created this child.
|
|
1086
|
+
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
setCurrentlyValidatingElement$1(element);
|
|
1090
|
+
|
|
1091
|
+
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
1092
|
+
|
|
1093
|
+
setCurrentlyValidatingElement$1(null);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Ensure that every element either is passed in a static location, in an
|
|
1098
|
+
* array with an explicit keys property defined, or in an object literal
|
|
1099
|
+
* with valid key property.
|
|
1100
|
+
*
|
|
1101
|
+
* @internal
|
|
1102
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
1103
|
+
* @param {*} parentType node's parent's type.
|
|
1104
|
+
*/
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
function validateChildKeys(node, parentType) {
|
|
1108
|
+
{
|
|
1109
|
+
if (typeof node !== 'object') {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
if (isArray(node)) {
|
|
1114
|
+
for (var i = 0; i < node.length; i++) {
|
|
1115
|
+
var child = node[i];
|
|
1116
|
+
|
|
1117
|
+
if (isValidElement(child)) {
|
|
1118
|
+
validateExplicitKey(child, parentType);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
} else if (isValidElement(node)) {
|
|
1122
|
+
// This element was passed in a valid location.
|
|
1123
|
+
if (node._store) {
|
|
1124
|
+
node._store.validated = true;
|
|
1125
|
+
}
|
|
1126
|
+
} else if (node) {
|
|
1127
|
+
var iteratorFn = getIteratorFn(node);
|
|
1128
|
+
|
|
1129
|
+
if (typeof iteratorFn === 'function') {
|
|
1130
|
+
// Entry iterators used to provide implicit keys,
|
|
1131
|
+
// but now we print a separate warning for them later.
|
|
1132
|
+
if (iteratorFn !== node.entries) {
|
|
1133
|
+
var iterator = iteratorFn.call(node);
|
|
1134
|
+
var step;
|
|
1135
|
+
|
|
1136
|
+
while (!(step = iterator.next()).done) {
|
|
1137
|
+
if (isValidElement(step.value)) {
|
|
1138
|
+
validateExplicitKey(step.value, parentType);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
/**
|
|
1147
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
1148
|
+
* provided by the type.
|
|
1149
|
+
*
|
|
1150
|
+
* @param {ReactElement} element
|
|
1151
|
+
*/
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
function validatePropTypes(element) {
|
|
1155
|
+
{
|
|
1156
|
+
var type = element.type;
|
|
1157
|
+
|
|
1158
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
1159
|
+
return;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
var propTypes;
|
|
1163
|
+
|
|
1164
|
+
if (typeof type === 'function') {
|
|
1165
|
+
propTypes = type.propTypes;
|
|
1166
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
|
|
1167
|
+
// Inner props are checked in the reconciler.
|
|
1168
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
1169
|
+
propTypes = type.propTypes;
|
|
1170
|
+
} else {
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (propTypes) {
|
|
1175
|
+
// Intentionally inside to avoid triggering lazy initializers:
|
|
1176
|
+
var name = getComponentNameFromType(type);
|
|
1177
|
+
checkPropTypes(propTypes, element.props, 'prop', name, element);
|
|
1178
|
+
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
|
1179
|
+
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
|
|
1180
|
+
|
|
1181
|
+
var _name = getComponentNameFromType(type);
|
|
1182
|
+
|
|
1183
|
+
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
|
|
1187
|
+
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Given a fragment, validate that it can only be provided with fragment props
|
|
1193
|
+
* @param {ReactElement} fragment
|
|
1194
|
+
*/
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
function validateFragmentProps(fragment) {
|
|
1198
|
+
{
|
|
1199
|
+
var keys = Object.keys(fragment.props);
|
|
1200
|
+
|
|
1201
|
+
for (var i = 0; i < keys.length; i++) {
|
|
1202
|
+
var key = keys[i];
|
|
1203
|
+
|
|
1204
|
+
if (key !== 'children' && key !== 'key') {
|
|
1205
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1206
|
+
|
|
1207
|
+
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
|
|
1208
|
+
|
|
1209
|
+
setCurrentlyValidatingElement$1(null);
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
if (fragment.ref !== null) {
|
|
1215
|
+
setCurrentlyValidatingElement$1(fragment);
|
|
1216
|
+
|
|
1217
|
+
error('Invalid attribute `ref` supplied to `React.Fragment`.');
|
|
1218
|
+
|
|
1219
|
+
setCurrentlyValidatingElement$1(null);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
var didWarnAboutKeySpread = {};
|
|
1225
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1226
|
+
{
|
|
1227
|
+
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
|
|
1228
|
+
// succeed and there will likely be errors in render.
|
|
1229
|
+
|
|
1230
|
+
if (!validType) {
|
|
1231
|
+
var info = '';
|
|
1232
|
+
|
|
1233
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1234
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
var sourceInfo = getSourceInfoErrorAddendum();
|
|
1238
|
+
|
|
1239
|
+
if (sourceInfo) {
|
|
1240
|
+
info += sourceInfo;
|
|
1241
|
+
} else {
|
|
1242
|
+
info += getDeclarationErrorAddendum();
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
var typeString;
|
|
1246
|
+
|
|
1247
|
+
if (type === null) {
|
|
1248
|
+
typeString = 'null';
|
|
1249
|
+
} else if (isArray(type)) {
|
|
1250
|
+
typeString = 'array';
|
|
1251
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1252
|
+
typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />";
|
|
1253
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1254
|
+
} else {
|
|
1255
|
+
typeString = typeof type;
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.
|
|
1262
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1263
|
+
|
|
1264
|
+
if (element == null) {
|
|
1265
|
+
return element;
|
|
1266
|
+
} // Skip key warning if the type isn't valid since our key validation logic
|
|
1267
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1268
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1269
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1270
|
+
// fixed, the key warnings will appear.)
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
if (validType) {
|
|
1274
|
+
var children = props.children;
|
|
1275
|
+
|
|
1276
|
+
if (children !== undefined) {
|
|
1277
|
+
if (isStaticChildren) {
|
|
1278
|
+
if (isArray(children)) {
|
|
1279
|
+
for (var i = 0; i < children.length; i++) {
|
|
1280
|
+
validateChildKeys(children[i], type);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
if (Object.freeze) {
|
|
1284
|
+
Object.freeze(children);
|
|
1285
|
+
}
|
|
1286
|
+
} else {
|
|
1287
|
+
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');
|
|
1288
|
+
}
|
|
1289
|
+
} else {
|
|
1290
|
+
validateChildKeys(children, type);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
{
|
|
1296
|
+
if (hasOwnProperty.call(props, 'key')) {
|
|
1297
|
+
var componentName = getComponentNameFromType(type);
|
|
1298
|
+
var keys = Object.keys(props).filter(function (k) {
|
|
1299
|
+
return k !== 'key';
|
|
1300
|
+
});
|
|
1301
|
+
var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}';
|
|
1302
|
+
|
|
1303
|
+
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
1304
|
+
var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}';
|
|
1305
|
+
|
|
1306
|
+
error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
1307
|
+
|
|
1308
|
+
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
|
|
1313
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1314
|
+
validateFragmentProps(element);
|
|
1315
|
+
} else {
|
|
1316
|
+
validatePropTypes(element);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
return element;
|
|
1320
|
+
}
|
|
1321
|
+
} // These two functions exist to still get child warnings in dev
|
|
1322
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
1323
|
+
// opt-in behavior for better messages but that we won't stop
|
|
1324
|
+
// giving you warnings if you use production apis.
|
|
1325
|
+
|
|
1326
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
1327
|
+
{
|
|
1328
|
+
return jsxWithValidation(type, props, key, true);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
1332
|
+
{
|
|
1333
|
+
return jsxWithValidation(type, props, key, false);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children.
|
|
1338
|
+
// for now we can ship identical prod functions
|
|
1339
|
+
|
|
1340
|
+
var jsxs = jsxWithValidationStatic ;
|
|
1341
|
+
|
|
1342
|
+
reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
|
|
1343
|
+
reactJsxRuntime_development.jsx = jsx;
|
|
1344
|
+
reactJsxRuntime_development.jsxs = jsxs;
|
|
1345
|
+
})();
|
|
1346
|
+
}
|
|
1347
|
+
return reactJsxRuntime_development;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
var hasRequiredJsxRuntime;
|
|
1351
|
+
|
|
1352
|
+
function requireJsxRuntime () {
|
|
1353
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
1354
|
+
hasRequiredJsxRuntime = 1;
|
|
1355
|
+
|
|
1356
|
+
if (process.env.NODE_ENV === 'production') {
|
|
1357
|
+
jsxRuntime.exports = requireReactJsxRuntime_production_min();
|
|
1358
|
+
} else {
|
|
1359
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
1360
|
+
}
|
|
1361
|
+
return jsxRuntime.exports;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* Returns a space-separated string of class names based on input arguments.
|
|
1368
|
+
*
|
|
1369
|
+
* Accepts any mix of strings, numbers, arrays, or objects. Falsy values are ignored.
|
|
1370
|
+
* Array and object values are recursively flattened, and object keys are included
|
|
1371
|
+
* if their value is truthy. Duplicate class names are removed.
|
|
1372
|
+
*
|
|
1373
|
+
* @param {...(string | number | undefined | null | false | Record<string, unknown> | unknown[])} args - Class values to join.
|
|
1374
|
+
* @returns {string} A space-separated string of unique class names.
|
|
1375
|
+
*
|
|
1376
|
+
* @example
|
|
1377
|
+
* classNames('foo', ['bar', { baz: true }], { qux: false, quux: true });
|
|
1378
|
+
* // => 'foo bar baz quux'
|
|
1379
|
+
*/
|
|
1380
|
+
function classNames(...args) {
|
|
1381
|
+
const classSet = new Set();
|
|
1382
|
+
function process(item) {
|
|
1383
|
+
if (item === undefined || item === null || item === false || item === '') {
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
if (typeof item === 'string' || typeof item === 'number') {
|
|
1387
|
+
for (const cls of String(item).split(/\s+/)) {
|
|
1388
|
+
if (cls)
|
|
1389
|
+
classSet.add(cls);
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
else if (Array.isArray(item)) {
|
|
1393
|
+
for (const sub of item)
|
|
1394
|
+
process(sub);
|
|
1395
|
+
}
|
|
1396
|
+
else if (typeof item === 'object') {
|
|
1397
|
+
for (const key in item) {
|
|
1398
|
+
if (Object.prototype.hasOwnProperty.call(item, key) && item[key]) {
|
|
1399
|
+
for (const cls of key.split(/\s+/)) {
|
|
1400
|
+
if (cls)
|
|
1401
|
+
classSet.add(cls);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
for (const arg of args) {
|
|
1408
|
+
process(arg);
|
|
1409
|
+
}
|
|
1410
|
+
return Array.from(classSet).join(' ');
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/**
|
|
1414
|
+
* Valid Bulma color classes.
|
|
1415
|
+
* @example 'primary', 'link', 'info'
|
|
1416
|
+
*/
|
|
1417
|
+
const validColors = [
|
|
1418
|
+
'primary',
|
|
1419
|
+
'link',
|
|
1420
|
+
'info',
|
|
1421
|
+
'success',
|
|
1422
|
+
'warning',
|
|
1423
|
+
'danger',
|
|
1424
|
+
'black',
|
|
1425
|
+
'black-bis',
|
|
1426
|
+
'black-ter',
|
|
1427
|
+
'grey-darker',
|
|
1428
|
+
'grey-dark',
|
|
1429
|
+
'grey',
|
|
1430
|
+
'grey-light',
|
|
1431
|
+
'grey-lighter',
|
|
1432
|
+
'white',
|
|
1433
|
+
'light',
|
|
1434
|
+
'dark',
|
|
1435
|
+
];
|
|
1436
|
+
/**
|
|
1437
|
+
* Valid Bulma color shade suffixes.
|
|
1438
|
+
* @example '00', '05', 'invert'
|
|
1439
|
+
*/
|
|
1440
|
+
const validColorShades = [
|
|
1441
|
+
'00',
|
|
1442
|
+
'05',
|
|
1443
|
+
'10',
|
|
1444
|
+
'15',
|
|
1445
|
+
'20',
|
|
1446
|
+
'25',
|
|
1447
|
+
'30',
|
|
1448
|
+
'35',
|
|
1449
|
+
'40',
|
|
1450
|
+
'45',
|
|
1451
|
+
'50',
|
|
1452
|
+
'55',
|
|
1453
|
+
'60',
|
|
1454
|
+
'65',
|
|
1455
|
+
'70',
|
|
1456
|
+
'75',
|
|
1457
|
+
'80',
|
|
1458
|
+
'85',
|
|
1459
|
+
'90',
|
|
1460
|
+
'95',
|
|
1461
|
+
'invert',
|
|
1462
|
+
];
|
|
1463
|
+
/**
|
|
1464
|
+
* Valid Bulma size classes for margins and paddings.
|
|
1465
|
+
* @example '0', '1', 'auto'
|
|
1466
|
+
*/
|
|
1467
|
+
const validSizes$1 = ['0', '1', '2', '3', '4', '5', '6', 'auto'];
|
|
1468
|
+
/**
|
|
1469
|
+
* Valid Bulma text size classes.
|
|
1470
|
+
* @example '1', '2', '3'
|
|
1471
|
+
*/
|
|
1472
|
+
const validTextSizes = ['1', '2', '3', '4', '5', '6', '7'];
|
|
1473
|
+
/**
|
|
1474
|
+
* Valid Bulma text alignment classes.
|
|
1475
|
+
* @example 'centered', 'left', 'right'
|
|
1476
|
+
*/
|
|
1477
|
+
const validAlignments$1 = [
|
|
1478
|
+
'centered',
|
|
1479
|
+
'justified',
|
|
1480
|
+
'left',
|
|
1481
|
+
'right',
|
|
1482
|
+
];
|
|
1483
|
+
/**
|
|
1484
|
+
* Valid Bulma text transformation classes.
|
|
1485
|
+
* @example 'capitalized', 'uppercase', 'italic'
|
|
1486
|
+
*/
|
|
1487
|
+
const validTextTransforms = [
|
|
1488
|
+
'capitalized',
|
|
1489
|
+
'lowercase',
|
|
1490
|
+
'uppercase',
|
|
1491
|
+
'italic',
|
|
1492
|
+
];
|
|
1493
|
+
/**
|
|
1494
|
+
* Valid Bulma text weight classes.
|
|
1495
|
+
* @example 'light', 'normal', 'bold'
|
|
1496
|
+
*/
|
|
1497
|
+
const validTextWeights = [
|
|
1498
|
+
'light',
|
|
1499
|
+
'normal',
|
|
1500
|
+
'medium',
|
|
1501
|
+
'semibold',
|
|
1502
|
+
'bold',
|
|
1503
|
+
];
|
|
1504
|
+
/**
|
|
1505
|
+
* Valid Bulma font family classes.
|
|
1506
|
+
* @example 'sans-serif', 'monospace', 'code'
|
|
1507
|
+
*/
|
|
1508
|
+
const validFontFamilies = [
|
|
1509
|
+
'sans-serif',
|
|
1510
|
+
'monospace',
|
|
1511
|
+
'primary',
|
|
1512
|
+
'secondary',
|
|
1513
|
+
'code',
|
|
1514
|
+
];
|
|
1515
|
+
/**
|
|
1516
|
+
* Valid Bulma display classes.
|
|
1517
|
+
* @example 'block', 'flex', 'inline'
|
|
1518
|
+
*/
|
|
1519
|
+
const validDisplays = [
|
|
1520
|
+
'block',
|
|
1521
|
+
'flex',
|
|
1522
|
+
'inline',
|
|
1523
|
+
'inline-block',
|
|
1524
|
+
'inline-flex',
|
|
1525
|
+
];
|
|
1526
|
+
/**
|
|
1527
|
+
* Valid Bulma visibility classes.
|
|
1528
|
+
* @example 'hidden', 'sr-only'
|
|
1529
|
+
*/
|
|
1530
|
+
const validVisibilities = ['hidden', 'sr-only'];
|
|
1531
|
+
/**
|
|
1532
|
+
* Valid Bulma flex direction classes.
|
|
1533
|
+
* @example 'row', 'column', 'row-reverse'
|
|
1534
|
+
*/
|
|
1535
|
+
const validFlexDirections = [
|
|
1536
|
+
'row',
|
|
1537
|
+
'row-reverse',
|
|
1538
|
+
'column',
|
|
1539
|
+
'column-reverse',
|
|
1540
|
+
];
|
|
1541
|
+
/**
|
|
1542
|
+
* Valid Bulma flex wrap classes.
|
|
1543
|
+
* @example 'nowrap', 'wrap', 'wrap-reverse'
|
|
1544
|
+
*/
|
|
1545
|
+
const validFlexWraps = ['nowrap', 'wrap', 'wrap-reverse'];
|
|
1546
|
+
/**
|
|
1547
|
+
* Valid Bulma justify-content classes.
|
|
1548
|
+
* @example 'flex-start', 'center', 'space-between'
|
|
1549
|
+
*/
|
|
1550
|
+
const validJustifyContents = [
|
|
1551
|
+
'flex-start',
|
|
1552
|
+
'flex-end',
|
|
1553
|
+
'center',
|
|
1554
|
+
'space-between',
|
|
1555
|
+
'space-around',
|
|
1556
|
+
'space-evenly',
|
|
1557
|
+
'start',
|
|
1558
|
+
'end',
|
|
1559
|
+
'left',
|
|
1560
|
+
'right',
|
|
1561
|
+
];
|
|
1562
|
+
/**
|
|
1563
|
+
* Valid Bulma align-content classes.
|
|
1564
|
+
* @example 'flex-start', 'center', 'stretch'
|
|
1565
|
+
*/
|
|
1566
|
+
const validAlignContents = [
|
|
1567
|
+
'flex-start',
|
|
1568
|
+
'flex-end',
|
|
1569
|
+
'center',
|
|
1570
|
+
'space-between',
|
|
1571
|
+
'space-around',
|
|
1572
|
+
'space-evenly',
|
|
1573
|
+
'stretch',
|
|
1574
|
+
];
|
|
1575
|
+
/**
|
|
1576
|
+
* Valid Bulma align-items classes.
|
|
1577
|
+
* @example 'stretch', 'flex-start', 'center'
|
|
1578
|
+
*/
|
|
1579
|
+
const validAlignItems = [
|
|
1580
|
+
'stretch',
|
|
1581
|
+
'flex-start',
|
|
1582
|
+
'flex-end',
|
|
1583
|
+
'center',
|
|
1584
|
+
'baseline',
|
|
1585
|
+
'start',
|
|
1586
|
+
'end',
|
|
1587
|
+
];
|
|
1588
|
+
/**
|
|
1589
|
+
* Valid Bulma align-self classes.
|
|
1590
|
+
* @example 'auto', 'flex-start', 'center'
|
|
1591
|
+
*/
|
|
1592
|
+
const validAlignSelfs = [
|
|
1593
|
+
'auto',
|
|
1594
|
+
'flex-start',
|
|
1595
|
+
'flex-end',
|
|
1596
|
+
'center',
|
|
1597
|
+
'baseline',
|
|
1598
|
+
'stretch',
|
|
1599
|
+
];
|
|
1600
|
+
/**
|
|
1601
|
+
* Valid Bulma flex grow and shrink values.
|
|
1602
|
+
* @example '0', '1'
|
|
1603
|
+
*/
|
|
1604
|
+
const validFlexGrowShrink = ['0', '1'];
|
|
1605
|
+
/**
|
|
1606
|
+
* Valid Bulma viewport classes for responsive design.
|
|
1607
|
+
* @example 'mobile', 'tablet', 'desktop'
|
|
1608
|
+
*/
|
|
1609
|
+
const validViewports = [
|
|
1610
|
+
'mobile',
|
|
1611
|
+
'tablet',
|
|
1612
|
+
'desktop',
|
|
1613
|
+
'widescreen',
|
|
1614
|
+
'fullhd',
|
|
1615
|
+
];
|
|
1616
|
+
/**
|
|
1617
|
+
* A hook that generates Bulma helper classes from props and separates unhandled props.
|
|
1618
|
+
*
|
|
1619
|
+
* @function useBulmaClasses
|
|
1620
|
+
* @param props - Combination of BulmaClassesProps and additional props.
|
|
1621
|
+
* @returns An object containing the Bulma helper classes and unhandled props.
|
|
1622
|
+
* @example
|
|
1623
|
+
* const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1624
|
+
* color: 'primary',
|
|
1625
|
+
* textSize: '3',
|
|
1626
|
+
* className: 'custom-class'
|
|
1627
|
+
* });
|
|
1628
|
+
* // bulmaHelperClasses: 'has-text-primary is-size-3'
|
|
1629
|
+
* // rest: { className: 'custom-class' }
|
|
1630
|
+
*/
|
|
1631
|
+
const useBulmaClasses = (props) => {
|
|
1632
|
+
const { color, backgroundColor, colorShade, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, textSize, textAlign, textTransform, textWeight, fontFamily, display, visibility, flexDirection, flexWrap, justifyContent, alignContent, alignItems, alignSelf, flexGrow, flexShrink, float, overflow, overlay, interaction, radius, shadow, responsive, viewport, ...rest } = props;
|
|
1633
|
+
const bulmaHelperClasses = useMemo(() => {
|
|
1634
|
+
const classes = [];
|
|
1635
|
+
// Helper to add class with optional viewport
|
|
1636
|
+
const addClass = (prefix, value, validValues) => {
|
|
1637
|
+
if (value && (!validValues.length || validValues.includes(value))) {
|
|
1638
|
+
const className = viewport && validViewports.includes(viewport)
|
|
1639
|
+
? `${prefix}-${value}-${viewport}`
|
|
1640
|
+
: `${prefix}-${value}`;
|
|
1641
|
+
classes.push(className);
|
|
1642
|
+
}
|
|
1643
|
+
};
|
|
1644
|
+
// Color handling
|
|
1645
|
+
const addColorClass = (prefix, value, shade) => {
|
|
1646
|
+
if (!value || ![...validColors, 'inherit', 'current'].includes(value))
|
|
1647
|
+
return;
|
|
1648
|
+
if (shade && validColorShades.includes(shade)) {
|
|
1649
|
+
const className = prefix === 'has-text' && viewport && validViewports.includes(viewport)
|
|
1650
|
+
? `${prefix}-${value}-${shade}-${viewport}`
|
|
1651
|
+
: `${prefix}-${value}-${shade}`;
|
|
1652
|
+
classes.push(className);
|
|
1653
|
+
}
|
|
1654
|
+
else {
|
|
1655
|
+
addClass(prefix, value, [...validColors, 'inherit', 'current']);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
// Color
|
|
1659
|
+
addColorClass('has-text', color, colorShade);
|
|
1660
|
+
addColorClass('has-background', backgroundColor, colorShade);
|
|
1661
|
+
// Spacing
|
|
1662
|
+
addClass('m', m, validSizes$1);
|
|
1663
|
+
addClass('mt', mt, validSizes$1);
|
|
1664
|
+
addClass('mr', mr, validSizes$1);
|
|
1665
|
+
addClass('mb', mb, validSizes$1);
|
|
1666
|
+
addClass('ml', ml, validSizes$1);
|
|
1667
|
+
addClass('mx', mx, validSizes$1);
|
|
1668
|
+
addClass('my', my, validSizes$1);
|
|
1669
|
+
addClass('p', p, validSizes$1);
|
|
1670
|
+
addClass('pt', pt, validSizes$1);
|
|
1671
|
+
addClass('pr', pr, validSizes$1);
|
|
1672
|
+
addClass('pb', pb, validSizes$1);
|
|
1673
|
+
addClass('pl', pl, validSizes$1);
|
|
1674
|
+
addClass('px', px, validSizes$1);
|
|
1675
|
+
addClass('py', py, validSizes$1);
|
|
1676
|
+
// Typography
|
|
1677
|
+
addClass('is-size', textSize, validTextSizes);
|
|
1678
|
+
addClass('has-text', textAlign, validAlignments$1);
|
|
1679
|
+
addClass('is', textTransform, validTextTransforms);
|
|
1680
|
+
addClass('has-text-weight', textWeight, validTextWeights);
|
|
1681
|
+
addClass('is-family', fontFamily, validFontFamilies);
|
|
1682
|
+
// Visibility
|
|
1683
|
+
addClass('is', display, validDisplays);
|
|
1684
|
+
if (visibility) {
|
|
1685
|
+
if (visibility === 'hidden' &&
|
|
1686
|
+
viewport &&
|
|
1687
|
+
validViewports.includes(viewport)) {
|
|
1688
|
+
classes.push(`is-hidden-${viewport}`);
|
|
1689
|
+
}
|
|
1690
|
+
else if (validVisibilities.includes(visibility)) {
|
|
1691
|
+
classes.push(`is-${visibility}`);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
// Flexbox
|
|
1695
|
+
if (display === 'flex' || display === 'inline-flex') {
|
|
1696
|
+
addClass('is-flex-direction', flexDirection, validFlexDirections);
|
|
1697
|
+
addClass('is-flex-wrap', flexWrap, validFlexWraps);
|
|
1698
|
+
addClass('is-justify-content', justifyContent, validJustifyContents);
|
|
1699
|
+
addClass('is-align-content', alignContent, validAlignContents);
|
|
1700
|
+
addClass('is-align-items', alignItems, validAlignItems);
|
|
1701
|
+
addClass('is-align-self', alignSelf, validAlignSelfs);
|
|
1702
|
+
addClass('is-flex-grow', flexGrow, validFlexGrowShrink);
|
|
1703
|
+
addClass('is-flex-shrink', flexShrink, validFlexGrowShrink);
|
|
1704
|
+
}
|
|
1705
|
+
// Other Helpers
|
|
1706
|
+
if (float) {
|
|
1707
|
+
addClass('is-pulled', float, ['left', 'right']);
|
|
1708
|
+
}
|
|
1709
|
+
if (overflow) {
|
|
1710
|
+
addClass('is', overflow, ['clipped']);
|
|
1711
|
+
}
|
|
1712
|
+
if (overlay) {
|
|
1713
|
+
classes.push('is-overlay');
|
|
1714
|
+
}
|
|
1715
|
+
if (interaction) {
|
|
1716
|
+
addClass('is', interaction, ['unselectable', 'clickable']);
|
|
1717
|
+
}
|
|
1718
|
+
if (radius) {
|
|
1719
|
+
addClass('is', radius, ['radiusless']);
|
|
1720
|
+
}
|
|
1721
|
+
if (shadow) {
|
|
1722
|
+
addClass('is', shadow, ['shadowless']);
|
|
1723
|
+
}
|
|
1724
|
+
if (responsive) {
|
|
1725
|
+
addClass('is', responsive, ['mobile', 'narrow']);
|
|
1726
|
+
}
|
|
1727
|
+
return classNames(classes);
|
|
1728
|
+
}, [
|
|
1729
|
+
color,
|
|
1730
|
+
backgroundColor,
|
|
1731
|
+
colorShade,
|
|
1732
|
+
m,
|
|
1733
|
+
mt,
|
|
1734
|
+
mr,
|
|
1735
|
+
mb,
|
|
1736
|
+
ml,
|
|
1737
|
+
mx,
|
|
1738
|
+
my,
|
|
1739
|
+
p,
|
|
1740
|
+
pt,
|
|
1741
|
+
pr,
|
|
1742
|
+
pb,
|
|
1743
|
+
pl,
|
|
1744
|
+
px,
|
|
1745
|
+
py,
|
|
1746
|
+
textSize,
|
|
1747
|
+
textAlign,
|
|
1748
|
+
textTransform,
|
|
1749
|
+
textWeight,
|
|
1750
|
+
fontFamily,
|
|
1751
|
+
display,
|
|
1752
|
+
visibility,
|
|
1753
|
+
flexDirection,
|
|
1754
|
+
flexWrap,
|
|
1755
|
+
justifyContent,
|
|
1756
|
+
alignContent,
|
|
1757
|
+
alignItems,
|
|
1758
|
+
alignSelf,
|
|
1759
|
+
flexGrow,
|
|
1760
|
+
flexShrink,
|
|
1761
|
+
float,
|
|
1762
|
+
overflow,
|
|
1763
|
+
overlay,
|
|
1764
|
+
interaction,
|
|
1765
|
+
radius,
|
|
1766
|
+
shadow,
|
|
1767
|
+
responsive,
|
|
1768
|
+
viewport,
|
|
1769
|
+
]);
|
|
1770
|
+
return { bulmaHelperClasses, rest };
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Builds Bulma column and offset class names for the Column component.
|
|
1775
|
+
*/
|
|
1776
|
+
function getColumnClassNames(props) {
|
|
1777
|
+
const classList = [];
|
|
1778
|
+
// Sizes
|
|
1779
|
+
const sizeProps = [
|
|
1780
|
+
{ prop: 'size', prefix: 'is', suffix: '' },
|
|
1781
|
+
{ prop: 'sizeMobile', prefix: 'is', suffix: 'mobile' },
|
|
1782
|
+
{ prop: 'sizeTablet', prefix: 'is', suffix: 'tablet' },
|
|
1783
|
+
{ prop: 'sizeDesktop', prefix: 'is', suffix: 'desktop' },
|
|
1784
|
+
{ prop: 'sizeWidescreen', prefix: 'is', suffix: 'widescreen' },
|
|
1785
|
+
{ prop: 'sizeFullhd', prefix: 'is', suffix: 'fullhd' },
|
|
1786
|
+
];
|
|
1787
|
+
for (const { prop, prefix, suffix } of sizeProps) {
|
|
1788
|
+
const val = props[prop];
|
|
1789
|
+
if (val !== undefined && val !== null) {
|
|
1790
|
+
let className = `${prefix}-${val}`;
|
|
1791
|
+
if (suffix)
|
|
1792
|
+
className += `-${suffix}`;
|
|
1793
|
+
classList.push(className);
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
// Offsets
|
|
1797
|
+
const offsetProps = [
|
|
1798
|
+
{ prop: 'offset', prefix: 'is-offset', suffix: '' },
|
|
1799
|
+
{ prop: 'offsetMobile', prefix: 'is-offset', suffix: 'mobile' },
|
|
1800
|
+
{ prop: 'offsetTablet', prefix: 'is-offset', suffix: 'tablet' },
|
|
1801
|
+
{ prop: 'offsetDesktop', prefix: 'is-offset', suffix: 'desktop' },
|
|
1802
|
+
{ prop: 'offsetWidescreen', prefix: 'is-offset', suffix: 'widescreen' },
|
|
1803
|
+
{ prop: 'offsetFullhd', prefix: 'is-offset', suffix: 'fullhd' },
|
|
1804
|
+
];
|
|
1805
|
+
for (const { prop, prefix, suffix } of offsetProps) {
|
|
1806
|
+
const val = props[prop];
|
|
1807
|
+
if (val !== undefined && val !== null) {
|
|
1808
|
+
let className = `${prefix}-${val}`;
|
|
1809
|
+
if (suffix)
|
|
1810
|
+
className += `-${suffix}`;
|
|
1811
|
+
classList.push(className);
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
// isNarrow (responsive)
|
|
1815
|
+
if (props.isNarrow)
|
|
1816
|
+
classList.push('is-narrow');
|
|
1817
|
+
if (props.isNarrowMobile)
|
|
1818
|
+
classList.push('is-narrow-mobile');
|
|
1819
|
+
if (props.isNarrowTablet)
|
|
1820
|
+
classList.push('is-narrow-tablet');
|
|
1821
|
+
if (props.isNarrowTouch)
|
|
1822
|
+
classList.push('is-narrow-touch');
|
|
1823
|
+
if (props.isNarrowDesktop)
|
|
1824
|
+
classList.push('is-narrow-desktop');
|
|
1825
|
+
if (props.isNarrowWidescreen)
|
|
1826
|
+
classList.push('is-narrow-widescreen');
|
|
1827
|
+
if (props.isNarrowFullhd)
|
|
1828
|
+
classList.push('is-narrow-fullhd');
|
|
1829
|
+
return classList;
|
|
1830
|
+
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Bulma Column component for responsive grid layouts.
|
|
1833
|
+
*
|
|
1834
|
+
* @function
|
|
1835
|
+
* @param {ColumnProps} props - Props for the Column component.
|
|
1836
|
+
* @returns {JSX.Element} The rendered column.
|
|
1837
|
+
* @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}
|
|
1838
|
+
*/
|
|
1839
|
+
const Column = ({ className, textColor, bgColor, size, sizeMobile, sizeTablet, sizeDesktop, sizeWidescreen, sizeFullhd, offset, offsetMobile, offsetTablet, offsetDesktop, offsetWidescreen, offsetFullhd, isNarrow, isNarrowMobile, isNarrowTablet, isNarrowTouch, isNarrowDesktop, isNarrowWidescreen, isNarrowFullhd, children, ...props }) => {
|
|
1840
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1841
|
+
color: textColor,
|
|
1842
|
+
backgroundColor: bgColor,
|
|
1843
|
+
...props,
|
|
1844
|
+
});
|
|
1845
|
+
const columnClasses = classNames('column', ...getColumnClassNames({
|
|
1846
|
+
size,
|
|
1847
|
+
sizeMobile,
|
|
1848
|
+
sizeTablet,
|
|
1849
|
+
sizeDesktop,
|
|
1850
|
+
sizeWidescreen,
|
|
1851
|
+
sizeFullhd,
|
|
1852
|
+
offset,
|
|
1853
|
+
offsetMobile,
|
|
1854
|
+
offsetTablet,
|
|
1855
|
+
offsetDesktop,
|
|
1856
|
+
offsetWidescreen,
|
|
1857
|
+
offsetFullhd,
|
|
1858
|
+
isNarrow,
|
|
1859
|
+
isNarrowMobile,
|
|
1860
|
+
isNarrowTablet,
|
|
1861
|
+
isNarrowTouch,
|
|
1862
|
+
isNarrowDesktop,
|
|
1863
|
+
isNarrowWidescreen,
|
|
1864
|
+
isNarrowFullhd,
|
|
1865
|
+
}), className, bulmaHelperClasses);
|
|
1866
|
+
return (jsxRuntimeExports.jsx("div", { className: columnClasses, ...rest, children: children }));
|
|
1867
|
+
};
|
|
1868
|
+
|
|
1869
|
+
/**
|
|
1870
|
+
* Builds Bulma gap classes for the Columns component.
|
|
1871
|
+
*/
|
|
1872
|
+
function getGapClasses(props) {
|
|
1873
|
+
const gapClassMap = [
|
|
1874
|
+
{ prop: 'gapSize', prefix: 'is' },
|
|
1875
|
+
{ prop: 'gapSizeMobile', prefix: 'is', suffix: 'mobile' },
|
|
1876
|
+
{ prop: 'gapSizeTablet', prefix: 'is', suffix: 'tablet' },
|
|
1877
|
+
{ prop: 'gapSizeDesktop', prefix: 'is', suffix: 'desktop' },
|
|
1878
|
+
{ prop: 'gapSizeWidescreen', prefix: 'is', suffix: 'widescreen' },
|
|
1879
|
+
{ prop: 'gapSizeFullhd', prefix: 'is', suffix: 'fullhd' },
|
|
1880
|
+
];
|
|
1881
|
+
return gapClassMap.flatMap(({ prop, prefix, suffix }) => {
|
|
1882
|
+
const val = props[prop];
|
|
1883
|
+
if (val !== undefined && val !== null) {
|
|
1884
|
+
let className = `${prefix}-${val}`;
|
|
1885
|
+
if (suffix)
|
|
1886
|
+
className += `-${suffix}`;
|
|
1887
|
+
return [className];
|
|
1888
|
+
}
|
|
1889
|
+
return [];
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
/**
|
|
1893
|
+
* Bulma Columns container for flexible, responsive layouts.
|
|
1894
|
+
*
|
|
1895
|
+
* @function
|
|
1896
|
+
* @param {ColumnsProps} props - Props for the Columns component.
|
|
1897
|
+
* @returns {JSX.Element} The rendered columns container.
|
|
1898
|
+
* @see {@link https://bulma.io/documentation/columns/ | Bulma Columns documentation}
|
|
1899
|
+
*/
|
|
1900
|
+
const Columns = ({ className, textColor, bgColor, isCentered, isGapless, isMultiline, isVCentered, isMobile, isDesktop, gapSize, gapSizeMobile, gapSizeTablet, gapSizeDesktop, gapSizeWidescreen, gapSizeFullhd, children, ...props }) => {
|
|
1901
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1902
|
+
color: textColor,
|
|
1903
|
+
backgroundColor: bgColor,
|
|
1904
|
+
...props,
|
|
1905
|
+
});
|
|
1906
|
+
const columnsClasses = classNames('columns', {
|
|
1907
|
+
'is-centered': isCentered,
|
|
1908
|
+
'is-gapless': isGapless,
|
|
1909
|
+
'is-multiline': isMultiline,
|
|
1910
|
+
'is-vcentered': isVCentered,
|
|
1911
|
+
'is-mobile': isMobile,
|
|
1912
|
+
'is-desktop': isDesktop,
|
|
1913
|
+
}, ...getGapClasses({
|
|
1914
|
+
gapSize,
|
|
1915
|
+
gapSizeMobile,
|
|
1916
|
+
gapSizeTablet,
|
|
1917
|
+
gapSizeDesktop,
|
|
1918
|
+
gapSizeWidescreen,
|
|
1919
|
+
gapSizeFullhd,
|
|
1920
|
+
}), className, bulmaHelperClasses);
|
|
1921
|
+
return (jsxRuntimeExports.jsx("div", { className: columnsClasses, ...rest, children: children }));
|
|
1922
|
+
};
|
|
1923
|
+
|
|
1924
|
+
const validBreadcrumbAlignments = ['centered', 'right'];
|
|
1925
|
+
const validBreadcrumbSeparators = [
|
|
1926
|
+
'arrow',
|
|
1927
|
+
'bullet',
|
|
1928
|
+
'dot',
|
|
1929
|
+
'succeeds',
|
|
1930
|
+
];
|
|
1931
|
+
const validBreadcrumbSizes = ['small', 'medium', 'large'];
|
|
1932
|
+
/**
|
|
1933
|
+
* Breadcrumb component for rendering a styled Bulma breadcrumb navigation.
|
|
1934
|
+
*
|
|
1935
|
+
* Supports alignment, separator styles, and sizes.
|
|
1936
|
+
*
|
|
1937
|
+
* @function
|
|
1938
|
+
* @param {BreadcrumbProps} props - Props for the Breadcrumb component.
|
|
1939
|
+
* @returns {JSX.Element} The rendered breadcrumb element.
|
|
1940
|
+
* @see {@link https://bulma.io/documentation/components/breadcrumb/ | Bulma Breadcrumb documentation}
|
|
1941
|
+
*/
|
|
1942
|
+
const Breadcrumb = ({ className, alignment, separator, size, children, ...props }) => {
|
|
1943
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
1944
|
+
const breadcrumbClasses = classNames('breadcrumb', className, bulmaHelperClasses, {
|
|
1945
|
+
[`is-${alignment}`]: alignment && validBreadcrumbAlignments.includes(alignment),
|
|
1946
|
+
[`has-${separator}-separator`]: separator && validBreadcrumbSeparators.includes(separator),
|
|
1947
|
+
[`is-${size}`]: size && validBreadcrumbSizes.includes(size),
|
|
1948
|
+
});
|
|
1949
|
+
return (jsxRuntimeExports.jsx("nav", { className: breadcrumbClasses, "aria-label": "breadcrumbs", ...rest, children: jsxRuntimeExports.jsx("ul", { children: children }) }));
|
|
1950
|
+
};
|
|
1951
|
+
|
|
1952
|
+
// Always wrap each footer item in .card-footer-item
|
|
1953
|
+
const renderFooter = (footer) => {
|
|
1954
|
+
if (!footer)
|
|
1955
|
+
return null;
|
|
1956
|
+
const items = Array.isArray(footer) ? footer : [footer];
|
|
1957
|
+
return items.map((item, idx) => (jsxRuntimeExports.jsx("span", { className: "card-footer-item", children: item }, idx)));
|
|
1958
|
+
};
|
|
1959
|
+
/**
|
|
1960
|
+
* Card component for rendering a styled Bulma card.
|
|
1961
|
+
*
|
|
1962
|
+
* @function
|
|
1963
|
+
* @param {CardProps} props - Props for the Card component.
|
|
1964
|
+
* @returns {JSX.Element} The rendered card element.
|
|
1965
|
+
* @see {@link https://bulma.io/documentation/components/card/ | Bulma Card documentation}
|
|
1966
|
+
*/
|
|
1967
|
+
const Card = ({ className, children, textColor, bgColor, hasShadow = true, header, headerCentered, headerIcon, footer, image, imageAlt, ...props }) => {
|
|
1968
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
1969
|
+
color: textColor,
|
|
1970
|
+
backgroundColor: bgColor,
|
|
1971
|
+
...props,
|
|
1972
|
+
});
|
|
1973
|
+
const cardClasses = classNames('card', className, bulmaHelperClasses, {
|
|
1974
|
+
'is-shadowless': !hasShadow,
|
|
1975
|
+
});
|
|
1976
|
+
// Render header with optional icon and is-centered modifier
|
|
1977
|
+
const renderHeader = (header, headerIcon, headerCentered) => {
|
|
1978
|
+
if (!header && !headerIcon)
|
|
1979
|
+
return null;
|
|
1980
|
+
return (jsxRuntimeExports.jsxs("header", { className: "card-header", children: [header && (jsxRuntimeExports.jsx("div", { className: classNames('card-header-title', {
|
|
1981
|
+
'is-centered': headerCentered,
|
|
1982
|
+
}), children: header })), headerIcon] }));
|
|
1983
|
+
};
|
|
1984
|
+
return (jsxRuntimeExports.jsxs("div", { className: cardClasses, ...rest, children: [renderHeader(header, headerIcon, headerCentered), image && (jsxRuntimeExports.jsx("div", { className: "card-image", children: typeof image === 'string' ? (jsxRuntimeExports.jsx("figure", { className: "image", children: jsxRuntimeExports.jsx("img", { src: image, alt: imageAlt !== null && imageAlt !== void 0 ? imageAlt : 'Card image' }) })) : (image) })), typeof children !== 'undefined' &&
|
|
1985
|
+
children !== null &&
|
|
1986
|
+
children !== '' && jsxRuntimeExports.jsx("div", { className: "card-content", children: children }), footer && (jsxRuntimeExports.jsx("footer", { className: "card-footer", children: renderFooter(footer) }))] }));
|
|
1987
|
+
};
|
|
1988
|
+
// Only for test coverage
|
|
1989
|
+
const __test_exports__ = { renderFooter };
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* Checks if code is running in a browser environment.
|
|
1993
|
+
* @param win - Window object.
|
|
1994
|
+
* @param doc - Document object.
|
|
1995
|
+
* @returns {boolean} True if in browser, false otherwise.
|
|
1996
|
+
*/
|
|
1997
|
+
const isBrowser = (win, doc) => typeof win !== 'undefined' && typeof doc !== 'undefined';
|
|
1998
|
+
/**
|
|
1999
|
+
* Bulma Dropdown component.
|
|
2000
|
+
*
|
|
2001
|
+
* @function
|
|
2002
|
+
* @param {DropdownProps} props - Props for the Dropdown component.
|
|
2003
|
+
* @returns {JSX.Element} The rendered dropdown.
|
|
2004
|
+
* @see {@link https://bulma.io/documentation/components/dropdown/ | Bulma Dropdown documentation}
|
|
2005
|
+
*/
|
|
2006
|
+
const DropdownComponent = ({ label, children, className, menuClassName, active: activeProp, up, right, hoverable, disabled, onActiveChange, closeOnClick = true, id, ...props }) => {
|
|
2007
|
+
const [active, setActive] = useState(!!activeProp);
|
|
2008
|
+
const dropdownRef = useRef(null);
|
|
2009
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2010
|
+
// Controlled mode support
|
|
2011
|
+
useEffect(() => {
|
|
2012
|
+
if (typeof activeProp === 'boolean')
|
|
2013
|
+
setActive(activeProp);
|
|
2014
|
+
}, [activeProp]);
|
|
2015
|
+
// SSR-safe outside click
|
|
2016
|
+
useEffect(() => {
|
|
2017
|
+
if (!active)
|
|
2018
|
+
return;
|
|
2019
|
+
if (!isBrowser(window, document))
|
|
2020
|
+
return;
|
|
2021
|
+
const handleClick = (e) => {
|
|
2022
|
+
var _a;
|
|
2023
|
+
if (!((_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
2024
|
+
setActive(false);
|
|
2025
|
+
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(false);
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
document.addEventListener('mousedown', handleClick);
|
|
2029
|
+
return () => document.removeEventListener('mousedown', handleClick);
|
|
2030
|
+
}, [active, onActiveChange]);
|
|
2031
|
+
const handleToggle = () => {
|
|
2032
|
+
if (disabled)
|
|
2033
|
+
return;
|
|
2034
|
+
const newActive = !active;
|
|
2035
|
+
setActive(newActive);
|
|
2036
|
+
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(newActive);
|
|
2037
|
+
};
|
|
2038
|
+
const handleMenuClick = () => {
|
|
2039
|
+
if (closeOnClick) {
|
|
2040
|
+
setActive(false);
|
|
2041
|
+
onActiveChange === null || onActiveChange === void 0 ? void 0 : onActiveChange(false);
|
|
2042
|
+
}
|
|
2043
|
+
};
|
|
2044
|
+
const dropdownClasses = classNames('dropdown', bulmaHelperClasses, {
|
|
2045
|
+
'is-active': active,
|
|
2046
|
+
'is-up': up,
|
|
2047
|
+
'is-right': right,
|
|
2048
|
+
'is-hoverable': hoverable,
|
|
2049
|
+
'is-disabled': disabled,
|
|
2050
|
+
}, className);
|
|
2051
|
+
return (jsxRuntimeExports.jsxs("div", { className: dropdownClasses, ref: dropdownRef, id: id, "data-testid": "dropdown-root", ...rest, children: [jsxRuntimeExports.jsx("div", { className: "dropdown-trigger", children: jsxRuntimeExports.jsxs("button", { className: "button", "aria-haspopup": "true", "aria-controls": id ? `${id}-menu` : undefined, "aria-expanded": active, onClick: handleToggle, disabled: disabled, type: "button", children: [jsxRuntimeExports.jsx("span", { children: label }), jsxRuntimeExports.jsx("span", { className: "icon is-small", "aria-hidden": "true", children: jsxRuntimeExports.jsx("i", { className: "fas fa-angle-down" }) })] }) }), jsxRuntimeExports.jsx("div", { className: classNames('dropdown-menu', menuClassName), id: id ? `${id}-menu` : undefined, role: "menu", "data-testid": "dropdown-menu", children: jsxRuntimeExports.jsx("div", { className: "dropdown-content", onClick: handleMenuClick, tabIndex: -1, children: children }) })] }));
|
|
2052
|
+
};
|
|
2053
|
+
/**
|
|
2054
|
+
* Bulma Dropdown item.
|
|
2055
|
+
*
|
|
2056
|
+
* @function
|
|
2057
|
+
* @param {DropdownItemProps} props - Props for the DropdownItem component.
|
|
2058
|
+
* @returns {JSX.Element} The rendered dropdown item.
|
|
2059
|
+
*/
|
|
2060
|
+
const DropdownItem = ({ children, active, className, as: Component = 'a', ...props }) => {
|
|
2061
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2062
|
+
return (jsxRuntimeExports.jsx(Component, { className: classNames('dropdown-item', bulmaHelperClasses, { 'is-active': active }, className), tabIndex: 0, role: "menuitem", "data-testid": "dropdown-item", ...rest, children: children }));
|
|
2063
|
+
};
|
|
2064
|
+
/**
|
|
2065
|
+
* Bulma Dropdown divider.
|
|
2066
|
+
*
|
|
2067
|
+
* @returns {JSX.Element} The divider element.
|
|
2068
|
+
*/
|
|
2069
|
+
const DropdownDivider = () => (jsxRuntimeExports.jsx("hr", { className: "dropdown-divider" }));
|
|
2070
|
+
// Assign static subcomponents
|
|
2071
|
+
const Dropdown = Object.assign(DropdownComponent, {
|
|
2072
|
+
Item: DropdownItem,
|
|
2073
|
+
Divider: DropdownDivider,
|
|
2074
|
+
});
|
|
2075
|
+
|
|
2076
|
+
// Context to track MenuList nesting level
|
|
2077
|
+
const MenuListLevelContext = createContext(0);
|
|
2078
|
+
/**
|
|
2079
|
+
* Bulma Menu component.
|
|
2080
|
+
*
|
|
2081
|
+
* @function
|
|
2082
|
+
* @param {MenuProps} props - Props for the Menu component.
|
|
2083
|
+
* @returns {JSX.Element} The rendered menu.
|
|
2084
|
+
* @see {@link https://bulma.io/documentation/components/menu/ | Bulma Menu documentation}
|
|
2085
|
+
*/
|
|
2086
|
+
const MenuComponent = ({ className, children, ...props }) => {
|
|
2087
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2088
|
+
return (jsxRuntimeExports.jsx("aside", { className: classNames('menu', className, bulmaHelperClasses), ...rest, children: children }));
|
|
2089
|
+
};
|
|
2090
|
+
/**
|
|
2091
|
+
* Bulma Menu label component.
|
|
2092
|
+
*
|
|
2093
|
+
* @function
|
|
2094
|
+
* @param {MenuLabelProps} props - Props for the MenuLabel component.
|
|
2095
|
+
* @returns {JSX.Element} The rendered menu label.
|
|
2096
|
+
*/
|
|
2097
|
+
const MenuLabel = ({ className, children, ...props }) => {
|
|
2098
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2099
|
+
return (jsxRuntimeExports.jsx("p", { className: classNames('menu-label', className, bulmaHelperClasses), ...rest, children: children }));
|
|
2100
|
+
};
|
|
2101
|
+
/**
|
|
2102
|
+
* MenuList applies `menu-list` class only at the top level (not for nested lists).
|
|
2103
|
+
*
|
|
2104
|
+
* @function
|
|
2105
|
+
* @param {MenuListProps} props - Props for the MenuList component.
|
|
2106
|
+
* @returns {JSX.Element} The rendered menu list.
|
|
2107
|
+
*/
|
|
2108
|
+
const MenuList = ({ className, children, ...props }) => {
|
|
2109
|
+
const level = useContext(MenuListLevelContext);
|
|
2110
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2111
|
+
const ulClass = classNames(className, bulmaHelperClasses, {
|
|
2112
|
+
'menu-list': level === 0,
|
|
2113
|
+
});
|
|
2114
|
+
// Increment level for nested MenuLists
|
|
2115
|
+
return (jsxRuntimeExports.jsx(MenuListLevelContext.Provider, { value: level + 1, children: jsxRuntimeExports.jsx("ul", { className: ulClass, ...rest, children: children }) }));
|
|
2116
|
+
};
|
|
2117
|
+
/**
|
|
2118
|
+
* MenuItem supports `as` prop for custom link components, e.g., react-router-dom Link.
|
|
2119
|
+
*
|
|
2120
|
+
* @function
|
|
2121
|
+
* @param {MenuItemProps} props - Props for the MenuItem component.
|
|
2122
|
+
* @returns {JSX.Element} The rendered menu item.
|
|
2123
|
+
*/
|
|
2124
|
+
const MenuItem = ({ className, children, active, href, as: Component = 'a', 'data-testid': testId, ...rest }) => {
|
|
2125
|
+
const { bulmaHelperClasses, rest: bulmaRest } = useBulmaClasses(rest);
|
|
2126
|
+
const itemClass = classNames({ 'is-active': active }, bulmaHelperClasses);
|
|
2127
|
+
// Standard <li> props
|
|
2128
|
+
const { style, id, title, role, tabIndex, ...linkProps } = bulmaRest;
|
|
2129
|
+
// Split children into label and nested MenuList(s)
|
|
2130
|
+
const labelChildren = [];
|
|
2131
|
+
const nestedMenuLists = [];
|
|
2132
|
+
React.Children.forEach(children, child => {
|
|
2133
|
+
if (React.isValidElement(child) && child.type === MenuList) {
|
|
2134
|
+
nestedMenuLists.push(child);
|
|
2135
|
+
}
|
|
2136
|
+
else {
|
|
2137
|
+
labelChildren.push(child);
|
|
2138
|
+
}
|
|
2139
|
+
});
|
|
2140
|
+
// href/to should go to the link component
|
|
2141
|
+
if (Component === 'a' && href) {
|
|
2142
|
+
linkProps.href = href;
|
|
2143
|
+
}
|
|
2144
|
+
if (Object.prototype.hasOwnProperty.call(rest, 'to')) {
|
|
2145
|
+
linkProps.to = rest.to;
|
|
2146
|
+
}
|
|
2147
|
+
return (jsxRuntimeExports.jsxs("li", { className: className, "data-testid": testId, style: style, id: id, title: title, role: role, tabIndex: tabIndex, children: [jsxRuntimeExports.jsx(Component, { className: itemClass, ...linkProps, children: labelChildren }), nestedMenuLists] }));
|
|
2148
|
+
};
|
|
2149
|
+
// Attach static subcomponents
|
|
2150
|
+
const Menu = Object.assign(MenuComponent, {
|
|
2151
|
+
Label: MenuLabel,
|
|
2152
|
+
List: MenuList,
|
|
2153
|
+
Item: MenuItem,
|
|
2154
|
+
});
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* Bulma-styled Message component.
|
|
2158
|
+
*
|
|
2159
|
+
* Supports Bulma helper classes, color, and an optional close button.
|
|
2160
|
+
*
|
|
2161
|
+
* @function
|
|
2162
|
+
* @param {MessageProps} props - Props for the Message component.
|
|
2163
|
+
* @returns {JSX.Element} The rendered message.
|
|
2164
|
+
* @see {@link https://bulma.io/documentation/components/message/ | Bulma Message documentation}
|
|
2165
|
+
*/
|
|
2166
|
+
const Message = ({ className, title, textColor, color, bgColor, onClose, children, ...props }) => {
|
|
2167
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2168
|
+
color: textColor,
|
|
2169
|
+
backgroundColor: bgColor,
|
|
2170
|
+
...props,
|
|
2171
|
+
});
|
|
2172
|
+
const messageClasses = classNames('message', color && `is-${color}`, className, bulmaHelperClasses);
|
|
2173
|
+
return (jsxRuntimeExports.jsxs("article", { className: messageClasses, ...rest, "data-testid": "message", children: [(title || onClose) && (jsxRuntimeExports.jsxs("div", { className: "message-header", children: [title && jsxRuntimeExports.jsx("span", { children: title }), onClose && (jsxRuntimeExports.jsx("button", { className: "delete", "aria-label": "delete", onClick: onClose, type: "button", "data-testid": "message-close" }))] })), children && (jsxRuntimeExports.jsx("div", { className: "message-body", "data-testid": "message-body", children: children }))] }));
|
|
2174
|
+
};
|
|
2175
|
+
|
|
2176
|
+
/**
|
|
2177
|
+
* Bulma Modal component, supporting both modal-card and modal-content variants.
|
|
2178
|
+
*
|
|
2179
|
+
* @function
|
|
2180
|
+
* @param {ModalProps} props - Props for the Modal component.
|
|
2181
|
+
* @returns {JSX.Element} The rendered modal.
|
|
2182
|
+
* @see {@link https://bulma.io/documentation/components/modal/ | Bulma Modal documentation}
|
|
2183
|
+
*/
|
|
2184
|
+
const Modal = ({ active = false, onClose, className, textColor, bgColor, modalCardTitle, modalCardFoot, type, children, ...props }) => {
|
|
2185
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2186
|
+
color: textColor,
|
|
2187
|
+
backgroundColor: bgColor,
|
|
2188
|
+
...props,
|
|
2189
|
+
});
|
|
2190
|
+
// EXPLICIT type wins; fallback to auto detection if not provided
|
|
2191
|
+
let isModalCard;
|
|
2192
|
+
if (type === 'card')
|
|
2193
|
+
isModalCard = true;
|
|
2194
|
+
else if (type === 'content')
|
|
2195
|
+
isModalCard = false;
|
|
2196
|
+
else
|
|
2197
|
+
isModalCard = !!modalCardTitle || !!modalCardFoot;
|
|
2198
|
+
const modalClasses = classNames('modal', { 'is-active': active }, className, bulmaHelperClasses);
|
|
2199
|
+
return (jsxRuntimeExports.jsxs("div", { className: modalClasses, ...rest, "data-testid": "modal", children: [jsxRuntimeExports.jsx("div", { className: "modal-background", onClick: onClose, "data-testid": "modal-background" }), isModalCard ? (jsxRuntimeExports.jsxs("div", { className: "modal-card", children: [modalCardTitle && (jsxRuntimeExports.jsxs("header", { className: "modal-card-head", children: [jsxRuntimeExports.jsx("p", { className: "modal-card-title", children: modalCardTitle }), onClose && (jsxRuntimeExports.jsx("button", { className: "delete", "aria-label": "close", onClick: onClose, type: "button", "data-testid": "modal-close" }))] })), jsxRuntimeExports.jsx("section", { className: "modal-card-body", "data-testid": "modal-body", children: children }), modalCardFoot && (jsxRuntimeExports.jsx("footer", { className: "modal-card-foot", children: modalCardFoot }))] })) : (jsxRuntimeExports.jsx("div", { className: "modal-content", "data-testid": "modal-content", children: children })), (!isModalCard || (!modalCardTitle && onClose)) && onClose && (jsxRuntimeExports.jsx("button", { className: "modal-close is-large", "aria-label": "close", onClick: onClose, type: "button", "data-testid": "modal-close-float" }))] }));
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* Bulma Navbar component, supports subcomponents for structured navigation.
|
|
2204
|
+
*
|
|
2205
|
+
* @function
|
|
2206
|
+
* @param {NavbarProps} props - Props for the Navbar component.
|
|
2207
|
+
* @returns {JSX.Element} The rendered navbar.
|
|
2208
|
+
* @see {@link https://bulma.io/documentation/components/navbar/ | Bulma Navbar documentation}
|
|
2209
|
+
*/
|
|
2210
|
+
const Navbar = ({ className, textColor, bgColor, color, transparent, fixed, children, ...props }) => {
|
|
2211
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2212
|
+
color: textColor,
|
|
2213
|
+
backgroundColor: bgColor,
|
|
2214
|
+
...props,
|
|
2215
|
+
});
|
|
2216
|
+
const navbarClasses = classNames('navbar', bulmaHelperClasses, className, {
|
|
2217
|
+
[`is-${color}`]: color,
|
|
2218
|
+
'is-transparent': transparent,
|
|
2219
|
+
[`is-fixed-${fixed}`]: fixed,
|
|
2220
|
+
});
|
|
2221
|
+
return (jsxRuntimeExports.jsx("nav", { className: navbarClasses, role: "navigation", "aria-label": "main navigation", ...rest, children: children }));
|
|
2222
|
+
};
|
|
2223
|
+
/**
|
|
2224
|
+
* Bulma Navbar brand area (usually left side).
|
|
2225
|
+
*
|
|
2226
|
+
* @function
|
|
2227
|
+
* @param {NavbarBrandProps} props - Props for the NavbarBrand component.
|
|
2228
|
+
* @returns {JSX.Element} The rendered brand area.
|
|
2229
|
+
*/
|
|
2230
|
+
const NavbarBrand = ({ className, children, textColor, ...props }) => {
|
|
2231
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2232
|
+
color: textColor,
|
|
2233
|
+
...props,
|
|
2234
|
+
});
|
|
2235
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('navbar-brand', bulmaHelperClasses, className), ...rest, children: children }));
|
|
2236
|
+
};
|
|
2237
|
+
/**
|
|
2238
|
+
* Bulma Navbar item (link, button, etc).
|
|
2239
|
+
*
|
|
2240
|
+
* @function
|
|
2241
|
+
* @param {NavbarItemProps} props - Props for the NavbarItem component.
|
|
2242
|
+
* @returns {JSX.Element} The rendered item.
|
|
2243
|
+
*/
|
|
2244
|
+
const NavbarItem = ({ className, as: Component = 'a', active, textColor, bgColor, children, ...props }) => {
|
|
2245
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2246
|
+
color: textColor,
|
|
2247
|
+
backgroundColor: bgColor,
|
|
2248
|
+
...props,
|
|
2249
|
+
});
|
|
2250
|
+
return (jsxRuntimeExports.jsx(Component, { className: classNames('navbar-item', bulmaHelperClasses, className, {
|
|
2251
|
+
'is-active': active,
|
|
2252
|
+
}), ...rest, children: children }));
|
|
2253
|
+
};
|
|
2254
|
+
/**
|
|
2255
|
+
* Bulma Navbar burger (responsive menu toggle).
|
|
2256
|
+
*
|
|
2257
|
+
* @function
|
|
2258
|
+
* @param {NavbarBurgerProps} props - Props for the NavbarBurger component.
|
|
2259
|
+
* @returns {JSX.Element} The rendered burger.
|
|
2260
|
+
*/
|
|
2261
|
+
const NavbarBurger = ({ className, active, children, ...props }) => {
|
|
2262
|
+
var _a;
|
|
2263
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2264
|
+
...props,
|
|
2265
|
+
});
|
|
2266
|
+
return (jsxRuntimeExports.jsxs("button", { type: "button", className: classNames('navbar-burger', bulmaHelperClasses, className, {
|
|
2267
|
+
'is-active': active,
|
|
2268
|
+
}), "aria-label": props['aria-label'] || 'menu', "aria-expanded": (_a = props['aria-expanded']) !== null && _a !== void 0 ? _a : !!active, ...rest, children: [jsxRuntimeExports.jsx("span", { "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true" }), jsxRuntimeExports.jsx("span", { "aria-hidden": "true" }), children] }));
|
|
2269
|
+
};
|
|
2270
|
+
/**
|
|
2271
|
+
* Bulma Navbar menu area (collapsible content).
|
|
2272
|
+
*
|
|
2273
|
+
* @function
|
|
2274
|
+
* @param {NavbarMenuProps} props - Props for the NavbarMenu component.
|
|
2275
|
+
* @returns {JSX.Element} The rendered menu.
|
|
2276
|
+
*/
|
|
2277
|
+
const NavbarMenu = ({ className, active, children, ...props }) => {
|
|
2278
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2279
|
+
...props,
|
|
2280
|
+
});
|
|
2281
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('navbar-menu', bulmaHelperClasses, className, {
|
|
2282
|
+
'is-active': active,
|
|
2283
|
+
}), ...rest, children: children }));
|
|
2284
|
+
};
|
|
2285
|
+
/**
|
|
2286
|
+
* Bulma Navbar start area (left-aligned).
|
|
2287
|
+
*
|
|
2288
|
+
* @function
|
|
2289
|
+
* @param {NavbarStartEndProps} props - Props for the NavbarStart component.
|
|
2290
|
+
* @returns {JSX.Element} The rendered start area.
|
|
2291
|
+
*/
|
|
2292
|
+
const NavbarStart = ({ className, children, ...props }) => {
|
|
2293
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2294
|
+
...props,
|
|
2295
|
+
});
|
|
2296
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('navbar-start', bulmaHelperClasses, className), ...rest, children: children }));
|
|
2297
|
+
};
|
|
2298
|
+
/**
|
|
2299
|
+
* Bulma Navbar end area (right-aligned).
|
|
2300
|
+
*
|
|
2301
|
+
* @function
|
|
2302
|
+
* @param {NavbarStartEndProps} props - Props for the NavbarEnd component.
|
|
2303
|
+
* @returns {JSX.Element} The rendered end area.
|
|
2304
|
+
*/
|
|
2305
|
+
const NavbarEnd = ({ className, children, ...props }) => {
|
|
2306
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2307
|
+
...props,
|
|
2308
|
+
});
|
|
2309
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('navbar-end', bulmaHelperClasses, className), ...rest, children: children }));
|
|
2310
|
+
};
|
|
2311
|
+
/**
|
|
2312
|
+
* Bulma Navbar dropdown (for nested dropdown menus).
|
|
2313
|
+
*
|
|
2314
|
+
* @function
|
|
2315
|
+
* @param {NavbarDropdownProps} props - Props for the NavbarDropdown component.
|
|
2316
|
+
* @returns {JSX.Element} The rendered dropdown.
|
|
2317
|
+
*/
|
|
2318
|
+
const NavbarDropdown = ({ className, right, up, hoverable, active, children, ...props }) => (jsxRuntimeExports.jsx("div", { className: classNames('navbar-item', 'has-dropdown', {
|
|
2319
|
+
'is-right': right,
|
|
2320
|
+
'is-up': up,
|
|
2321
|
+
'is-hoverable': hoverable,
|
|
2322
|
+
'is-active': active,
|
|
2323
|
+
}, className), ...props, children: children }));
|
|
2324
|
+
/**
|
|
2325
|
+
* Bulma Navbar dropdown menu container.
|
|
2326
|
+
*
|
|
2327
|
+
* @function
|
|
2328
|
+
* @param {NavbarDropdownMenuProps} props - Props for the NavbarDropdownMenu component.
|
|
2329
|
+
* @returns {JSX.Element} The rendered dropdown menu.
|
|
2330
|
+
*/
|
|
2331
|
+
const NavbarDropdownMenu = ({ className, right, up, children, ...props }) => (jsxRuntimeExports.jsx("div", { className: classNames('navbar-dropdown', {
|
|
2332
|
+
'is-right': right,
|
|
2333
|
+
'is-up': up,
|
|
2334
|
+
}, className), ...props, children: children }));
|
|
2335
|
+
/**
|
|
2336
|
+
* Bulma Navbar divider.
|
|
2337
|
+
*
|
|
2338
|
+
* @param props - Standard hr props.
|
|
2339
|
+
* @returns {JSX.Element} The rendered divider.
|
|
2340
|
+
*/
|
|
2341
|
+
const NavbarDivider = props => jsxRuntimeExports.jsx("hr", { className: "navbar-divider", ...props });
|
|
2342
|
+
// Attach subcomponents
|
|
2343
|
+
Navbar.Brand = NavbarBrand;
|
|
2344
|
+
Navbar.Item = NavbarItem;
|
|
2345
|
+
Navbar.Burger = NavbarBurger;
|
|
2346
|
+
Navbar.Menu = NavbarMenu;
|
|
2347
|
+
Navbar.Start = NavbarStart;
|
|
2348
|
+
Navbar.End = NavbarEnd;
|
|
2349
|
+
Navbar.Dropdown = NavbarDropdown;
|
|
2350
|
+
Navbar.DropdownMenu = NavbarDropdownMenu;
|
|
2351
|
+
Navbar.Divider = NavbarDivider;
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* Bulma Pagination previous button.
|
|
2355
|
+
*/
|
|
2356
|
+
const PaginationPrevious = ({ className, disabled, children, ...props }) => (jsxRuntimeExports.jsx("a", { className: classNames('pagination-previous', className, {
|
|
2357
|
+
'is-disabled': disabled,
|
|
2358
|
+
}), "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, ...props, onClick: disabled
|
|
2359
|
+
? e => {
|
|
2360
|
+
e.preventDefault();
|
|
2361
|
+
e.stopPropagation();
|
|
2362
|
+
}
|
|
2363
|
+
: props.onClick, children: children }));
|
|
2364
|
+
/**
|
|
2365
|
+
* Bulma Pagination next button.
|
|
2366
|
+
*/
|
|
2367
|
+
const PaginationNext = ({ className, disabled, children, ...props }) => (jsxRuntimeExports.jsx("a", { className: classNames('pagination-next', className, {
|
|
2368
|
+
'is-disabled': disabled,
|
|
2369
|
+
}), "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, ...props, onClick: disabled
|
|
2370
|
+
? e => {
|
|
2371
|
+
e.preventDefault();
|
|
2372
|
+
e.stopPropagation();
|
|
2373
|
+
}
|
|
2374
|
+
: props.onClick, children: children }));
|
|
2375
|
+
/**
|
|
2376
|
+
* Bulma Pagination navigation component.
|
|
2377
|
+
*
|
|
2378
|
+
* @function
|
|
2379
|
+
* @param {PaginationProps} props - Props for the Pagination component.
|
|
2380
|
+
* @returns {JSX.Element} The rendered pagination.
|
|
2381
|
+
* @see {@link https://bulma.io/documentation/components/pagination/ | Bulma Pagination documentation}
|
|
2382
|
+
*/
|
|
2383
|
+
const Pagination = ({ color, textColor, bgColor, size, align, rounded, className, children, ...props }) => {
|
|
2384
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2385
|
+
color: textColor,
|
|
2386
|
+
backgroundColor: bgColor,
|
|
2387
|
+
...props,
|
|
2388
|
+
});
|
|
2389
|
+
const paginationClasses = classNames('pagination', bulmaHelperClasses, className, {
|
|
2390
|
+
[`is-${color}`]: color,
|
|
2391
|
+
[`is-${size}`]: size,
|
|
2392
|
+
[`is-${align}`]: align,
|
|
2393
|
+
'is-rounded': rounded,
|
|
2394
|
+
});
|
|
2395
|
+
return (jsxRuntimeExports.jsx("nav", { className: paginationClasses, role: "navigation", "aria-label": "pagination", ...rest, children: children }));
|
|
2396
|
+
};
|
|
2397
|
+
/**
|
|
2398
|
+
* Bulma Pagination list container.
|
|
2399
|
+
*/
|
|
2400
|
+
const PaginationList = ({ className, textColor, bgColor, children, ...props }) => {
|
|
2401
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2402
|
+
color: textColor,
|
|
2403
|
+
backgroundColor: bgColor,
|
|
2404
|
+
...props,
|
|
2405
|
+
});
|
|
2406
|
+
return (jsxRuntimeExports.jsx("ul", { className: classNames('pagination-list', bulmaHelperClasses, className), ...rest, children: children }));
|
|
2407
|
+
};
|
|
2408
|
+
/**
|
|
2409
|
+
* Bulma Pagination link (page number).
|
|
2410
|
+
*/
|
|
2411
|
+
const PaginationLink = ({ className, textColor, bgColor, active, disabled, onClick, children, ...props }) => {
|
|
2412
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2413
|
+
color: textColor,
|
|
2414
|
+
backgroundColor: bgColor,
|
|
2415
|
+
...props,
|
|
2416
|
+
});
|
|
2417
|
+
const handleClick = (e) => {
|
|
2418
|
+
if (disabled) {
|
|
2419
|
+
e.preventDefault();
|
|
2420
|
+
e.stopPropagation();
|
|
2421
|
+
return;
|
|
2422
|
+
}
|
|
2423
|
+
if (onClick) {
|
|
2424
|
+
onClick(e);
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
return (jsxRuntimeExports.jsx("li", { children: jsxRuntimeExports.jsx("a", { className: classNames('pagination-link', bulmaHelperClasses, className, {
|
|
2428
|
+
'is-current': active,
|
|
2429
|
+
'is-disabled': disabled,
|
|
2430
|
+
}), "aria-current": active ? 'page' : undefined, "aria-disabled": disabled, tabIndex: disabled ? -1 : 0, onClick: handleClick, ...rest, children: children }) }));
|
|
2431
|
+
};
|
|
2432
|
+
/**
|
|
2433
|
+
* Bulma Pagination ellipsis element.
|
|
2434
|
+
*
|
|
2435
|
+
* @param props - Standard li props.
|
|
2436
|
+
* @returns {JSX.Element} The rendered ellipsis.
|
|
2437
|
+
*/
|
|
2438
|
+
const PaginationEllipsis = props => (jsxRuntimeExports.jsx("li", { children: jsxRuntimeExports.jsx("span", { className: "pagination-ellipsis", ...props, children: "\u2026" }) }));
|
|
2439
|
+
Pagination.Link = PaginationLink;
|
|
2440
|
+
Pagination.List = PaginationList;
|
|
2441
|
+
Pagination.Ellipsis = PaginationEllipsis;
|
|
2442
|
+
Pagination.Previous = PaginationPrevious;
|
|
2443
|
+
Pagination.Next = PaginationNext;
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Bulma Panel component, supports various panel subcomponents.
|
|
2447
|
+
*
|
|
2448
|
+
* @function
|
|
2449
|
+
* @param {PanelProps} props - Props for the Panel component.
|
|
2450
|
+
* @returns {JSX.Element} The rendered panel.
|
|
2451
|
+
* @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}
|
|
2452
|
+
*/
|
|
2453
|
+
const Panel = ({ color, className, children, ...props }) => {
|
|
2454
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2455
|
+
color,
|
|
2456
|
+
...props,
|
|
2457
|
+
});
|
|
2458
|
+
const panelClasses = classNames('panel', bulmaHelperClasses, className, {
|
|
2459
|
+
[`is-${color}`]: color,
|
|
2460
|
+
});
|
|
2461
|
+
return (jsxRuntimeExports.jsx("nav", { className: panelClasses, ...rest, children: children }));
|
|
2462
|
+
};
|
|
2463
|
+
/**
|
|
2464
|
+
* Bulma Panel heading.
|
|
2465
|
+
*/
|
|
2466
|
+
const PanelHeading = ({ className, children, ...props }) => (jsxRuntimeExports.jsx("p", { className: classNames('panel-heading', className), ...props, children: children }));
|
|
2467
|
+
/**
|
|
2468
|
+
* Bulma Panel tabs.
|
|
2469
|
+
*/
|
|
2470
|
+
const PanelTabs = ({ className, children, ...props }) => (jsxRuntimeExports.jsx("p", { className: classNames('panel-tabs', className), ...props, children: children }));
|
|
2471
|
+
/**
|
|
2472
|
+
* Bulma Panel block.
|
|
2473
|
+
*/
|
|
2474
|
+
const PanelBlock = ({ className, active, children, ...props }) => (jsxRuntimeExports.jsx("a", { className: classNames('panel-block', className, { 'is-active': active }), ...props, children: children }));
|
|
2475
|
+
/**
|
|
2476
|
+
* Bulma Panel icon.
|
|
2477
|
+
*/
|
|
2478
|
+
const PanelIcon = ({ className, children, ...props }) => (jsxRuntimeExports.jsx("span", { className: classNames('panel-icon', className), ...props, children: children }));
|
|
2479
|
+
/**
|
|
2480
|
+
* Bulma Panel input block.
|
|
2481
|
+
*/
|
|
2482
|
+
const PanelInputBlock = ({ value, onChange, placeholder, iconClassName = 'fas fa-search', ...props }) => (jsxRuntimeExports.jsx("div", { className: "panel-block", ...props, children: jsxRuntimeExports.jsxs("p", { className: "control has-icons-left", children: [jsxRuntimeExports.jsx("input", { className: "input", type: "text", placeholder: placeholder, value: value, onChange: onChange }), jsxRuntimeExports.jsx("span", { className: "icon is-left", children: jsxRuntimeExports.jsx("i", { className: iconClassName, "aria-hidden": "true" }) })] }) }));
|
|
2483
|
+
/**
|
|
2484
|
+
* Bulma Panel checkbox block.
|
|
2485
|
+
*/
|
|
2486
|
+
const PanelCheckboxBlock = ({ checked, onChange, children, ...props }) => (jsxRuntimeExports.jsxs("label", { className: "panel-block", ...props, children: [jsxRuntimeExports.jsx("input", { type: "checkbox", checked: checked, onChange: onChange }), children] }));
|
|
2487
|
+
/**
|
|
2488
|
+
* Bulma Panel button block.
|
|
2489
|
+
*/
|
|
2490
|
+
const PanelButtonBlock = ({ children, className, ...props }) => (jsxRuntimeExports.jsx("div", { className: "panel-block", children: jsxRuntimeExports.jsx("button", { className: classNames('button is-link is-outlined is-fullwidth', className), ...props, children: children }) }));
|
|
2491
|
+
Panel.Heading = PanelHeading;
|
|
2492
|
+
Panel.Tabs = PanelTabs;
|
|
2493
|
+
Panel.Block = PanelBlock;
|
|
2494
|
+
Panel.Icon = PanelIcon;
|
|
2495
|
+
Panel.InputBlock = PanelInputBlock;
|
|
2496
|
+
Panel.CheckboxBlock = PanelCheckboxBlock;
|
|
2497
|
+
Panel.ButtonBlock = PanelButtonBlock;
|
|
2498
|
+
|
|
2499
|
+
/**
|
|
2500
|
+
* Bulma Tabs component with subcomponents for tab lists and items.
|
|
2501
|
+
*
|
|
2502
|
+
* @function
|
|
2503
|
+
* @param {TabsProps} props - Props for the Tabs component.
|
|
2504
|
+
* @returns {JSX.Element} The rendered tabs.
|
|
2505
|
+
* @see {@link https://bulma.io/documentation/components/tabs/ | Bulma Tabs documentation}
|
|
2506
|
+
*/
|
|
2507
|
+
const Tabs = ({ align, size, fullwidth, boxed, toggle, rounded, color, className, children, ...props }) => {
|
|
2508
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2509
|
+
color,
|
|
2510
|
+
...props,
|
|
2511
|
+
});
|
|
2512
|
+
const tabsClass = classNames('tabs', bulmaHelperClasses, {
|
|
2513
|
+
[`is-${align}`]: align,
|
|
2514
|
+
[`is-${size}`]: size,
|
|
2515
|
+
'is-fullwidth': fullwidth,
|
|
2516
|
+
'is-boxed': boxed,
|
|
2517
|
+
'is-toggle': toggle,
|
|
2518
|
+
'is-toggle-rounded': toggle && rounded,
|
|
2519
|
+
[`is-${color}`]: color,
|
|
2520
|
+
}, className);
|
|
2521
|
+
return (jsxRuntimeExports.jsx("div", { className: tabsClass, ...rest, children: children }));
|
|
2522
|
+
};
|
|
2523
|
+
/**
|
|
2524
|
+
* Bulma Tab list container.
|
|
2525
|
+
*
|
|
2526
|
+
* @function
|
|
2527
|
+
* @param {TabListProps} props - Props for the TabList component.
|
|
2528
|
+
* @returns {JSX.Element} The rendered tab list.
|
|
2529
|
+
*/
|
|
2530
|
+
const TabList = ({ className, children, ...props }) => (jsxRuntimeExports.jsx("ul", { className: classNames(className), ...props, children: children }));
|
|
2531
|
+
/**
|
|
2532
|
+
* Bulma Tab item.
|
|
2533
|
+
*
|
|
2534
|
+
* @function
|
|
2535
|
+
* @param {TabItemProps} props - Props for the TabItem component.
|
|
2536
|
+
* @returns {JSX.Element} The rendered tab item.
|
|
2537
|
+
*/
|
|
2538
|
+
const TabItem = ({ active, className, children, onClick, ...props }) => (jsxRuntimeExports.jsx("li", { className: classNames({ 'is-active': active }, className), onClick: onClick, ...props, children: children }));
|
|
2539
|
+
Tabs.List = TabList;
|
|
2540
|
+
Tabs.Item = TabItem;
|
|
2541
|
+
|
|
2542
|
+
/**
|
|
2543
|
+
* Block component for rendering a styled Bulma block element.
|
|
2544
|
+
*
|
|
2545
|
+
* A block is a simple utility element that adds spacing (margin-bottom) between elements.
|
|
2546
|
+
* Supports Bulma helper classes for additional styling like text color, background color, and layout.
|
|
2547
|
+
*
|
|
2548
|
+
* @function
|
|
2549
|
+
* @param {BlockProps} props - Props for the Block component.
|
|
2550
|
+
* @returns {JSX.Element} The rendered block element.
|
|
2551
|
+
* @see {@link https://bulma.io/documentation/elements/block/ | Bulma Block documentation}
|
|
2552
|
+
*/
|
|
2553
|
+
const Block = ({ className, textColor, bgColor, children, ...props }) => {
|
|
2554
|
+
/**
|
|
2555
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2556
|
+
*/
|
|
2557
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2558
|
+
color: textColor,
|
|
2559
|
+
backgroundColor: bgColor,
|
|
2560
|
+
...props,
|
|
2561
|
+
});
|
|
2562
|
+
const blockClasses = classNames('block', className, bulmaHelperClasses);
|
|
2563
|
+
return (jsxRuntimeExports.jsx("div", { className: blockClasses, ...rest, children: children }));
|
|
2564
|
+
};
|
|
2565
|
+
|
|
2566
|
+
/**
|
|
2567
|
+
* Box component for rendering a styled Bulma box element.
|
|
2568
|
+
*
|
|
2569
|
+
* Supports Bulma helper classes for styling and layout, with optional shadow control.
|
|
2570
|
+
*
|
|
2571
|
+
* @function
|
|
2572
|
+
* @param {BoxProps} props - Props for the Box component.
|
|
2573
|
+
* @returns {JSX.Element} The rendered box element.
|
|
2574
|
+
* @see {@link https://bulma.io/documentation/elements/box/ | Bulma Box documentation}
|
|
2575
|
+
*/
|
|
2576
|
+
const Box = ({ className, textColor, bgColor, hasShadow = true, children, ...props }) => {
|
|
2577
|
+
/**
|
|
2578
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2579
|
+
*/
|
|
2580
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2581
|
+
color: textColor,
|
|
2582
|
+
backgroundColor: bgColor,
|
|
2583
|
+
...props,
|
|
2584
|
+
});
|
|
2585
|
+
const boxClasses = classNames('box', className, bulmaHelperClasses, {
|
|
2586
|
+
'is-shadowless': !hasShadow,
|
|
2587
|
+
});
|
|
2588
|
+
return (jsxRuntimeExports.jsx("div", { className: boxClasses, ...rest, children: children }));
|
|
2589
|
+
};
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Button component for rendering a Bulma-styled button or anchor.
|
|
2593
|
+
*
|
|
2594
|
+
* Supports Bulma helper classes for colors, sizes, and various button states and modifiers.
|
|
2595
|
+
*
|
|
2596
|
+
* @function
|
|
2597
|
+
* @param {ButtonProps} props - Props for the Button component.
|
|
2598
|
+
* @returns {JSX.Element} The rendered button or anchor element.
|
|
2599
|
+
* @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}
|
|
2600
|
+
*/
|
|
2601
|
+
const Button = ({ color, size, isLight, isRounded, isLoading, isStatic, isFullWidth, isOutlined, isInverted, isFocused, isActive, isHovered, isDisabled, className, children, textColor, bgColor, as = 'button', href, onClick, target, rel, ...props }) => {
|
|
2602
|
+
/**
|
|
2603
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2604
|
+
*/
|
|
2605
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2606
|
+
color: textColor,
|
|
2607
|
+
backgroundColor: bgColor,
|
|
2608
|
+
...props,
|
|
2609
|
+
});
|
|
2610
|
+
const buttonClasses = classNames('button', className, bulmaHelperClasses, {
|
|
2611
|
+
[`is-${color}`]: color,
|
|
2612
|
+
[`is-${size}`]: size && size !== 'normal',
|
|
2613
|
+
'is-light': isLight,
|
|
2614
|
+
'is-rounded': isRounded,
|
|
2615
|
+
'is-loading': isLoading,
|
|
2616
|
+
'is-static': isStatic,
|
|
2617
|
+
'is-fullwidth': isFullWidth,
|
|
2618
|
+
'is-outlined': isOutlined,
|
|
2619
|
+
'is-inverted': isInverted,
|
|
2620
|
+
'is-focused': isFocused,
|
|
2621
|
+
'is-active': isActive,
|
|
2622
|
+
'is-hovered': isHovered,
|
|
2623
|
+
'is-disabled': isDisabled,
|
|
2624
|
+
});
|
|
2625
|
+
if (as === 'a') {
|
|
2626
|
+
// Remove button-specific props (like 'type') from rest
|
|
2627
|
+
const { ...anchorRest } = rest;
|
|
2628
|
+
return (jsxRuntimeExports.jsx("a", { className: buttonClasses, href: href, target: target, rel: rel, "aria-disabled": isDisabled, tabIndex: isDisabled ? -1 : undefined, onClick: isDisabled
|
|
2629
|
+
? e => e.preventDefault()
|
|
2630
|
+
: onClick, ...anchorRest, children: children }));
|
|
2631
|
+
}
|
|
2632
|
+
return (jsxRuntimeExports.jsx("button", { className: buttonClasses, disabled: isDisabled, onClick: onClick, ...rest, children: children }));
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* Buttons component for rendering a group of Bulma-styled buttons.
|
|
2637
|
+
*
|
|
2638
|
+
* Supports Bulma helper classes for styling, color, and layout, including centering, right alignment, and grouping as addons.
|
|
2639
|
+
*
|
|
2640
|
+
* @function
|
|
2641
|
+
* @param {ButtonsProps} props - Props for the Buttons component.
|
|
2642
|
+
* @returns {JSX.Element} The rendered group of buttons.
|
|
2643
|
+
* @see {@link https://bulma.io/documentation/elements/button/#group | Bulma Button Group documentation}
|
|
2644
|
+
*/
|
|
2645
|
+
const Buttons = ({ className, textColor, bgColor, isCentered, isRight, hasAddons, children, ...props }) => {
|
|
2646
|
+
/**
|
|
2647
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2648
|
+
*/
|
|
2649
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2650
|
+
color: textColor,
|
|
2651
|
+
backgroundColor: bgColor,
|
|
2652
|
+
...props,
|
|
2653
|
+
});
|
|
2654
|
+
const buttonsClasses = classNames('buttons', className, bulmaHelperClasses, {
|
|
2655
|
+
'is-centered': isCentered,
|
|
2656
|
+
'is-right': isRight,
|
|
2657
|
+
'has-addons': hasAddons,
|
|
2658
|
+
});
|
|
2659
|
+
return (jsxRuntimeExports.jsx("div", { className: buttonsClasses, ...rest, children: children }));
|
|
2660
|
+
};
|
|
2661
|
+
|
|
2662
|
+
// Valid size modifiers for the content class
|
|
2663
|
+
const validSizes = ['small', 'medium', 'large'];
|
|
2664
|
+
/**
|
|
2665
|
+
* Content component for rendering a styled Bulma content block.
|
|
2666
|
+
*
|
|
2667
|
+
* Applies typographic styles to HTML content (e.g., paragraphs, headings, lists) with Bulma's content class.
|
|
2668
|
+
* Supports size modifiers and Bulma helper classes for additional styling.
|
|
2669
|
+
*
|
|
2670
|
+
* @function
|
|
2671
|
+
* @param {ContentProps} props - Props for the Content component.
|
|
2672
|
+
* @returns {JSX.Element} The rendered content block.
|
|
2673
|
+
* @see {@link https://bulma.io/documentation/elements/content/ | Bulma Content documentation}
|
|
2674
|
+
*/
|
|
2675
|
+
const Content = ({ className, textColor, bgColor, size, children, ...props }) => {
|
|
2676
|
+
/**
|
|
2677
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2678
|
+
*/
|
|
2679
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2680
|
+
color: textColor,
|
|
2681
|
+
backgroundColor: bgColor,
|
|
2682
|
+
...props,
|
|
2683
|
+
});
|
|
2684
|
+
const contentClasses = classNames('content', className, bulmaHelperClasses, {
|
|
2685
|
+
[`is-${size}`]: size && size !== 'normal' && validSizes.includes(size),
|
|
2686
|
+
});
|
|
2687
|
+
return (jsxRuntimeExports.jsx("div", { className: contentClasses, ...rest, children: children }));
|
|
2688
|
+
};
|
|
2689
|
+
|
|
2690
|
+
/**
|
|
2691
|
+
* Delete component for rendering a Bulma-styled delete/close button.
|
|
2692
|
+
*
|
|
2693
|
+
* Supports Bulma helper classes for styling, color, and size, and includes accessibility and disabled state.
|
|
2694
|
+
*
|
|
2695
|
+
* @function
|
|
2696
|
+
* @param {DeleteProps} props - Props for the Delete component.
|
|
2697
|
+
* @returns {JSX.Element} The rendered delete button.
|
|
2698
|
+
* @see {@link https://bulma.io/documentation/elements/delete/ | Bulma Delete documentation}
|
|
2699
|
+
*/
|
|
2700
|
+
const Delete = ({ className, textColor, bgColor, onClick, size, ariaLabel = 'Close', disabled = false, ...props }) => {
|
|
2701
|
+
/**
|
|
2702
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2703
|
+
*/
|
|
2704
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2705
|
+
color: textColor,
|
|
2706
|
+
backgroundColor: bgColor,
|
|
2707
|
+
...props,
|
|
2708
|
+
});
|
|
2709
|
+
const classes = classNames('delete', {
|
|
2710
|
+
[`is-${size}`]: size,
|
|
2711
|
+
'is-disabled': disabled,
|
|
2712
|
+
}, bulmaHelperClasses, className);
|
|
2713
|
+
return (jsxRuntimeExports.jsx("button", { className: classes, onClick: onClick, "aria-label": ariaLabel, disabled: disabled, type: "button", ...rest }));
|
|
2714
|
+
};
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* Gets the correct classes for the icon element based on the library and features.
|
|
2718
|
+
*
|
|
2719
|
+
* @param {IconLibrary} library - The icon library.
|
|
2720
|
+
* @param {string} name - The icon name.
|
|
2721
|
+
* @param {string | string[]} [libraryFeatures] - Additional library-specific classes.
|
|
2722
|
+
* @returns {string} The combined class string for the icon.
|
|
2723
|
+
*/
|
|
2724
|
+
function getIconClasses(library, name, libraryFeatures) {
|
|
2725
|
+
let baseClass = '';
|
|
2726
|
+
let iconClass = '';
|
|
2727
|
+
let features = Array.isArray(libraryFeatures)
|
|
2728
|
+
? libraryFeatures
|
|
2729
|
+
: libraryFeatures
|
|
2730
|
+
? [libraryFeatures]
|
|
2731
|
+
: [];
|
|
2732
|
+
switch (library) {
|
|
2733
|
+
case 'fa': {
|
|
2734
|
+
// Font Awesome 5/6: use 'fas', 'far', 'fab', etc. as feature, icon is 'fa-<icon>'
|
|
2735
|
+
// If features contains a FA style ('fas', 'far', 'fab'), use it, otherwise default to 'fas'
|
|
2736
|
+
const faStyle = features.find(f => ['fas', 'far', 'fab', 'fal', 'fad', 'fat'].includes(f)) || 'fas';
|
|
2737
|
+
baseClass = faStyle;
|
|
2738
|
+
iconClass = `fa-${name}`;
|
|
2739
|
+
features = features.filter(f => f !== faStyle);
|
|
2740
|
+
return [baseClass, iconClass, ...features].join(' ');
|
|
2741
|
+
}
|
|
2742
|
+
case 'mdi':
|
|
2743
|
+
// Material Design Icons: always 'mdi mdi-<icon>'
|
|
2744
|
+
baseClass = 'mdi';
|
|
2745
|
+
iconClass = `mdi-${name}`;
|
|
2746
|
+
return [baseClass, iconClass, ...features].join(' ');
|
|
2747
|
+
case 'ion':
|
|
2748
|
+
// Ionicons (v4+): 'ion' and 'ion-<icon>'
|
|
2749
|
+
baseClass = 'ion';
|
|
2750
|
+
iconClass = `ion-${name}`;
|
|
2751
|
+
return [baseClass, iconClass, ...features].join(' ');
|
|
2752
|
+
default:
|
|
2753
|
+
// fallback: just icon name and features
|
|
2754
|
+
return [name, ...features].join(' ');
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Icon component for rendering a Bulma-styled icon container.
|
|
2759
|
+
*
|
|
2760
|
+
* Supports Bulma helper classes for styling, color, and size, and renders an <i></i> element for the icon itself.
|
|
2761
|
+
*
|
|
2762
|
+
* @function
|
|
2763
|
+
* @param {IconProps} props - Props for the Icon component.
|
|
2764
|
+
* @returns {JSX.Element} The rendered icon element.
|
|
2765
|
+
* @see {@link https://bulma.io/documentation/elements/icon/ | Bulma Icon documentation}
|
|
2766
|
+
*/
|
|
2767
|
+
const Icon = ({ className, textColor, bgColor, name, library = 'fa', // Font Awesome is default
|
|
2768
|
+
libraryFeatures, size, ariaLabel = 'icon', style, ...props }) => {
|
|
2769
|
+
/**
|
|
2770
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2771
|
+
*/
|
|
2772
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2773
|
+
color: textColor,
|
|
2774
|
+
backgroundColor: bgColor,
|
|
2775
|
+
...props,
|
|
2776
|
+
});
|
|
2777
|
+
const iconContainerClasses = classNames('icon', {
|
|
2778
|
+
[`is-${size}`]: size,
|
|
2779
|
+
}, bulmaHelperClasses, className);
|
|
2780
|
+
const iClasses = getIconClasses(library, name, libraryFeatures);
|
|
2781
|
+
return (jsxRuntimeExports.jsx("span", { className: iconContainerClasses, "aria-label": ariaLabel, style: style, ...rest, children: jsxRuntimeExports.jsx("i", { className: iClasses }) }));
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
/**
|
|
2785
|
+
* IconText component for rendering one or more icons with optional text, styled with Bulma.
|
|
2786
|
+
*
|
|
2787
|
+
* Supports Bulma helper classes for styling, color, and layout. Can render a single icon with text or multiple icon/text pairs.
|
|
2788
|
+
*
|
|
2789
|
+
* @function
|
|
2790
|
+
* @param {IconTextProps} props - Props for the IconText component.
|
|
2791
|
+
* @returns {JSX.Element} The rendered icon text element.
|
|
2792
|
+
* @see {@link https://bulma.io/documentation/elements/icon/#icon-text | Bulma IconText documentation}
|
|
2793
|
+
*/
|
|
2794
|
+
const IconText = ({ className, textColor, bgColor, iconProps, children, items, ...props }) => {
|
|
2795
|
+
/**
|
|
2796
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2797
|
+
*/
|
|
2798
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2799
|
+
color: textColor,
|
|
2800
|
+
backgroundColor: bgColor,
|
|
2801
|
+
...props,
|
|
2802
|
+
});
|
|
2803
|
+
const iconTextClasses = classNames('icon-text', bulmaHelperClasses, className);
|
|
2804
|
+
return (jsxRuntimeExports.jsx("span", { className: iconTextClasses, ...rest, children: items ? (items.map((item, index) => (jsxRuntimeExports.jsxs(React.Fragment, { children: [jsxRuntimeExports.jsx(Icon, { ...item.iconProps }), item.text && jsxRuntimeExports.jsx("span", { children: item.text })] }, index)))) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [iconProps && jsxRuntimeExports.jsx(Icon, { ...iconProps }), children && jsxRuntimeExports.jsx("span", { children: children })] })) }));
|
|
2805
|
+
};
|
|
2806
|
+
|
|
2807
|
+
/**
|
|
2808
|
+
* Image component for rendering a styled Bulma image element.
|
|
2809
|
+
*
|
|
2810
|
+
* Supports fixed-size containers, aspect ratios, rounded images, retina images, and arbitrary children (e.g., iframe).
|
|
2811
|
+
*
|
|
2812
|
+
* The "as" prop allows rendering as "figure", "p", or "div" tags etc.
|
|
2813
|
+
*
|
|
2814
|
+
* @function
|
|
2815
|
+
* @param {ImageProps} props - Props for the Image component.
|
|
2816
|
+
* @returns {JSX.Element} The rendered image element.
|
|
2817
|
+
* @see {@link https://bulma.io/documentation/elements/image/ | Bulma Image documentation}
|
|
2818
|
+
*/
|
|
2819
|
+
const Image = ({ as, className, textColor, bgColor, size, isRounded, isRetina, src, alt, children, ...props }) => {
|
|
2820
|
+
/**
|
|
2821
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2822
|
+
*/
|
|
2823
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2824
|
+
color: textColor,
|
|
2825
|
+
backgroundColor: bgColor,
|
|
2826
|
+
...props,
|
|
2827
|
+
});
|
|
2828
|
+
const imageClasses = classNames('image', className, bulmaHelperClasses, {
|
|
2829
|
+
[`is-${size}`]: size,
|
|
2830
|
+
'has-ratio': size && typeof size === 'string' && size.includes('by'),
|
|
2831
|
+
});
|
|
2832
|
+
// Default tag logic: if "as" is provided, use it.
|
|
2833
|
+
// If not, use <figure> for aspect ratios or children, <div> otherwise.
|
|
2834
|
+
let Tag;
|
|
2835
|
+
if (as) {
|
|
2836
|
+
Tag = as;
|
|
2837
|
+
}
|
|
2838
|
+
else if (size && typeof size === 'string' && size.includes('by')) {
|
|
2839
|
+
Tag = 'figure';
|
|
2840
|
+
}
|
|
2841
|
+
else {
|
|
2842
|
+
Tag = 'div';
|
|
2843
|
+
}
|
|
2844
|
+
const content = children ? (children) : (jsxRuntimeExports.jsx("img", { className: classNames({ 'is-rounded': isRounded }), src: src, alt: alt, ...(isRetina && src ? { srcSet: `${src} 2x` } : {}) }));
|
|
2845
|
+
return (jsxRuntimeExports.jsx(Tag, { className: imageClasses, ...rest, children: content }));
|
|
2846
|
+
};
|
|
2847
|
+
|
|
2848
|
+
/**
|
|
2849
|
+
* Notification component for rendering a styled Bulma notification.
|
|
2850
|
+
*
|
|
2851
|
+
* Supports colors, light variants, a delete button, and arbitrary content.
|
|
2852
|
+
*
|
|
2853
|
+
* @function
|
|
2854
|
+
* @param {NotificationProps} props - Props for the Notification component.
|
|
2855
|
+
* @returns {JSX.Element} The rendered notification element.
|
|
2856
|
+
* @see {@link https://bulma.io/documentation/elements/notification/ | Bulma Notification documentation}
|
|
2857
|
+
*/
|
|
2858
|
+
const Notification = ({ className, color, isLight, hasDelete, onDelete, children, ...props }) => {
|
|
2859
|
+
/**
|
|
2860
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2861
|
+
*/
|
|
2862
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2863
|
+
...props,
|
|
2864
|
+
});
|
|
2865
|
+
const notificationClasses = classNames('notification', className, bulmaHelperClasses, {
|
|
2866
|
+
[`is-${color}`]: color && validColors.includes(color),
|
|
2867
|
+
'is-light': isLight,
|
|
2868
|
+
});
|
|
2869
|
+
return (jsxRuntimeExports.jsxs("div", { className: notificationClasses, ...rest, children: [hasDelete && (jsxRuntimeExports.jsx("button", { className: "delete", onClick: onDelete, "aria-label": "Close notification" })), children] }));
|
|
2870
|
+
};
|
|
2871
|
+
|
|
2872
|
+
/**
|
|
2873
|
+
* Progress component for rendering a styled Bulma progress bar.
|
|
2874
|
+
*
|
|
2875
|
+
* Supports Bulma color and size modifiers, value/max attributes, and optional custom content.
|
|
2876
|
+
*
|
|
2877
|
+
* @function
|
|
2878
|
+
* @param {ProgressProps} props - Props for the Progress component.
|
|
2879
|
+
* @returns {JSX.Element} The rendered progress bar element.
|
|
2880
|
+
* @see {@link https://bulma.io/documentation/elements/progress/ | Bulma Progress documentation}
|
|
2881
|
+
*/
|
|
2882
|
+
const Progress = ({ className, color, size, value, max, children, ...props }) => {
|
|
2883
|
+
/**
|
|
2884
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2885
|
+
*/
|
|
2886
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2887
|
+
...props,
|
|
2888
|
+
});
|
|
2889
|
+
const progressClasses = classNames('progress', className, bulmaHelperClasses, {
|
|
2890
|
+
[`is-${color}`]: color && validColors.includes(color),
|
|
2891
|
+
[`is-${size}`]: size,
|
|
2892
|
+
});
|
|
2893
|
+
return (jsxRuntimeExports.jsx("progress", { className: progressClasses, value: value, max: max, ...rest, children: children }));
|
|
2894
|
+
};
|
|
2895
|
+
|
|
2896
|
+
const validSubTitleSizes = ['1', '2', '3', '4', '5', '6'];
|
|
2897
|
+
const validSubTitleElements = [
|
|
2898
|
+
'h1',
|
|
2899
|
+
'h2',
|
|
2900
|
+
'h3',
|
|
2901
|
+
'h4',
|
|
2902
|
+
'h5',
|
|
2903
|
+
'h6',
|
|
2904
|
+
'p',
|
|
2905
|
+
];
|
|
2906
|
+
/**
|
|
2907
|
+
* SubTitle component for rendering a styled Bulma subtitle.
|
|
2908
|
+
*
|
|
2909
|
+
* Supports Bulma subtitle sizes and rendering as different HTML elements (h1-h6, p).
|
|
2910
|
+
*
|
|
2911
|
+
* @function
|
|
2912
|
+
* @param {SubTitleProps} props - Props for the SubTitle component.
|
|
2913
|
+
* @returns {JSX.Element} The rendered subtitle element.
|
|
2914
|
+
* @see {@link https://bulma.io/documentation/elements/title/#subtitle | Bulma Subtitle documentation}
|
|
2915
|
+
*/
|
|
2916
|
+
const SubTitle = ({ className, size, as = 'h1', children, ...props }) => {
|
|
2917
|
+
/**
|
|
2918
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2919
|
+
*/
|
|
2920
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
2921
|
+
// Validate 'as' prop at runtime
|
|
2922
|
+
const element = validSubTitleElements.includes(as) ? as : 'h1';
|
|
2923
|
+
// Validate 'size' prop at runtime
|
|
2924
|
+
const validSize = size && validSubTitleSizes.includes(size) ? size : undefined;
|
|
2925
|
+
const subTitleClasses = classNames('subtitle', className, bulmaHelperClasses, {
|
|
2926
|
+
[`is-${validSize}`]: validSize,
|
|
2927
|
+
});
|
|
2928
|
+
// Determine the tag based on 'element' and 'validSize'
|
|
2929
|
+
const Tag = element === 'p' ? 'p' : validSize ? `h${validSize}` : element;
|
|
2930
|
+
return (jsxRuntimeExports.jsx(Tag, { className: subTitleClasses, ...rest, children: children }));
|
|
2931
|
+
};
|
|
2932
|
+
|
|
2933
|
+
/**
|
|
2934
|
+
* Table component for rendering a styled Bulma table.
|
|
2935
|
+
*
|
|
2936
|
+
* Supports responsive, bordered, striped, narrow, hoverable, and fullwidth variants.
|
|
2937
|
+
*
|
|
2938
|
+
* @function
|
|
2939
|
+
* @param {TableProps} props - Props for the Table component.
|
|
2940
|
+
* @returns {JSX.Element} The rendered table element.
|
|
2941
|
+
* @see {@link https://bulma.io/documentation/elements/table/ | Bulma Table documentation}
|
|
2942
|
+
*/
|
|
2943
|
+
const Table = ({ className, isBordered, isStriped, isNarrow, isHoverable, isFullwidth, isResponsive, children, ...props }) => {
|
|
2944
|
+
/**
|
|
2945
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2946
|
+
*/
|
|
2947
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
2948
|
+
const tableClasses = classNames('table', className, bulmaHelperClasses, {
|
|
2949
|
+
'is-bordered': isBordered,
|
|
2950
|
+
'is-striped': isStriped,
|
|
2951
|
+
'is-narrow': isNarrow,
|
|
2952
|
+
'is-hoverable': isHoverable,
|
|
2953
|
+
'is-fullwidth': isFullwidth,
|
|
2954
|
+
});
|
|
2955
|
+
const tableElement = (jsxRuntimeExports.jsx("table", { className: tableClasses, ...rest, children: children }));
|
|
2956
|
+
return isResponsive ? (jsxRuntimeExports.jsx("div", { className: "table-container", children: tableElement })) : (tableElement);
|
|
2957
|
+
};
|
|
2958
|
+
|
|
2959
|
+
const validTagColors = [
|
|
2960
|
+
'primary',
|
|
2961
|
+
'link',
|
|
2962
|
+
'info',
|
|
2963
|
+
'success',
|
|
2964
|
+
'warning',
|
|
2965
|
+
'danger',
|
|
2966
|
+
'black',
|
|
2967
|
+
'dark',
|
|
2968
|
+
'light',
|
|
2969
|
+
'white',
|
|
2970
|
+
];
|
|
2971
|
+
const validTagSizes = ['normal', 'medium', 'large'];
|
|
2972
|
+
/**
|
|
2973
|
+
* Tag component for rendering a styled Bulma tag.
|
|
2974
|
+
*
|
|
2975
|
+
* Supports colors, sizes, rounded, delete, and hoverable variants.
|
|
2976
|
+
*
|
|
2977
|
+
* @function
|
|
2978
|
+
* @param {TagProps} props - Props for the Tag component.
|
|
2979
|
+
* @returns {JSX.Element} The rendered tag element.
|
|
2980
|
+
* @see {@link https://bulma.io/documentation/elements/tag/ | Bulma Tag documentation}
|
|
2981
|
+
*/
|
|
2982
|
+
const Tag = ({ className, color, size, isRounded, isDelete, isHoverable, onDelete, children, ...props }) => {
|
|
2983
|
+
/**
|
|
2984
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
2985
|
+
*/
|
|
2986
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
2987
|
+
const tagClasses = classNames('tag', className, bulmaHelperClasses, {
|
|
2988
|
+
[`is-${color}`]: color && validTagColors.includes(color),
|
|
2989
|
+
[`is-${size}`]: size && size !== 'normal' && validTagSizes.includes(size),
|
|
2990
|
+
'is-rounded': isRounded,
|
|
2991
|
+
'is-delete': isDelete,
|
|
2992
|
+
'is-hoverable': isHoverable,
|
|
2993
|
+
});
|
|
2994
|
+
if (isDelete) {
|
|
2995
|
+
return (jsxRuntimeExports.jsx("button", { className: tagClasses, onClick: onDelete, "aria-label": "Delete tag", ...rest }));
|
|
2996
|
+
}
|
|
2997
|
+
return (jsxRuntimeExports.jsx("span", { className: tagClasses, ...rest, children: children }));
|
|
2998
|
+
};
|
|
2999
|
+
|
|
3000
|
+
/**
|
|
3001
|
+
* Tags component for rendering a styled Bulma tags container.
|
|
3002
|
+
*
|
|
3003
|
+
* Supports addons and multiline variants.
|
|
3004
|
+
*
|
|
3005
|
+
* @function
|
|
3006
|
+
* @param {TagsProps} props - Props for the Tags component.
|
|
3007
|
+
* @returns {JSX.Element} The rendered tags container.
|
|
3008
|
+
* @see {@link https://bulma.io/documentation/elements/tag/#list-of-tags | Bulma Tags documentation}
|
|
3009
|
+
*/
|
|
3010
|
+
const Tags = ({ className, hasAddons, isMultiline, children, ...props }) => {
|
|
3011
|
+
/**
|
|
3012
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3013
|
+
*/
|
|
3014
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3015
|
+
const tagsClasses = classNames('tags', className, bulmaHelperClasses, {
|
|
3016
|
+
'has-addons': hasAddons,
|
|
3017
|
+
'are-multiline': isMultiline,
|
|
3018
|
+
});
|
|
3019
|
+
return (jsxRuntimeExports.jsx("div", { className: tagsClasses, ...rest, children: children }));
|
|
3020
|
+
};
|
|
3021
|
+
|
|
3022
|
+
/**
|
|
3023
|
+
* Tbody component for rendering a styled Bulma table body.
|
|
3024
|
+
*
|
|
3025
|
+
* Supports Bulma helper classes for additional styling.
|
|
3026
|
+
*
|
|
3027
|
+
* @function
|
|
3028
|
+
* @param {TbodyProps} props - Props for the Tbody component.
|
|
3029
|
+
* @returns {JSX.Element} The rendered table body element.
|
|
3030
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-body | Bulma Table documentation}
|
|
3031
|
+
*/
|
|
3032
|
+
const Tbody = ({ className, children, ...props }) => {
|
|
3033
|
+
/**
|
|
3034
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3035
|
+
*/
|
|
3036
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3037
|
+
const tbodyClasses = classNames(className, bulmaHelperClasses);
|
|
3038
|
+
return (jsxRuntimeExports.jsx("tbody", { className: tbodyClasses, ...rest, children: children }));
|
|
3039
|
+
};
|
|
3040
|
+
|
|
3041
|
+
const validTableColors = [
|
|
3042
|
+
'primary',
|
|
3043
|
+
'link',
|
|
3044
|
+
'info',
|
|
3045
|
+
'success',
|
|
3046
|
+
'warning',
|
|
3047
|
+
'danger',
|
|
3048
|
+
'black',
|
|
3049
|
+
'dark',
|
|
3050
|
+
'light',
|
|
3051
|
+
'white',
|
|
3052
|
+
];
|
|
3053
|
+
/**
|
|
3054
|
+
* Td component for rendering a styled Bulma table cell.
|
|
3055
|
+
*
|
|
3056
|
+
* Supports Bulma color modifiers and helper classes for additional styling.
|
|
3057
|
+
*
|
|
3058
|
+
* @function
|
|
3059
|
+
* @param {TdProps} props - Props for the Td component.
|
|
3060
|
+
* @returns {JSX.Element} The rendered table cell element.
|
|
3061
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-body | Bulma Table documentation}
|
|
3062
|
+
*/
|
|
3063
|
+
const Td = ({ className, color, children, ...props }) => {
|
|
3064
|
+
/**
|
|
3065
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3066
|
+
*/
|
|
3067
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3068
|
+
const tdClasses = classNames(className, bulmaHelperClasses, {
|
|
3069
|
+
[`is-${color}`]: color && validTableColors.includes(color),
|
|
3070
|
+
});
|
|
3071
|
+
return (jsxRuntimeExports.jsx("td", { className: tdClasses, ...rest, children: children }));
|
|
3072
|
+
};
|
|
3073
|
+
|
|
3074
|
+
/**
|
|
3075
|
+
* Tfoot component for rendering a styled Bulma table footer.
|
|
3076
|
+
*
|
|
3077
|
+
* Supports Bulma helper classes for additional styling.
|
|
3078
|
+
*
|
|
3079
|
+
* @function
|
|
3080
|
+
* @param {TfootProps} props - Props for the Tfoot component.
|
|
3081
|
+
* @returns {JSX.Element} The rendered table footer element.
|
|
3082
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-footer | Bulma Table documentation}
|
|
3083
|
+
*/
|
|
3084
|
+
const Tfoot = ({ className, children, ...props }) => {
|
|
3085
|
+
/**
|
|
3086
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3087
|
+
*/
|
|
3088
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3089
|
+
const tfootClasses = classNames(className, bulmaHelperClasses);
|
|
3090
|
+
return (jsxRuntimeExports.jsx("tfoot", { className: tfootClasses, ...rest, children: children }));
|
|
3091
|
+
};
|
|
3092
|
+
|
|
3093
|
+
const validAlignments = ['left', 'right', 'centered'];
|
|
3094
|
+
/**
|
|
3095
|
+
* Th component for rendering a styled Bulma table header cell.
|
|
3096
|
+
*
|
|
3097
|
+
* Supports alignment, width, and color modifiers.
|
|
3098
|
+
*
|
|
3099
|
+
* @function
|
|
3100
|
+
* @param {ThProps} props - Props for the Th component.
|
|
3101
|
+
* @returns {JSX.Element} The rendered table header cell element.
|
|
3102
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-head | Bulma Table documentation}
|
|
3103
|
+
*/
|
|
3104
|
+
const Th = ({ className, isAligned, width, color, children, ...props }) => {
|
|
3105
|
+
/**
|
|
3106
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3107
|
+
*/
|
|
3108
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3109
|
+
const thClasses = classNames(className, bulmaHelperClasses, {
|
|
3110
|
+
[`has-text-${isAligned}`]: isAligned && validAlignments.includes(isAligned),
|
|
3111
|
+
[`is-${color}`]: color && validTableColors.includes(color),
|
|
3112
|
+
});
|
|
3113
|
+
return (jsxRuntimeExports.jsx("th", { className: thClasses, style: width
|
|
3114
|
+
? { width: typeof width === 'number' ? `${width}px` : width }
|
|
3115
|
+
: undefined, ...rest, children: children }));
|
|
3116
|
+
};
|
|
3117
|
+
|
|
3118
|
+
/**
|
|
3119
|
+
* Thead component for rendering a styled Bulma table header.
|
|
3120
|
+
*
|
|
3121
|
+
* Supports Bulma helper classes for additional styling.
|
|
3122
|
+
*
|
|
3123
|
+
* @function
|
|
3124
|
+
* @param {TheadProps} props - Props for the Thead component.
|
|
3125
|
+
* @returns {JSX.Element} The rendered table header element.
|
|
3126
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-head | Bulma Table documentation}
|
|
3127
|
+
*/
|
|
3128
|
+
const Thead = ({ className, children, ...props }) => {
|
|
3129
|
+
/**
|
|
3130
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3131
|
+
*/
|
|
3132
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3133
|
+
const theadClasses = classNames(className, bulmaHelperClasses);
|
|
3134
|
+
return (jsxRuntimeExports.jsx("thead", { className: theadClasses, ...rest, children: children }));
|
|
3135
|
+
};
|
|
3136
|
+
|
|
3137
|
+
const validTitleSizes = ['1', '2', '3', '4', '5', '6'];
|
|
3138
|
+
const validTitleElements = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'];
|
|
3139
|
+
/**
|
|
3140
|
+
* Title component for rendering a styled Bulma title.
|
|
3141
|
+
*
|
|
3142
|
+
* Supports sizes, spacing, and rendering as different HTML elements.
|
|
3143
|
+
*
|
|
3144
|
+
* @function
|
|
3145
|
+
* @param {TitleProps} props - Props for the Title component.
|
|
3146
|
+
* @returns {JSX.Element} The rendered title element.
|
|
3147
|
+
* @see {@link https://bulma.io/documentation/elements/title/ | Bulma Title documentation}
|
|
3148
|
+
*/
|
|
3149
|
+
const Title = ({ className, size, isSpaced, as = 'h1', children, ...props }) => {
|
|
3150
|
+
/**
|
|
3151
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3152
|
+
*/
|
|
3153
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3154
|
+
// Validate 'as' prop at runtime
|
|
3155
|
+
const element = validTitleElements.includes(as) ? as : 'h1';
|
|
3156
|
+
// Validate 'size' prop at runtime
|
|
3157
|
+
const validSize = size && validTitleSizes.includes(size) ? size : undefined;
|
|
3158
|
+
const titleClasses = classNames('title', className, bulmaHelperClasses, {
|
|
3159
|
+
[`is-${validSize}`]: validSize,
|
|
3160
|
+
'is-spaced': isSpaced,
|
|
3161
|
+
});
|
|
3162
|
+
// Determine the tag based on 'element' and 'validSize'
|
|
3163
|
+
const Tag = element === 'p' ? 'p' : validSize ? `h${validSize}` : element;
|
|
3164
|
+
return (jsxRuntimeExports.jsx(Tag, { className: titleClasses, ...rest, children: children }));
|
|
3165
|
+
};
|
|
3166
|
+
|
|
3167
|
+
/**
|
|
3168
|
+
* Tr component for rendering a styled Bulma table row.
|
|
3169
|
+
*
|
|
3170
|
+
* Supports the is-selected modifier and color modifiers.
|
|
3171
|
+
*
|
|
3172
|
+
* @function
|
|
3173
|
+
* @param {TrProps} props - Props for the Tr component.
|
|
3174
|
+
* @returns {JSX.Element} The rendered table row element.
|
|
3175
|
+
* @see {@link https://bulma.io/documentation/elements/table/#table-row | Bulma Table documentation}
|
|
3176
|
+
*/
|
|
3177
|
+
const Tr = ({ className, isSelected, color, children, ...props }) => {
|
|
3178
|
+
/**
|
|
3179
|
+
* Generates Bulma helper classes and separates out remaining props.
|
|
3180
|
+
*/
|
|
3181
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3182
|
+
const trClasses = classNames(className, bulmaHelperClasses, {
|
|
3183
|
+
'is-selected': isSelected,
|
|
3184
|
+
[`is-${color}`]: color && validTableColors.includes(color),
|
|
3185
|
+
});
|
|
3186
|
+
return (jsxRuntimeExports.jsx("tr", { className: trClasses, ...rest, children: children }));
|
|
3187
|
+
};
|
|
3188
|
+
|
|
3189
|
+
/**
|
|
3190
|
+
* Bulma Checkbox component with Bulma helper classes support.
|
|
3191
|
+
* The label is provided via the children prop.
|
|
3192
|
+
*
|
|
3193
|
+
* @function
|
|
3194
|
+
* @param {CheckboxProps} props - Props for the Checkbox component.
|
|
3195
|
+
* @returns {JSX.Element} The rendered checkbox element.
|
|
3196
|
+
*/
|
|
3197
|
+
const Checkbox = forwardRef(({ disabled, className, children, ...props }, ref) => {
|
|
3198
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3199
|
+
...props,
|
|
3200
|
+
});
|
|
3201
|
+
const checkboxClass = classNames('checkbox', bulmaHelperClasses, className);
|
|
3202
|
+
return (jsxRuntimeExports.jsxs("label", { className: checkboxClass, children: [jsxRuntimeExports.jsx("input", { ref: ref, type: "checkbox", disabled: disabled, ...rest }), children] }));
|
|
3203
|
+
});
|
|
3204
|
+
Checkbox.displayName = 'Checkbox';
|
|
3205
|
+
|
|
3206
|
+
const allowedColors = [...validColors, 'inherit', 'current'];
|
|
3207
|
+
/**
|
|
3208
|
+
* Bulma Control component for form controls, with icons, loading, and Bulma helper support.
|
|
3209
|
+
*
|
|
3210
|
+
* @function
|
|
3211
|
+
* @param {ControlProps} props - Props for the Control component.
|
|
3212
|
+
* @returns {JSX.Element} The rendered control container.
|
|
3213
|
+
* @see {@link https://bulma.io/documentation/form/general/#control | Bulma Control documentation}
|
|
3214
|
+
*/
|
|
3215
|
+
const Control = React.forwardRef(({ as = 'div', hasIconsLeft, hasIconsRight, isLoading, isExpanded, size, textColor, bgColor, iconLeft, iconRight, iconLeftName, iconLeftSize, iconRightName, iconRightSize, className, children, ...props }, ref) => {
|
|
3216
|
+
const Component = (as === 'p' ? 'p' : 'div');
|
|
3217
|
+
// Remove textColor/bgColor from props before spreading
|
|
3218
|
+
const { textColor: _ignoredTextColor, bgColor: _ignoredBgColor, ...restProps } = props;
|
|
3219
|
+
const safeTextColor = allowedColors.includes(textColor)
|
|
3220
|
+
? textColor
|
|
3221
|
+
: undefined;
|
|
3222
|
+
const safeBgColor = allowedColors.includes(bgColor)
|
|
3223
|
+
? bgColor
|
|
3224
|
+
: undefined;
|
|
3225
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3226
|
+
color: safeTextColor,
|
|
3227
|
+
backgroundColor: safeBgColor,
|
|
3228
|
+
...restProps,
|
|
3229
|
+
});
|
|
3230
|
+
// Prepare icon props for the shortcut
|
|
3231
|
+
const leftIconProps = iconLeft ||
|
|
3232
|
+
(iconLeftName
|
|
3233
|
+
? {
|
|
3234
|
+
name: iconLeftName,
|
|
3235
|
+
size: iconLeftSize,
|
|
3236
|
+
}
|
|
3237
|
+
: undefined);
|
|
3238
|
+
const rightIconProps = iconRight ||
|
|
3239
|
+
(iconRightName
|
|
3240
|
+
? {
|
|
3241
|
+
name: iconRightName,
|
|
3242
|
+
size: iconRightSize,
|
|
3243
|
+
}
|
|
3244
|
+
: undefined);
|
|
3245
|
+
const controlClass = classNames('control', bulmaHelperClasses, {
|
|
3246
|
+
'has-icons-left': hasIconsLeft || !!leftIconProps,
|
|
3247
|
+
'has-icons-right': hasIconsRight || !!rightIconProps,
|
|
3248
|
+
'is-loading': isLoading,
|
|
3249
|
+
'is-expanded': isExpanded,
|
|
3250
|
+
[`is-${size}`]: !!size,
|
|
3251
|
+
}, className);
|
|
3252
|
+
// --- FIX: Spread both restProps (for data-testid, etc) AND rest (from useBulmaClasses) ---
|
|
3253
|
+
return (jsxRuntimeExports.jsxs(Component, { className: controlClass, ref: ref, ...restProps, ...rest, children: [children, leftIconProps && leftIconProps.name && (jsxRuntimeExports.jsx(Icon, { ...leftIconProps, className: "is-left" })), rightIconProps && rightIconProps.name && (jsxRuntimeExports.jsx(Icon, { ...rightIconProps, className: "is-right" }))] }));
|
|
3254
|
+
});
|
|
3255
|
+
Control.displayName = 'Control';
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* FieldLabel component for rendering a Bulma field label.
|
|
3259
|
+
*
|
|
3260
|
+
* @function
|
|
3261
|
+
* @param {FieldLabelProps} props - Props for the FieldLabel component.
|
|
3262
|
+
* @returns {JSX.Element} The rendered field label.
|
|
3263
|
+
*/
|
|
3264
|
+
const FieldLabel = ({ size, textColor, bgColor, className, children, ...props }) => {
|
|
3265
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3266
|
+
color: textColor,
|
|
3267
|
+
backgroundColor: bgColor,
|
|
3268
|
+
...props,
|
|
3269
|
+
});
|
|
3270
|
+
const fieldLabelClass = classNames('field-label', bulmaHelperClasses, { [`is-${size}`]: size }, className);
|
|
3271
|
+
// Spread ...props and ...rest so custom props like data-testid are included
|
|
3272
|
+
return (jsxRuntimeExports.jsx("div", { className: fieldLabelClass, ...props, ...rest, children: children }));
|
|
3273
|
+
};
|
|
3274
|
+
/**
|
|
3275
|
+
* FieldBody component for rendering Bulma field body.
|
|
3276
|
+
*
|
|
3277
|
+
* @function
|
|
3278
|
+
* @param {FieldBodyProps} props - Props for the FieldBody component.
|
|
3279
|
+
* @returns {JSX.Element} The rendered field body.
|
|
3280
|
+
*/
|
|
3281
|
+
const FieldBody = ({ textColor, bgColor, className, children, ...props }) => {
|
|
3282
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3283
|
+
color: textColor,
|
|
3284
|
+
backgroundColor: bgColor,
|
|
3285
|
+
...props,
|
|
3286
|
+
});
|
|
3287
|
+
const fieldBodyClass = classNames('field-body', bulmaHelperClasses, className);
|
|
3288
|
+
// Spread ...props and ...rest so custom props like data-testid are included
|
|
3289
|
+
return (jsxRuntimeExports.jsx("div", { className: fieldBodyClass, ...props, ...rest, children: children }));
|
|
3290
|
+
};
|
|
3291
|
+
FieldLabel.displayName = 'FieldLabel';
|
|
3292
|
+
FieldBody.displayName = 'FieldBody';
|
|
3293
|
+
|
|
3294
|
+
/**
|
|
3295
|
+
* Bulma File upload component with full Bulma helper class support.
|
|
3296
|
+
* isRight and isCentered are mutually exclusive (Bulma spec).
|
|
3297
|
+
*
|
|
3298
|
+
* @function
|
|
3299
|
+
* @param {FileProps} props - Props for the File component.
|
|
3300
|
+
* @returns {JSX.Element} The rendered file upload field.
|
|
3301
|
+
* @see {@link https://bulma.io/documentation/form/file/ | Bulma File documentation}
|
|
3302
|
+
*/
|
|
3303
|
+
const File = forwardRef(({ color, size, isBoxed, isFullwidth, isRight, isCentered, hasName, label, iconLeft, iconRight, className, inputClassName, fileName, ...props }, ref) => {
|
|
3304
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3305
|
+
color,
|
|
3306
|
+
...props,
|
|
3307
|
+
});
|
|
3308
|
+
// Mutually exclusive alignment
|
|
3309
|
+
let alignmentClass;
|
|
3310
|
+
if (isRight && isCentered) {
|
|
3311
|
+
// If both are set, prefer isRight and warn in dev
|
|
3312
|
+
alignmentClass = 'is-right';
|
|
3313
|
+
}
|
|
3314
|
+
else if (isRight) {
|
|
3315
|
+
alignmentClass = 'is-right';
|
|
3316
|
+
}
|
|
3317
|
+
else if (isCentered) {
|
|
3318
|
+
alignmentClass = 'is-centered';
|
|
3319
|
+
}
|
|
3320
|
+
const fileClass = classNames('file', bulmaHelperClasses, {
|
|
3321
|
+
[`is-${color}`]: color,
|
|
3322
|
+
[`is-${size}`]: size,
|
|
3323
|
+
'is-boxed': isBoxed,
|
|
3324
|
+
'is-fullwidth': isFullwidth,
|
|
3325
|
+
'has-name': hasName,
|
|
3326
|
+
}, alignmentClass, className);
|
|
3327
|
+
return (jsxRuntimeExports.jsx("div", { className: fileClass, children: jsxRuntimeExports.jsxs("label", { className: "file-label", children: [jsxRuntimeExports.jsx("input", { ref: ref, className: classNames('file-input', inputClassName), type: "file", ...rest }), jsxRuntimeExports.jsxs("span", { className: "file-cta", children: [iconLeft && jsxRuntimeExports.jsx("span", { className: "file-icon", children: iconLeft }), jsxRuntimeExports.jsx("span", { className: "file-label", children: label || 'Choose a file…' }), iconRight && jsxRuntimeExports.jsx("span", { className: "file-icon", children: iconRight })] }), hasName && fileName && jsxRuntimeExports.jsx("span", { className: "file-name", children: fileName })] }) }));
|
|
3328
|
+
});
|
|
3329
|
+
File.displayName = 'File';
|
|
3330
|
+
|
|
3331
|
+
/**
|
|
3332
|
+
* Bulma Input component with full Bulma helper class support.
|
|
3333
|
+
*
|
|
3334
|
+
* @function
|
|
3335
|
+
* @param {InputProps} props - Props for the Input component.
|
|
3336
|
+
* @returns {JSX.Element} The rendered input element.
|
|
3337
|
+
* @see {@link https://bulma.io/documentation/form/input/ | Bulma Input documentation}
|
|
3338
|
+
*/
|
|
3339
|
+
const Input = forwardRef(({ color, size, isRounded, isStatic, isHovered, isFocused, isLoading, className, disabled, readOnly, ...props }, ref) => {
|
|
3340
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3341
|
+
color,
|
|
3342
|
+
...props,
|
|
3343
|
+
});
|
|
3344
|
+
const inputClass = classNames('input', bulmaHelperClasses, {
|
|
3345
|
+
[`is-${color}`]: color,
|
|
3346
|
+
[`is-${size}`]: size,
|
|
3347
|
+
'is-rounded': isRounded,
|
|
3348
|
+
'is-static': isStatic,
|
|
3349
|
+
'is-hovered': isHovered,
|
|
3350
|
+
'is-focused': isFocused,
|
|
3351
|
+
'is-loading': isLoading,
|
|
3352
|
+
}, className);
|
|
3353
|
+
return (jsxRuntimeExports.jsx("input", { ref: ref, className: inputClass, disabled: disabled, readOnly: readOnly, ...rest }));
|
|
3354
|
+
});
|
|
3355
|
+
Input.displayName = 'Input';
|
|
3356
|
+
|
|
3357
|
+
/**
|
|
3358
|
+
* Bulma Radio component with Bulma helper classes support.
|
|
3359
|
+
* The label is provided via the children prop.
|
|
3360
|
+
*
|
|
3361
|
+
* @function
|
|
3362
|
+
* @param {RadioProps} props - Props for the Radio component.
|
|
3363
|
+
* @returns {JSX.Element} The rendered radio element.
|
|
3364
|
+
*/
|
|
3365
|
+
const Radio = forwardRef(({ disabled, className, children, ...props }, ref) => {
|
|
3366
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3367
|
+
...props,
|
|
3368
|
+
});
|
|
3369
|
+
const radioClass = classNames('radio', bulmaHelperClasses, className);
|
|
3370
|
+
return (jsxRuntimeExports.jsxs("label", { className: radioClass, children: [jsxRuntimeExports.jsx("input", { ref: ref, type: "radio", disabled: disabled, ...rest }), children] }));
|
|
3371
|
+
});
|
|
3372
|
+
Radio.displayName = 'Radio';
|
|
3373
|
+
|
|
3374
|
+
/**
|
|
3375
|
+
* Bulma Select component with full Bulma helper class support.
|
|
3376
|
+
*
|
|
3377
|
+
* @function
|
|
3378
|
+
* @param {SelectProps} props - Props for the Select component.
|
|
3379
|
+
* @returns {JSX.Element} The rendered select element.
|
|
3380
|
+
* @see {@link https://bulma.io/documentation/form/select/ | Bulma Select documentation}
|
|
3381
|
+
*/
|
|
3382
|
+
const Select = forwardRef(({ color, size, isRounded, isLoading, isActive, className, disabled, children, multiple, multipleSize, ...props }, ref) => {
|
|
3383
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3384
|
+
color,
|
|
3385
|
+
...props,
|
|
3386
|
+
});
|
|
3387
|
+
const selectClass = classNames('select', bulmaHelperClasses, {
|
|
3388
|
+
[`is-${color}`]: color,
|
|
3389
|
+
[`is-${size}`]: size,
|
|
3390
|
+
'is-rounded': isRounded,
|
|
3391
|
+
'is-loading': isLoading,
|
|
3392
|
+
'is-active': isActive,
|
|
3393
|
+
}, className);
|
|
3394
|
+
// Only set size attribute when multiple is true and multipleSize is specified
|
|
3395
|
+
const selectProps = {
|
|
3396
|
+
disabled,
|
|
3397
|
+
multiple,
|
|
3398
|
+
...rest,
|
|
3399
|
+
};
|
|
3400
|
+
if (multiple && typeof multipleSize === 'number') {
|
|
3401
|
+
selectProps.size = multipleSize;
|
|
3402
|
+
}
|
|
3403
|
+
return (jsxRuntimeExports.jsx("div", { className: selectClass, children: jsxRuntimeExports.jsx("select", { ref: ref, ...selectProps, children: children }) }));
|
|
3404
|
+
});
|
|
3405
|
+
Select.displayName = 'Select';
|
|
3406
|
+
|
|
3407
|
+
/**
|
|
3408
|
+
* Bulma TextArea component with full Bulma helper class support.
|
|
3409
|
+
*
|
|
3410
|
+
* @function
|
|
3411
|
+
* @param {TextAreaProps} props - Props for the TextArea component.
|
|
3412
|
+
* @returns {JSX.Element} The rendered textarea element.
|
|
3413
|
+
* @see {@link https://bulma.io/documentation/form/textarea/ | Bulma Textarea documentation}
|
|
3414
|
+
*/
|
|
3415
|
+
const TextArea = forwardRef(({ color, size, isRounded, isStatic, isHovered, isFocused, isLoading, isActive, hasFixedSize, className, disabled, readOnly, rows, ...props }, ref) => {
|
|
3416
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3417
|
+
color,
|
|
3418
|
+
...props,
|
|
3419
|
+
});
|
|
3420
|
+
const textareaClass = classNames('textarea', bulmaHelperClasses, {
|
|
3421
|
+
[`is-${color}`]: color,
|
|
3422
|
+
[`is-${size}`]: size,
|
|
3423
|
+
'is-rounded': isRounded,
|
|
3424
|
+
'is-static': isStatic,
|
|
3425
|
+
'is-hovered': isHovered,
|
|
3426
|
+
'is-focused': isFocused,
|
|
3427
|
+
'is-loading': isLoading,
|
|
3428
|
+
'is-active': isActive,
|
|
3429
|
+
'has-fixed-size': hasFixedSize,
|
|
3430
|
+
}, className);
|
|
3431
|
+
return (jsxRuntimeExports.jsx("textarea", { ref: ref, className: textareaClass, disabled: disabled, readOnly: readOnly, rows: rows, ...rest }));
|
|
3432
|
+
});
|
|
3433
|
+
TextArea.displayName = 'TextArea';
|
|
3434
|
+
|
|
3435
|
+
/**
|
|
3436
|
+
* Builds Bulma grid cell class names for the Cell component.
|
|
3437
|
+
*/
|
|
3438
|
+
function getCellGridClasses(props) {
|
|
3439
|
+
const classes = [];
|
|
3440
|
+
if (props.colStart !== undefined)
|
|
3441
|
+
classes.push(`is-col-start-${props.colStart}`);
|
|
3442
|
+
if (props.colFromEnd !== undefined)
|
|
3443
|
+
classes.push(`is-col-from-end-${props.colFromEnd}`);
|
|
3444
|
+
if (props.colSpan !== undefined)
|
|
3445
|
+
classes.push(`is-col-span-${props.colSpan}`);
|
|
3446
|
+
if (props.rowStart !== undefined)
|
|
3447
|
+
classes.push(`is-row-start-${props.rowStart}`);
|
|
3448
|
+
if (props.rowFromEnd !== undefined)
|
|
3449
|
+
classes.push(`is-row-from-end-${props.rowFromEnd}`);
|
|
3450
|
+
if (props.rowSpan !== undefined)
|
|
3451
|
+
classes.push(`is-row-span-${props.rowSpan}`);
|
|
3452
|
+
return classes;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Bulma Cell component for CSS Grid layouts.
|
|
3456
|
+
*
|
|
3457
|
+
* @function
|
|
3458
|
+
* @param {CellProps} props - Props for the Cell component.
|
|
3459
|
+
* @returns {JSX.Element} The rendered grid cell.
|
|
3460
|
+
* @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}
|
|
3461
|
+
*/
|
|
3462
|
+
const Cell = ({ colStart, colFromEnd, colSpan, rowStart, rowFromEnd, rowSpan, className, textColor, bgColor, children, ...props }) => {
|
|
3463
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3464
|
+
color: textColor,
|
|
3465
|
+
backgroundColor: bgColor,
|
|
3466
|
+
...props,
|
|
3467
|
+
});
|
|
3468
|
+
const cellClasses = classNames('cell', ...getCellGridClasses({
|
|
3469
|
+
colStart,
|
|
3470
|
+
colFromEnd,
|
|
3471
|
+
colSpan,
|
|
3472
|
+
rowStart,
|
|
3473
|
+
rowFromEnd,
|
|
3474
|
+
rowSpan,
|
|
3475
|
+
}), className, bulmaHelperClasses);
|
|
3476
|
+
return (jsxRuntimeExports.jsx("div", { className: cellClasses, ...rest, children: children }));
|
|
3477
|
+
};
|
|
3478
|
+
|
|
3479
|
+
/**
|
|
3480
|
+
* Builds Bulma grid inner classes for the Grid component.
|
|
3481
|
+
*/
|
|
3482
|
+
function getGridInnerClasses({ gap, columnGap, rowGap, minCol, }) {
|
|
3483
|
+
const classes = [];
|
|
3484
|
+
if (gap !== undefined)
|
|
3485
|
+
classes.push(`is-gap-${gap}`);
|
|
3486
|
+
if (columnGap !== undefined)
|
|
3487
|
+
classes.push(`is-column-gap-${columnGap}`);
|
|
3488
|
+
if (rowGap !== undefined)
|
|
3489
|
+
classes.push(`is-row-gap-${rowGap}`);
|
|
3490
|
+
if (minCol !== undefined)
|
|
3491
|
+
classes.push(`is-col-min-${minCol}`);
|
|
3492
|
+
return classes;
|
|
3493
|
+
}
|
|
3494
|
+
/**
|
|
3495
|
+
* Builds Bulma fixed grid classes for the Grid component.
|
|
3496
|
+
*/
|
|
3497
|
+
function getFixedGridClasses({ fixedCols, fixedColsMobile, fixedColsTablet, fixedColsDesktop, fixedColsWidescreen, fixedColsFullhd, }) {
|
|
3498
|
+
const classes = [];
|
|
3499
|
+
if (fixedCols === 'auto') {
|
|
3500
|
+
// 'auto' overrides all other column settings
|
|
3501
|
+
classes.push('has-auto-count');
|
|
3502
|
+
return classes;
|
|
3503
|
+
}
|
|
3504
|
+
if (fixedCols !== undefined)
|
|
3505
|
+
classes.push(`has-${fixedCols}-cols`);
|
|
3506
|
+
if (fixedColsMobile !== undefined)
|
|
3507
|
+
classes.push(`has-${fixedColsMobile}-cols-mobile`);
|
|
3508
|
+
if (fixedColsTablet !== undefined)
|
|
3509
|
+
classes.push(`has-${fixedColsTablet}-cols-tablet`);
|
|
3510
|
+
if (fixedColsDesktop !== undefined)
|
|
3511
|
+
classes.push(`has-${fixedColsDesktop}-cols-desktop`);
|
|
3512
|
+
if (fixedColsWidescreen !== undefined)
|
|
3513
|
+
classes.push(`has-${fixedColsWidescreen}-cols-widescreen`);
|
|
3514
|
+
if (fixedColsFullhd !== undefined)
|
|
3515
|
+
classes.push(`has-${fixedColsFullhd}-cols-fullhd`);
|
|
3516
|
+
return classes;
|
|
3517
|
+
}
|
|
3518
|
+
/**
|
|
3519
|
+
* Bulma Grid component for CSS Grid layouts, supports both fixed and responsive grid modes.
|
|
3520
|
+
*
|
|
3521
|
+
* @function
|
|
3522
|
+
* @param {GridProps} props - Props for the Grid component.
|
|
3523
|
+
* @returns {JSX.Element} The rendered grid.
|
|
3524
|
+
* @see {@link https://bulma.io/documentation/grid/ | Bulma Grid documentation}
|
|
3525
|
+
*/
|
|
3526
|
+
const Grid = ({ isFixed = false, gap, columnGap, rowGap, minCol, fixedCols, fixedColsMobile, fixedColsTablet, fixedColsDesktop, fixedColsWidescreen, fixedColsFullhd, className, textColor, bgColor, children, ...props }) => {
|
|
3527
|
+
// Map textColor and bgColor to color and backgroundColor for useBulmaClasses
|
|
3528
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3529
|
+
color: textColor,
|
|
3530
|
+
backgroundColor: bgColor,
|
|
3531
|
+
...props,
|
|
3532
|
+
});
|
|
3533
|
+
const gridClasses = classNames('grid', ...getGridInnerClasses({ gap, columnGap, rowGap, minCol }), bulmaHelperClasses, className);
|
|
3534
|
+
if (isFixed) {
|
|
3535
|
+
// Apply has-X-cols and responsive column count classes to the outer fixed-grid container
|
|
3536
|
+
const fixedGridClasses = classNames('fixed-grid', ...getFixedGridClasses({
|
|
3537
|
+
fixedCols,
|
|
3538
|
+
fixedColsMobile,
|
|
3539
|
+
fixedColsTablet,
|
|
3540
|
+
fixedColsDesktop,
|
|
3541
|
+
fixedColsWidescreen,
|
|
3542
|
+
fixedColsFullhd,
|
|
3543
|
+
}));
|
|
3544
|
+
return (jsxRuntimeExports.jsx("div", { className: fixedGridClasses, children: jsxRuntimeExports.jsx("div", { className: gridClasses, ...rest, children: children }) }));
|
|
3545
|
+
}
|
|
3546
|
+
// Standard Bulma grid (not fixed)
|
|
3547
|
+
return (jsxRuntimeExports.jsx("div", { className: gridClasses, ...rest, children: children }));
|
|
3548
|
+
};
|
|
3549
|
+
|
|
3550
|
+
/**
|
|
3551
|
+
* Container component for Bulma.
|
|
3552
|
+
* Adds optional responsive, fluid, and color support, including is-max-* and breakpoint classes.
|
|
3553
|
+
*
|
|
3554
|
+
* @function
|
|
3555
|
+
* @param {ContainerProps} props - Props for the Container component.
|
|
3556
|
+
* @returns {JSX.Element} The rendered container.
|
|
3557
|
+
* @see {@link https://bulma.io/documentation/layout/container/ | Bulma Container documentation}
|
|
3558
|
+
*/
|
|
3559
|
+
const Container = ({ className, textColor, bgColor, fluid, widescreen, fullhd, breakpoint, isMax, children, ...props }) => {
|
|
3560
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3561
|
+
color: textColor,
|
|
3562
|
+
backgroundColor: bgColor,
|
|
3563
|
+
...props,
|
|
3564
|
+
});
|
|
3565
|
+
// Only allow isMax for supported breakpoints
|
|
3566
|
+
const validMaxBreakpoints = [
|
|
3567
|
+
'tablet',
|
|
3568
|
+
'desktop',
|
|
3569
|
+
'widescreen',
|
|
3570
|
+
];
|
|
3571
|
+
let breakpointClass;
|
|
3572
|
+
if (breakpoint) {
|
|
3573
|
+
if (isMax && validMaxBreakpoints.includes(breakpoint)) {
|
|
3574
|
+
breakpointClass = `is-max-${breakpoint}`;
|
|
3575
|
+
}
|
|
3576
|
+
else if (!isMax) {
|
|
3577
|
+
breakpointClass = `is-${breakpoint}`;
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
const containerClasses = classNames('container', {
|
|
3581
|
+
'is-fluid': fluid,
|
|
3582
|
+
'is-widescreen': widescreen,
|
|
3583
|
+
'is-fullhd': fullhd,
|
|
3584
|
+
}, breakpointClass, className, bulmaHelperClasses);
|
|
3585
|
+
return (jsxRuntimeExports.jsx("div", { className: containerClasses, ...rest, children: children }));
|
|
3586
|
+
};
|
|
3587
|
+
|
|
3588
|
+
/**
|
|
3589
|
+
* Bulma Hero component root.
|
|
3590
|
+
*
|
|
3591
|
+
* @function
|
|
3592
|
+
* @param {HeroProps} props - Props for the Hero component.
|
|
3593
|
+
* @returns {JSX.Element} The rendered hero.
|
|
3594
|
+
* @see {@link https://bulma.io/documentation/layout/hero/ | Bulma Hero documentation}
|
|
3595
|
+
*/
|
|
3596
|
+
const Hero = ({ className, color, size, bgColor, fullheightWithNavbar, children, ...props }) => {
|
|
3597
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3598
|
+
color,
|
|
3599
|
+
backgroundColor: bgColor,
|
|
3600
|
+
...props,
|
|
3601
|
+
});
|
|
3602
|
+
const heroClasses = classNames('hero', bulmaHelperClasses, className, color && `is-${color}`, size && size !== 'fullheight-with-navbar' && `is-${size}`, {
|
|
3603
|
+
'is-fullheight-with-navbar': fullheightWithNavbar || size === 'fullheight-with-navbar',
|
|
3604
|
+
});
|
|
3605
|
+
return (jsxRuntimeExports.jsx("section", { className: heroClasses, ...rest, children: children }));
|
|
3606
|
+
};
|
|
3607
|
+
/**
|
|
3608
|
+
* Bulma Hero head section.
|
|
3609
|
+
*/
|
|
3610
|
+
const HeroHead = ({ className, children, color, bgColor, textColor, ...props }) => {
|
|
3611
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3612
|
+
color: textColor !== null && textColor !== void 0 ? textColor : color,
|
|
3613
|
+
backgroundColor: bgColor,
|
|
3614
|
+
...props,
|
|
3615
|
+
});
|
|
3616
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('hero-head', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3617
|
+
};
|
|
3618
|
+
/**
|
|
3619
|
+
* Bulma Hero body section.
|
|
3620
|
+
*/
|
|
3621
|
+
const HeroBody = ({ className, children, color, bgColor, textColor, ...props }) => {
|
|
3622
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3623
|
+
color: textColor !== null && textColor !== void 0 ? textColor : color,
|
|
3624
|
+
backgroundColor: bgColor,
|
|
3625
|
+
...props,
|
|
3626
|
+
});
|
|
3627
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('hero-body', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3628
|
+
};
|
|
3629
|
+
/**
|
|
3630
|
+
* Bulma Hero foot section.
|
|
3631
|
+
*/
|
|
3632
|
+
const HeroFoot = ({ className, children, color, bgColor, textColor, ...props }) => {
|
|
3633
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
3634
|
+
color: textColor !== null && textColor !== void 0 ? textColor : color,
|
|
3635
|
+
backgroundColor: bgColor,
|
|
3636
|
+
...props,
|
|
3637
|
+
});
|
|
3638
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('hero-foot', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3639
|
+
};
|
|
3640
|
+
// Attach subcomponents
|
|
3641
|
+
Hero.Head = HeroHead;
|
|
3642
|
+
Hero.Body = HeroBody;
|
|
3643
|
+
Hero.Foot = HeroFoot;
|
|
3644
|
+
|
|
3645
|
+
/**
|
|
3646
|
+
* Bulma Media component root.
|
|
3647
|
+
*
|
|
3648
|
+
* @function
|
|
3649
|
+
* @param {MediaProps} props - Props for the Media component.
|
|
3650
|
+
* @returns {JSX.Element} The rendered media container.
|
|
3651
|
+
* @see {@link https://bulma.io/documentation/layout/media-object/ | Bulma Media documentation}
|
|
3652
|
+
*/
|
|
3653
|
+
const Media = ({ as = 'article', className, children, ...props }) => {
|
|
3654
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
3655
|
+
const Tag = as;
|
|
3656
|
+
return (jsxRuntimeExports.jsx(Tag, { className: classNames('media', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3657
|
+
};
|
|
3658
|
+
/**
|
|
3659
|
+
* Bulma Media left section.
|
|
3660
|
+
*/
|
|
3661
|
+
const MediaLeft = ({ as = 'figure', className, children, ...props }) => {
|
|
3662
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
3663
|
+
const Tag = as;
|
|
3664
|
+
return (jsxRuntimeExports.jsx(Tag, { className: classNames('media-left', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3665
|
+
};
|
|
3666
|
+
/**
|
|
3667
|
+
* Bulma Media content section.
|
|
3668
|
+
*/
|
|
3669
|
+
const MediaContent = ({ className, children, ...props }) => {
|
|
3670
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
3671
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('media-content', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3672
|
+
};
|
|
3673
|
+
/**
|
|
3674
|
+
* Bulma Media right section.
|
|
3675
|
+
*/
|
|
3676
|
+
const MediaRight = ({ className, children, ...props }) => {
|
|
3677
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
3678
|
+
return (jsxRuntimeExports.jsx("div", { className: classNames('media-right', bulmaHelperClasses, className), ...rest, children: children }));
|
|
3679
|
+
};
|
|
3680
|
+
Media.Left = MediaLeft;
|
|
3681
|
+
Media.Content = MediaContent;
|
|
3682
|
+
Media.Right = MediaRight;
|
|
3683
|
+
|
|
3684
|
+
/**
|
|
3685
|
+
* Bulma Section component for general layout.
|
|
3686
|
+
*
|
|
3687
|
+
* @function
|
|
3688
|
+
* @param {SectionProps} props - Props for the Section component.
|
|
3689
|
+
* @returns {JSX.Element} The rendered section.
|
|
3690
|
+
* @see {@link https://bulma.io/documentation/layout/section/ | Bulma Section documentation}
|
|
3691
|
+
*/
|
|
3692
|
+
const Section = ({ size, className, children, ...props }) => {
|
|
3693
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses({ ...props });
|
|
3694
|
+
const sectionClasses = classNames('section', className, bulmaHelperClasses, {
|
|
3695
|
+
[`is-${size}`]: size,
|
|
3696
|
+
});
|
|
3697
|
+
return (jsxRuntimeExports.jsx("section", { className: sectionClasses, ...rest, children: children }));
|
|
3698
|
+
};
|
|
3699
|
+
|
|
3700
|
+
export { Block, Box, Breadcrumb, Button, Buttons, Card, Cell, Column, Columns, Container, Content, Delete, Dropdown, DropdownDivider, DropdownItem, Grid, Hero, HeroBody, HeroFoot, HeroHead, Icon, IconText, Image, Media, MediaContent, MediaLeft, MediaRight, Menu, MenuItem, MenuLabel, MenuList, Message, Modal, Navbar, NavbarBrand, NavbarBurger, NavbarDivider, NavbarDropdown, NavbarDropdownMenu, NavbarEnd, NavbarItem, NavbarMenu, NavbarStart, Notification, Pagination, PaginationEllipsis, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, Panel, PanelBlock, PanelButtonBlock, PanelCheckboxBlock, PanelHeading, PanelIcon, PanelInputBlock, PanelTabs, Progress, Section, SubTitle, TabItem, TabList, Table, Tabs, Tag, Tags, Tbody, Td, Tfoot, Th, Thead, Title, Tr, __test_exports__, classNames, isBrowser, useBulmaClasses, validAlignContents, validAlignItems, validAlignSelfs, validAlignments$1 as validAlignments, validColorShades, validColors, validDisplays, validFlexDirections, validFlexGrowShrink, validFlexWraps, validFontFamilies, validJustifyContents, validSizes$1 as validSizes, validTableColors, validTextSizes, validTextTransforms, validTextWeights, validViewports, validVisibilities };
|
|
3701
|
+
//# sourceMappingURL=index.esm.js.map
|