@panneau/core 4.0.11 → 4.0.15
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/contexts.d.ts +450 -0
- package/{es → dist}/contexts.js +170 -170
- package/dist/hooks.d.ts +362 -0
- package/{es → dist}/hooks.js +60 -60
- package/dist/index.d.ts +502 -0
- package/{es → dist}/index.js +7 -258
- package/dist/utils.d.ts +207 -0
- package/{es → dist}/utils.js +56 -57
- package/package.json +23 -23
- package/es/types/core.d.ts +0 -133
- package/es/types/form.d.ts +0 -58
- package/es/types/index.d.ts +0 -20
- package/es/types/panneau.d.ts +0 -50
- package/es/types/resource.d.ts +0 -112
- package/lib/contexts.js +0 -1432
- package/lib/hooks.js +0 -1168
- package/lib/index.js +0 -1019
- package/lib/utils.js +0 -789
package/{es → dist}/utils.js
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import isNumber from 'lodash
|
|
1
|
+
import isNumber from 'lodash/isNumber';
|
|
2
2
|
import { snakeCase } from 'snake-case';
|
|
3
3
|
import _regenerator from '@babel/runtime/helpers/regenerator';
|
|
4
4
|
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
5
|
-
import isObject from 'lodash
|
|
5
|
+
import isObject from 'lodash/isObject';
|
|
6
6
|
import { useEffect, isValidElement } from 'react';
|
|
7
7
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
8
8
|
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
9
9
|
import ReactIs from 'react-is';
|
|
10
10
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
11
|
-
import isString from 'lodash
|
|
11
|
+
import isString from 'lodash/isString';
|
|
12
12
|
import { pascalCase, kebabCase, snakeCase as snakeCase$1 } from 'change-case';
|
|
13
13
|
export { kebabCase as dashCase, pascalCase, snakeCase } from 'change-case';
|
|
14
|
-
import isArray from 'lodash
|
|
14
|
+
import isArray from 'lodash/isArray';
|
|
15
15
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
16
|
-
import get from 'lodash
|
|
17
|
-
import capitalize from 'lodash
|
|
16
|
+
import get from 'lodash/get';
|
|
17
|
+
import capitalize from 'lodash/capitalize';
|
|
18
18
|
import EventEmitter from 'wolfy87-eventemitter';
|
|
19
19
|
import slugify from 'slugify';
|
|
20
20
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
21
|
-
import uniqBy from 'lodash
|
|
21
|
+
import uniqBy from 'lodash/uniqBy';
|
|
22
22
|
|
|
23
23
|
function checkClickable(el) {
|
|
24
24
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -33,7 +33,6 @@ function checkClickable(el) {
|
|
|
33
33
|
tagName = _ref2$tagName === void 0 ? null : _ref2$tagName,
|
|
34
34
|
_ref2$parentNode = _ref2.parentNode,
|
|
35
35
|
parentNode = _ref2$parentNode === void 0 ? null : _ref2$parentNode;
|
|
36
|
-
_ref2.dataset;
|
|
37
36
|
if (tagName === 'BODY') {
|
|
38
37
|
return false;
|
|
39
38
|
}
|
|
@@ -58,15 +57,15 @@ function checkClickable(el) {
|
|
|
58
57
|
return false;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
function convertStyleToString(style) {
|
|
62
61
|
return style !== null ? Object.keys(style).map(function (key) {
|
|
63
62
|
return "".concat(snakeCase(key), ":").concat(isNumber(style[key]) ? "".concat(style[key], "px") : style[key], ";");
|
|
64
63
|
}).join('\n') : '';
|
|
65
|
-
}
|
|
64
|
+
}
|
|
66
65
|
|
|
67
|
-
|
|
66
|
+
function createNullableOnChange() {
|
|
68
67
|
var onChange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
69
|
-
return function (newValue) {
|
|
68
|
+
return function nullableOnChange(newValue) {
|
|
70
69
|
var nullableValue = newValue;
|
|
71
70
|
if (isObject(newValue)) {
|
|
72
71
|
var allNull = Object.keys(newValue).reduce(function (acc, key) {
|
|
@@ -80,10 +79,10 @@ var createNullableOnChange = function createNullableOnChange() {
|
|
|
80
79
|
onChange(nullableValue);
|
|
81
80
|
}
|
|
82
81
|
};
|
|
83
|
-
}
|
|
82
|
+
}
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
return function (event, callback) {
|
|
84
|
+
function createUseEvent(eventsManager) {
|
|
85
|
+
return function useEvent(event, callback) {
|
|
87
86
|
var enabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
88
87
|
useEffect(function () {
|
|
89
88
|
if (enabled && eventsManager !== null) {
|
|
@@ -96,7 +95,7 @@ var createUseEvent = function createUseEvent(eventsManager) {
|
|
|
96
95
|
};
|
|
97
96
|
}, [eventsManager, event, callback, enabled]);
|
|
98
97
|
};
|
|
99
|
-
}
|
|
98
|
+
}
|
|
100
99
|
|
|
101
100
|
/*! clipboard-copy. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
102
101
|
|
|
@@ -211,17 +210,17 @@ function _copyToClipboard() {
|
|
|
211
210
|
return _copyToClipboard.apply(this, arguments);
|
|
212
211
|
}
|
|
213
212
|
|
|
214
|
-
|
|
213
|
+
function flattenComponents(components) {
|
|
215
214
|
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
216
215
|
if (components === null) {
|
|
217
216
|
return null;
|
|
218
217
|
}
|
|
219
218
|
return Object.keys(components).reduce(function (newMap, key) {
|
|
220
|
-
return ReactIs.isValidElementType(components[key]) ? _objectSpread(_objectSpread({}, newMap), {}, _defineProperty({}, prefix !== null ? "".concat(prefix, ".").concat(key) : key, components[key])) : _objectSpread(_objectSpread({}, newMap),
|
|
219
|
+
return ReactIs.isValidElementType(components[key]) ? _objectSpread(_objectSpread({}, newMap), {}, _defineProperty({}, prefix !== null ? "".concat(prefix, ".").concat(key) : key, components[key])) : _objectSpread(_objectSpread({}, newMap), flattenComponents(components[key], key));
|
|
221
220
|
}, {});
|
|
222
|
-
}
|
|
221
|
+
}
|
|
223
222
|
|
|
224
|
-
|
|
223
|
+
function formatDuration(timeInSeconds) {
|
|
225
224
|
var numberOfSeconds = parseInt(String(timeInSeconds), 10); // don't forget the second param
|
|
226
225
|
var hours = Math.floor(numberOfSeconds / 3600);
|
|
227
226
|
var minutes = Math.floor((numberOfSeconds - hours * 3600) / 60);
|
|
@@ -236,10 +235,10 @@ var formatDuration = function formatDuration(timeInSeconds) {
|
|
|
236
235
|
seconds = "0".concat(seconds);
|
|
237
236
|
}
|
|
238
237
|
return "".concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
239
|
-
}
|
|
238
|
+
}
|
|
240
239
|
|
|
241
240
|
var _excluded$1 = ["component"];
|
|
242
|
-
|
|
241
|
+
function getComponent(component) {
|
|
243
242
|
var _ref = isObject(component) ? component : {
|
|
244
243
|
component: component
|
|
245
244
|
};
|
|
@@ -249,10 +248,10 @@ var getComponent = function getComponent(component) {
|
|
|
249
248
|
name: component,
|
|
250
249
|
props: Object.keys(props).length > 0 ? props : null
|
|
251
250
|
};
|
|
252
|
-
}
|
|
251
|
+
}
|
|
253
252
|
|
|
254
253
|
var _excluded = ["id", "field"];
|
|
255
|
-
|
|
254
|
+
function getColumnFromField(field) {
|
|
256
255
|
if (field === null) {
|
|
257
256
|
return null;
|
|
258
257
|
}
|
|
@@ -276,8 +275,8 @@ var getColumnFromField = function getColumnFromField(field) {
|
|
|
276
275
|
component: componentName,
|
|
277
276
|
field: field
|
|
278
277
|
});
|
|
279
|
-
}
|
|
280
|
-
|
|
278
|
+
}
|
|
279
|
+
function getColumnsWithFields(resource, columns) {
|
|
281
280
|
var _resource$fields = resource.fields,
|
|
282
281
|
fields = _resource$fields === void 0 ? [] : _resource$fields;
|
|
283
282
|
var newColumns = columns !== null ? columns.map(function (column) {
|
|
@@ -299,9 +298,9 @@ var getColumnsWithFields = function getColumnsWithFields(resource, columns) {
|
|
|
299
298
|
return it !== null;
|
|
300
299
|
}) : [];
|
|
301
300
|
return newColumns;
|
|
302
|
-
}
|
|
301
|
+
}
|
|
303
302
|
|
|
304
|
-
|
|
303
|
+
function getComponentFromName() {
|
|
305
304
|
var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
306
305
|
var components = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
307
306
|
var defaultComponent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -314,9 +313,9 @@ var getComponentFromName = function getComponentFromName() {
|
|
|
314
313
|
console.warn('Could not find component from name', name, pascalName, components);
|
|
315
314
|
}
|
|
316
315
|
return component;
|
|
317
|
-
}
|
|
316
|
+
}
|
|
318
317
|
|
|
319
|
-
|
|
318
|
+
function getDefinitionFromId() {
|
|
320
319
|
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
321
320
|
var items = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
322
321
|
var defaultObject = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
@@ -329,17 +328,17 @@ var getDefinitionFromId = function getDefinitionFromId() {
|
|
|
329
328
|
}) || items.find(function (i) {
|
|
330
329
|
return i.id === id;
|
|
331
330
|
}) || defaultObject;
|
|
332
|
-
}
|
|
331
|
+
}
|
|
333
332
|
|
|
334
|
-
|
|
333
|
+
function getDisplayName(_ref) {
|
|
335
334
|
var _ref$displayName = _ref.displayName,
|
|
336
335
|
displayName = _ref$displayName === void 0 ? null : _ref$displayName,
|
|
337
336
|
_ref$name = _ref.name,
|
|
338
337
|
name = _ref$name === void 0 ? null : _ref$name;
|
|
339
338
|
return displayName || name || 'Component';
|
|
340
|
-
}
|
|
339
|
+
}
|
|
341
340
|
|
|
342
|
-
|
|
341
|
+
function getFieldByName(fields, name) {
|
|
343
342
|
return fields.reduce(function (foundField, it) {
|
|
344
343
|
if (foundField !== null) {
|
|
345
344
|
return foundField;
|
|
@@ -351,11 +350,11 @@ var _getFieldByName = function getFieldByName(fields, name) {
|
|
|
351
350
|
if (name !== null && fieldName === name) {
|
|
352
351
|
return it;
|
|
353
352
|
}
|
|
354
|
-
return
|
|
353
|
+
return getFieldByName(subFields, name);
|
|
355
354
|
}, null);
|
|
356
|
-
}
|
|
355
|
+
}
|
|
357
356
|
|
|
358
|
-
|
|
357
|
+
function getFieldFromPath(path, fields, fieldManager) {
|
|
359
358
|
return (isArray(path) ? path : [path]).reduce(function (foundField, key) {
|
|
360
359
|
if (foundField === null) {
|
|
361
360
|
return null;
|
|
@@ -380,29 +379,29 @@ var getFieldFromPath = function getFieldFromPath(path, fields, fieldManager) {
|
|
|
380
379
|
listItems: true
|
|
381
380
|
});
|
|
382
381
|
}
|
|
383
|
-
return
|
|
382
|
+
return getFieldByName([].concat(_toConsumableArray(fieldFields || []), _toConsumableArray(subFields || []), _toConsumableArray(settings || [])), key);
|
|
384
383
|
}, {
|
|
385
384
|
fields: fields
|
|
386
385
|
});
|
|
387
|
-
}
|
|
386
|
+
}
|
|
388
387
|
|
|
389
|
-
|
|
388
|
+
function getFileName() {
|
|
390
389
|
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
391
390
|
if (url === null || typeof url.match === 'undefined') {
|
|
392
391
|
return null;
|
|
393
392
|
}
|
|
394
393
|
var match = url.match(/([^/]+)(\?.*)?$/);
|
|
395
394
|
return match ? match[1] : url;
|
|
396
|
-
}
|
|
395
|
+
}
|
|
397
396
|
|
|
398
|
-
|
|
397
|
+
function getPathValue(it, path) {
|
|
399
398
|
var value = get(it, path, null);
|
|
400
399
|
return value !== null && isObject(value) ? Object.values(value).reduce(function (foundValue, val) {
|
|
401
400
|
return foundValue !== null ? foundValue : val;
|
|
402
401
|
}, null) : value;
|
|
403
|
-
}
|
|
402
|
+
}
|
|
404
403
|
|
|
405
|
-
|
|
404
|
+
function getSelectOptions(options) {
|
|
406
405
|
return options.map(function (it) {
|
|
407
406
|
if (isObject(it)) {
|
|
408
407
|
var _ref = it,
|
|
@@ -425,11 +424,11 @@ var getSelectOptions = function getSelectOptions(options) {
|
|
|
425
424
|
label: capitalize("".concat(it))
|
|
426
425
|
};
|
|
427
426
|
});
|
|
428
|
-
}
|
|
427
|
+
}
|
|
429
428
|
|
|
430
|
-
|
|
429
|
+
function isMessage(message) {
|
|
431
430
|
return isObject(message) && typeof message.defaultMessage !== 'undefined';
|
|
432
|
-
}
|
|
431
|
+
}
|
|
433
432
|
|
|
434
433
|
/**
|
|
435
434
|
* Locale loader
|
|
@@ -541,7 +540,7 @@ function selectPage(pageSelected, items, selectedItems, onSelectionChange) {
|
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
542
|
|
|
544
|
-
|
|
543
|
+
function setValue(value, keyParts, fieldValue) {
|
|
545
544
|
var key = keyParts.shift();
|
|
546
545
|
if (!key) {
|
|
547
546
|
return value;
|
|
@@ -551,16 +550,16 @@ var _setValue = function setValue(value, keyParts, fieldValue) {
|
|
|
551
550
|
if (isArray) {
|
|
552
551
|
var index = parseInt(key, 10);
|
|
553
552
|
var arrayValue = value;
|
|
554
|
-
var newArrayValue = fieldValue !== null ? [].concat(_toConsumableArray(arrayValue.slice(0, index)), [keyParts.length > 0 ?
|
|
553
|
+
var newArrayValue = fieldValue !== null ? [].concat(_toConsumableArray(arrayValue.slice(0, index)), [keyParts.length > 0 ? setValue(arrayValue !== null ? arrayValue[index] || null : null, keyParts, fieldValue) : fieldValue], _toConsumableArray(arrayValue.slice(index + 1))) : [].concat(_toConsumableArray(arrayValue.slice(0, index)), _toConsumableArray(arrayValue.slice(index + 1)));
|
|
555
554
|
return newArrayValue.length > 0 ? newArrayValue : null;
|
|
556
555
|
}
|
|
557
556
|
var objectValue = value;
|
|
558
|
-
return _objectSpread(_objectSpread({}, objectValue), {}, _defineProperty({}, key, keyParts.length > 0 ?
|
|
557
|
+
return _objectSpread(_objectSpread({}, objectValue), {}, _defineProperty({}, key, keyParts.length > 0 ? setValue(objectValue !== null ? objectValue[key] || null : null, keyParts, fieldValue) : fieldValue));
|
|
559
558
|
}
|
|
560
559
|
return null;
|
|
561
|
-
}
|
|
560
|
+
}
|
|
562
561
|
|
|
563
|
-
|
|
562
|
+
function slug(str) {
|
|
564
563
|
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
565
564
|
var toSlug;
|
|
566
565
|
if (separator === '-') {
|
|
@@ -571,19 +570,19 @@ var slug = function slug(str) {
|
|
|
571
570
|
return slugify(toSlug, {
|
|
572
571
|
lower: true
|
|
573
572
|
});
|
|
574
|
-
}
|
|
573
|
+
}
|
|
575
574
|
|
|
576
|
-
|
|
575
|
+
function validateFields(fields, value) {
|
|
577
576
|
return fields.reduce(function (acc, field) {
|
|
578
577
|
if (acc === true) {
|
|
579
578
|
if (field.type === 'fields' && field.fields) {
|
|
580
|
-
return
|
|
579
|
+
return validateFields(field.fields, value);
|
|
581
580
|
}
|
|
582
581
|
var val = value && field.name && value[field.name] ? value[field.name] : false;
|
|
583
582
|
return !(field.required && !val);
|
|
584
583
|
}
|
|
585
584
|
return acc;
|
|
586
585
|
}, true);
|
|
587
|
-
}
|
|
586
|
+
}
|
|
588
587
|
|
|
589
|
-
export { checkClickable, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent,
|
|
588
|
+
export { checkClickable, convertStyleToString, copyToClipboard, createNullableOnChange, createUseEvent, flattenComponents, formatDuration, getColumnsWithFields, getComponent, getComponentFromName, getDefinitionFromId, getDisplayName, getFieldByName, getFieldFromPath, getFileName, getPathValue, getSelectOptions, isMessage, loadPackage, selectItem, selectPage, setValue as setFieldValue, slug, validateFields };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -26,35 +26,36 @@
|
|
|
26
26
|
],
|
|
27
27
|
"license": "ISC",
|
|
28
28
|
"type": "module",
|
|
29
|
-
"module": "
|
|
30
|
-
"types": "
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"types": "./es/types/index.d.ts"
|
|
36
|
-
}
|
|
33
|
+
"default": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts"
|
|
37
35
|
},
|
|
38
|
-
"./contexts":
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
"./contexts": {
|
|
37
|
+
"default": "./dist/contexts.js",
|
|
38
|
+
"types": "./dist/contexts.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./hooks": {
|
|
41
|
+
"default": "./dist/hooks.js",
|
|
42
|
+
"types": "./dist/hooks.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./utils": {
|
|
45
|
+
"default": "./dist/utils.js",
|
|
46
|
+
"types": "./dist/utils.d.ts"
|
|
47
|
+
}
|
|
42
48
|
},
|
|
43
49
|
"sideEffects": [
|
|
44
|
-
"./
|
|
50
|
+
"./dist/hooks.js"
|
|
45
51
|
],
|
|
46
52
|
"files": [
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"assets",
|
|
50
|
-
"components.js",
|
|
51
|
-
"contexts.js",
|
|
52
|
-
"hooks.js",
|
|
53
|
-
"utils.js"
|
|
53
|
+
"dist",
|
|
54
|
+
"assets"
|
|
54
55
|
],
|
|
55
56
|
"scripts": {
|
|
56
57
|
"prepublishOnly": "npm run build",
|
|
57
|
-
"build": "../../scripts/prepare-package.sh"
|
|
58
|
+
"build": "../../scripts/prepare-package.sh --types"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"react": "^19.0.0",
|
|
@@ -82,8 +83,7 @@
|
|
|
82
83
|
"debug": "^4.3.4",
|
|
83
84
|
"flat": "^6.0.1",
|
|
84
85
|
"hoist-non-react-statics": "^3.3.2",
|
|
85
|
-
"lodash
|
|
86
|
-
"prop-types": "^15.7.2",
|
|
86
|
+
"lodash": "^4.17.21",
|
|
87
87
|
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0",
|
|
88
88
|
"react-is": "^18.2.0",
|
|
89
89
|
"slugify": "^1.5.0",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "83c02ca2f26e02383ef452ffcafda984d0b211cd"
|
|
100
100
|
}
|
package/es/types/core.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core UI Types
|
|
3
|
-
* TypeScript interfaces corresponding to PanneauPropTypes
|
|
4
|
-
*/
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internationalization message definition
|
|
9
|
-
*/
|
|
10
|
-
export interface Message {
|
|
11
|
-
id: string;
|
|
12
|
-
defaultMessage?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Label can be either a message object or any React node
|
|
17
|
-
*/
|
|
18
|
-
export type Label = Message | ReactNode;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* HTTP status code (number or string)
|
|
22
|
-
*/
|
|
23
|
-
export type StatusCode = number | string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Menu item definition
|
|
27
|
-
*/
|
|
28
|
-
export interface MenuItem {
|
|
29
|
-
id?: number | string;
|
|
30
|
-
label?: Label;
|
|
31
|
-
url?: string;
|
|
32
|
-
external?: boolean;
|
|
33
|
-
active?: boolean;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Button definition
|
|
38
|
-
*/
|
|
39
|
-
export interface Button {
|
|
40
|
-
id?: string;
|
|
41
|
-
label?: Label;
|
|
42
|
-
onClick?: () => void;
|
|
43
|
-
href?: string;
|
|
44
|
-
target?: string;
|
|
45
|
-
theme?: ButtonTheme;
|
|
46
|
-
size?: ButtonSize;
|
|
47
|
-
type?: ButtonType;
|
|
48
|
-
disabled?: boolean;
|
|
49
|
-
external?: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Button theme variants (Bootstrap 5)
|
|
54
|
-
*/
|
|
55
|
-
export type ButtonTheme =
|
|
56
|
-
| 'primary'
|
|
57
|
-
| 'secondary'
|
|
58
|
-
| 'success'
|
|
59
|
-
| 'danger'
|
|
60
|
-
| 'warning'
|
|
61
|
-
| 'info'
|
|
62
|
-
| 'light'
|
|
63
|
-
| 'dark'
|
|
64
|
-
| null;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Button size variants
|
|
68
|
-
*/
|
|
69
|
-
export type ButtonSize = 'lg' | 'md' | 'sm' | null;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Button type attribute
|
|
73
|
-
*/
|
|
74
|
-
export type ButtonType = 'button' | 'submit';
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Dropdown alignment
|
|
78
|
-
*/
|
|
79
|
-
export type DropdownAlign = 'start' | 'end';
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Form control size
|
|
83
|
-
*/
|
|
84
|
-
export type ControlSize = 'lg' | 'sm' | null;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Form status states
|
|
88
|
-
*/
|
|
89
|
-
export type FormStatus = 'loading' | 'success' | 'error' | null;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Form feedback states
|
|
93
|
-
*/
|
|
94
|
-
export type Feedback = 'valid' | 'invalid' | 'loading' | null;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Form error object
|
|
98
|
-
*/
|
|
99
|
-
export interface FormError {
|
|
100
|
-
message?: string;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Toggle definition
|
|
105
|
-
*/
|
|
106
|
-
export interface Toggle {
|
|
107
|
-
key?: string;
|
|
108
|
-
label?: string;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Breadcrumb definition
|
|
113
|
-
*/
|
|
114
|
-
export interface Breadcrumb {
|
|
115
|
-
url?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Font definition
|
|
120
|
-
*/
|
|
121
|
-
export interface Font {
|
|
122
|
-
// Properties to be defined based on requirements
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Tracking variables
|
|
127
|
-
*/
|
|
128
|
-
export type TrackingVariables = Record<string, unknown>;
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Trigger update identifier
|
|
132
|
-
*/
|
|
133
|
-
export type TriggerUpdate = string;
|
package/es/types/form.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Form Types
|
|
3
|
-
* TypeScript interfaces for form-related components
|
|
4
|
-
*/
|
|
5
|
-
import { ReactNode } from 'react';
|
|
6
|
-
|
|
7
|
-
import { Label } from './core';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Field option for select/radio inputs
|
|
11
|
-
*/
|
|
12
|
-
export interface FieldOption {
|
|
13
|
-
value?: string;
|
|
14
|
-
label?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Select option (more flexible than FieldOption)
|
|
19
|
-
*/
|
|
20
|
-
export type SelectOption =
|
|
21
|
-
| string
|
|
22
|
-
| number
|
|
23
|
-
| {
|
|
24
|
-
value?: unknown;
|
|
25
|
-
label?: Label | string;
|
|
26
|
-
}
|
|
27
|
-
| Record<string, unknown>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Field definition
|
|
31
|
-
*/
|
|
32
|
-
export interface Field {
|
|
33
|
-
name?: string; // Not required on localized fields
|
|
34
|
-
type?: string;
|
|
35
|
-
component?: string;
|
|
36
|
-
label?: ReactNode;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Form definition
|
|
41
|
-
*/
|
|
42
|
-
export interface Form {
|
|
43
|
-
title: ReactNode;
|
|
44
|
-
fields?: Field[];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Table column definition
|
|
49
|
-
*/
|
|
50
|
-
export type TableColumn =
|
|
51
|
-
| string
|
|
52
|
-
| {
|
|
53
|
-
id?: string;
|
|
54
|
-
component?: string;
|
|
55
|
-
path?: string;
|
|
56
|
-
field?: string;
|
|
57
|
-
columnClassName?: string;
|
|
58
|
-
};
|
package/es/types/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Panneau TypeScript Type Definitions
|
|
3
|
-
*
|
|
4
|
-
* This module exports TypeScript interfaces corresponding to the PanneauPropTypes
|
|
5
|
-
* defined in packages/core/src/lib/PropTypes.js
|
|
6
|
-
*
|
|
7
|
-
* @module @panneau/core/types
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
// Core UI Types
|
|
11
|
-
export type * from './core';
|
|
12
|
-
|
|
13
|
-
// Form Types
|
|
14
|
-
export type * from './form';
|
|
15
|
-
|
|
16
|
-
// Resource Types
|
|
17
|
-
export type * from './resource';
|
|
18
|
-
|
|
19
|
-
// Panneau Definition Types
|
|
20
|
-
export type * from './panneau';
|
package/es/types/panneau.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Panneau Definition Types
|
|
3
|
-
* TypeScript interfaces for main Panneau configuration and definitions
|
|
4
|
-
*/
|
|
5
|
-
import { Intl, Resource } from './resource';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Panneau route configuration
|
|
9
|
-
*/
|
|
10
|
-
export interface Routes {
|
|
11
|
-
'resources.index': string;
|
|
12
|
-
'resources.create': string;
|
|
13
|
-
'resources.store': string;
|
|
14
|
-
'resources.show': string;
|
|
15
|
-
'resources.edit': string;
|
|
16
|
-
'resources.update': string;
|
|
17
|
-
'resources.delete': string;
|
|
18
|
-
'resources.destroy': string;
|
|
19
|
-
'resources.duplicate': string;
|
|
20
|
-
'resources.clone': string;
|
|
21
|
-
'resources.restore': string;
|
|
22
|
-
[key: string]: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Page definition
|
|
27
|
-
*/
|
|
28
|
-
export interface Page {
|
|
29
|
-
component: string;
|
|
30
|
-
[key: string]: unknown;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Panneau definition (main configuration)
|
|
35
|
-
*/
|
|
36
|
-
export interface PanneauDefinition {
|
|
37
|
-
name?: string;
|
|
38
|
-
resources?: Resource[];
|
|
39
|
-
routes?: Routes;
|
|
40
|
-
pages?: Record<string, Page>;
|
|
41
|
-
intl?: Intl;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Generic definition
|
|
46
|
-
*/
|
|
47
|
-
export interface Definition {
|
|
48
|
-
name?: string;
|
|
49
|
-
[key: string]: unknown;
|
|
50
|
-
}
|