@pronto-tools-and-more/components 8.5.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/main.js CHANGED
@@ -381,11 +381,21 @@ var PublicationToggle = () => {
381
381
  var SearchField = () => {
382
382
  const json = {
383
383
  type: "search-field",
384
- className: "searchfield"
384
+ class: "searchfield"
385
385
  };
386
386
  return /* @__PURE__ */ React.createElement("div", { className: "SearchField" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
387
387
  };
388
388
 
389
+ // src/parts/SearchHeaderSelect/SearchHeaderSelect.tsx
390
+ var SearchHeaderSelect = () => {
391
+ return /* @__PURE__ */ React.createElement("select", { name: "", id: "", className: "SearchHeaderSelect" }, /* @__PURE__ */ React.createElement("option", { value: "time" }, "Zeitraum"));
392
+ };
393
+
394
+ // src/parts/SearchHeaderToggle/SearchHeaderToggle.tsx
395
+ var SearchHeaderToggle = () => {
396
+ return /* @__PURE__ */ React.createElement("div", { className: "SearchHeaderToggle" }, /* @__PURE__ */ React.createElement("div", null, "news"), /* @__PURE__ */ React.createElement("div", null, "epaper"));
397
+ };
398
+
389
399
  // src/parts/SearchLink/SearchLink.tsx
390
400
  var SearchLink = ({ message } = {}) => {
391
401
  const json = {
@@ -401,116 +411,12 @@ var SearchLink = ({ message } = {}) => {
401
411
  return /* @__PURE__ */ React.createElement("div", { className: "SearchLink" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
402
412
  };
403
413
 
404
- // src/parts/HasComplexChildren/HasComplexChildren.ts
405
- var isComplex = (child) => {
406
- return typeof child !== "string";
407
- };
408
- var hasComplexChildren = (children) => {
409
- return children.some(isComplex);
410
- };
411
-
412
- // src/parts/FakeNode/FakeNode.ts
413
- var fakeNode = {
414
- type: "html",
415
- tag: "div",
416
- content: '<img src="x" onerror="globalThis.fixRender(this)" />'
417
- };
418
-
419
- // src/parts/CreateFakeSection/CreateFakeSection.ts
420
- var createFakeSection = (children) => {
421
- return {
422
- type: "section",
423
- content: [fakeNode, ...children]
424
- };
425
- };
426
-
427
- // src/parts/UnwrapComponent/UnwrapComponent.tsx
428
- var getComponentChildren = (element, componentProps) => {
429
- if (componentProps && componentProps.children) {
430
- if (typeof componentProps.children === "string") {
431
- return [componentProps.children];
432
- }
433
- return componentProps.children;
434
- }
435
- if (element && element.children) {
436
- if (typeof element.children === "string") {
437
- return [element.children];
438
- }
439
- return element.children;
440
- }
441
- return [];
442
- };
443
- var getComponentProperties = (element) => {
444
- const componentType = element.type;
445
- const componentProps = element.props;
446
- const componentChildren = getComponentChildren(element, componentProps);
447
- return {
448
- componentType,
449
- componentProps,
450
- componentChildren
451
- };
452
- };
453
- var unwrapComponent = (element) => {
454
- if (!element) {
455
- return {
456
- type: "html",
457
- tag: "div",
458
- content: `Unknown component`
459
- };
460
- }
461
- if (typeof element === "string" || typeof element === "number" || typeof element === "boolean") {
462
- return {
463
- type: "html",
464
- tag: "div",
465
- content: `${element}`
466
- };
467
- }
468
- const { componentChildren, componentProps, componentType } = getComponentProperties(element);
469
- if (typeof componentType === "function") {
470
- const vnode = componentType({
471
- ...componentProps
472
- });
473
- const rendered = unwrapComponent(vnode);
474
- return rendered;
475
- }
476
- if (typeof componentType === "string") {
477
- const hasComplexChildren2 = hasComplexChildren(componentChildren);
478
- const renderedChildren = hasComplexChildren2 ? componentChildren.map(unwrapComponent) : [];
479
- const content = hasComplexChildren2 ? "" : componentChildren[0] || "";
480
- const props = componentProps ? componentProps : {};
481
- return createFakeSection([
482
- {
483
- type: "html",
484
- tag: componentType,
485
- content
486
- },
487
- ...renderedChildren
488
- ]);
489
- }
490
- if (componentType) {
491
- return {
492
- type: "TODO"
493
- };
494
- }
495
- return {};
496
- };
497
-
498
414
  // src/parts/SearchResults/SearchResults.tsx
499
415
  var SearchResults = ({
500
- SearchResult
416
+ render
501
417
  }) => {
502
- const searchResult = {
503
- description: "abc",
504
- label: "abc",
505
- readtime: "",
506
- title: "$context.title",
507
- imageSrc: ""
508
- };
509
- const unwrapped = unwrapComponent(
510
- /* @__PURE__ */ React.createElement(SearchResult, { item: searchResult })
511
- );
512
418
  const json = {
513
- content: unwrapped,
419
+ render,
514
420
  dataSource: {
515
421
  phrase: "$context.phrase",
516
422
  type: "search-result",
@@ -589,7 +495,7 @@ var SearchResults = ({
589
495
  }
590
496
  },
591
497
  type: "list",
592
- class: "schlauch-section",
498
+ class: "schlauch-section data-custom-search-results",
593
499
  emptyMessage: {
594
500
  message: "SEARCH_RESULT_NO_RESULT",
595
501
  variables: ["$context.phrase"]
@@ -642,6 +548,8 @@ export {
642
548
  PostContentBody,
643
549
  PublicationToggle,
644
550
  SearchField,
551
+ SearchHeaderSelect,
552
+ SearchHeaderToggle,
645
553
  SearchLink,
646
554
  SearchResults,
647
555
  SubscriptionLink
@@ -23,6 +23,8 @@ export * from "../MenuItems/MenuItems.tsx";
23
23
  export * from "../PostContentBody/PostContentBody.tsx";
24
24
  export * from "../PublicationToggle/PublicationToggle.tsx";
25
25
  export * from "../SearchField/SearchField.tsx";
26
+ export * from "../SearchHeaderSelect/SearchHeaderSelect.tsx";
27
+ export * from "../SearchHeaderToggle/SearchHeaderToggle.tsx";
26
28
  export * from "../SearchLink/SearchLink.tsx";
27
29
  export * from "../SearchResults/SearchResults.tsx";
28
30
  export * from "../SubscriptionLink/SubscriptionLink.tsx";
@@ -1,6 +1,6 @@
1
1
  import type React from "react";
2
2
  import type { ISearchResult } from "../ISearchResult/ISearchResult.tsx";
3
- export interface ISearchResultComponent {
3
+ export interface ISearchResultItemRenderer {
4
4
  ({ item }: {
5
5
  item: ISearchResult;
6
6
  }): React.ReactNode;
@@ -0,0 +1 @@
1
+ export declare const SearchHeaderSelect: () => import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare const SearchHeaderToggle: () => import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { ISearchResultComponent } from "../ISearchResultComponent/ISearchResultComponent.tsx";
2
- export declare const SearchResults: ({ SearchResult, }: {
3
- SearchResult: ISearchResultComponent;
1
+ import type { ISearchResultItemRenderer } from "../ISearchResultComponent/ISearchResultComponent.tsx";
2
+ export declare const SearchResults: ({ render, }: {
3
+ render: ISearchResultItemRenderer;
4
4
  }) => import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components",
3
- "version": "8.5.0",
3
+ "version": "8.7.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",