@limetech/lime-elements 38.3.3 → 38.4.1
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.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/limel-badge_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-badge_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-markdown.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/collection/components/badge/badge.css +2 -1
- package/dist/collection/components/markdown/markdown.css +4 -80
- package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.css +128 -284
- package/dist/esm/limel-badge_3.entry.js +1 -1
- package/dist/esm/limel-badge_3.entry.js.map +1 -1
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-markdown.entry.js.map +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0863261f.entry.js +2 -0
- package/dist/lime-elements/p-0863261f.entry.js.map +1 -0
- package/dist/lime-elements/p-66501d69.entry.js +2 -0
- package/dist/lime-elements/p-66501d69.entry.js.map +1 -0
- package/dist/lime-elements/{p-f641bcb0.entry.js → p-d7f22e4e.entry.js} +2 -2
- package/dist/lime-elements/{p-f641bcb0.entry.js.map → p-d7f22e4e.entry.js.map} +1 -1
- package/package.json +1 -1
- package/dist/lime-elements/p-3ab8ab51.entry.js +0 -2
- package/dist/lime-elements/p-3ab8ab51.entry.js.map +0 -1
- package/dist/lime-elements/p-aad274aa.entry.js +0 -2
- package/dist/lime-elements/p-aad274aa.entry.js.map +0 -1
|
@@ -142,6 +142,7 @@
|
|
|
142
142
|
/**
|
|
143
143
|
* @prop --badge-background-color: badge background color
|
|
144
144
|
* @prop --badge-text-color: badge text color
|
|
145
|
+
* @prop --badge-max-width: maximum width of the badge, before its text gets truncated
|
|
145
146
|
*/
|
|
146
147
|
:host([hidden]) {
|
|
147
148
|
display: none;
|
|
@@ -175,7 +176,7 @@ span {
|
|
|
175
176
|
}
|
|
176
177
|
span:not(:empty) {
|
|
177
178
|
min-width: var(--limel-min-badge-size);
|
|
178
|
-
max-width: 2.75rem;
|
|
179
|
+
max-width: var(--badge-max-width, 2.75rem);
|
|
179
180
|
padding: 0 0.28125rem;
|
|
180
181
|
}
|
|
181
182
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
|
-
/**
|
|
3
|
-
* @prop --markdown-hyperlink-color: color of text for hyperlinks. Defaults to `--color-blue-dark`;
|
|
4
|
-
* @prop --markdown-hyperlink-color--hovered: color of text for hyperlinks when hovered. Defaults to `--color-blue-default`;
|
|
5
|
-
*/
|
|
6
2
|
/**
|
|
7
3
|
* Note! This file is exported to `dist/scss/` in the published
|
|
8
4
|
* node module, for consumer projects to import.
|
|
@@ -192,8 +188,6 @@ p,
|
|
|
192
188
|
li {
|
|
193
189
|
font-size: 0.875rem;
|
|
194
190
|
word-break: break-word;
|
|
195
|
-
hyphens: auto;
|
|
196
|
-
-webkit-hyphens: auto;
|
|
197
191
|
}
|
|
198
192
|
|
|
199
193
|
a {
|
|
@@ -372,80 +366,6 @@ img {
|
|
|
372
366
|
border-radius: 0.25rem;
|
|
373
367
|
}
|
|
374
368
|
|
|
375
|
-
/**
|
|
376
|
-
* Note! This file is exported to `dist/scss/` in the published
|
|
377
|
-
* node module, for consumer projects to import.
|
|
378
|
-
* That means this file cannot import from any file that isn't
|
|
379
|
-
* also exported, keeping the same relative path.
|
|
380
|
-
*
|
|
381
|
-
* Or, just don't import anything, that works too.
|
|
382
|
-
*/
|
|
383
|
-
/**
|
|
384
|
-
* This can be used on a trigger element that opens a dropdown menu or a popover.
|
|
385
|
-
*/
|
|
386
|
-
/**
|
|
387
|
-
* This mixin will mask out the content that is close to
|
|
388
|
-
* the edges of a scrollable area.
|
|
389
|
-
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
390
|
-
* as an argument for `$direction`.
|
|
391
|
-
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
392
|
-
* as an argument for `$direction`.
|
|
393
|
-
*
|
|
394
|
-
* For the visual effect to work smoothly, we need to make sure that
|
|
395
|
-
* the size of the fade-out edge effect is the same as the
|
|
396
|
-
* internal paddings of the scrollable area. Otherwise, content of a
|
|
397
|
-
* scrollable area that does not have a padding will fade out before
|
|
398
|
-
* any scrolling has been done.
|
|
399
|
-
* This is why this mixin already adds paddings, which automatically
|
|
400
|
-
* default to the size of the fade-out effect.
|
|
401
|
-
* This size defaults to `1rem`, but to override the size use
|
|
402
|
-
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
403
|
-
* when `vertically` argument is set, and use
|
|
404
|
-
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
405
|
-
* when `horizontally` argument is set.
|
|
406
|
-
* Of course you can also programmatically increase and decrease the
|
|
407
|
-
* size of these variables for each edge, based on the amount of
|
|
408
|
-
* scrolling that has been done by the user. In this case, make sure
|
|
409
|
-
* to add a custom padding where the mixin is used, to override
|
|
410
|
-
* the paddings that are automatically added by the mixin in the
|
|
411
|
-
* compiled CSS code.
|
|
412
|
-
*/
|
|
413
|
-
/**
|
|
414
|
-
* This mixin will add an animated underline to the bottom of an `a` elements.
|
|
415
|
-
* Note that you may need to add `all: unset;` –depending on your use case–
|
|
416
|
-
* before using this mixin.
|
|
417
|
-
*/
|
|
418
|
-
/**
|
|
419
|
-
* This mixin creates a cross-browser font stack.
|
|
420
|
-
* - `sans-serif` can be used for the UI of the components.
|
|
421
|
-
* - `monospace` can be used for code.
|
|
422
|
-
*
|
|
423
|
-
* ⚠️ If we change the font stacks, we need to update
|
|
424
|
-
* 1. the consumer documentation in `README.md`, and
|
|
425
|
-
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
426
|
-
* in the `<style>` tag of `index.html`.
|
|
427
|
-
*/
|
|
428
|
-
/**
|
|
429
|
-
* This mixin is a hack, using old CSS syntax
|
|
430
|
-
* to enable you to truncate a piece of text,
|
|
431
|
-
* after a certain number of lines.
|
|
432
|
-
*/
|
|
433
|
-
/**
|
|
434
|
-
* The breakpoints below are used to create responsive designs
|
|
435
|
-
* in Lime's products. Therefore, they are here to get distributed
|
|
436
|
-
* to all components in other private repos, which rely on this `mixins`
|
|
437
|
-
* file, to create consistent styles.
|
|
438
|
-
*
|
|
439
|
-
* :::important
|
|
440
|
-
* In very rare cases you should used media queries!
|
|
441
|
-
* Nowadays, there are many better ways of achieving responsive design
|
|
442
|
-
* without media queries. For example, using CSS Grid, Flexbox, and their features.
|
|
443
|
-
* :::
|
|
444
|
-
*/
|
|
445
|
-
/**
|
|
446
|
-
* Media query mixins for responsive design based on screen width.
|
|
447
|
-
* Note that these mixins do not detect the device type!
|
|
448
|
-
*/
|
|
449
369
|
kbd {
|
|
450
370
|
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
|
|
451
371
|
font-weight: 600;
|
|
@@ -533,6 +453,10 @@ kbd {
|
|
|
533
453
|
padding: 0.00625rem 0.125rem;
|
|
534
454
|
}
|
|
535
455
|
|
|
456
|
+
/**
|
|
457
|
+
* @prop --markdown-hyperlink-color: color of text for hyperlinks. Defaults to `--color-blue-dark`;
|
|
458
|
+
* @prop --markdown-hyperlink-color--hovered: color of text for hyperlinks when hovered. Defaults to `--color-blue-default`;
|
|
459
|
+
*/
|
|
536
460
|
hr {
|
|
537
461
|
border-top: 1px solid rgb(var(--contrast-700));
|
|
538
462
|
}
|
|
@@ -65,134 +65,6 @@
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
:host(limel-prosemirror-adapter) {
|
|
69
|
-
display: flex;
|
|
70
|
-
flex-direction: column;
|
|
71
|
-
}
|
|
72
|
-
:host(limel-prosemirror-adapter) .toolbar {
|
|
73
|
-
order: 1;
|
|
74
|
-
}
|
|
75
|
-
:host(limel-prosemirror-adapter) div#editor {
|
|
76
|
-
order: 2;
|
|
77
|
-
height: 100%;
|
|
78
|
-
flex-grow: 1;
|
|
79
|
-
}
|
|
80
|
-
:host(limel-prosemirror-adapter) div[contenteditable=true] {
|
|
81
|
-
height: 100%;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
* {
|
|
85
|
-
box-sizing: border-box;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
:host(limel-prosemirror-adapter:hover) .toolbar,
|
|
89
|
-
:host(limel-prosemirror-adapter:focus-within) .toolbar {
|
|
90
|
-
will-change: grid-template-rows;
|
|
91
|
-
}
|
|
92
|
-
:host(limel-prosemirror-adapter:hover) limel-action-bar,
|
|
93
|
-
:host(limel-prosemirror-adapter:focus-within) limel-action-bar {
|
|
94
|
-
will-change: opacity, padding;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.ProseMirror-menubar-wrapper {
|
|
98
|
-
display: grid;
|
|
99
|
-
grid-template-rows: auto 1fr;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.ProseMirror-textblock-dropdown {
|
|
103
|
-
min-width: 3em;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.ProseMirror-tooltip .ProseMirror-menu {
|
|
107
|
-
width: -webkit-fit-content;
|
|
108
|
-
width: fit-content;
|
|
109
|
-
white-space: pre;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.toolbar {
|
|
113
|
-
--action-bar-border-radius: 0.25rem;
|
|
114
|
-
border-radius: var(--action-bar-border-radius);
|
|
115
|
-
flex-shrink: 0;
|
|
116
|
-
position: sticky;
|
|
117
|
-
z-index: 1;
|
|
118
|
-
top: 0;
|
|
119
|
-
width: 100%;
|
|
120
|
-
display: grid;
|
|
121
|
-
grid-template-rows: var(--limel-prosemirror-adapter-toolbar-grid-template-rows);
|
|
122
|
-
transition-property: grid-template-rows;
|
|
123
|
-
transition-duration: var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);
|
|
124
|
-
transition-timing-function: var(--limel-prosemirror-adapter-toolbar-transition-timing-function);
|
|
125
|
-
background-color: rgba(var(--contrast-200), 0.5);
|
|
126
|
-
backdrop-filter: blur(0.5rem);
|
|
127
|
-
-webkit-backdrop-filter: blur(0.5rem);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
limel-action-bar {
|
|
131
|
-
min-width: 0;
|
|
132
|
-
transition-property: padding, opacity;
|
|
133
|
-
transition-duration: var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);
|
|
134
|
-
transition-timing-function: var(--limel-prosemirror-adapter-toolbar-transition-timing-function);
|
|
135
|
-
opacity: var(--limel-prosemirror-adapter-toolbar-opacity);
|
|
136
|
-
padding: var(--limel-prosemirror-adapter-action-bar-padding-top-bottom, 0.125rem) 0.25rem;
|
|
137
|
-
background-color: transparent;
|
|
138
|
-
overflow: hidden;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.ProseMirror {
|
|
142
|
-
position: relative;
|
|
143
|
-
word-wrap: break-word;
|
|
144
|
-
white-space: pre-wrap;
|
|
145
|
-
white-space: break-spaces;
|
|
146
|
-
-webkit-font-variant-ligatures: none;
|
|
147
|
-
font-variant-ligatures: none;
|
|
148
|
-
font-feature-settings: "liga" 0;
|
|
149
|
-
padding: var(--limel-text-editor-padding);
|
|
150
|
-
}
|
|
151
|
-
.ProseMirror [draggable][contenteditable=false] {
|
|
152
|
-
user-select: text;
|
|
153
|
-
}
|
|
154
|
-
.ProseMirror:focus-visible {
|
|
155
|
-
outline: none;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
.ProseMirror-hideselection {
|
|
159
|
-
caret-color: transparent;
|
|
160
|
-
}
|
|
161
|
-
.ProseMirror-hideselection *::selection {
|
|
162
|
-
background: transparent;
|
|
163
|
-
}
|
|
164
|
-
.ProseMirror-hideselection *::-moz-selection {
|
|
165
|
-
background: transparent;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.ProseMirror-selectednode {
|
|
169
|
-
outline: 0.125rem solid rgb(var(--color-sky-light));
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
li.ProseMirror-selectednode {
|
|
173
|
-
outline: none;
|
|
174
|
-
}
|
|
175
|
-
li.ProseMirror-selectednode:after {
|
|
176
|
-
content: "";
|
|
177
|
-
position: absolute;
|
|
178
|
-
left: -2rem;
|
|
179
|
-
right: -0.125rem;
|
|
180
|
-
top: -0.125rem;
|
|
181
|
-
bottom: -0.125rem;
|
|
182
|
-
border: 0.125rem solid rgb(var(--color-sky-light));
|
|
183
|
-
pointer-events: none;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
img.ProseMirror-separator {
|
|
187
|
-
display: inline !important;
|
|
188
|
-
border: none !important;
|
|
189
|
-
margin: 0 !important;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
limel-portal {
|
|
193
|
-
width: 25rem;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
68
|
blockquote {
|
|
197
69
|
position: relative;
|
|
198
70
|
font-weight: 100;
|
|
@@ -230,8 +102,6 @@ p,
|
|
|
230
102
|
li {
|
|
231
103
|
font-size: 0.875rem;
|
|
232
104
|
word-break: break-word;
|
|
233
|
-
hyphens: auto;
|
|
234
|
-
-webkit-hyphens: auto;
|
|
235
105
|
}
|
|
236
106
|
|
|
237
107
|
a {
|
|
@@ -480,12 +350,6 @@ li {
|
|
|
480
350
|
* Media query mixins for responsive design based on screen width.
|
|
481
351
|
* Note that these mixins do not detect the device type!
|
|
482
352
|
*/
|
|
483
|
-
/*
|
|
484
|
-
* This file is imported into every component!
|
|
485
|
-
*
|
|
486
|
-
* Nothing in this file may output any CSS
|
|
487
|
-
* without being explicitly called by outside code.
|
|
488
|
-
*/
|
|
489
353
|
code {
|
|
490
354
|
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
|
|
491
355
|
font-size: 0.8125rem;
|
|
@@ -557,80 +421,6 @@ table {
|
|
|
557
421
|
max-width: 100%;
|
|
558
422
|
}
|
|
559
423
|
|
|
560
|
-
/**
|
|
561
|
-
* Note! This file is exported to `dist/scss/` in the published
|
|
562
|
-
* node module, for consumer projects to import.
|
|
563
|
-
* That means this file cannot import from any file that isn't
|
|
564
|
-
* also exported, keeping the same relative path.
|
|
565
|
-
*
|
|
566
|
-
* Or, just don't import anything, that works too.
|
|
567
|
-
*/
|
|
568
|
-
/**
|
|
569
|
-
* This can be used on a trigger element that opens a dropdown menu or a popover.
|
|
570
|
-
*/
|
|
571
|
-
/**
|
|
572
|
-
* This mixin will mask out the content that is close to
|
|
573
|
-
* the edges of a scrollable area.
|
|
574
|
-
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
575
|
-
* as an argument for `$direction`.
|
|
576
|
-
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
577
|
-
* as an argument for `$direction`.
|
|
578
|
-
*
|
|
579
|
-
* For the visual effect to work smoothly, we need to make sure that
|
|
580
|
-
* the size of the fade-out edge effect is the same as the
|
|
581
|
-
* internal paddings of the scrollable area. Otherwise, content of a
|
|
582
|
-
* scrollable area that does not have a padding will fade out before
|
|
583
|
-
* any scrolling has been done.
|
|
584
|
-
* This is why this mixin already adds paddings, which automatically
|
|
585
|
-
* default to the size of the fade-out effect.
|
|
586
|
-
* This size defaults to `1rem`, but to override the size use
|
|
587
|
-
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
588
|
-
* when `vertically` argument is set, and use
|
|
589
|
-
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
590
|
-
* when `horizontally` argument is set.
|
|
591
|
-
* Of course you can also programmatically increase and decrease the
|
|
592
|
-
* size of these variables for each edge, based on the amount of
|
|
593
|
-
* scrolling that has been done by the user. In this case, make sure
|
|
594
|
-
* to add a custom padding where the mixin is used, to override
|
|
595
|
-
* the paddings that are automatically added by the mixin in the
|
|
596
|
-
* compiled CSS code.
|
|
597
|
-
*/
|
|
598
|
-
/**
|
|
599
|
-
* This mixin will add an animated underline to the bottom of an `a` elements.
|
|
600
|
-
* Note that you may need to add `all: unset;` –depending on your use case–
|
|
601
|
-
* before using this mixin.
|
|
602
|
-
*/
|
|
603
|
-
/**
|
|
604
|
-
* This mixin creates a cross-browser font stack.
|
|
605
|
-
* - `sans-serif` can be used for the UI of the components.
|
|
606
|
-
* - `monospace` can be used for code.
|
|
607
|
-
*
|
|
608
|
-
* ⚠️ If we change the font stacks, we need to update
|
|
609
|
-
* 1. the consumer documentation in `README.md`, and
|
|
610
|
-
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
611
|
-
* in the `<style>` tag of `index.html`.
|
|
612
|
-
*/
|
|
613
|
-
/**
|
|
614
|
-
* This mixin is a hack, using old CSS syntax
|
|
615
|
-
* to enable you to truncate a piece of text,
|
|
616
|
-
* after a certain number of lines.
|
|
617
|
-
*/
|
|
618
|
-
/**
|
|
619
|
-
* The breakpoints below are used to create responsive designs
|
|
620
|
-
* in Lime's products. Therefore, they are here to get distributed
|
|
621
|
-
* to all components in other private repos, which rely on this `mixins`
|
|
622
|
-
* file, to create consistent styles.
|
|
623
|
-
*
|
|
624
|
-
* :::important
|
|
625
|
-
* In very rare cases you should used media queries!
|
|
626
|
-
* Nowadays, there are many better ways of achieving responsive design
|
|
627
|
-
* without media queries. For example, using CSS Grid, Flexbox, and their features.
|
|
628
|
-
* :::
|
|
629
|
-
*/
|
|
630
|
-
/**
|
|
631
|
-
* Media query mixins for responsive design based on screen width.
|
|
632
|
-
* Note that these mixins do not detect the device type!
|
|
633
|
-
*/
|
|
634
424
|
kbd {
|
|
635
425
|
font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
|
|
636
426
|
font-weight: 600;
|
|
@@ -655,80 +445,6 @@ img {
|
|
|
655
445
|
border-radius: 0.25rem;
|
|
656
446
|
}
|
|
657
447
|
|
|
658
|
-
/**
|
|
659
|
-
* Note! This file is exported to `dist/scss/` in the published
|
|
660
|
-
* node module, for consumer projects to import.
|
|
661
|
-
* That means this file cannot import from any file that isn't
|
|
662
|
-
* also exported, keeping the same relative path.
|
|
663
|
-
*
|
|
664
|
-
* Or, just don't import anything, that works too.
|
|
665
|
-
*/
|
|
666
|
-
/**
|
|
667
|
-
* This can be used on a trigger element that opens a dropdown menu or a popover.
|
|
668
|
-
*/
|
|
669
|
-
/**
|
|
670
|
-
* This mixin will mask out the content that is close to
|
|
671
|
-
* the edges of a scrollable area.
|
|
672
|
-
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
673
|
-
* as an argument for `$direction`.
|
|
674
|
-
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
675
|
-
* as an argument for `$direction`.
|
|
676
|
-
*
|
|
677
|
-
* For the visual effect to work smoothly, we need to make sure that
|
|
678
|
-
* the size of the fade-out edge effect is the same as the
|
|
679
|
-
* internal paddings of the scrollable area. Otherwise, content of a
|
|
680
|
-
* scrollable area that does not have a padding will fade out before
|
|
681
|
-
* any scrolling has been done.
|
|
682
|
-
* This is why this mixin already adds paddings, which automatically
|
|
683
|
-
* default to the size of the fade-out effect.
|
|
684
|
-
* This size defaults to `1rem`, but to override the size use
|
|
685
|
-
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
686
|
-
* when `vertically` argument is set, and use
|
|
687
|
-
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
688
|
-
* when `horizontally` argument is set.
|
|
689
|
-
* Of course you can also programmatically increase and decrease the
|
|
690
|
-
* size of these variables for each edge, based on the amount of
|
|
691
|
-
* scrolling that has been done by the user. In this case, make sure
|
|
692
|
-
* to add a custom padding where the mixin is used, to override
|
|
693
|
-
* the paddings that are automatically added by the mixin in the
|
|
694
|
-
* compiled CSS code.
|
|
695
|
-
*/
|
|
696
|
-
/**
|
|
697
|
-
* This mixin will add an animated underline to the bottom of an `a` elements.
|
|
698
|
-
* Note that you may need to add `all: unset;` –depending on your use case–
|
|
699
|
-
* before using this mixin.
|
|
700
|
-
*/
|
|
701
|
-
/**
|
|
702
|
-
* This mixin creates a cross-browser font stack.
|
|
703
|
-
* - `sans-serif` can be used for the UI of the components.
|
|
704
|
-
* - `monospace` can be used for code.
|
|
705
|
-
*
|
|
706
|
-
* ⚠️ If we change the font stacks, we need to update
|
|
707
|
-
* 1. the consumer documentation in `README.md`, and
|
|
708
|
-
* 2. the CSS variables of `--kompendium-example-font-family`
|
|
709
|
-
* in the `<style>` tag of `index.html`.
|
|
710
|
-
*/
|
|
711
|
-
/**
|
|
712
|
-
* This mixin is a hack, using old CSS syntax
|
|
713
|
-
* to enable you to truncate a piece of text,
|
|
714
|
-
* after a certain number of lines.
|
|
715
|
-
*/
|
|
716
|
-
/**
|
|
717
|
-
* The breakpoints below are used to create responsive designs
|
|
718
|
-
* in Lime's products. Therefore, they are here to get distributed
|
|
719
|
-
* to all components in other private repos, which rely on this `mixins`
|
|
720
|
-
* file, to create consistent styles.
|
|
721
|
-
*
|
|
722
|
-
* :::important
|
|
723
|
-
* In very rare cases you should used media queries!
|
|
724
|
-
* Nowadays, there are many better ways of achieving responsive design
|
|
725
|
-
* without media queries. For example, using CSS Grid, Flexbox, and their features.
|
|
726
|
-
* :::
|
|
727
|
-
*/
|
|
728
|
-
/**
|
|
729
|
-
* Media query mixins for responsive design based on screen width.
|
|
730
|
-
* Note that these mixins do not detect the device type!
|
|
731
|
-
*/
|
|
732
448
|
.image-wrapper {
|
|
733
449
|
display: inline-flex;
|
|
734
450
|
position: relative;
|
|
@@ -856,4 +572,132 @@ img {
|
|
|
856
572
|
width: 0.25rem;
|
|
857
573
|
height: 0.25rem;
|
|
858
574
|
background-color: rgb(var(--contrast-100));
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
:host(limel-prosemirror-adapter) {
|
|
578
|
+
display: flex;
|
|
579
|
+
flex-direction: column;
|
|
580
|
+
}
|
|
581
|
+
:host(limel-prosemirror-adapter) .toolbar {
|
|
582
|
+
order: 1;
|
|
583
|
+
}
|
|
584
|
+
:host(limel-prosemirror-adapter) div#editor {
|
|
585
|
+
order: 2;
|
|
586
|
+
height: 100%;
|
|
587
|
+
flex-grow: 1;
|
|
588
|
+
}
|
|
589
|
+
:host(limel-prosemirror-adapter) div[contenteditable=true] {
|
|
590
|
+
height: 100%;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
* {
|
|
594
|
+
box-sizing: border-box;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
:host(limel-prosemirror-adapter:hover) .toolbar,
|
|
598
|
+
:host(limel-prosemirror-adapter:focus-within) .toolbar {
|
|
599
|
+
will-change: grid-template-rows;
|
|
600
|
+
}
|
|
601
|
+
:host(limel-prosemirror-adapter:hover) limel-action-bar,
|
|
602
|
+
:host(limel-prosemirror-adapter:focus-within) limel-action-bar {
|
|
603
|
+
will-change: opacity, padding;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.ProseMirror-menubar-wrapper {
|
|
607
|
+
display: grid;
|
|
608
|
+
grid-template-rows: auto 1fr;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.ProseMirror-textblock-dropdown {
|
|
612
|
+
min-width: 3em;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
.ProseMirror-tooltip .ProseMirror-menu {
|
|
616
|
+
width: -webkit-fit-content;
|
|
617
|
+
width: fit-content;
|
|
618
|
+
white-space: pre;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.toolbar {
|
|
622
|
+
--action-bar-border-radius: 0.25rem;
|
|
623
|
+
border-radius: var(--action-bar-border-radius);
|
|
624
|
+
flex-shrink: 0;
|
|
625
|
+
position: sticky;
|
|
626
|
+
z-index: 1;
|
|
627
|
+
top: 0;
|
|
628
|
+
width: 100%;
|
|
629
|
+
display: grid;
|
|
630
|
+
grid-template-rows: var(--limel-prosemirror-adapter-toolbar-grid-template-rows);
|
|
631
|
+
transition-property: grid-template-rows;
|
|
632
|
+
transition-duration: var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);
|
|
633
|
+
transition-timing-function: var(--limel-prosemirror-adapter-toolbar-transition-timing-function);
|
|
634
|
+
background-color: rgba(var(--contrast-200), 0.5);
|
|
635
|
+
backdrop-filter: blur(0.5rem);
|
|
636
|
+
-webkit-backdrop-filter: blur(0.5rem);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
limel-action-bar {
|
|
640
|
+
min-width: 0;
|
|
641
|
+
transition-property: padding, opacity;
|
|
642
|
+
transition-duration: var(--limel-prosemirror-adapter-toolbar-grid-template-rows-transition-duration);
|
|
643
|
+
transition-timing-function: var(--limel-prosemirror-adapter-toolbar-transition-timing-function);
|
|
644
|
+
opacity: var(--limel-prosemirror-adapter-toolbar-opacity);
|
|
645
|
+
padding: var(--limel-prosemirror-adapter-action-bar-padding-top-bottom, 0.125rem) 0.25rem;
|
|
646
|
+
background-color: transparent;
|
|
647
|
+
overflow: hidden;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
.ProseMirror {
|
|
651
|
+
position: relative;
|
|
652
|
+
word-wrap: break-word;
|
|
653
|
+
white-space: pre-wrap;
|
|
654
|
+
white-space: break-spaces;
|
|
655
|
+
-webkit-font-variant-ligatures: none;
|
|
656
|
+
font-variant-ligatures: none;
|
|
657
|
+
font-feature-settings: "liga" 0;
|
|
658
|
+
padding: var(--limel-text-editor-padding);
|
|
659
|
+
}
|
|
660
|
+
.ProseMirror [draggable][contenteditable=false] {
|
|
661
|
+
user-select: text;
|
|
662
|
+
}
|
|
663
|
+
.ProseMirror:focus-visible {
|
|
664
|
+
outline: none;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.ProseMirror-hideselection {
|
|
668
|
+
caret-color: transparent;
|
|
669
|
+
}
|
|
670
|
+
.ProseMirror-hideselection *::selection {
|
|
671
|
+
background: transparent;
|
|
672
|
+
}
|
|
673
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
674
|
+
background: transparent;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
.ProseMirror-selectednode {
|
|
678
|
+
outline: 0.125rem solid rgb(var(--color-sky-light));
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
li.ProseMirror-selectednode {
|
|
682
|
+
outline: none;
|
|
683
|
+
}
|
|
684
|
+
li.ProseMirror-selectednode:after {
|
|
685
|
+
content: "";
|
|
686
|
+
position: absolute;
|
|
687
|
+
left: -2rem;
|
|
688
|
+
right: -0.125rem;
|
|
689
|
+
top: -0.125rem;
|
|
690
|
+
bottom: -0.125rem;
|
|
691
|
+
border: 0.125rem solid rgb(var(--color-sky-light));
|
|
692
|
+
pointer-events: none;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
img.ProseMirror-separator {
|
|
696
|
+
display: inline !important;
|
|
697
|
+
border: none !important;
|
|
698
|
+
margin: 0 !important;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
limel-portal {
|
|
702
|
+
width: 25rem;
|
|
859
703
|
}
|
|
@@ -3,7 +3,7 @@ import { a as abbreviate } from './format-57cd836a.js';
|
|
|
3
3
|
import { c as createRandomString } from './random-string-e74dc48d.js';
|
|
4
4
|
import './_commonjsHelpers-5ec8f9b7.js';
|
|
5
5
|
|
|
6
|
-
const badgeCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host([hidden]){display:none}:host(limel-badge){--limel-min-badge-size:1rem;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;min-height:var(--limel-min-badge-size);min-width:var(--limel-min-badge-size)}span{cursor:default;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:0.6875rem;line-height:var(--limel-min-badge-size);color:var(--badge-text-color, rgb(var(--contrast-1200)));border-radius:var(--limel-min-badge-size);max-height:var(--limel-min-badge-size);min-width:0.5rem;min-height:0.5rem;background-color:var(--badge-background-color, rgb(var(--contrast-500)))}span:not(:empty){min-width:var(--limel-min-badge-size);max-width:2.75rem;padding:0 0.28125rem}:host(.has-large-label) span{cursor:help}";
|
|
6
|
+
const badgeCss = "@charset \"UTF-8\";:host{--mdc-theme-primary:var(\n --lime-primary-color,\n rgb(var(--color-teal-default))\n );--mdc-theme-secondary:var(\n --lime-secondary-color,\n rgb(var(--contrast-1100))\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-secondary:var(\n --lime-on-secondary-color,\n rgb(var(--contrast-100))\n );--mdc-theme-text-disabled-on-background:var(\n --lime-text-disabled-on-background-color,\n rgba(var(--contrast-1700), 0.38)\n );--mdc-theme-text-primary-on-background:var(\n --lime-text-primary-on-background-color,\n rgba(var(--contrast-1700), 0.87)\n );--mdc-theme-text-secondary-on-background:var(\n --lime-text-secondary-on-background-color,\n rgba(var(--contrast-1700), 0.54)\n );--mdc-theme-error:var(\n --lime-error-background-color,\n rgb(var(--color-red-dark))\n );--lime-error-text-color:rgb(var(--color-red-darker));--mdc-theme-surface:var(\n --lime-surface-background-color,\n rgb(var(--contrast-100))\n );--mdc-theme-on-surface:var(\n --lime-on-surface-color,\n rgb(var(--contrast-1500))\n )}:host([hidden]){display:none}:host(limel-badge){--limel-min-badge-size:1rem;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0;min-height:var(--limel-min-badge-size);min-width:var(--limel-min-badge-size)}span{cursor:default;box-sizing:border-box;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:center;font-size:0.6875rem;line-height:var(--limel-min-badge-size);color:var(--badge-text-color, rgb(var(--contrast-1200)));border-radius:var(--limel-min-badge-size);max-height:var(--limel-min-badge-size);min-width:0.5rem;min-height:0.5rem;background-color:var(--badge-background-color, rgb(var(--contrast-500)))}span:not(:empty){min-width:var(--limel-min-badge-size);max-width:var(--badge-max-width, 2.75rem);padding:0 0.28125rem}:host(.has-large-label) span{cursor:help}";
|
|
7
7
|
|
|
8
8
|
const Badge = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-badge.limel-tooltip.limel-tooltip-content.entry.js","mappings":";;;;;AAAA,MAAM,QAAQ,GAAG,w7DAAw7D;;MCgB57D,KAAK;;;;;EAUP,MAAM;IACT,QACI,EAAC,IAAI,IACD,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,EAC5C,KAAK,EAAE;QACH,iBAAiB,EAAE,IAAI,CAAC,YAAY,EAAE;OACzC,IAED,gBAAO,IAAI,CAAC,WAAW,EAAE,CAAQ,CAC9B,EACT;GACL;EAEO,WAAW;IACf,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE;MAChC,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACjC;IAED,OAAO,IAAI,CAAC,KAAK,CA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AAK,CAAC;IAC7B,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,EAAE;MACpC,gBAAgB;QACZ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;KACpE;IAED,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,IAAI,CAAC,SAAS,EAAE;MAChB,KAAK,CAAC,KAAK,GAAG;QACV,6BAA6B,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;OAC5D,CAAC;KACL;IAED,OAAO;MACH,0BAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7D,WAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrC,WAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;","names":[],"sources":["./src/components/badge/badge.scss?tag=limel-badge&encapsulation=shadow","./src/components/badge/badge.tsx","./src/components/tooltip/getOwnerElement.tsx","./src/components/tooltip/tooltipTimer.ts","./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["@use '../../style/functions';\n@use '../../style/internal/lime-theme';\n@use '../../style/mixins';\n\n/**\n * @prop --badge-background-color: badge background color\n * @prop --badge-text-color: badge text color\n */\n\n:host([hidden]) {\n display: none;\n}\n\n:host(limel-badge) {\n --limel-min-badge-size: 1rem;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-height: var(--limel-min-badge-size);\n min-width: var(--limel-min-badge-size);\n}\n\nspan {\n cursor: default;\n box-sizing: border-box;\n\n @include mixins.truncate-text;\n text-align: center;\n font-size: functions.pxToRem(11);\n line-height: var(--limel-min-badge-size);\n\n color: var(--badge-text-color, rgb(var(--contrast-1200)));\n\n border-radius: var(--limel-min-badge-size);\n max-height: var(--limel-min-badge-size);\n min-width: 0.5rem;\n min-height: 0.5rem;\n\n background-color: var(--badge-background-color, rgb(var(--contrast-500)));\n\n &:not(:empty) {\n min-width: var(\n --limel-min-badge-size\n ); // ensures that a badge with only one character rendered as perfect circle\n max-width: 2.75rem;\n padding: 0 functions.pxToRem(4.5);\n }\n}\n\n:host(.has-large-label) {\n span {\n cursor: help;\n }\n}\n","import { Component, Prop, h, Host } from '@stencil/core';\nimport { abbreviate } from './format';\n\n/**\n * The Badge component can be used to display a notification badge,\n * optionally with a number or a text label.\n *\n * @exampleComponent limel-example-badge\n * @exampleComponent limel-example-badge-number\n * @exampleComponent limel-example-badge-string\n */\n@Component({\n tag: 'limel-badge',\n styleUrl: 'badge.scss',\n shadow: true,\n})\nexport class Badge {\n /**\n * Label to display in the badge.\n * Numeric labels larger than 999 will be rounded and abbreviated.\n * String labels get truncated if their length is longer than\n * six characters.\n */\n @Prop({ reflect: true })\n public label?: number | string;\n\n public render() {\n return (\n <Host\n title={this.labelIsLarge() ? this.label : ''}\n class={{\n 'has-large-label': this.labelIsLarge(),\n }}\n >\n <span>{this.renderLabel()}</span>\n </Host>\n );\n }\n\n private renderLabel() {\n if (typeof this.label === 'number') {\n return abbreviate(this.label);\n }\n\n return this.label;\n }\n\n private labelIsLarge() {\n const largeNumericLabel = 999;\n const largeStringLabel = 6;\n if (\n (typeof this.label === 'number' &&\n this.label > largeNumericLabel) ||\n (typeof this.label === 'string' &&\n this.label.length > largeStringLabel)\n ) {\n return true;\n }\n }\n}\n","export function getOwnerElement(\n id: string,\n startingPoint: Node,\n): HTMLElement | undefined {\n let element: Node = startingPoint;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(id);\n}\n","const DEFAULT_DELAY_FOR_SHOWING = 500;\n\nexport class TooltipTimer {\n private timerHandle: number | null = null;\n private showCallback: Function;\n private hideCallback: Function;\n private delayForShowing: number;\n\n constructor(\n showCallback: Function,\n hideCallback: Function,\n delayForShowing: number = DEFAULT_DELAY_FOR_SHOWING,\n ) {\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.delayForShowing = delayForShowing;\n }\n\n showAfterDelay(): void {\n if (!this.timerHandle) {\n this.timerHandle = setTimeout(\n this.showCallback,\n this.delayForShowing,\n );\n }\n }\n\n hide(): void {\n clearTimeout(this.timerHandle);\n this.timerHandle = null;\n this.hideCallback();\n }\n}\n","/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n:host(limel-tooltip) {\n // Absolutely positioning ensures that this invisible element\n // does not occupy visible space in the UI.\n // Without this, `limel-tooltip` could in many cases\n // mess up the layout, where it is used.\n // For example, inside a `grid` or `flex` section,\n // every instance of the tooltip would take some space,\n // creating gaps and empty holes.\n position: absolute;\n pointer-events: none;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { JSX } from 'react';\nimport { createRandomString } from '../../util/random-string';\nimport { OpenDirection } from '../menu/menu.types';\nimport { getOwnerElement } from './getOwnerElement';\nimport { TooltipTimer } from './tooltipTimer';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment (the same shadowRoot).\n * Often, it's easiest to just place them next to each other like in the example\n * below, but if you need to, you can place them differently.\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n *\n * @exampleComponent limel-example-tooltip-basic\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n /**\n * Decides the tooltip's location in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'top';\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n @State()\n private open: boolean;\n\n private portalId: string;\n private tooltipId: string;\n private ownerElement: HTMLElement;\n private tooltipTimer: TooltipTimer;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n this.tooltipTimer = new TooltipTimer(\n () => (this.open = true),\n () => (this.open = false),\n );\n }\n\n public connectedCallback() {\n this.ownerElement = getOwnerElement(this.elementId, this.host);\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render(): JSX.Element {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index',\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection={this.openDirection}\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n anchor={this.ownerElement}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n this.ownerElement?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n this.ownerElement?.addEventListener('mouseover', this.showTooltip);\n this.ownerElement?.addEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.addEventListener('focus', this.showTooltip);\n this.ownerElement?.addEventListener('blur', this.hideTooltip);\n }\n\n private removeListeners() {\n this.ownerElement?.removeEventListener('mouseover', this.showTooltip);\n this.ownerElement?.removeEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.removeEventListener('focus', this.showTooltip);\n this.ownerElement?.removeEventListener('blur', this.hideTooltip);\n }\n\n private showTooltip = () => {\n this.tooltipTimer.showAfterDelay();\n };\n\n private hideTooltip = () => {\n this.tooltipTimer.hide();\n };\n}\n",":host(limel-tooltip-content) {\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n *\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-badge.limel-tooltip.limel-tooltip-content.entry.js","mappings":";;;;;AAAA,MAAM,QAAQ,GAAG,g9DAAg9D;;MCgBp9D,KAAK;;;;;EAUP,MAAM;IACT,QACI,EAAC,IAAI,IACD,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,GAAG,EAAE,EAC5C,KAAK,EAAE;QACH,iBAAiB,EAAE,IAAI,CAAC,YAAY,EAAE;OACzC,IAED,gBAAO,IAAI,CAAC,WAAW,EAAE,CAAQ,CAC9B,EACT;GACL;EAEO,WAAW;IACf,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,Q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;AC1KL,MAAM,iBAAiB,GAAG,kkBAAkkB;;MCY/kB,cAAc;;;;;;;EAmBhB,MAAM;IACT,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,SAAS,EAAE;MACpC,gBAAgB;QACZ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC;KACpE;IAED,MAAM,KAAK,GAAQ,EAAE,CAAC;IACtB,IAAI,IAAI,CAAC,SAAS,EAAE;MAChB,KAAK,CAAC,KAAK,GAAG;QACV,6BAA6B,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,IAAI;OAC5D,CAAC;KACL;IAED,OAAO;MACH,0BAAM,KAAK,EAAE,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,IAAM,KAAK,GAC7D,WAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAO,EACrC,WAAK,KAAK,EAAC,cAAc,IAAE,IAAI,CAAC,WAAW,CAAO,CAC/C;KACV,CAAC;GACL;;;;;;","names":[],"sources":["./src/components/badge/badge.scss?tag=limel-badge&encapsulation=shadow","./src/components/badge/badge.tsx","./src/components/tooltip/getOwnerElement.tsx","./src/components/tooltip/tooltipTimer.ts","./src/components/tooltip/tooltip.scss?tag=limel-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx","./src/components/tooltip/tooltip-content.scss?tag=limel-tooltip-content&encapsulation=shadow","./src/components/tooltip/tooltip-content.tsx"],"sourcesContent":["@use '../../style/functions';\n@use '../../style/internal/lime-theme';\n@use '../../style/mixins';\n\n/**\n * @prop --badge-background-color: badge background color\n * @prop --badge-text-color: badge text color\n * @prop --badge-max-width: maximum width of the badge, before its text gets truncated\n */\n\n:host([hidden]) {\n display: none;\n}\n\n:host(limel-badge) {\n --limel-min-badge-size: 1rem;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n flex-shrink: 0;\n min-height: var(--limel-min-badge-size);\n min-width: var(--limel-min-badge-size);\n}\n\nspan {\n cursor: default;\n box-sizing: border-box;\n\n @include mixins.truncate-text;\n text-align: center;\n font-size: functions.pxToRem(11);\n line-height: var(--limel-min-badge-size);\n\n color: var(--badge-text-color, rgb(var(--contrast-1200)));\n\n border-radius: var(--limel-min-badge-size);\n max-height: var(--limel-min-badge-size);\n min-width: 0.5rem;\n min-height: 0.5rem;\n\n background-color: var(--badge-background-color, rgb(var(--contrast-500)));\n\n &:not(:empty) {\n min-width: var(\n --limel-min-badge-size\n ); // ensures that a badge with only one character rendered as perfect circle\n max-width: var(--badge-max-width, 2.75rem);\n padding: 0 functions.pxToRem(4.5);\n }\n}\n\n:host(.has-large-label) {\n span {\n cursor: help;\n }\n}\n","import { Component, Prop, h, Host } from '@stencil/core';\nimport { abbreviate } from './format';\n\n/**\n * The Badge component can be used to display a notification badge,\n * optionally with a number or a text label.\n *\n * @exampleComponent limel-example-badge\n * @exampleComponent limel-example-badge-number\n * @exampleComponent limel-example-badge-string\n */\n@Component({\n tag: 'limel-badge',\n styleUrl: 'badge.scss',\n shadow: true,\n})\nexport class Badge {\n /**\n * Label to display in the badge.\n * Numeric labels larger than 999 will be rounded and abbreviated.\n * String labels get truncated if their length is longer than\n * six characters.\n */\n @Prop({ reflect: true })\n public label?: number | string;\n\n public render() {\n return (\n <Host\n title={this.labelIsLarge() ? this.label : ''}\n class={{\n 'has-large-label': this.labelIsLarge(),\n }}\n >\n <span>{this.renderLabel()}</span>\n </Host>\n );\n }\n\n private renderLabel() {\n if (typeof this.label === 'number') {\n return abbreviate(this.label);\n }\n\n return this.label;\n }\n\n private labelIsLarge() {\n const largeNumericLabel = 999;\n const largeStringLabel = 6;\n if (\n (typeof this.label === 'number' &&\n this.label > largeNumericLabel) ||\n (typeof this.label === 'string' &&\n this.label.length > largeStringLabel)\n ) {\n return true;\n }\n }\n}\n","export function getOwnerElement(\n id: string,\n startingPoint: Node,\n): HTMLElement | undefined {\n let element: Node = startingPoint;\n\n do {\n element = element.parentNode;\n } while (\n element &&\n element.nodeType !== Node.DOCUMENT_FRAGMENT_NODE &&\n element.nodeType !== Node.DOCUMENT_NODE\n );\n\n return (element as ShadowRoot)?.getElementById(id);\n}\n","const DEFAULT_DELAY_FOR_SHOWING = 500;\n\nexport class TooltipTimer {\n private timerHandle: number | null = null;\n private showCallback: Function;\n private hideCallback: Function;\n private delayForShowing: number;\n\n constructor(\n showCallback: Function,\n hideCallback: Function,\n delayForShowing: number = DEFAULT_DELAY_FOR_SHOWING,\n ) {\n this.showCallback = showCallback;\n this.hideCallback = hideCallback;\n this.delayForShowing = delayForShowing;\n }\n\n showAfterDelay(): void {\n if (!this.timerHandle) {\n this.timerHandle = setTimeout(\n this.showCallback,\n this.delayForShowing,\n );\n }\n }\n\n hide(): void {\n clearTimeout(this.timerHandle);\n this.timerHandle = null;\n this.hideCallback();\n }\n}\n","/**\n * @prop --tooltip-z-index: z-index of the tooltip.\n */\n\n:host(limel-tooltip) {\n // Absolutely positioning ensures that this invisible element\n // does not occupy visible space in the UI.\n // Without this, `limel-tooltip` could in many cases\n // mess up the layout, where it is used.\n // For example, inside a `grid` or `flex` section,\n // every instance of the tooltip would take some space,\n // creating gaps and empty holes.\n position: absolute;\n pointer-events: none;\n}\n","import { Component, h, Prop, Element, State } from '@stencil/core';\nimport { JSX } from 'react';\nimport { createRandomString } from '../../util/random-string';\nimport { OpenDirection } from '../menu/menu.types';\nimport { getOwnerElement } from './getOwnerElement';\nimport { TooltipTimer } from './tooltipTimer';\n\nconst DEFAULT_MAX_LENGTH = 50;\n\n/**\n * A tooltip can be used to display a descriptive text for any element.\n * The displayed content must be a brief and supplemental string of text,\n * identifying the element or describing its function for the user,\n * helping them better understand unfamiliar objects that aren't described\n * directly in the UI.\n *\n * ## Interaction\n * The tooltip appears after a slight delay, when the element is hovered;\n * and disappears as soon as the cursor leaves the element.\n * Therefore, users cannot interact with the tip, but if the trigger element\n * itself is interactive, it will remain interactible even with a tooltip bound\n * to it.\n *\n * :::note\n * In order to display the tooltip, the tooltip element and its trigger element\n * must be within the same document or document fragment (the same shadowRoot).\n * Often, it's easiest to just place them next to each other like in the example\n * below, but if you need to, you can place them differently.\n *\n * ```html\n * <limel-button icon=\"search\" id=\"tooltip-example\" />\n * <limel-tooltip label=\"Search\" elementId=\"tooltip-example\" />\n * ```\n * :::\n *\n * ## Usage\n * - Keep in mind that tooltips can be distracting, and can be perceived as an interruption.\n * Use them only when they add significant value.\n * - A good tip is concise, helpful, and informative.\n * Don't explain the obvious or simply repeat what is already on the screen.\n * When used correctly, supplemental info of a tooltip helps to [declutter the UI](/#/DesignGuidelines/decluttering.md/).\n * - If the tip is essential to the primary tasks that the user is performing,\n * such as warnings or important notes, include the information directly in the\n * interface instead.\n * - When a component offers a helper text (e.g. [Input field](/#/component/limel-input-field/)),\n * use that, not a tooltip.\n * - Make sure to use the tooltip on an element that users naturally and\n * effortlessly recognize can be hovered.\n *\n * @exampleComponent limel-example-tooltip-basic\n * @exampleComponent limel-example-tooltip-max-character\n * @exampleComponent limel-example-tooltip-composite\n */\n@Component({\n tag: 'limel-tooltip',\n shadow: true,\n styleUrl: 'tooltip.scss',\n})\nexport class Tooltip {\n /**\n * ID of the owner element that the tooltip should describe.\n * Must be a child within the same document fragment as the tooltip element\n * itself.\n */\n @Prop({ reflect: true })\n public elementId!: string;\n\n /**\n * Short descriptive text of the owner element.\n */\n @Prop({ reflect: true })\n public label!: string;\n\n /**\n * Additional helper text for the element.\n * Example usage can be a keyboard shortcut to activate the function of the\n * owner element.\n */\n @Prop({ reflect: true })\n public helperLabel?: string;\n\n /**\n * The maximum amount of characters before rendering 'label' and\n * 'helperLabel' in two rows.\n */\n @Prop({ reflect: true })\n public maxlength?: number = DEFAULT_MAX_LENGTH;\n\n /**\n * Decides the tooltip's location in relation to its trigger.\n */\n @Prop({ reflect: true })\n public openDirection: OpenDirection = 'top';\n\n @Element()\n private host: HTMLLimelTooltipElement;\n\n @State()\n private open: boolean;\n\n private portalId: string;\n private tooltipId: string;\n private ownerElement: HTMLElement;\n private tooltipTimer: TooltipTimer;\n\n public constructor() {\n this.portalId = createRandomString();\n this.tooltipId = createRandomString();\n this.tooltipTimer = new TooltipTimer(\n () => (this.open = true),\n () => (this.open = false),\n );\n }\n\n public connectedCallback() {\n this.ownerElement = getOwnerElement(this.elementId, this.host);\n this.setOwnerAriaLabel();\n this.addListeners();\n }\n\n public disconnectedCallback() {\n this.removeListeners();\n }\n\n public render(): JSX.Element {\n const tooltipZIndex = getComputedStyle(this.host).getPropertyValue(\n '--tooltip-z-index',\n );\n\n return (\n <div class=\"trigger-anchor\">\n <limel-portal\n openDirection={this.openDirection}\n visible={this.open}\n containerId={this.portalId}\n containerStyle={{\n 'z-index': tooltipZIndex,\n 'pointer-events': 'none',\n }}\n anchor={this.ownerElement}\n >\n <limel-tooltip-content\n label={this.label}\n helperLabel={this.helperLabel}\n maxlength={this.maxlength}\n role=\"tooltip\"\n aria-hidden={!this.open}\n id={this.tooltipId}\n />\n </limel-portal>\n </div>\n );\n }\n\n private setOwnerAriaLabel() {\n this.ownerElement?.setAttribute('aria-describedby', this.tooltipId);\n }\n\n private addListeners() {\n this.ownerElement?.addEventListener('mouseover', this.showTooltip);\n this.ownerElement?.addEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.addEventListener('focus', this.showTooltip);\n this.ownerElement?.addEventListener('blur', this.hideTooltip);\n }\n\n private removeListeners() {\n this.ownerElement?.removeEventListener('mouseover', this.showTooltip);\n this.ownerElement?.removeEventListener('mouseout', this.hideTooltip);\n this.ownerElement?.removeEventListener('focus', this.showTooltip);\n this.ownerElement?.removeEventListener('blur', this.hideTooltip);\n }\n\n private showTooltip = () => {\n this.tooltipTimer.showAfterDelay();\n };\n\n private hideTooltip = () => {\n this.tooltipTimer.hide();\n };\n}\n",":host(limel-tooltip-content) {\n display: flex;\n\n border-radius: 0.25rem;\n padding: 0.25rem 0.5rem;\n background-color: rgb(var(--contrast-1300));\n box-shadow: var(--shadow-depth-16);\n}\n\ntext {\n font-size: 0.875rem; // 14px\n line-height: 1.25;\n display: flex;\n column-gap: 1rem;\n\n &.has-column-layout {\n display: table-cell;\n width: fit-content;\n max-width: min(var(--tooltip-max-width-of-text), 80vw);\n .label {\n padding-bottom: 0.5rem;\n }\n .helper-label {\n padding-bottom: 0.25rem;\n }\n }\n}\n\n.label {\n color: rgb(var(--contrast-200));\n}\n\n.helper-label {\n color: rgb(var(--contrast-800));\n\n &:empty {\n display: none;\n }\n}\n","import { Component, h, Prop } from '@stencil/core';\n\n/**\n * This component is used internally by `limel-tooltip`.\n *\n * @private\n */\n@Component({\n tag: 'limel-tooltip-content',\n shadow: true,\n styleUrl: 'tooltip-content.scss',\n})\nexport class TooltipContent {\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n label!: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n helperLabel?: string;\n\n /**\n * Read more in tooltip.tsx\n */\n @Prop({ reflect: true })\n maxlength?: number;\n\n public render() {\n let isLabelsTextLong = false;\n if (this.helperLabel && this.maxlength) {\n isLabelsTextLong =\n this.label.length + this.helperLabel.length > this.maxlength;\n }\n\n const props: any = {};\n if (this.maxlength) {\n props.style = {\n '--tooltip-max-width-of-text': `${this.maxlength}` + 'ch',\n };\n }\n\n return [\n <text class={{ 'has-column-layout': isLabelsTextLong }} {...props}>\n <div class=\"label\">{this.label}</div>\n <div class=\"helper-label\">{this.helperLabel}</div>\n </text>,\n ];\n }\n}\n"],"version":3}
|