revdev-components 0.149.0 → 0.150.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.
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  import { BackSidebarOption } from "./interfaces";
3
- import { AlfaNavigatorMapper } from "..";
3
+ import { AlfaBreadcrumbMapper } from "..";
4
4
  export * from "./interfaces";
5
5
  export interface BackSidebarProps {
6
6
  className?: string;
7
7
  options: BackSidebarOption[];
8
- mapper: AlfaNavigatorMapper;
8
+ mapper: AlfaBreadcrumbMapper;
9
9
  top?: React.ReactNode;
10
10
  shortMode?: boolean;
11
11
  activePathKey?: string;
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { BackSidebarOption } from "../interfaces";
3
- import { AlfaNavigatorMapper } from "src/interfaces";
3
+ import { AlfaBreadcrumbMapper } from "src/interfaces";
4
4
  interface Props {
5
5
  option: BackSidebarOption;
6
6
  activePathKey?: string;
7
- mapper: AlfaNavigatorMapper;
7
+ mapper: AlfaBreadcrumbMapper;
8
8
  }
9
9
  export declare const BackSidebarMenuItem: React.FC<Props>;
10
10
  export {};
@@ -1,10 +1,10 @@
1
1
  import React from "react";
2
2
  import { BackSidebarOption } from "../interfaces";
3
- import { AlfaNavigatorMapper } from "src/index";
3
+ import { AlfaBreadcrumbMapper } from "src/index";
4
4
  interface Props {
5
5
  option: BackSidebarOption;
6
6
  activePathKey?: string;
7
- mapper: AlfaNavigatorMapper;
7
+ mapper: AlfaBreadcrumbMapper;
8
8
  }
9
9
  export declare const BackSidebarShortMenuItem: React.FC<Props>;
10
10
  export {};
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { AlfaNavigatorOption } from "src/interfaces";
2
+ import { AlfaBreadcrumbOption } from "src/interfaces";
3
3
  interface Props {
4
- option: AlfaNavigatorOption;
4
+ option: AlfaBreadcrumbOption;
5
5
  isActive: boolean;
6
6
  }
7
7
  export declare const BackSidebarSubMenuItem: React.FC<Props>;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import { AlfaBreadcrumbMapper, AlfaBreadcrumbOption, AlfaBreadcrumbPath, AlfaBreadcrumbPathPart } from "src/interfaces";
3
+ export interface AlfaNavigatorChangeEvent {
4
+ path?: string[];
5
+ }
6
+ export interface AlfaBreadcrumbProps {
7
+ root?: AlfaBreadcrumbOption | AlfaBreadcrumbPathPart;
8
+ options?: AlfaBreadcrumbOption[];
9
+ className?: string;
10
+ stepClassName?: string;
11
+ isMobile?: boolean;
12
+ mapper?: AlfaBreadcrumbMapper;
13
+ path?: AlfaBreadcrumbPath;
14
+ onChange?: (e: AlfaNavigatorChangeEvent) => void;
15
+ separator?: React.ReactNode;
16
+ maxStepTextLength?: number;
17
+ }
18
+ export declare const AlfaBreadcrumb: React.FC<AlfaBreadcrumbProps>;
package/build/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export * from "./headerActionPanel";
22
22
  export * from "./iconDivision";
23
23
  export * from "./tooltip";
24
24
  export * from "./popoverSelect";
25
- export * from "./navigator";
25
+ export * from "./breadcrumb";
26
26
  export * from "./attributor";
27
27
  export * from "./optionsAutocomplete";
28
28
  export * from "./button";
package/build/index.js CHANGED
@@ -5133,7 +5133,7 @@ var s$d = {"root":"index-module_root__AZ9HE","root__active":"index-module_root__
5133
5133
  var BackSidebarSubMenuItem = function (_a) {
5134
5134
  var _b;
5135
5135
  var isActive = _a.isActive, option = _a.option;
5136
- var icon = option.icon, label = option.label, path = option.path;
5136
+ var icon = option.icon, label = option.label, path = option.href;
5137
5137
  return (React.createElement(AppLink, { className: classNames(s$d.root, (_b = {}, _b[s$d.root__active] = isActive, _b)), href: path },
5138
5138
  icon && React.createElement(RegularIcon, { name: icon }),
5139
5139
  React.createElement("span", null, label)));
@@ -5380,7 +5380,16 @@ var HeaderActionPanel = function (_a) {
5380
5380
  }))) : null;
5381
5381
  };
5382
5382
 
5383
- var s$3 = {"root":"index-module_root__t3gxi"};
5383
+ var s$3 = {"root":"index-module_root__AUcgm","separator":"index-module_separator__eiPxa","step":"index-module_step__Qwm7C","image":"index-module_image__kUPE1"};
5384
+
5385
+ var TextUtil = {
5386
+ maxTextEllipsis: function (text, maxLength) {
5387
+ if (text.length <= maxLength) {
5388
+ return text;
5389
+ }
5390
+ return text.slice(0, maxLength - 3) + "...";
5391
+ },
5392
+ };
5384
5393
 
5385
5394
  function getNavOption(mapper, part) {
5386
5395
  var _a = Array.isArray(part) ? part : [part, undefined], key = _a[0], param = _a[1];
@@ -5392,8 +5401,8 @@ function getNavOption(mapper, part) {
5392
5401
  }
5393
5402
  return undefined;
5394
5403
  }
5395
- var AlfaNavigator = function (_a) {
5396
- var className = _a.className, stepClassName = _a.stepClassName, root = _a.root, _b = _a.options, options = _b === void 0 ? [] : _b, isMobile = _a.isMobile, mapper = _a.mapper, path = _a.path, onChange = _a.onChange;
5404
+ var AlfaBreadcrumb = function (_a) {
5405
+ var className = _a.className, stepClassName = _a.stepClassName, root = _a.root, _b = _a.options, options = _b === void 0 ? [] : _b, isMobile = _a.isMobile, mapper = _a.mapper, path = _a.path, onChange = _a.onChange, _c = _a.separator, separator = _c === void 0 ? "/" : _c, _d = _a.maxStepTextLength, maxStepTextLength = _d === void 0 ? 30 : _d;
5397
5406
  var isMount = useDidMount();
5398
5407
  React.useEffect(function () {
5399
5408
  if (isMount) {
@@ -5442,10 +5451,13 @@ var AlfaNavigator = function (_a) {
5442
5451
  return result;
5443
5452
  }, [root, options, isMobile, mapper, path]);
5444
5453
  return innerOptions.length ? (React.createElement("div", { className: classNames(s$3.root, className) }, innerOptions.map(function (_a, index) {
5445
- var href = _a.path, label = _a.label;
5446
- return (React.createElement(React.Fragment, { key: href },
5447
- index > 0 ? React.createElement("span", null, "\u203A") : null,
5448
- React.createElement(AppLink, { className: classNames(s$3.step, stepClassName), href: href }, label)));
5454
+ var href = _a.href, label = _a.label, imageUrl = _a.imageUrl;
5455
+ var labelContent = (React.createElement(React.Fragment, null,
5456
+ imageUrl && React.createElement("img", { className: s$3.image, src: imageUrl, alt: label }),
5457
+ React.createElement("span", null, TextUtil.maxTextEllipsis(label, maxStepTextLength))));
5458
+ return (React.createElement(React.Fragment, { key: href || label || index },
5459
+ index > 0 ? React.createElement("span", { className: s$3.separator }, separator) : null,
5460
+ href ? (React.createElement(AppLink, { className: classNames(s$3.step, s$3.link, stepClassName), href: href, title: label }, labelContent)) : (React.createElement("span", { className: classNames(s$3.step, s$3.label, stepClassName), title: label }, labelContent))));
5449
5461
  }))) : null;
5450
5462
  };
5451
5463
 
@@ -5539,7 +5551,7 @@ var AudioPlayer = function (_a) {
5539
5551
  };
5540
5552
 
5541
5553
  exports.AlfaAttributor = AlfaAttributor;
5542
- exports.AlfaNavigator = AlfaNavigator;
5554
+ exports.AlfaBreadcrumb = AlfaBreadcrumb;
5543
5555
  exports.AppForm = AppForm;
5544
5556
  exports.AppLink = AppLink;
5545
5557
  exports.AppLinkButton = AppLinkButton;
@@ -1,9 +1,10 @@
1
1
  import { RegularIconName } from "src/icon";
2
- export interface AlfaNavigatorOption {
3
- path: string;
2
+ export interface AlfaBreadcrumbOption {
3
+ href?: string;
4
4
  label: string;
5
5
  icon?: RegularIconName;
6
+ imageUrl?: string;
6
7
  }
7
- export type AlfaNavigatorMapper = Record<string, AlfaNavigatorOption | ((param: any) => AlfaNavigatorOption)>;
8
- export type AlfaNavigatorPathPart<TKey extends string = string> = TKey | [TKey, any];
9
- export type AlfaNavigatorPath<TKey extends string = string> = AlfaNavigatorPathPart<TKey>[];
8
+ export type AlfaBreadcrumbMapper = Record<string, AlfaBreadcrumbOption | ((param: any) => AlfaBreadcrumbOption)>;
9
+ export type AlfaBreadcrumbPathPart<TKey extends string = string> = TKey | [TKey, any];
10
+ export type AlfaBreadcrumbPath<TKey extends string = string> = AlfaBreadcrumbPathPart<TKey>[];
package/build/styles.css CHANGED
@@ -547,14 +547,28 @@ body {
547
547
  .index-module_button__UVt6a:hover {
548
548
  color: var(--color);
549
549
  }
550
- .index-module_root__t3gxi {
550
+ .index-module_root__AUcgm {
551
551
  --linkColor: var(--passiveColor);
552
552
  display: flex;
553
553
  flex-direction: row;
554
554
  align-items: center;
555
555
  gap: 0.5em;
556
+ }
557
+
558
+ .index-module_separator__eiPxa {
559
+ user-select: none;
556
560
  color: var(--passiveColor);
557
- font-size: 0.8em;
561
+ }
562
+
563
+ .index-module_step__Qwm7C {
564
+ display: flex;
565
+ align-items: center;
566
+ }
567
+
568
+ .index-module_image__kUPE1 {
569
+ width: 1.25em;
570
+ height: 1.25em;
571
+ margin-right: 0.3em;
558
572
  }
559
573
  .index-module_root__UuWET {
560
574
  font-size: 0.8em;
@@ -0,0 +1,3 @@
1
+ export declare const TextUtil: {
2
+ maxTextEllipsis: (text: string, maxLength: number) => string;
3
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revdev-components",
3
- "version": "0.149.0",
3
+ "version": "0.150.0",
4
4
  "main": "build/index.js",
5
5
  "module": "build/index.esm.js",
6
6
  "scripts": {
@@ -1,16 +0,0 @@
1
- import React from "react";
2
- import { AlfaNavigatorMapper, AlfaNavigatorOption, AlfaNavigatorPath, AlfaNavigatorPathPart } from "src/interfaces";
3
- export interface AlfaNavigatorChangeEvent {
4
- path?: string[];
5
- }
6
- export interface AlfaNavigatorProps {
7
- root?: AlfaNavigatorOption | AlfaNavigatorPathPart;
8
- options?: AlfaNavigatorOption[];
9
- className?: string;
10
- stepClassName?: string;
11
- isMobile?: boolean;
12
- mapper?: AlfaNavigatorMapper;
13
- path?: AlfaNavigatorPath;
14
- onChange?: (e: AlfaNavigatorChangeEvent) => void;
15
- }
16
- export declare const AlfaNavigator: React.FC<AlfaNavigatorProps>;