@edifice.io/react 2.5.16-develop-pedago.20260429161139 → 2.5.16-develop-pedago.20260506150449

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.
@@ -15,16 +15,14 @@ function drawBlurListener(application, {
15
15
  const child = application.stage.getChildByName(spriteName), scale = getApplicationScale(application);
16
16
  if (child == null) return;
17
17
  const newSprite = new PIXI.Sprite(child.texture);
18
- newSprite.filters = [
19
- new PIXI.BlurFilter(
20
- 8,
21
- // PIXI Default value for strength of the blur effect
22
- 4,
23
- // Quality of the blur effect depending on the scale (4 is the PIXI default value)
24
- Math.min(scale, 1)
25
- )
18
+ newSprite.filters = [new PIXI.BlurFilter(
19
+ 8,
20
+ // PIXI Default value for strength of the blur effect
21
+ 4,
22
+ // Quality of the blur effect depending on the scale (4 is the PIXI default value)
23
+ Math.min(scale, 1)
26
24
  // Resolution of the blur effect depending on the scale
27
- ], newSprite.width = child.width, newSprite.height = child.height, newSprite.scale = new PIXI.Point(1, 1), newSprite.anchor = child.anchor, newSprite.mask = drawBrush(points, scale), child.addChild(newSprite);
25
+ )], newSprite.width = child.width, newSprite.height = child.height, newSprite.scale = new PIXI.Point(1, 1), newSprite.anchor = child.anchor, newSprite.mask = drawBrush(points, scale), child.addChild(newSprite);
28
26
  });
29
27
  }
30
28
  function drawCursor(application) {
@@ -36,6 +36,18 @@ export interface InternalLinkerProps {
36
36
  disableApplicationSelector?: boolean;
37
37
  /** Optional callback to filter resources after loading. Applied in addition to search filters. */
38
38
  resourceFilter?: (resource: ILinkedResource) => boolean;
39
+ /**
40
+ * When provided, replaces the built-in search/load logic entirely.
41
+ * Called with the current search terms and selected application whenever the search changes.
42
+ * The returned resources are displayed as-is (no additional filtering or sorting).
43
+ */
44
+ onSearch?: (search: string, application?: ApplicationOption) => Promise<ILinkedResource[]>;
45
+ /** When true, a "load more" button is shown. The caller controls this flag. */
46
+ hasMoreResources?: boolean;
47
+ /** Called when the user clicks the "load more" button. */
48
+ onLoadMore?: () => void;
49
+ /** Label for the "load more" button. Defaults to the `bbm.linker.see.more` i18n key. */
50
+ loadMoreLabel?: string;
39
51
  }
40
- export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
52
+ export declare const InternalLinker: ({ appCode, defaultAppCode, defaultResourceId, onChange, onSelect, multiple, resourceList, applicationList, showApplicationSelector, disableApplicationSelector, resourceFilter, onSearch, hasMoreResources, onLoadMore, loadMoreLabel, }: InternalLinkerProps) => import("react/jsx-runtime").JSX.Element;
41
53
  export default InternalLinker;
@@ -10,6 +10,7 @@ import { useResourceSearch } from "../../../../hooks/useResourceSearch/useResour
10
10
  import AppIcon from "../../../../components/AppIcon/AppIcon.js";
11
11
  import Dropdown from "../../../../components/Dropdown/Dropdown.js";
12
12
  import SearchBar from "../../../../components/SearchBar/SearchBar.js";
13
+ import Button from "../../../../components/Button/Button.js";
13
14
  import EmptyScreen from "../../../../components/EmptyScreen/EmptyScreen.js";
14
15
  import { emptyScreenMapping } from "../../../../utilities/emptyscreen-mapping/emptyscreen-mapping.js";
15
16
  const InternalLinker = ({
@@ -23,7 +24,11 @@ const InternalLinker = ({
23
24
  applicationList,
24
25
  showApplicationSelector = !0,
25
26
  disableApplicationSelector = !1,
26
- resourceFilter
27
+ resourceFilter,
28
+ onSearch,
29
+ hasMoreResources,
30
+ onLoadMore,
31
+ loadMoreLabel
27
32
  }) => {
28
33
  const {
29
34
  t
@@ -39,6 +44,14 @@ const InternalLinker = ({
39
44
  return ((_a = resource.name) == null ? void 0 : _a.toLowerCase().includes(searchParam)) || ((_b = resource.creatorName) == null ? void 0 : _b.toLowerCase().includes(searchParam)) || ((_c = resource.description) == null ? void 0 : _c.toLowerCase().includes(searchParam));
40
45
  }, []), sortResources = useCallback((resources2) => resources2.sort((a, b) => a.modifiedAt < b.modifiedAt ? 1 : -1), []), loadAndDisplayResources = useCallback((search) => {
41
46
  async function load() {
47
+ if (onSearch) {
48
+ try {
49
+ setResources(await onSearch(search || "", selectedApplication));
50
+ } catch {
51
+ setResources([]);
52
+ }
53
+ return;
54
+ }
42
55
  if (resourceList) {
43
56
  let filteredResources = resourceList.filter((resource) => filterResources(resource, search));
44
57
  resourceFilter && (filteredResources = filteredResources.filter(resourceFilter)), setResources(sortResources(filteredResources));
@@ -63,7 +76,7 @@ const InternalLinker = ({
63
76
  setResources([]);
64
77
  }
65
78
  load();
66
- }, [loadResources, selectedApplication, filterResources, sortResources, resourceList, resourceFilter]), [selectedDocuments, setSelectedDocuments] = useState([]), handleOptionClick = (option) => {
79
+ }, [onSearch, loadResources, selectedApplication, filterResources, sortResources, resourceList, resourceFilter]), [selectedDocuments, setSelectedDocuments] = useState([]), handleOptionClick = (option) => {
67
80
  onChange == null || onChange(option), setSelectedApplication(option);
68
81
  }, handleSearchChange = (event) => {
69
82
  const newText = event.target.value;
@@ -121,10 +134,13 @@ const InternalLinker = ({
121
134
  /* @__PURE__ */ jsx("div", { className: "flex-grow-1 align-self-center", children: /* @__PURE__ */ jsx("form", { className: "gap-16 d-flex w-100 align-items-center px-16 py-8", onSubmit: handleSubmit, children: /* @__PURE__ */ jsx(SearchBar, { isVariant: !0, placeholder: t("search"), size: "lg", className: "w-100", disabled: !selectedApplication, onChange: handleSearchChange }) }) })
122
135
  ] }),
123
136
  /* @__PURE__ */ jsxs("div", { className: "internal-linker flex-grow-1 w-100 rounded-bottom border gap-0 overflow-auto", children: [
124
- selectedApplication && resources && resources.length > 0 && /* @__PURE__ */ jsx("div", { children: resources.map((resource) => {
125
- const isSelected = selectedDocuments.findIndex((doc) => doc.assetId === resource.assetId) >= 0;
126
- return /* @__PURE__ */ jsx(LinkerCard, { doc: resource, isSelected, onClick: () => toggleResourceSelection(resource) }, resource.path);
127
- }) }),
137
+ selectedApplication && resources && resources.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
138
+ resources.map((resource) => {
139
+ const isSelected = selectedDocuments.findIndex((doc) => doc.assetId === resource.assetId) >= 0;
140
+ return /* @__PURE__ */ jsx(LinkerCard, { doc: resource, isSelected, onClick: () => toggleResourceSelection(resource) }, resource.path);
141
+ }),
142
+ hasMoreResources && /* @__PURE__ */ jsx("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ jsx(Button, { type: "button", color: "secondary", variant: "filled", onClick: onLoadMore, children: loadMoreLabel ?? t("bbm.linker.see.more") }) })
143
+ ] }),
128
144
  selectedApplication && resources && resources.length <= 0 && /* @__PURE__ */ jsx("div", { className: "d-flex justify-content-center mt-16", children: /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: emptyScreenMapping[(theme == null ? void 0 : theme.bootstrapVersion) ?? "one"][selectedApplication == null ? void 0 : selectedApplication.application], text: t("bbm.linker.int.notfound"), className: "mt-16" }) }),
129
145
  !selectedApplication && /* @__PURE__ */ jsx("div", { className: "d-flex justify-content-center mt-32", children: /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: emptyScreenMapping[(theme == null ? void 0 : theme.bootstrapVersion) ?? "one"].empty, text: t("bbm.linker.int.empty"), className: "mt-32" }) })
130
146
  ] })
@@ -1,10 +1,13 @@
1
- import { IResource } from '@edifice.io/client';
1
+ import { ILinkedResource } from '@edifice.io/client';
2
2
  import { CardProps } from '../../../components';
3
+ /** Augments ILinkedResource with an optional pre-computed date string. */
4
+ export interface ILinkedResourceWithDate extends ILinkedResource {
5
+ /** When provided, displayed as-is instead of computing fromNow(modifiedAt). */
6
+ fromDate?: string;
7
+ }
3
8
  export interface LinkerCardProps extends CardProps {
4
- /**
5
- * Resource to render as a card
6
- * */
7
- doc: IResource;
9
+ /** Resource to render as a card */
10
+ doc: ILinkedResourceWithDate;
8
11
  }
9
12
  declare const LinkerCard: {
10
13
  ({ doc, isClickable, isSelectable, isSelected, onClick, className, }: LinkerCardProps): import("react/jsx-runtime").JSX.Element;
@@ -16,11 +16,7 @@ const LinkerCard = ({
16
16
  }) => {
17
17
  const {
18
18
  fromNow
19
- } = useDate(), {
20
- fromDate
21
- } = useMemo(() => ({
22
- fromDate: fromNow(doc.modifiedAt)
23
- }), [fromNow, doc]);
19
+ } = useDate(), displayDate = useMemo(() => doc.fromDate ?? fromNow(doc.modifiedAt), [doc.fromDate, doc.modifiedAt, fromNow]);
24
20
  return /* @__PURE__ */ jsx(Card, { className: clsx("card-linker shadow-none", className), isClickable, isSelectable, isSelected, onClick, children: /* @__PURE__ */ jsxs(Card.Body, { space: "8", children: [
25
21
  /* @__PURE__ */ jsx("div", { className: "card-image ps-8 pe-4", children: doc.thumbnail && doc.thumbnail.length > 0 ? /* @__PURE__ */ jsx(Image, { alt: "", height: 48, width: 48, src: doc.thumbnail, objectFit: "cover", className: "rounded h-full", style: {
26
22
  aspectRatio: 1 / 1
@@ -29,7 +25,7 @@ const LinkerCard = ({
29
25
  /* @__PURE__ */ jsx(Card.Text, { children: doc.name }),
30
26
  /* @__PURE__ */ jsx(Card.Text, { className: "text-black-50", children: doc == null ? void 0 : doc.creatorName })
31
27
  ] }),
32
- /* @__PURE__ */ jsx("div", { className: "d-none d-md-block text-black-50 ps-4 pe-8", children: /* @__PURE__ */ jsx(Card.Text, { children: fromDate }) }),
28
+ /* @__PURE__ */ jsx("div", { className: "d-none d-md-block text-black-50 ps-4 pe-8", children: /* @__PURE__ */ jsx(Card.Text, { children: displayDate }) }),
33
29
  doc.shared && /* @__PURE__ */ jsx("div", { className: "ps-4 pe-8", children: /* @__PURE__ */ jsx(SvgIconUsers, { width: "20", height: "20" }) })
34
30
  ] }) });
35
31
  };
@@ -1,6 +1,6 @@
1
1
  import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
2
  import { __module as isSameOrAfter$1 } from "../../../../../../_virtual/isSameOrAfter.js";
3
- (function(module, exports$1) {
3
+ (function(module, exports) {
4
4
  (function(e, t) {
5
5
  module.exports = t();
6
6
  })(commonjsGlobal, function() {
@@ -1,6 +1,6 @@
1
1
  import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
2
  import { __module as isToday$1 } from "../../../../../../_virtual/isToday.js";
3
- (function(module, exports$1) {
3
+ (function(module, exports) {
4
4
  (function(e, o) {
5
5
  module.exports = o();
6
6
  })(commonjsGlobal, function() {
@@ -1,6 +1,6 @@
1
1
  import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
2
  import { __module as localeData$1 } from "../../../../../../_virtual/localeData.js";
3
- (function(module, exports$1) {
3
+ (function(module, exports) {
4
4
  (function(n, e) {
5
5
  module.exports = e();
6
6
  })(commonjsGlobal, function() {
@@ -1,6 +1,6 @@
1
1
  import { commonjsGlobal, getDefaultExportFromCjs } from "../../../../../../_virtual/_commonjsHelpers.js";
2
2
  import { __module as weekday$1 } from "../../../../../../_virtual/weekday.js";
3
- (function(module, exports$1) {
3
+ (function(module, exports) {
4
4
  (function(e, t) {
5
5
  module.exports = t();
6
6
  })(commonjsGlobal, function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.5.16-develop-pedago.20260429161139",
3
+ "version": "2.5.16-develop-pedago.20260506150449",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -135,9 +135,9 @@
135
135
  "swiper": "^10.1.0",
136
136
  "ua-parser-js": "^1.0.36",
137
137
  "react-pdf": "10.2.0",
138
- "@edifice.io/bootstrap": "2.5.16-develop-pedago.20260429161139",
139
- "@edifice.io/tiptap-extensions": "2.5.16-develop-pedago.20260429161139",
140
- "@edifice.io/utilities": "2.5.16-develop-pedago.20260429161139"
138
+ "@edifice.io/bootstrap": "2.5.16-develop-pedago.20260506150449",
139
+ "@edifice.io/tiptap-extensions": "2.5.16-develop-pedago.20260506150449",
140
+ "@edifice.io/utilities": "2.5.16-develop-pedago.20260506150449"
141
141
  },
142
142
  "devDependencies": {
143
143
  "@babel/plugin-transform-react-pure-annotations": "^7.23.3",
@@ -168,8 +168,8 @@
168
168
  "vite": "^5.4.11",
169
169
  "vite-plugin-dts": "^4.1.0",
170
170
  "vite-tsconfig-paths": "^5.0.1",
171
- "@edifice.io/config": "2.5.16-develop-pedago.20260429161139",
172
- "@edifice.io/client": "2.5.16-develop-pedago.20260429161139"
171
+ "@edifice.io/client": "2.5.16-develop-pedago.20260506150449",
172
+ "@edifice.io/config": "2.5.16-develop-pedago.20260506150449"
173
173
  },
174
174
  "peerDependencies": {
175
175
  "@react-spring/web": "^9.7.5",