revdev-components 0.75.0 → 0.76.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/build/index.js CHANGED
@@ -5227,11 +5227,28 @@ var HeaderActionPanel = function (_a) {
5227
5227
  var s$2 = {"root":"index-module_root__t3gxi"};
5228
5228
 
5229
5229
  var AlfaNavigator = function (_a) {
5230
- var className = _a.className, stepClassName = _a.stepClassName, rootOption = _a.rootOption, options = _a.options, isMobile = _a.isMobile;
5230
+ var className = _a.className, stepClassName = _a.stepClassName, rootOption = _a.rootOption, _b = _a.options, options = _b === void 0 ? [] : _b, isMobile = _a.isMobile, mapper = _a.mapper, path = _a.path;
5231
5231
  var innerOptions = React.useMemo(function () {
5232
- var allOptions = rootOption ? __spreadArray([rootOption], options, true) : options;
5233
- return isMobile ? allOptions.slice(options.length - 1) : allOptions;
5234
- }, [rootOption, options, isMobile]);
5232
+ var result = [];
5233
+ if (mapper && Array.isArray(path)) {
5234
+ result = path
5235
+ .map(function (p) {
5236
+ var _a = Array.isArray(p) ? p : [p, undefined], key = _a[0], param = _a[1];
5237
+ var o = mapper[key];
5238
+ if (o) {
5239
+ return typeof o === "function" ? o((param === null || param === void 0 ? void 0 : param.toString()) || "") : o;
5240
+ }
5241
+ return undefined;
5242
+ })
5243
+ .filter(function (x) { return x; });
5244
+ }
5245
+ else {
5246
+ result = options;
5247
+ }
5248
+ result = rootOption ? __spreadArray([rootOption], result, true) : result;
5249
+ result = isMobile ? result.slice(options.length - 1) : result;
5250
+ return result;
5251
+ }, [rootOption, options, isMobile, mapper, path]);
5235
5252
  return innerOptions.length ? (React.createElement("div", { className: classNames(s$2.root, className) }, innerOptions.map(function (_a, index) {
5236
5253
  var href = _a.href, label = _a.label;
5237
5254
  return (React.createElement(React.Fragment, { key: index },
@@ -3,12 +3,17 @@ export interface AlfaNavigatorOption {
3
3
  href: string;
4
4
  label: string;
5
5
  }
6
+ export type AlfaNavigatorMapper = Record<string, AlfaNavigatorOption | ((param: string) => AlfaNavigatorOption)>;
7
+ export type AlfaNavigatorPathPart<TKey extends string = string> = TKey | [TKey, string | number];
8
+ export type AlfaNavigatorPart<TKey extends string = string> = AlfaNavigatorPathPart<TKey>[];
6
9
  interface Props {
7
10
  rootOption?: AlfaNavigatorOption;
8
- options: AlfaNavigatorOption[];
11
+ options?: AlfaNavigatorOption[];
9
12
  className?: string;
10
13
  stepClassName?: string;
11
14
  isMobile?: boolean;
15
+ mapper?: AlfaNavigatorMapper;
16
+ path?: AlfaNavigatorPart;
12
17
  }
13
18
  export declare const AlfaNavigator: React.FC<Props>;
14
19
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev-components",
3
- "version": "0.75.0",
3
+ "version": "0.76.0",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.esm.js",
6
6
  "scripts": {