@ebrains/react 0.3.0-alpha.0 → 0.4.0-alpha.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,129 +0,0 @@
1
- import { r as registerInstance, h } from './index.esm2.js';
2
- import { c as cva } from './index-39c58238.esm.js';
3
- import 'react';
4
- import 'react/jsx-runtime';
5
- import 'react-dom';
6
-
7
- const edsCardDescCss = ".f-ui-02-light{font-family:var(--f-ui-02-light-fontFamily);font-weight:var(--f-ui-02-light-fontWeight);font-size:var(--f-ui-02-light-fontSize);line-height:var(--f-ui-02-light-lineHeight);letter-spacing:var(--f-ui-02-light-letterSpacing)}.f-ui-03-light{font-family:var(--f-ui-03-light-fontFamily);font-weight:var(--f-ui-03-light-fontWeight);font-size:var(--f-ui-03-light-fontSize);line-height:var(--f-ui-03-light-lineHeight);letter-spacing:var(--f-ui-03-light-letterSpacing)}.text-light{color:var(--grey-700)}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.line-clamp-4{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4}";
8
- const EdsCardDescStyle0 = edsCardDescCss;
9
- const EdsCardDesc = class {
10
- constructor(hostRef) {
11
- registerInstance(this, hostRef);
12
- this.description = undefined;
13
- this.descClass = 'f-ui-03-light';
14
- this.truncate = true;
15
- this.truncateLines = '3';
16
- }
17
- getTruncateClass() {
18
- return this.truncate && this.truncateLines ? `line-clamp-${this.truncateLines}` : '';
19
- }
20
- render() {
21
- return h("p", {
22
- key: '017c115ebff999c74cff1eaeb5c63f97e0f6554d',
23
- class: `text-light ${this.descClass}`
24
- }, h("span", {
25
- key: 'f87b9b3d593e417ef351882f426d24c0b206ccab',
26
- class: this.getTruncateClass()
27
- }, this.description));
28
- }
29
- };
30
- EdsCardDesc.style = EdsCardDescStyle0;
31
- const edsCardTitleCss = "a{all:unset;display:inline;color:inherit;text-decoration:none;cursor:pointer}h1,h2,h3,h4,h5,h6{margin:0}.f-heading-01{font-family:var(--f-heading-01-fontFamily);font-weight:var(--f-heading-01-fontWeight);font-size:var(--f-heading-01-fontSize);line-height:var(--f-heading-01-lineHeight);letter-spacing:var(--f-heading-01-letterSpacing)}.f-heading-02{font-family:var(--f-heading-02-fontFamily);font-weight:var(--f-heading-02-fontWeight);font-size:var(--f-heading-02-fontSize);line-height:var(--f-heading-02-lineHeight);letter-spacing:var(--f-heading-02-letterSpacing)}.f-heading-03{font-family:var(--f-heading-03-fontFamily);font-weight:var(--f-heading-03-fontWeight);font-size:var(--f-heading-03-fontSize);line-height:var(--f-heading-03-lineHeight);letter-spacing:var(--f-heading-03-letterSpacing)}.f-heading-04{font-family:var(--f-heading-04-fontFamily);font-weight:var(--f-heading-04-fontWeight);font-size:var(--f-heading-04-fontSize);line-height:var(--f-heading-04-lineHeight);letter-spacing:var(--f-heading-04-letterSpacing)}.f-heading-05{font-family:var(--f-heading-05-fontFamily);font-weight:var(--f-heading-05-fontWeight);font-size:var(--f-heading-05-fontSize);line-height:var(--f-heading-05-lineHeight);letter-spacing:var(--f-heading-05-letterSpacing)}.f-heading-06{font-family:var(--f-heading-06-fontFamily);font-weight:var(--f-heading-06-fontWeight);font-size:var(--f-heading-06-fontSize);line-height:var(--f-heading-06-lineHeight);letter-spacing:var(--f-heading-06-letterSpacing)}.break-words{overflow-wrap:break-word}.after\\:absolute::after{position:absolute}.after\\:inset-0::after{inset:0rem}.after\\:z-10::after{z-index:10}.after\\:content-\\[\\'\\'\\]::after{--tw-content:'';content:var(--tw-content)}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}";
32
- const EdsCardTitleStyle0 = edsCardTitleCss;
33
- const EdsCardTitle = class {
34
- constructor(hostRef) {
35
- registerInstance(this, hostRef);
36
- this.url = undefined;
37
- this.titleClass = undefined;
38
- this.headingLevel = 'h3';
39
- this.externalLink = false;
40
- this.cardTitle = undefined;
41
- this.hierarchy = true;
42
- }
43
- /**
44
- * Dynamically generate the title class based on the heading level.
45
- */
46
- getTitleClass() {
47
- const levelMap = this.hierarchy ? {
48
- h1: '05',
49
- h2: '05',
50
- h3: '05',
51
- h4: '05',
52
- h5: '05',
53
- h6: '06'
54
- } : {
55
- h1: '01',
56
- h2: '02',
57
- h3: '03',
58
- h4: '04',
59
- h5: '05',
60
- h6: '06'
61
- };
62
- return `f-heading-${levelMap[this.headingLevel]}`;
63
- }
64
- /*private getTag() {
65
- if (this.url) {
66
- return 'a';
67
- }
68
- return 'span';
69
- }*/
70
- render() {
71
- //const Tag = this.getTag();
72
- const Heading = this.headingLevel;
73
- return h(Heading, {
74
- key: '8aee3bcb0e04508dd21a03ea0f695e040f37c767',
75
- class: this.getTitleClass()
76
- }, h("a", {
77
- key: 'c5fa27fe86037ed6b039c156aecdf1acc9c7c8bc',
78
- class: "break-words after:absolute after:inset-0 after:z-10 after:content-[''] focus:outline-none",
79
- href: this.url,
80
- target: this.externalLink ? '_blank' : undefined,
81
- rel: this.externalLink ? 'noopener noreferrer' : undefined
82
- }, this.cardTitle));
83
- }
84
- };
85
- EdsCardTitle.style = EdsCardTitleStyle0;
86
- const edsTagCss = ".f-ui-05{font-family:var(--f-ui-05-fontFamily);font-weight:var(--f-ui-05-fontWeight);font-size:var(--f-ui-05-fontSize);line-height:var(--f-ui-05-lineHeight);letter-spacing:var(--f-ui-05-letterSpacing)}.py-1{padding-top:0.0625rem;padding-bottom:0.0625rem}.px-4{padding-left:0.25rem;padding-right:0.25rem}.border-2{border-width:2px}.rounded-pill{border-radius:100px}.border-default{border:2px solid var(--black)}.text-inverse{color:var(--white)}.bg-strongest{background-color:var(--black)}.text-\\[\\#0034CB\\]{--tw-text-opacity:1;color:rgb(0 52 203 / var(--tw-text-opacity))}.border-\\[\\#0034CB\\]{--tw-border-opacity:1;border:2px solid rgb(0 52 203 / var(--tw-border-opacity))}.text-light{color:var(--grey-700)}.bg-strongest-soft{background-color:rgba(0, 0, 0, .05)}.border-transparent{border-color:var(--transparent)}.border-inverse{border-color:var(--white)}.bg-inverse{background-color:var(--white)}.text-lighter{color:var(--grey-600)}";
87
- const EdsTagStyle0 = edsTagCss;
88
-
89
- // Define the CVA for the tag styles
90
- const tagStyles = cva(['f-ui-05 py-1 px-4 border-2 rounded-pill'],
91
- // Base classes
92
- {
93
- variants: {
94
- intent: {
95
- default: 'border-default',
96
- strong: 'text-inverse bg-strongest border-default',
97
- accent: 'text-[#0034CB] border-[#0034CB]',
98
- weak: 'text-light bg-strongest-soft border-transparent',
99
- inverse: 'border-inverse text-inverse',
100
- 'inverse-strong': 'bg-inverse border-inverse text-lighter'
101
- }
102
- },
103
- defaultVariants: {
104
- intent: 'default'
105
- }
106
- });
107
- const EdsTag = class {
108
- constructor(hostRef) {
109
- registerInstance(this, hostRef);
110
- this.label = undefined;
111
- this.intent = 'default';
112
- }
113
- /**
114
- * Render the component.
115
- * @returns The rendered HTML for the tag component with the applied styles and label.
116
- */
117
- render() {
118
- const classes = tagStyles({
119
- intent: this.intent
120
- });
121
- return h("span", {
122
- key: '546bd7eb2c78760edc12cd7bb3ede5f6ab9099f3',
123
- class: classes
124
- }, this.label);
125
- }
126
- };
127
- EdsTag.style = EdsTagStyle0;
128
-
129
- export { EdsCardDesc as eds_card_desc, EdsCardTitle as eds_card_title, EdsTag as eds_tag };
@@ -1,125 +0,0 @@
1
- import { r as registerInstance, h, g as getElement } from './index.esm2.js';
2
- import { s as sendAnalytics } from './color-0ba8ed56.esm.js';
3
- import 'react';
4
- import 'react/jsx-runtime';
5
- import 'react-dom';
6
- import './index-39c58238.esm.js';
7
-
8
- const edsCardGenericCss = ".h-auto{height:auto}.h-full{height:100%}.\\!min-h-20{min-height:1.25rem !important}.min-h-120{min-height:120px}.min-h-156{min-height:156px}.bg-default{background-color:var(--grey-200)}.bg-inverse{background-color:var(--white)}.effect-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.hover\\:shadow-hover:hover{--tw-shadow:0px 0px 16px rgba(0, 0, 0, 0.2);--tw-shadow-colored:0px 0px 16px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.cursor-pointer{cursor:pointer}.border-soft{border-color:rgba(0, 0, 0, .15 )}.border-softer{border:2px solid rgba(0, 0, 0, .1 )}.effect-focus-within{outline-width:3px;outline-offset:2px;outline-color:var(--green-500)}.effect-focus-within:focus-within{outline-style:solid}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grow{flex-grow:1}.flex-col{flex-direction:column}.rounded-lg{border-radius:16px}.border-2{border-width:2px}.p-12{padding:0.75rem}.p-16{padding:1rem}.mt-6{margin-top:0.375rem}.mt-8{margin-top:0.5rem}.gap-y-4{row-gap:0.25rem}.order-first{order:-9999}.mb-10{margin-bottom:0.625rem}.mb-12{margin-bottom:0.75rem}";
9
- const EdsCardGenericStyle0 = edsCardGenericCss;
10
- const EdsCardGeneric = class {
11
- constructor(hostRef) {
12
- registerInstance(this, hostRef);
13
- this.parentContext = null; // Accepts the entire event detail or null
14
- this.cardTitle = undefined;
15
- this.url = undefined;
16
- this.description = undefined;
17
- this.image = undefined;
18
- this.avatar = undefined;
19
- this.shortAbbreviation = undefined;
20
- this.headingLevel = 'h3';
21
- this.tags = '';
22
- this.tiny = false;
23
- this.bg = true;
24
- this.withHover = true;
25
- this.hierarchy = true;
26
- this.parsedImage = null;
27
- }
28
- componentWillLoad() {
29
- if (this.image) {
30
- try {
31
- if (typeof this.image === 'object') {
32
- // If image is already an object, assign it directly
33
- this.parsedImage = this.image;
34
- } else if (typeof this.image === 'string') {
35
- // If image is a string, try to parse it
36
- this.parsedImage = JSON.parse(this.image);
37
- }
38
- } catch (error) {
39
- // eslint-disable-next-line
40
- console.error('Error parsing image prop:', error);
41
- this.parsedImage = {}; // Assign a fallback empty object in case of an error
42
- }
43
- }
44
- }
45
- handleParentContext(event) {
46
- if (event.target !== this.el) {
47
- // Ignore the event if it's not targeted at this specific instance
48
- return;
49
- }
50
- //console.log(event.detail);
51
- this.parentContext = event.detail;
52
- event.stopPropagation();
53
- }
54
- /**
55
- * Parses the `tags` prop into an array of link objects.
56
- * Returns an empty array if parsing fails or if `tags` is not a valid JSON string or object.
57
- *
58
- * @returns {any[]} Array of parsed link objects
59
- */
60
- get parsedTags() {
61
- if (typeof this.tags === 'object') {
62
- return this.tags;
63
- } else if (typeof this.tags === 'string') {
64
- try {
65
- return JSON.parse(this.tags);
66
- } catch (e) {
67
- // eslint-disable-next-line
68
- console.error('Error parsing tags prop:', e);
69
- return [];
70
- }
71
- }
72
- return [];
73
- }
74
- articleClasses() {
75
- return [this.description ? this.tiny ? 'min-h-120' : 'min-h-156' : 'h-auto', this.bg ? 'bg-inverse' : 'bg-default', this.withHover ? 'effect-shadow hover:shadow-hover cursor-pointer' : '', 'border-softer effect-focus-within relative flex grow flex-col rounded-lg border-2 p-16'].join(' ');
76
- }
77
- handleClick() {
78
- var _a;
79
- sendAnalytics({
80
- category: 'ui-component',
81
- parentContext: this.parentContext,
82
- tag: this.el.tagName.toLowerCase(),
83
- name: ((_a = this.cardTitle) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '',
84
- action: 'click'
85
- });
86
- }
87
- render() {
88
- return h("article", {
89
- key: '17d1f00f232a4436756fa3846684bbae8c716036',
90
- class: this.articleClasses(),
91
- onClick: () => this.handleClick()
92
- }, h("eds-card-title", {
93
- key: 'd99ee1716c4e308a3ea446f0f7cedfaeac30f2ed',
94
- "heading-level": this.headingLevel,
95
- titleClass: this.image ? 'f-ui-01' : undefined,
96
- "card-title": this.cardTitle,
97
- url: this.url,
98
- hierarchy: this.hierarchy
99
- }), this.description && h("eds-card-desc", {
100
- key: 'c5bdc76e68a8d660609630aa8184ec3a9508ab61',
101
- class: "mt-8",
102
- "truncate-lines": "3",
103
- description: this.description
104
- }), this.parsedImage ? h("eds-img", Object.assign({
105
- class: "mt-8"
106
- }, this.parsedImage)) : this.avatar || this.shortAbbreviation ? h("eds-avatar", {
107
- class: "order-first mb-12",
108
- picture: this.avatar,
109
- initials: this.shortAbbreviation
110
- }) : null, h("div", {
111
- key: 'fa993e3c60d357eb0d9a63e612bdd2bf026e7a85',
112
- class: "flex flex-wrap gap-y-4"
113
- }, this.parsedTags.map((tag, index) => h("eds-tag", {
114
- key: index,
115
- intent: tag.style,
116
- label: tag.label
117
- }))), ' ');
118
- }
119
- get el() {
120
- return getElement(this);
121
- }
122
- };
123
- EdsCardGeneric.style = EdsCardGenericStyle0;
124
-
125
- export { EdsCardGeneric as eds_card_generic };