@dracor/react 0.8.0 → 1.0.0-alpha.2

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.
Files changed (99) hide show
  1. package/README.md +42 -18
  2. package/dist/index.d.ts +201 -100
  3. package/dist/index.es.js +1514 -0
  4. package/dist/index.es.js.map +1 -0
  5. package/dist/index.umd.js +44 -0
  6. package/dist/index.umd.js.map +1 -0
  7. package/package.json +96 -71
  8. package/src/dracor.css +142 -0
  9. package/dist/cjs/index.js +0 -299
  10. package/dist/cjs/index.js.map +0 -1
  11. package/dist/cjs/types/components/ApiDoc/ApiDoc.d.ts +0 -6
  12. package/dist/cjs/types/components/ApiDoc/ApiDoc.stories.d.ts +0 -19
  13. package/dist/cjs/types/components/ApiDoc/ApiDoc.test.d.ts +0 -1
  14. package/dist/cjs/types/components/ApiDoc/index.d.ts +0 -1
  15. package/dist/cjs/types/components/Authors/Authors.d.ts +0 -10
  16. package/dist/cjs/types/components/Authors/Authors.stories.d.ts +0 -12
  17. package/dist/cjs/types/components/Authors/Authors.test.d.ts +0 -1
  18. package/dist/cjs/types/components/Authors/index.d.ts +0 -1
  19. package/dist/cjs/types/components/DebouncedInput/DebouncedInput.d.ts +0 -6
  20. package/dist/cjs/types/components/DebouncedInput/index.d.ts +0 -1
  21. package/dist/cjs/types/components/IdCopy/IdCopy.d.ts +0 -8
  22. package/dist/cjs/types/components/IdCopy/IdCopy.stories.d.ts +0 -11
  23. package/dist/cjs/types/components/IdCopy/IdCopy.test.d.ts +0 -1
  24. package/dist/cjs/types/components/IdCopy/index.d.ts +0 -1
  25. package/dist/cjs/types/components/IdLink/IdLink.d.ts +0 -7
  26. package/dist/cjs/types/components/IdLink/IdLink.stories.d.ts +0 -15
  27. package/dist/cjs/types/components/IdLink/IdLink.test.d.ts +0 -1
  28. package/dist/cjs/types/components/IdLink/index.d.ts +0 -1
  29. package/dist/cjs/types/components/Navigation/NavBar.d.ts +0 -13
  30. package/dist/cjs/types/components/Navigation/NavBar.stories.d.ts +0 -26
  31. package/dist/cjs/types/components/Navigation/NavBar.test.d.ts +0 -1
  32. package/dist/cjs/types/components/Navigation/NavItem.d.ts +0 -8
  33. package/dist/cjs/types/components/Navigation/NavItem.stories.d.ts +0 -17
  34. package/dist/cjs/types/components/Navigation/NavMenu.d.ts +0 -12
  35. package/dist/cjs/types/components/Navigation/NavMenu.stories.d.ts +0 -17
  36. package/dist/cjs/types/components/Navigation/index.d.ts +0 -1
  37. package/dist/cjs/types/components/Table/Table.d.ts +0 -11
  38. package/dist/cjs/types/components/Table/Table.stories.d.ts +0 -9
  39. package/dist/cjs/types/components/Table/Table.test.d.ts +0 -1
  40. package/dist/cjs/types/components/Table/index.d.ts +0 -1
  41. package/dist/cjs/types/components/Tabs/Tabs.d.ts +0 -11
  42. package/dist/cjs/types/components/Tabs/Tabs.stories.d.ts +0 -16
  43. package/dist/cjs/types/components/Tabs/Tabs.test.d.ts +0 -1
  44. package/dist/cjs/types/components/Tabs/index.d.ts +0 -1
  45. package/dist/cjs/types/components/Years/Years.d.ts +0 -10
  46. package/dist/cjs/types/components/Years/Years.stories.d.ts +0 -11
  47. package/dist/cjs/types/components/Years/Years.test.d.ts +0 -1
  48. package/dist/cjs/types/components/Years/index.d.ts +0 -1
  49. package/dist/cjs/types/components/index.d.ts +0 -9
  50. package/dist/cjs/types/einakter-gh.d.ts +0 -2
  51. package/dist/cjs/types/index.d.ts +0 -2
  52. package/dist/cjs/types/testHelpers.d.ts +0 -7
  53. package/dist/cjs/types/utils.d.ts +0 -2
  54. package/dist/esm/index.js +0 -287
  55. package/dist/esm/index.js.map +0 -1
  56. package/dist/esm/types/components/ApiDoc/ApiDoc.d.ts +0 -6
  57. package/dist/esm/types/components/ApiDoc/ApiDoc.stories.d.ts +0 -19
  58. package/dist/esm/types/components/ApiDoc/ApiDoc.test.d.ts +0 -1
  59. package/dist/esm/types/components/ApiDoc/index.d.ts +0 -1
  60. package/dist/esm/types/components/Authors/Authors.d.ts +0 -10
  61. package/dist/esm/types/components/Authors/Authors.stories.d.ts +0 -12
  62. package/dist/esm/types/components/Authors/Authors.test.d.ts +0 -1
  63. package/dist/esm/types/components/Authors/index.d.ts +0 -1
  64. package/dist/esm/types/components/DebouncedInput/DebouncedInput.d.ts +0 -6
  65. package/dist/esm/types/components/DebouncedInput/index.d.ts +0 -1
  66. package/dist/esm/types/components/IdCopy/IdCopy.d.ts +0 -8
  67. package/dist/esm/types/components/IdCopy/IdCopy.stories.d.ts +0 -11
  68. package/dist/esm/types/components/IdCopy/IdCopy.test.d.ts +0 -1
  69. package/dist/esm/types/components/IdCopy/index.d.ts +0 -1
  70. package/dist/esm/types/components/IdLink/IdLink.d.ts +0 -7
  71. package/dist/esm/types/components/IdLink/IdLink.stories.d.ts +0 -15
  72. package/dist/esm/types/components/IdLink/IdLink.test.d.ts +0 -1
  73. package/dist/esm/types/components/IdLink/index.d.ts +0 -1
  74. package/dist/esm/types/components/Navigation/NavBar.d.ts +0 -13
  75. package/dist/esm/types/components/Navigation/NavBar.stories.d.ts +0 -26
  76. package/dist/esm/types/components/Navigation/NavBar.test.d.ts +0 -1
  77. package/dist/esm/types/components/Navigation/NavItem.d.ts +0 -8
  78. package/dist/esm/types/components/Navigation/NavItem.stories.d.ts +0 -17
  79. package/dist/esm/types/components/Navigation/NavMenu.d.ts +0 -12
  80. package/dist/esm/types/components/Navigation/NavMenu.stories.d.ts +0 -17
  81. package/dist/esm/types/components/Navigation/index.d.ts +0 -1
  82. package/dist/esm/types/components/Table/Table.d.ts +0 -11
  83. package/dist/esm/types/components/Table/Table.stories.d.ts +0 -9
  84. package/dist/esm/types/components/Table/Table.test.d.ts +0 -1
  85. package/dist/esm/types/components/Table/index.d.ts +0 -1
  86. package/dist/esm/types/components/Tabs/Tabs.d.ts +0 -11
  87. package/dist/esm/types/components/Tabs/Tabs.stories.d.ts +0 -16
  88. package/dist/esm/types/components/Tabs/Tabs.test.d.ts +0 -1
  89. package/dist/esm/types/components/Tabs/index.d.ts +0 -1
  90. package/dist/esm/types/components/Years/Years.d.ts +0 -10
  91. package/dist/esm/types/components/Years/Years.stories.d.ts +0 -11
  92. package/dist/esm/types/components/Years/Years.test.d.ts +0 -1
  93. package/dist/esm/types/components/Years/index.d.ts +0 -1
  94. package/dist/esm/types/components/index.d.ts +0 -9
  95. package/dist/esm/types/einakter-gh.d.ts +0 -2
  96. package/dist/esm/types/index.d.ts +0 -2
  97. package/dist/esm/types/testHelpers.d.ts +0 -7
  98. package/dist/esm/types/utils.d.ts +0 -2
  99. package/tailwind.js +0 -56
@@ -1 +0,0 @@
1
- export { default } from './Authors';
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- export default function DebouncedInput({ value: initialValue, onChange, debounce, ...props }: {
3
- value: string | number;
4
- onChange: (value: string | number) => void;
5
- debounce?: number;
6
- } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'>): import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
1
- export { default } from './DebouncedInput';
@@ -1,8 +0,0 @@
1
- interface Props {
2
- children: string;
3
- prefix?: string;
4
- uri?: string;
5
- className?: string;
6
- }
7
- export default function IdCopy({ children, className, uri, prefix }: Props): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,11 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import IdCopy from './IdCopy';
3
- declare const meta: {
4
- title: string;
5
- component: typeof IdCopy;
6
- tags: string[];
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof meta>;
10
- export declare const Basic: Story;
11
- export declare const WithUri: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './IdCopy';
@@ -1,7 +0,0 @@
1
- export interface Props {
2
- button?: boolean;
3
- showLabel?: boolean;
4
- className?: string;
5
- children: string;
6
- }
7
- export default function IdLink({ showLabel, children, className }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,15 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import IdLink from './IdLink';
3
- declare const meta: {
4
- title: string;
5
- component: typeof IdLink;
6
- tags: string[];
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof meta>;
10
- export declare const Wikidata: Story;
11
- export declare const WikidataURI: Story;
12
- export declare const Dracor: Story;
13
- export declare const DracorURI: Story;
14
- export declare const Wega: Story;
15
- export declare const WegaURI: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './IdLink';
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { Props as NavItemProps } from './NavItem';
3
- import { Props as NavMenuProps } from './NavMenu';
4
- export interface NavBarProps {
5
- title: string;
6
- logo?: string;
7
- logoClass?: string;
8
- version?: string;
9
- gitHubUrl?: string;
10
- gitHubIcon?: JSX.Element;
11
- navItems?: (NavItemProps | NavMenuProps)[];
12
- }
13
- export default function NavBar({ title, logo, logoClass, version, gitHubUrl, gitHubIcon, navItems }: NavBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,26 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import NavBar from './NavBar';
3
- declare const meta: {
4
- title: string;
5
- component: typeof NavBar;
6
- tags: string[];
7
- decorators: import("@storybook/preview-api/dist/storybook-channel-mock-a19cd233").M[];
8
- parameters: {
9
- reactRouter: {
10
- routePath: string;
11
- };
12
- };
13
- argTypes: {
14
- logo: {
15
- control: {
16
- type: string;
17
- };
18
- options: string[];
19
- };
20
- };
21
- };
22
- export default meta;
23
- type Story = StoryObj<typeof meta>;
24
- export declare const Dracor: Story;
25
- export declare const Einakter: Story;
26
- export declare const Ecocor: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface Props {
2
- label: string;
3
- href: string;
4
- active?: boolean;
5
- className?: string;
6
- }
7
- export default function NavItem({ label, href, active, className }: Props): import("react/jsx-runtime").JSX.Element;
8
- export declare function itemClassNames(active?: boolean, className?: string): string;
@@ -1,17 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import NavItem from './NavItem';
3
- declare const meta: {
4
- title: string;
5
- component: typeof NavItem;
6
- tags: string[];
7
- decorators: import("@storybook/preview-api/dist/storybook-channel-mock-a19cd233").M[];
8
- parameters: {
9
- reactRouter: {
10
- routePath: string;
11
- };
12
- };
13
- };
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
- export declare const Home: Story;
17
- export declare const Active: Story;
@@ -1,12 +0,0 @@
1
- interface Item {
2
- label: string;
3
- href: string;
4
- selected?: boolean;
5
- }
6
- export interface Props {
7
- label: string;
8
- items: Item[];
9
- menuClass?: string;
10
- }
11
- export default function NavMenu({ label, items, menuClass }: Props): import("react/jsx-runtime").JSX.Element;
12
- export {};
@@ -1,17 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import NavMenu from './NavMenu';
3
- declare const meta: {
4
- title: string;
5
- component: typeof NavMenu;
6
- tags: string[];
7
- decorators: import("@storybook/preview-api/dist/storybook-channel-mock-a19cd233").M[];
8
- parameters: {
9
- reactRouter: {
10
- routePath: string;
11
- };
12
- };
13
- };
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
- export declare const Simple: Story;
17
- export declare const Active: Story;
@@ -1 +0,0 @@
1
- export { default } from './NavBar';
@@ -1,11 +0,0 @@
1
- import { ColumnDef, SortDirection, SortingState } from '@tanstack/react-table';
2
- export interface Props {
3
- data: any[];
4
- columns: ColumnDef<any>[];
5
- defaultSort?: SortingState;
6
- }
7
- declare const Table: ({ columns, data: initialData, defaultSort }: Props) => import("react/jsx-runtime").JSX.Element;
8
- export default Table;
9
- export declare function SortIndicator({ status }: {
10
- status: false | SortDirection;
11
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,9 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- declare const meta: {
3
- title: string;
4
- component: ({ columns, data: initialData, defaultSort }: import("./Table").Props) => import("react/jsx-runtime").JSX.Element;
5
- tags: string[];
6
- };
7
- export default meta;
8
- type Story = StoryObj<typeof meta>;
9
- export declare const Basic: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './Table';
@@ -1,11 +0,0 @@
1
- interface TabData {
2
- label: string;
3
- href: string;
4
- active?: boolean;
5
- }
6
- export interface Props {
7
- data: TabData[];
8
- }
9
- export default function Tabs({ data: tabs }: Props): import("react/jsx-runtime").JSX.Element;
10
- export declare function linkClasses(active: boolean): string;
11
- export {};
@@ -1,16 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import Tabs from './Tabs';
3
- declare const meta: {
4
- title: string;
5
- component: typeof Tabs;
6
- tags: string[];
7
- decorators: import("@storybook/preview-api/dist/storybook-channel-mock-a19cd233").M[];
8
- parameters: {
9
- reactRouter: {
10
- routePath: string;
11
- };
12
- };
13
- };
14
- export default meta;
15
- type Story = StoryObj<typeof meta>;
16
- export declare const Basic: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './Tabs';
@@ -1,10 +0,0 @@
1
- export interface Props {
2
- written?: number;
3
- premiere?: number;
4
- print?: number;
5
- locale?: string;
6
- labelWritten?: string;
7
- labelPremiered?: string;
8
- labelPrinted?: string;
9
- }
10
- export default function Years({ written, premiere, print, locale, labelPremiered, labelPrinted, labelWritten, }: Props): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- import type { StoryObj } from '@storybook/react';
2
- import Years from './Years';
3
- declare const meta: {
4
- title: string;
5
- component: typeof Years;
6
- tags: string[];
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof meta>;
10
- export declare const Basic: Story;
11
- export declare const German: Story;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export { default } from './Years';
@@ -1,9 +0,0 @@
1
- export { default as ApiDoc } from './ApiDoc';
2
- export { default as Authors } from './Authors';
3
- export { default as DebouncedInput } from './DebouncedInput';
4
- export { default as IdCopy } from './IdCopy';
5
- export { default as IdLink } from './IdLink';
6
- export { default as NavBar } from './Navigation';
7
- export { default as Table } from './Table';
8
- export { default as Tabs } from './Tabs';
9
- export { default as Years } from './Years';
@@ -1,2 +0,0 @@
1
- declare const icon: import("react/jsx-runtime").JSX.Element;
2
- export default icon;
@@ -1,2 +0,0 @@
1
- export * from './components';
2
- export * from './utils';
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const withRouter: (children: JSX.Element, { route }?: {
3
- route?: string | undefined;
4
- }) => import("react/jsx-runtime").JSX.Element;
5
- export declare const withProviders: (children: JSX.Element, { route }?: {
6
- route?: string | undefined;
7
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,2 +0,0 @@
1
- export declare function formatEra(year: string, ceBefore?: number): string;
2
- export declare function formatYear(year: number | string, locale?: string): string;
package/dist/esm/index.js DELETED
@@ -1,287 +0,0 @@
1
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { Helmet } from 'react-helmet-async';
3
- import SwaggerUI from 'swagger-ui-react';
4
- import 'swagger-ui-react/swagger-ui.css';
5
- import { useState, useEffect, Fragment as Fragment$1 } from 'react';
6
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
- import { faClipboard, faCaretDown, faPenFancy, faTheaterMasks, faBook } from '@fortawesome/free-solid-svg-icons';
8
- import { CopyToClipboard } from 'react-copy-to-clipboard';
9
- import { Link, useLocation } from 'react-router-dom';
10
- import { faGithub } from '@fortawesome/free-brands-svg-icons';
11
- import { Menu, Transition } from '@headlessui/react';
12
- import { useReactTable, getCoreRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
13
-
14
- function ApiDoc({ url, title }) {
15
- return (jsxs("div", { children: [title && (jsx(Helmet, { children: jsx("title", { children: title }) })), jsx(SwaggerUI, { url: url, deepLinking: true })] }));
16
- }
17
-
18
- const types = [
19
- {
20
- schema: 'wikidata',
21
- label: 'Wikidata',
22
- url: 'https://www.wikidata.org/wiki',
23
- pattern: 'https://www.wikidata.org/(?:wiki|entity)',
24
- classes: 'pl-[26px] bg-wikidata bg-[length:17px]',
25
- },
26
- {
27
- schema: 'dracor',
28
- label: 'DraCor',
29
- url: 'https://dracor.org/id',
30
- classes: 'pl-[23px] bg-dracor bg-[length:13px]'
31
- },
32
- {
33
- schema: 'wega',
34
- label: 'Carl-Maria-von-Weber-Gesamtausgabe (WeGA)',
35
- url: 'https://weber-gesamtausgabe.de',
36
- classes: 'pl-[23px] bg-wega bg-[length:13px]'
37
- },
38
- {
39
- schema: 'isni',
40
- label: 'ISNI',
41
- url: 'https://isni.org/isni',
42
- },
43
- {
44
- schema: 'pnd',
45
- label: 'PND',
46
- url: 'https://d-nb.info/gnd',
47
- },
48
- ];
49
- function IdLink({ showLabel, children, className }) {
50
- let spanClasses = 'inline-flex bg-white bg-no-repeat bg-[5px] rounded px-1.5 gap-1 align-text-bottom';
51
- let id;
52
- const type = types.find(({ pattern, url, schema }) => {
53
- const rx = new RegExp(`^(?:${pattern || url}/|${schema}:)([a-z\\d]+)$`, 'i');
54
- const m = children.match(rx);
55
- if (m) {
56
- id = m[1];
57
- return true;
58
- }
59
- return false;
60
- });
61
- if (!type) {
62
- return jsx("span", { className: spanClasses, children: children });
63
- }
64
- const { url, label, schema, classes = '' } = type;
65
- spanClasses += ` ${classes}`;
66
- return (jsxs("span", { className: spanClasses, children: [showLabel && `${label}: `, jsx("a", { className: className, href: `${url}/${id}`, title: label, children: id })] }));
67
- }
68
-
69
- const Authors = ({ data }) => {
70
- return (jsx(Fragment, { children: data.map((author, i) => (jsxs("span", { children: [i > 0 && jsx("br", {}), author.name, author.pseudonym && (jsxs("i", { children: [" (", author.pseudonym, ")"] })), (author.ref) && (jsxs(Fragment, { children: [' ', jsx("small", { children: jsx(IdLink, { children: author.ref }) })] }))] }, `${i}-${author.name}`))) }));
71
- };
72
-
73
- /******************************************************************************
74
- Copyright (c) Microsoft Corporation.
75
-
76
- Permission to use, copy, modify, and/or distribute this software for any
77
- purpose with or without fee is hereby granted.
78
-
79
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
80
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
81
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
82
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
83
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
84
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
85
- PERFORMANCE OF THIS SOFTWARE.
86
- ***************************************************************************** */
87
- /* global Reflect, Promise, SuppressedError, Symbol */
88
-
89
-
90
- function __rest(s, e) {
91
- var t = {};
92
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
93
- t[p] = s[p];
94
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
95
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
96
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
97
- t[p[i]] = s[p[i]];
98
- }
99
- return t;
100
- }
101
-
102
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
103
- var e = new Error(message);
104
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
105
- };
106
-
107
- function DebouncedInput(_a) {
108
- var { value: initialValue, onChange, debounce = 500 } = _a, props = __rest(_a, ["value", "onChange", "debounce"]);
109
- const [value, setValue] = useState(initialValue);
110
- useEffect(() => {
111
- setValue(initialValue);
112
- }, [initialValue]);
113
- useEffect(() => {
114
- const timeout = setTimeout(() => {
115
- onChange(value);
116
- }, debounce);
117
- return () => clearTimeout(timeout);
118
- // eslint-disable-next-line react-hooks/exhaustive-deps
119
- }, [value]);
120
- return (jsx("input", Object.assign({}, props, { value: value, onChange: (e) => setValue(e.target.value) })));
121
- }
122
-
123
- const { protocol, host } = window.location;
124
- const defaultPrefix = `${protocol}//${host}/id/`;
125
- function IdCopy({ children, className = '', uri, prefix }) {
126
- const id = children;
127
- const text = uri || `${prefix || defaultPrefix}${id}`;
128
- return (jsx("span", { className: `inline-flex bg-white rounded px-1.5 gap-1 align-text-bottom cursor-pointer ${className}`, children: jsx(CopyToClipboard, { text: text, children: jsxs("span", { title: "copy to clipboard", children: [jsx("span", { className: "pr-1", children: id }), jsx(FontAwesomeIcon, { icon: faClipboard, size: "sm" })] }) }) }));
129
- }
130
-
131
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
132
-
133
- /* eslint-disable */
134
- /* tslint:disable */
135
- //////////////////////////////////////////////////////////////////////////////
136
- /// Autogenerated by tailwindcss-classnames CLI. https://git.io/JtsPU
137
- /// DO NOT EDIT THIS FILE DIRECTLY!
138
- //////////////////////////////////////////////////////////////////////////////
139
- var alignItems = clsx;
140
- var flexGrow = clsx;
141
- //////////// Layout Utility functions
142
- var display = clsx;
143
- //////////// Sizing Utility functions
144
- var width = clsx;
145
- var classnames = clsx;
146
-
147
- function NavItem({ label, href, active, className }) {
148
- return (jsx(Link, { to: href, className: itemClassNames(active, className), children: label }));
149
- }
150
- function itemClassNames(active = false, className = '') {
151
- return `block md:inline-block justify-center text-white hover:text-blue-100
152
- uppercase
153
- ${active ? 'border-b-4' : ''} ${className}`;
154
- }
155
-
156
- function NavMenu({ label, items, menuClass }) {
157
- const location = useLocation();
158
- function isActive({ href, selected }) {
159
- if (selected !== undefined) {
160
- return selected;
161
- }
162
- return location.pathname.startsWith(href);
163
- }
164
- const active = Boolean(items.find((item) => isActive(item)));
165
- return (jsxs(Menu, { as: "div", className: "relative inline-block text-left", children: [jsx("div", { children: jsxs(Menu.Button, { className: itemClassNames(active, menuClass), children: [label, jsx(FontAwesomeIcon, { icon: faCaretDown, className: "ml-2 mt-1", size: "sm", "aria-hidden": "true" })] }) }), jsx(Transition, { as: Fragment$1, enter: "transition ease-out duration-100", enterFrom: "transform opacity-0 scale-95", enterTo: "transform opacity-100 scale-100", leave: "transition ease-in duration-75", leaveFrom: "transform opacity-100 scale-100", leaveTo: "transform opacity-0 scale-95", children: jsx(Menu.Items, { className: "absolute left-0 mt-2 min-w-fit whitespace-nowrap origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none", children: jsx("div", { className: "px-1 py-1", children: items.map((item) => (jsx(Menu.Item, { children: ({ active }) => (jsx(Link, { to: item.href, className: `${active ? 'bg-blue-100' : ''} ${isActive(item) ? 'bg-blue-300 text-white' : ''} text-gray-900 group flex w-full items-center rounded-md px-2 py-1 text-sm`, children: item.label })) }, item.href))) }) }) })] }));
166
- }
167
-
168
- function NavBar({ title, logo, logoClass, version, gitHubUrl, gitHubIcon, navItems }) {
169
- const [showNav, setShowNav] = useState(false);
170
- const location = useLocation();
171
- function isActive({ href, active }) {
172
- if (active !== undefined) {
173
- return active;
174
- }
175
- return location.pathname.startsWith(href);
176
- }
177
- const menuWrapperClasses = classnames(display('block', 'md:flex', { hidden: !showNav }), flexGrow('grow'), alignItems('md:items-center'), width('w-full', 'md:w-auto'));
178
- return (jsxs("nav", { className: "flex items-center justify-between flex-wrap p-4 bg-primary text-white font-medium", children: [jsx(Link, { to: "/", children: jsx("img", { alt: `${title} logo`, title: `${title}${version ? ` (${version})` : ''}`, className: `h-12 ${logoClass || ''}`, src: logo }) }), jsx("div", { className: "block md:hidden", children: jsx("button", { className: "flex items-center px-3 py-2 hover:text-blue-100", onClick: () => setShowNav(!showNav), children: jsxs("svg", { className: "fill-current h-10 w-10", viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", children: [jsx("title", { children: "Menu" }), jsx("path", { d: "M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z" })] }) }) }), jsxs("div", { className: menuWrapperClasses, children: [(navItems === null || navItems === void 0 ? void 0 : navItems.length) && (jsx("div", { className: "my-2 md:flex-grow md:flex-row flex justify-center flex-col gap-4", children: navItems.map((item) => ('items' in item
179
- ? jsx(NavMenu, { label: item.label, items: item.items }, item.label)
180
- : jsx(NavItem, { label: item.label, href: item.href, active: isActive(item) }, item.label))) })), gitHubUrl && (jsx("div", { children: jsx("a", { href: gitHubUrl, title: "EcoCor Github", className: "text-white text-2xl", children: gitHubIcon
181
- ? gitHubIcon
182
- : jsx(FontAwesomeIcon, { icon: faGithub, size: "2xl" }) }) }))] })] }));
183
- }
184
-
185
- const Table = ({ columns, data: initialData, defaultSort = [] }) => {
186
- const [sorting, setSorting] = useState(defaultSort);
187
- const [globalFilter, setGlobalFilter] = useState('');
188
- const [data] = useState(initialData);
189
- const table = useReactTable({
190
- data,
191
- columns,
192
- state: {
193
- sorting,
194
- globalFilter,
195
- },
196
- onSortingChange: setSorting,
197
- onGlobalFilterChange: setGlobalFilter,
198
- getCoreRowModel: getCoreRowModel(),
199
- getSortedRowModel: getSortedRowModel(),
200
- getFilteredRowModel: getFilteredRowModel(),
201
- debugTable: true,
202
- });
203
- return (jsxs(Fragment, { children: [jsxs("div", { className: "mb-2", children: [jsx(DebouncedInput, { value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : '', onChange: (value) => setGlobalFilter(String(value)), placeholder: 'Search' }), globalFilter !== '' && (jsxs("span", { className: "ml-2", children: ["(", table.getRowModel().rows.length, ")"] }))] }), jsx("div", { className: "flex", children: jsxs("table", { children: [jsx("thead", { children: table.getHeaderGroups().map((headerGroup) => (jsx("tr", { children: headerGroup.headers.map((header) => (jsx("th", { colSpan: header.colSpan, children: header.isPlaceholder ? null : (jsxs("div", { className: header.column.getCanSort()
204
- ? 'cursor-pointer select-none'
205
- : '',
206
- onClick: header.column.getToggleSortingHandler(), children: [flexRender(header.column.columnDef.header, header.getContext()), ' ', jsx(SortIndicator, { status: header.column.getIsSorted() })] })) }, header.id))) }, headerGroup.id))) }), jsx("tbody", { children: table.getRowModel().rows.map((row, i) => (jsx("tr", { className: i % 2 ? '' : 'bg-neutral-200', children: row.getVisibleCells().map((cell) => (jsx("td", { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) })] }) })] }));
207
- };
208
- function SortIndicator({ status }) {
209
- return (jsxs(Fragment, { children: [jsx("span", { className: status !== 'asc' ? 'opacity-40' : '', children: "\u25B2" }), jsx("span", { className: status !== 'desc' ? 'opacity-40' : '', children: "\u25BC" })] }));
210
- }
211
-
212
- function Tabs({ data: tabs }) {
213
- return (jsx("div", { className: "text-sm font-medium text-center text-gray-500 border-b border-gray-200 dark:text-gray-400 dark:border-gray-700", children: jsx("div", { className: "flex flex-wrap -mb-px gap-3", children: tabs.map(({ label, href, active }) => (jsx("div", { children: jsx(Link, { to: href, className: linkClasses(active || false), children: label }) }, href))) }) }));
214
- }
215
- function linkClasses(active) {
216
- let classes = 'inline-block p-4 border-b-2 text-gray-500 hover:text-gray-600';
217
- if (active) {
218
- classes += ' border-primary';
219
- }
220
- else {
221
- classes += ' border-transparent hover:border-gray-300';
222
- }
223
- return classes;
224
- }
225
-
226
- function formatEra(year, ceBefore = 0) {
227
- if (year === null) {
228
- return '';
229
- }
230
- const y = parseInt(year, 10);
231
- if (y < 0) {
232
- return `${y * -1} BCE`;
233
- }
234
- if (y < ceBefore) {
235
- return `${y} CE`;
236
- }
237
- return String(y);
238
- }
239
- function formatYear(year, locale = 'en-GB') {
240
- const yearString = `${year}`;
241
- // range, both BCE
242
- if (yearString.match('^-[0-9]{4}/-[0-9]{4}$')) {
243
- const years = yearString.split('/').map(y => parseInt(y, 10) * -1);
244
- return `${years[0]}-${years[1]} BCE`;
245
- }
246
- // range, mixed era
247
- if (yearString.match('^-?[0-9]{4}/-?[0-9]{4}$')) {
248
- const years = yearString.split('/');
249
- return `${formatEra(years[0])}-${formatEra(years[1], 1000)}`;
250
- }
251
- // YYYY-MM
252
- if (yearString.match('^[0-9]{4}-[0-9]{2}$')) {
253
- const date = new Date(yearString);
254
- return date.toLocaleDateString(locale, { month: 'long', year: 'numeric' });
255
- }
256
- // YYYY-MM-DD
257
- if (yearString.match('^[0-9]{4}-[0-9]{2}-[0-9]{2}$')) {
258
- const date = new Date(yearString);
259
- return date.toLocaleDateString(locale, {
260
- day: 'numeric',
261
- month: 'long',
262
- year: 'numeric'
263
- });
264
- }
265
- // not before
266
- if (yearString.match('^>-?[0-9]{4}')) {
267
- const year = yearString.substring(1);
268
- return `after ${formatEra(year, 1000)}`;
269
- }
270
- // not after
271
- if (yearString.match('^<-?[0-9]{4}')) {
272
- const year = yearString.substring(1);
273
- return `before ${formatEra(year, 1000)}`;
274
- }
275
- // single year
276
- if (yearString.match('^-?[0-9]{4}')) {
277
- return formatEra(yearString, 1000);
278
- }
279
- return yearString;
280
- }
281
-
282
- function Years({ written, premiere, print, locale, labelPremiered = 'premiered', labelPrinted = 'printed', labelWritten = 'written', }) {
283
- return (jsxs(Fragment, { children: [written && (jsxs(Fragment, { children: [jsxs("span", { title: labelWritten, children: [jsx(FontAwesomeIcon, { icon: faPenFancy, size: "sm" }), "\u00A0", formatYear(written, locale)] }), ' '] })), premiere && (jsxs(Fragment, { children: [jsxs("span", { title: labelPremiered, children: [jsx(FontAwesomeIcon, { icon: faTheaterMasks, size: "sm" }), "\u00A0", formatYear(premiere, locale)] }), ' '] })), print && (jsxs("span", { title: labelPrinted, children: [jsx(FontAwesomeIcon, { icon: faBook, size: "sm" }), "\u00A0", formatYear(print, locale)] }))] }));
284
- }
285
-
286
- export { ApiDoc, Authors, DebouncedInput, IdCopy, IdLink, NavBar, Table, Tabs, Years, formatEra, formatYear };
287
- //# sourceMappingURL=index.js.map