@limetech/lime-elements 37.71.0 → 37.72.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 +17 -0
- package/dist/cjs/3d-tilt-hover-effect-f64da0a8.js +162 -0
- package/dist/cjs/3d-tilt-hover-effect-f64da0a8.js.map +1 -0
- package/dist/cjs/limel-card.cjs.entry.js +9 -2
- package/dist/cjs/limel-card.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-info-tile.cjs.entry.js +13 -8
- package/dist/cjs/limel-info-tile.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-markdown.cjs.entry.js +1 -1
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +2 -2
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js.map +1 -1
- package/dist/cjs/{markdown-parser-ba7cc71e.js → markdown-parser-d1887ec8.js} +12466 -421
- package/dist/cjs/markdown-parser-d1887ec8.js.map +1 -0
- package/dist/collection/components/card/card.css +76 -37
- package/dist/collection/components/card/card.js +9 -2
- package/dist/collection/components/card/card.js.map +1 -1
- package/dist/collection/components/info-tile/info-tile.css +73 -38
- package/dist/collection/components/info-tile/info-tile.js +13 -8
- package/dist/collection/components/info-tile/info-tile.js.map +1 -1
- package/dist/collection/components/markdown/markdown-parser.js +23 -0
- package/dist/collection/components/markdown/markdown-parser.js.map +1 -1
- package/dist/collection/components/text-editor/utils/html-converter.js +2 -2
- package/dist/collection/components/text-editor/utils/html-converter.js.map +1 -1
- package/dist/collection/style/mixins.scss +114 -0
- package/dist/collection/util/3d-tilt-hover-effect.js +157 -0
- package/dist/collection/util/3d-tilt-hover-effect.js.map +1 -0
- package/dist/esm/3d-tilt-hover-effect-a76fcd43.js +160 -0
- package/dist/esm/3d-tilt-hover-effect-a76fcd43.js.map +1 -0
- package/dist/esm/limel-card.entry.js +10 -3
- package/dist/esm/limel-card.entry.js.map +1 -1
- package/dist/esm/limel-info-tile.entry.js +14 -9
- package/dist/esm/limel-info-tile.entry.js.map +1 -1
- package/dist/esm/limel-markdown.entry.js +1 -1
- package/dist/esm/limel-prosemirror-adapter.entry.js +2 -2
- package/dist/esm/limel-prosemirror-adapter.entry.js.map +1 -1
- package/dist/esm/{markdown-parser-3c0af898.js → markdown-parser-90f72b15.js} +12466 -422
- package/dist/esm/markdown-parser-90f72b15.js.map +1 -0
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-05c10bed.entry.js +2 -0
- package/dist/lime-elements/p-05c10bed.entry.js.map +1 -0
- package/dist/lime-elements/p-23bc6de0.js +2 -0
- package/dist/lime-elements/p-23bc6de0.js.map +1 -0
- package/dist/lime-elements/p-3e8afa19.js +8 -0
- package/dist/lime-elements/p-3e8afa19.js.map +1 -0
- package/dist/lime-elements/{p-da20ff72.entry.js → p-4bfcb8c7.entry.js} +2 -2
- package/dist/lime-elements/p-6de2f65c.entry.js +2 -0
- package/dist/lime-elements/p-6de2f65c.entry.js.map +1 -0
- package/dist/lime-elements/p-a0944503.entry.js +2 -0
- package/dist/lime-elements/p-a0944503.entry.js.map +1 -0
- package/dist/lime-elements/style/mixins.scss +114 -0
- package/dist/scss/mixins.scss +114 -0
- package/dist/types/components/card/card.d.ts +4 -0
- package/dist/types/components/info-tile/info-tile.d.ts +5 -1
- package/dist/types/components/markdown/markdown-parser.d.ts +8 -0
- package/dist/types/util/3d-tilt-hover-effect.d.ts +118 -0
- package/package.json +3 -2
- package/dist/cjs/markdown-parser-ba7cc71e.js.map +0 -1
- package/dist/esm/markdown-parser-3c0af898.js.map +0 -1
- package/dist/lime-elements/p-060bbefe.entry.js +0 -2
- package/dist/lime-elements/p-060bbefe.entry.js.map +0 -1
- package/dist/lime-elements/p-086509a5.js +0 -8
- package/dist/lime-elements/p-086509a5.js.map +0 -1
- package/dist/lime-elements/p-32844d2b.entry.js +0 -2
- package/dist/lime-elements/p-32844d2b.entry.js.map +0 -1
- package/dist/lime-elements/p-ca929a0e.entry.js +0 -2
- package/dist/lime-elements/p-ca929a0e.entry.js.map +0 -1
- /package/dist/lime-elements/{p-da20ff72.entry.js.map → p-4bfcb8c7.entry.js.map} +0 -0
|
@@ -88,44 +88,9 @@ section {
|
|
|
88
88
|
:host(limel-card[orientation=landscape]) section {
|
|
89
89
|
flex-direction: row;
|
|
90
90
|
}
|
|
91
|
-
:
|
|
92
|
-
transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
|
|
93
|
-
cursor: pointer;
|
|
94
|
-
color: var(--mdc-theme-on-surface);
|
|
95
|
-
background-color: var(--card-background-color, rgb(var(--contrast-200)));
|
|
96
|
-
}
|
|
97
|
-
:host(limel-card[clickable]) section:focus {
|
|
98
|
-
outline: none;
|
|
99
|
-
}
|
|
100
|
-
:host(limel-card[clickable]) section:focus-visible {
|
|
101
|
-
outline: none;
|
|
102
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
103
|
-
}
|
|
104
|
-
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:focus, :host(limel-card[clickable]) section:focus-visible {
|
|
105
|
-
will-change: color, background-color, box-shadow, transform;
|
|
106
|
-
}
|
|
107
|
-
:host(limel-card[clickable]) section:hover {
|
|
108
|
-
transform: translate3d(0, 0.01rem, 0);
|
|
109
|
-
color: var(--mdc-theme-on-surface);
|
|
110
|
-
background-color: var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));
|
|
111
|
-
box-shadow: var(--button-shadow-hovered);
|
|
112
|
-
}
|
|
113
|
-
:host(limel-card[clickable]) section:active {
|
|
114
|
-
--limel-clickable-transform-timing-function: cubic-bezier(
|
|
115
|
-
0.83,
|
|
116
|
-
-0.15,
|
|
117
|
-
0.49,
|
|
118
|
-
1.16
|
|
119
|
-
);
|
|
120
|
-
transform: translate3d(0, 0.05rem, 0);
|
|
121
|
-
box-shadow: var(--button-shadow-pressed);
|
|
122
|
-
}
|
|
123
|
-
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:active {
|
|
124
|
-
--limel-clickable-transition-speed: 0.2s;
|
|
125
|
-
--limel-clickable-transform-speed: 0.16s;
|
|
126
|
-
}
|
|
127
|
-
:host(limel-card[clickable]:hover) section {
|
|
91
|
+
section:hover {
|
|
128
92
|
border-color: transparent;
|
|
93
|
+
background-color: var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));
|
|
129
94
|
}
|
|
130
95
|
|
|
131
96
|
.body {
|
|
@@ -201,4 +166,78 @@ limel-action-bar {
|
|
|
201
166
|
--action-bar-background-color: transparent;
|
|
202
167
|
padding: 0.5rem;
|
|
203
168
|
margin-left: auto;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.limel-3d-hover-effect-glow {
|
|
172
|
+
transition: background 0.4s ease, opacity 0.4s ease;
|
|
173
|
+
pointer-events: none;
|
|
174
|
+
position: absolute;
|
|
175
|
+
inset: 0;
|
|
176
|
+
border-radius: var(--card-border-radius, 0.95rem);
|
|
177
|
+
opacity: 0.1;
|
|
178
|
+
background-image: radial-gradient(circle at var(--limel-3d-hover-effect-glow-position, 50% -20%), rgb(var(--color-white), 0.3), rgb(var(--color-white), 0));
|
|
179
|
+
mix-blend-mode: plus-lighter;
|
|
180
|
+
}
|
|
181
|
+
section:hover .limel-3d-hover-effect-glow {
|
|
182
|
+
opacity: 0.5;
|
|
183
|
+
}
|
|
184
|
+
@media (prefers-reduced-motion) {
|
|
185
|
+
section:hover .limel-3d-hover-effect-glow {
|
|
186
|
+
opacity: 0.2;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
:host(limel-card) {
|
|
191
|
+
isolation: isolate;
|
|
192
|
+
transform-style: preserve-3d;
|
|
193
|
+
perspective: 1000px;
|
|
194
|
+
}
|
|
195
|
+
@media (prefers-reduced-motion) {
|
|
196
|
+
:host(limel-card) {
|
|
197
|
+
perspective: 2000px;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
section {
|
|
202
|
+
position: relative;
|
|
203
|
+
transition-duration: 0.8s;
|
|
204
|
+
transition-property: transform, box-shadow, background-color;
|
|
205
|
+
transition-timing-function: ease-out;
|
|
206
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
207
|
+
}
|
|
208
|
+
section:focus {
|
|
209
|
+
outline: none;
|
|
210
|
+
}
|
|
211
|
+
section:hover, section:focus, section:focus-visible, section:focus-within {
|
|
212
|
+
will-change: background-color, box-shadow, transform;
|
|
213
|
+
}
|
|
214
|
+
section:hover, section:focus, section:focus-visible, section:active {
|
|
215
|
+
transition-duration: 0.2s;
|
|
216
|
+
}
|
|
217
|
+
section:hover, section:focus-visible {
|
|
218
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
219
|
+
}
|
|
220
|
+
section:hover {
|
|
221
|
+
transform: scale3d(1.01, 1.01, 1.01) rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
222
|
+
}
|
|
223
|
+
section:focus-visible {
|
|
224
|
+
outline: none;
|
|
225
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
226
|
+
}
|
|
227
|
+
:host(limel-card[clickable]) section {
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
box-shadow: var(--button-shadow-normal);
|
|
230
|
+
}
|
|
231
|
+
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:focus-visible {
|
|
232
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
233
|
+
}
|
|
234
|
+
:host(limel-card[clickable]) section:active {
|
|
235
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
236
|
+
box-shadow: var(--button-shadow-pressed);
|
|
237
|
+
}
|
|
238
|
+
:host(limel-card[clickable]) section:focus-visible {
|
|
239
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
240
|
+
}
|
|
241
|
+
:host(limel-card[clickable]) section:focus-visible:active {
|
|
242
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
204
243
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host, } from '@stencil/core';
|
|
2
2
|
import { isItem } from '../action-bar/isItem';
|
|
3
3
|
import { getIconName } from '../icon/get-icon-props';
|
|
4
|
+
import { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';
|
|
4
5
|
/**
|
|
5
6
|
* Card is a component that displays content about a single topic,
|
|
6
7
|
* in a structured way. It can contain a header, and some supporting media such
|
|
@@ -32,8 +33,13 @@ export class Card {
|
|
|
32
33
|
this.clickable = false;
|
|
33
34
|
this.orientation = 'portrait';
|
|
34
35
|
}
|
|
36
|
+
componentWillLoad() {
|
|
37
|
+
const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(this.host);
|
|
38
|
+
this.handleMouseEnter = handleMouseEnter;
|
|
39
|
+
this.handleMouseLeave = handleMouseLeave;
|
|
40
|
+
}
|
|
35
41
|
render() {
|
|
36
|
-
return (h("section", { tabindex: this.clickable ? 0 : '' }, this.renderImage(), h("div", { class: "body" }, this.renderHeader(), this.renderSlot(), this.renderValue(), this.renderActionBar())));
|
|
42
|
+
return (h(Host, { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("section", { tabindex: this.clickable ? 0 : '' }, this.renderImage(), h("div", { class: "body" }, this.renderHeader(), this.renderSlot(), this.renderValue(), this.renderActionBar()), h("div", { class: "limel-3d-hover-effect-glow" }))));
|
|
37
43
|
}
|
|
38
44
|
renderImage() {
|
|
39
45
|
if (!this.image) {
|
|
@@ -278,5 +284,6 @@ export class Card {
|
|
|
278
284
|
}
|
|
279
285
|
}];
|
|
280
286
|
}
|
|
287
|
+
static get elementRef() { return "host"; }
|
|
281
288
|
}
|
|
282
289
|
//# sourceMappingURL=card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"card.js","sourceRoot":"","sources":["../../../src/components/card/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,CAAC,EACD,IAAI,EACJ,KAAK,EAEL,OAAO,EACP,IAAI,GACP,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,IAAI;;IAoKL,uBAAkB,GAAG,CACzB,KAAiD,EACnD,EAAE;MACA,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;OAC1C;IACL,CAAC,CAAC;;;;;;mBAnIsD,EAAE;qBAO9B,KAAK;uBAOc,UAAU;;EAclD,iBAAiB;IACpB,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,GAAG,qBAAqB,CAChE,IAAI,CAAC,IAAI,CACZ,CAAC;IACF,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IACzC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;EAC7C,CAAC;EAEM,MAAM;IACT,OAAO,CACH,EAAC,IAAI,IACD,YAAY,EAAE,IAAI,CAAC,gBAAgB,EACnC,YAAY,EAAE,IAAI,CAAC,gBAAgB;MAEnC,eAAS,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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,CAAC,IAAI,CAAC,OAAO,EAAE;MACf,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,OAAO,CAAM,CAAC;EACnC,CAAC;EAEO,gBAAgB;IACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MAClB,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,UAAU,CAAM,CAAC;EACtC,CAAC;EAEO,UAAU;IACd,OAAO,YAAM,IAAI,EAAC,WAAW,GAAG,CAAC;EACrC,CAAC;EAEO,WAAW;IACf,OAAO,sBAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;EACjD,CAAC;EAWO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;MACtB,OAAO;KACV;IAED,OAAO,CACH,wBACI,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,cAAc,EAAE,IAAI,CAAC,kBAAkB,GACzC,CACL,CAAC;EACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n h,\n Prop,\n Event,\n EventEmitter,\n Element,\n Host,\n} from '@stencil/core';\nimport { Image } from '../../global/shared-types/image.types';\nimport { Icon } from '../../global/shared-types/icon.types';\nimport { isItem } from '../action-bar/isItem';\nimport { getIconName } from '../icon/get-icon-props';\nimport { ListSeparator } from '../../global/shared-types/separator.types';\nimport { ActionBarItem } from '../action-bar/action-bar.types';\nimport { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';\n\n/**\n * Card is a component that displays content about a single topic,\n * in a structured way. It can contain a header, and some supporting media such\n * as an image or an icon, a body of text, or optional actions.\n *\n * @exampleComponent limel-example-card-basic\n * @exampleComponent limel-example-card-image\n * @exampleComponent limel-example-card-actions\n * @exampleComponent limel-example-card-clickable\n * @exampleComponent limel-example-card-orientation\n * @exampleComponent limel-example-card-slot\n * @exampleComponent limel-example-card-styling\n * @beta\n */\n@Component({\n tag: 'limel-card',\n shadow: true,\n styleUrl: 'card.scss',\n})\nexport class Card {\n /**\n * Heading of the card,\n * to provide a short title about the context.\n */\n @Prop({ reflect: true })\n public heading?: string;\n\n /**\n * Subheading of the card\n * to provide a short description of the context.\n */\n @Prop({ reflect: true })\n public subheading?: string;\n\n /**\n * A hero image to display in the card,\n * to enrich the content with visual information.\n */\n @Prop()\n public image?: Image;\n\n /**\n * An icon, to display along with the heading and subheading.\n */\n @Prop({ reflect: true })\n public icon?: string | Icon;\n\n /**\n * The content of the card.\n * Supports markdown, to provide a rich text experience.\n */\n @Prop()\n public value?: string;\n\n /**\n * Actions to display in the card,\n * to provide the user with options to interact with the content.\n */\n @Prop()\n public actions?: Array<ActionBarItem | ListSeparator> = [];\n\n /**\n * When true, improve the accessibility of the component and hints the user\n * that the card can be interacted width.\n */\n @Prop({ reflect: true })\n public clickable: boolean = false;\n\n /**\n * The orientation of the card,\n * specially useful when the card has an image.\n */\n @Prop({ reflect: true })\n public orientation: 'landscape' | 'portrait' = 'portrait';\n\n /**\n * Fired when a action bar item has been clicked.\n */\n @Event()\n public actionSelected: EventEmitter<ActionBarItem>;\n\n @Element()\n private host: HTMLElement;\n\n private handleMouseEnter: () => void;\n private handleMouseLeave: () => void;\n\n public componentWillLoad() {\n const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(\n this.host,\n );\n this.handleMouseEnter = handleMouseEnter;\n this.handleMouseLeave = handleMouseLeave;\n }\n\n public render() {\n return (\n <Host\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\n <section tabindex={this.clickable ? 0 : ''}>\n {this.renderImage()}\n <div class=\"body\">\n {this.renderHeader()}\n {this.renderSlot()}\n {this.renderValue()}\n {this.renderActionBar()}\n </div>\n <div class=\"limel-3d-hover-effect-glow\" />\n </section>\n </Host>\n );\n }\n\n private renderImage() {\n if (!this.image) {\n return;\n }\n\n return <img src={this.image.src} alt={this.image.alt} loading=\"lazy\" />;\n }\n\n private renderHeader() {\n if (!this.heading && !this.subheading && !this.icon) {\n return;\n }\n\n return (\n <header>\n {this.renderIcon()}\n <div class=\"headings\">\n {this.renderHeading()}\n {this.renderSubheading()}\n </div>\n </header>\n );\n }\n\n private renderIcon() {\n const icon = getIconName(this.icon);\n const color =\n typeof this.icon !== 'string' ? this.icon?.color : undefined;\n\n if (!icon) {\n return;\n }\n\n return (\n <limel-icon\n style={{\n color: `${color}`,\n }}\n badge={true}\n name={icon}\n />\n );\n }\n\n private renderHeading() {\n if (!this.heading) {\n return;\n }\n\n return <h1>{this.heading}</h1>;\n }\n\n private renderSubheading() {\n if (!this.subheading) {\n return;\n }\n\n return <h2>{this.subheading}</h2>;\n }\n\n private renderSlot() {\n return <slot name=\"component\" />;\n }\n\n private renderValue() {\n return <limel-markdown value={this.value} />;\n }\n\n private handleActionSelect = (\n event: CustomEvent<ActionBarItem | ListSeparator>,\n ) => {\n event.stopPropagation();\n if (isItem(event.detail)) {\n this.actionSelected.emit(event.detail);\n }\n };\n\n private renderActionBar() {\n if (!this.actions.length) {\n return;\n }\n\n return (\n <limel-action-bar\n actions={this.actions}\n onItemSelected={this.handleActionSelect}\n />\n );\n }\n}\n"]}
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
--icon-min-size: 2rem;
|
|
104
104
|
--icon-preferred-size: 60cqh;
|
|
105
105
|
--icon-max-size: calc(100cqw - 0.5rem);
|
|
106
|
-
isolation: isolate;
|
|
107
106
|
container-type: size;
|
|
108
107
|
position: relative;
|
|
109
108
|
display: flex;
|
|
@@ -133,43 +132,6 @@ a {
|
|
|
133
132
|
border-radius: var(--info-tile-border-radius, 1rem);
|
|
134
133
|
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
135
134
|
}
|
|
136
|
-
a.is-clickable {
|
|
137
|
-
transition: color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
color: var(--mdc-theme-on-surface);
|
|
140
|
-
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
141
|
-
box-shadow: var(--button-shadow-normal);
|
|
142
|
-
}
|
|
143
|
-
a.is-clickable:hover, a.is-clickable:focus, a.is-clickable:focus-visible {
|
|
144
|
-
will-change: color, background-color, box-shadow, transform;
|
|
145
|
-
}
|
|
146
|
-
a.is-clickable:hover {
|
|
147
|
-
transform: translate3d(0, -0.04rem, 0);
|
|
148
|
-
color: var(--mdc-theme-on-surface);
|
|
149
|
-
background-color: var(--info-tile-background-color, var(--lime-elevated-surface-background-color));
|
|
150
|
-
box-shadow: var(--button-shadow-hovered);
|
|
151
|
-
}
|
|
152
|
-
a.is-clickable:active {
|
|
153
|
-
--limel-clickable-transform-timing-function: cubic-bezier(
|
|
154
|
-
0.83,
|
|
155
|
-
-0.15,
|
|
156
|
-
0.49,
|
|
157
|
-
1.16
|
|
158
|
-
);
|
|
159
|
-
transform: translate3d(0, 0.05rem, 0);
|
|
160
|
-
box-shadow: var(--button-shadow-pressed);
|
|
161
|
-
}
|
|
162
|
-
a.is-clickable:hover, a.is-clickable:active {
|
|
163
|
-
--limel-clickable-transition-speed: 0.2s;
|
|
164
|
-
--limel-clickable-transform-speed: 0.16s;
|
|
165
|
-
}
|
|
166
|
-
a.is-clickable:focus {
|
|
167
|
-
outline: none;
|
|
168
|
-
}
|
|
169
|
-
a.is-clickable:focus-visible {
|
|
170
|
-
outline: none;
|
|
171
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
172
|
-
}
|
|
173
135
|
|
|
174
136
|
.icon {
|
|
175
137
|
z-index: 1;
|
|
@@ -375,4 +337,77 @@ limel-linear-progress {
|
|
|
375
337
|
right: 0.5rem;
|
|
376
338
|
--icon-max-size: 3rem;
|
|
377
339
|
}
|
|
340
|
+
}
|
|
341
|
+
.limel-3d-hover-effect-glow {
|
|
342
|
+
transition: background 0.4s ease, opacity 0.4s ease;
|
|
343
|
+
pointer-events: none;
|
|
344
|
+
position: absolute;
|
|
345
|
+
inset: 0;
|
|
346
|
+
border-radius: var(--info-tile-border-radius, 1rem);
|
|
347
|
+
opacity: 0.1;
|
|
348
|
+
background-image: radial-gradient(circle at var(--limel-3d-hover-effect-glow-position, 50% -20%), rgb(var(--color-white), 0.3), rgb(var(--color-white), 0));
|
|
349
|
+
mix-blend-mode: plus-lighter;
|
|
350
|
+
}
|
|
351
|
+
a:hover .limel-3d-hover-effect-glow {
|
|
352
|
+
opacity: 0.5;
|
|
353
|
+
}
|
|
354
|
+
@media (prefers-reduced-motion) {
|
|
355
|
+
a:hover .limel-3d-hover-effect-glow {
|
|
356
|
+
opacity: 0.2;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
:host(limel-info-tile) {
|
|
361
|
+
isolation: isolate;
|
|
362
|
+
transform-style: preserve-3d;
|
|
363
|
+
perspective: 1000px;
|
|
364
|
+
}
|
|
365
|
+
@media (prefers-reduced-motion) {
|
|
366
|
+
:host(limel-info-tile) {
|
|
367
|
+
perspective: 2000px;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
a {
|
|
372
|
+
position: relative;
|
|
373
|
+
transition-duration: 0.8s;
|
|
374
|
+
transition-property: transform, box-shadow, background-color;
|
|
375
|
+
transition-timing-function: ease-out;
|
|
376
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
377
|
+
}
|
|
378
|
+
a:focus {
|
|
379
|
+
outline: none;
|
|
380
|
+
}
|
|
381
|
+
a:hover, a:focus, a:focus-visible, a:focus-within {
|
|
382
|
+
will-change: background-color, box-shadow, transform;
|
|
383
|
+
}
|
|
384
|
+
a:hover, a:focus, a:focus-visible, a:active {
|
|
385
|
+
transition-duration: 0.2s;
|
|
386
|
+
}
|
|
387
|
+
a:hover, a:focus-visible {
|
|
388
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
389
|
+
}
|
|
390
|
+
a:hover {
|
|
391
|
+
transform: scale3d(1.01, 1.01, 1.01) rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
392
|
+
}
|
|
393
|
+
a:focus-visible {
|
|
394
|
+
outline: none;
|
|
395
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
396
|
+
}
|
|
397
|
+
a.is-clickable {
|
|
398
|
+
cursor: pointer;
|
|
399
|
+
box-shadow: var(--button-shadow-normal);
|
|
400
|
+
}
|
|
401
|
+
a.is-clickable:hover, a.is-clickable:focus-visible {
|
|
402
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
403
|
+
}
|
|
404
|
+
a.is-clickable:active {
|
|
405
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
406
|
+
box-shadow: var(--button-shadow-pressed);
|
|
407
|
+
}
|
|
408
|
+
a.is-clickable:focus-visible {
|
|
409
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
410
|
+
}
|
|
411
|
+
a.is-clickable:focus-visible:active {
|
|
412
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
378
413
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { h } from '@stencil/core';
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';
|
|
2
3
|
/**
|
|
3
4
|
* This component can be used on places such as a start page or a dashboard.
|
|
4
5
|
* It offers features for visualizing aggregated data along with supplementary
|
|
@@ -76,6 +77,11 @@ export class InfoTile {
|
|
|
76
77
|
this.link = undefined;
|
|
77
78
|
this.progress = undefined;
|
|
78
79
|
}
|
|
80
|
+
componentWillLoad() {
|
|
81
|
+
const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(this.host);
|
|
82
|
+
this.handleMouseEnter = handleMouseEnter;
|
|
83
|
+
this.handleMouseLeave = handleMouseLeave;
|
|
84
|
+
}
|
|
79
85
|
render() {
|
|
80
86
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
81
87
|
const extendedAriaLabel = this.checkProps(this === null || this === void 0 ? void 0 : this.prefix) +
|
|
@@ -89,13 +95,11 @@ export class InfoTile {
|
|
|
89
95
|
this.checkProps((_c = this === null || this === void 0 ? void 0 : this.progress) === null || _c === void 0 ? void 0 : _c.suffix) +
|
|
90
96
|
this.checkProps((_d = this === null || this === void 0 ? void 0 : this.link) === null || _d === void 0 ? void 0 : _d.title);
|
|
91
97
|
const link = !this.disabled ? (_e = this.link) === null || _e === void 0 ? void 0 : _e.href : '#';
|
|
92
|
-
return
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.renderNotification(),
|
|
98
|
-
];
|
|
98
|
+
return (h(Host, { onMouseEnter: this.handleMouseEnter, onMouseLeave: this.handleMouseLeave }, h("a", { title: (_f = this.link) === null || _f === void 0 ? void 0 : _f.title, href: link, target: (_g = this.link) === null || _g === void 0 ? void 0 : _g.target, tabindex: "0", "aria-label": extendedAriaLabel, "aria-disabled": this.disabled, "aria-busy": this.loading ? 'true' : 'false', "aria-live": "polite", class: {
|
|
99
|
+
'is-clickable': !!((_h = this.link) === null || _h === void 0 ? void 0 : _h.href) && !this.disabled,
|
|
100
|
+
'has-circular-progress': !!((_j = this.progress) === null || _j === void 0 ? void 0 : _j.value) ||
|
|
101
|
+
((_k = this.progress) === null || _k === void 0 ? void 0 : _k.value) === 0,
|
|
102
|
+
} }, this.renderIcon(), this.renderProgress(), h("div", { class: "value-group" }, this.renderPrefix(), h("div", { class: "value-and-suffix" }, this.renderValue(), this.renderSuffix()), this.renderSpinner()), this.renderLabel()), this.renderNotification(), h("div", { class: "limel-3d-hover-effect-glow" })));
|
|
99
103
|
}
|
|
100
104
|
checkProps(propValue) {
|
|
101
105
|
return !propValue ? '' : propValue + ' ';
|
|
@@ -295,5 +299,6 @@ export class InfoTile {
|
|
|
295
299
|
}
|
|
296
300
|
};
|
|
297
301
|
}
|
|
302
|
+
static get elementRef() { return "host"; }
|
|
298
303
|
}
|
|
299
304
|
//# sourceMappingURL=info-tile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"info-tile.js","sourceRoot":"","sources":["../../../src/components/info-tile/info-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAInD;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,QAAQ;;IAkIT,iBAAY,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,YAAM,KAAK,EAAC,QAAQ,IAAE,IAAI,CAAC,MAAM,CAAQ,CAAC;OACpD;IACL,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;;MACvB,MAAM,cAAc,GAAG,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;MAE5D,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;QAC7B,OAAO,YAAM,KAAK,EAAC,OAAO,yBAAW,CAAC;OACzC;MAED,IAAI,IAAI,CAAC,KAAK,EAAE;QACZ,OAAO,CACH,YACI,KAAK,EAAE;YACH,KAAK,EAAE,IAAI;YACX,CAAC,MAAM,cAAc,EAAE,CAAC,EAAE,IAAI;WACjC,IAEA,IAAI,CAAC,KAAK,CACR,CACV,CAAC;OACL;IACL,CAAC,CAAC;IAEM,iBAAY,GAA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,MAAM,CAAC,CAAC,CAAC,OAAO,eAChC,QAAQ,EAClB,KAAK,EAAE;UACH,cAAc,EAAE,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,IAAI,CAAA,IAAI,CAAC,IAAI,CAAC,QAAQ;UACnD,uBAAuB,EACnB,CAAC,CAAC,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,KAAK,CAAA,IAAI,CAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,KAAK,MAAK,CAAC;SAC3D;QAEA,IAAI,CAAC,UAAU,EAAE;QACjB,IAAI,CAAC,cAAc,EAAE;QACtB,WAAK,KAAK,EAAC,aAAa;UACnB,IAAI,CAAC,YAAY,EAAE;UACpB,WAAK,KAAK,EAAC,kBAAkB;YACxB,IAAI,CAAC,WAAW,EAAE;YAClB,IAAI,CAAC,YAAY,EAAE,CAClB;UACL,IAAI,CAAC,aAAa,EAAE,CACnB;QACL,IAAI,CAAC,WAAW,EAAE,CACnB;MACJ,IAAI,CAAC,kBAAkB,EAAE;KAC5B,CAAC;EACN,CAAC;EAEO,UAAU,CAAC,SAAS;IACxB,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC;EAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EJ","sourcesContent":["import { Component, Prop, h } from '@stencil/core';\nimport { InfoTileProgress } from '../info-tile/info-tile.types';\nimport { Link } from '../../global/shared-types/link.types';\n\n/**\n * This component can be used on places such as a start page or a dashboard.\n * It offers features for visualizing aggregated data along with supplementary\n * information.\n *\n * If clicking on the component should navigate the user to\n * a new screen or web page, you need to provide a URL,\n * using the `link` property.\n *\n * @exampleComponent limel-example-info-tile\n * @exampleComponent limel-example-info-tile-badge\n * @exampleComponent limel-example-info-tile-progress\n * @exampleComponent limel-example-info-tile-loading\n * @exampleComponent limel-example-info-tile-styling\n */\n@Component({\n tag: 'limel-info-tile',\n shadow: true,\n styleUrl: 'info-tile.scss',\n})\nexport class InfoTile {\n /**\n * A piece of text or number that is the main piece of information\n * which the component is intended to visualize.\n */\n @Prop({ reflect: true })\n public value: number | string;\n\n /**\n * Name of icon for the info tile.\n */\n @Prop()\n public icon?: string;\n\n /**\n * The text to show below the info tile. Long labels will be truncated.\n */\n @Prop({ reflect: true })\n public label?: string = null;\n\n /**\n * A string of text that is visually placed before the value.\n */\n @Prop({ reflect: true })\n public prefix?: string;\n\n /**\n * A string of text that is visually placed after the value.\n */\n @Prop({ reflect: true })\n public suffix?: string;\n\n /**\n * Set to `true` if info tile is disabled.\n */\n @Prop({ reflect: true })\n public disabled? = false;\n\n /**\n * If supplied, the info tile will display a notification badge.\n */\n @Prop({ reflect: true })\n public badge?: number | string;\n\n /**\n * Set to `true` to put the component in the `loading` state.\n * This does _not_ disable the link. To do so, the\n * `disabled` property should be set to `true` as well.\n */\n @Prop({ reflect: true })\n public loading? = false;\n\n /**\n * If supplied, the info tile will be a clickable link.\n *\n * Supplying a value also adds an elevated effect using a shadow,\n * as well as `cursor: pointer`, which appears on hover.\n * While we strongly recommend supplying a link whenever the\n * component should act as a link, if this is not possible, and\n * you need to provide interaction through a click handler,\n * you can still get the correct styling by supplying a `Link`\n * object with the `href` property set to `'#'`.\n */\n @Prop()\n public link?: Link;\n\n /**\n * Properties of the optional circular progress bar.\n *\n * Defaults:\n * - `maxValue`: 100\n * - `suffix`: %\n * - `displayPercentageColors`: false\n *\n * Colors change with intervals of 10 %.\n */\n @Prop()\n public progress?: InfoTileProgress;\n\n public render() {\n const extendedAriaLabel =\n this.checkProps(this?.prefix) +\n this.value +\n ' ' +\n this.checkProps(this?.suffix) +\n this.checkProps(this?.label) +\n '. ' +\n this.checkProps(this?.progress?.prefix) +\n this.checkProps(this?.progress?.value) +\n this.checkProps(this?.progress?.suffix) +\n this.checkProps(this?.link?.title);\n\n const link = !this.disabled ? this.link?.href : '#';\n\n return [\n <a\n title={this.link?.title}\n href={link}\n target={this.link?.target}\n tabindex=\"0\"\n aria-label={extendedAriaLabel}\n aria-disabled={this.disabled}\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n class={{\n 'is-clickable': !!this.link?.href && !this.disabled,\n 'has-circular-progress':\n !!this.progress?.value || this.progress?.value === 0,\n }}\n >\n {this.renderIcon()}\n {this.renderProgress()}\n <div class=\"value-group\">\n {this.renderPrefix()}\n <div class=\"value-and-suffix\">\n {this.renderValue()}\n {this.renderSuffix()}\n </div>\n {this.renderSpinner()}\n </div>\n {this.renderLabel()}\n </a>,\n this.renderNotification(),\n ];\n }\n\n private checkProps(propValue) {\n return !propValue ? '' : propValue + ' ';\n }\n\n private renderPrefix = () => {\n if (this.prefix) {\n return <span class=\"prefix\">{this.prefix}</span>;\n }\n };\n\n private renderValue = () => {\n const characterCount = (this.value ?? '').toString().length;\n\n if (!this.value && this.loading) {\n return <span class=\"value\">···</span>;\n }\n\n if (this.value) {\n return (\n <span\n class={{\n value: true,\n [`ch-${characterCount}`]: true,\n }}\n >\n {this.value}\n </span>\n );\n }\n };\n\n private renderSuffix = () => {\n if (this.suffix) {\n return <span class=\"suffix\">{this.suffix}</span>;\n }\n };\n\n private renderIcon = () => {\n if (this.icon) {\n return <limel-icon class=\"icon\" name={this.icon} />;\n }\n };\n\n private renderProgress = () => {\n if (this.progress?.value || this.progress?.value === 0) {\n return (\n <limel-circular-progress\n class=\"progress\"\n prefix={this.progress.prefix}\n value={this.progress.value}\n suffix={this.progress.suffix}\n maxValue={this.progress.maxValue}\n displayPercentageColors={\n this.progress.displayPercentageColors\n }\n />\n );\n }\n };\n\n private renderLabel = () => {\n if (this.label) {\n return <span class=\"label\">{this.label}</span>;\n }\n };\n\n private renderNotification = () => {\n if (this.badge) {\n return <limel-badge label={this.badge} />;\n }\n };\n\n private renderSpinner = () => {\n if (this.loading) {\n return <limel-linear-progress indeterminate={true} />;\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"info-tile.js","sourceRoot":"","sources":["../../../src/components/info-tile/info-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGlE,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAExE;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,QAAQ;;IAuJT,iBAAY,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,YAAM,KAAK,EAAC,QAAQ,IAAE,IAAI,CAAC,MAAM,CAAQ,CAAC;OACpD;IACL,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;;MACvB,MAAM,cAAc,GAAG,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC;MAE5D,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;QAC7B,OAAO,YAAM,KAAK,EAAC,OAAO,yBAAW,CAAC;OACzC;MAED,IAAI,IAAI,CAAC,KAAK,EAAE;QACZ,OAAO,CACH,YACI,KAAK,EAAE;YACH,KAAK,EAAE,IAAI;YACX,CAAC,MAAM,cAAc,EAAE,CAAC,EAAE,IAAI;WACjC,IAEA,IAAI,CAAC,KAAK,CACR,CACV,CAAC;OACL;IACL,CAAC,CAAC;IAEM,iBAAY,GAAG,GAAG,EAAE;MACxB,IAAI,IAAI,CAAC,MAAM,EAAE;QACb,OAAO,YAAM,KAAK,EAAC,QAAQ,IAAE,IAAI,CAAC,MAAM,CAAQ,CAAC;OACpD;IACL,CAA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;;;;;;;CA2EJ","sourcesContent":["import { Component, Prop, h, Element, Host } from '@stencil/core';\nimport { InfoTileProgress } from '../info-tile/info-tile.types';\nimport { Link } from '../../global/shared-types/link.types';\nimport { getMouseEventHandlers } from '../../util/3d-tilt-hover-effect';\n\n/**\n * This component can be used on places such as a start page or a dashboard.\n * It offers features for visualizing aggregated data along with supplementary\n * information.\n *\n * If clicking on the component should navigate the user to\n * a new screen or web page, you need to provide a URL,\n * using the `link` property.\n *\n * @exampleComponent limel-example-info-tile\n * @exampleComponent limel-example-info-tile-badge\n * @exampleComponent limel-example-info-tile-progress\n * @exampleComponent limel-example-info-tile-loading\n * @exampleComponent limel-example-info-tile-styling\n */\n@Component({\n tag: 'limel-info-tile',\n shadow: true,\n styleUrl: 'info-tile.scss',\n})\nexport class InfoTile {\n /**\n * A piece of text or number that is the main piece of information\n * which the component is intended to visualize.\n */\n @Prop({ reflect: true })\n public value: number | string;\n\n /**\n * Name of icon for the info tile.\n */\n @Prop()\n public icon?: string;\n\n /**\n * The text to show below the info tile. Long labels will be truncated.\n */\n @Prop({ reflect: true })\n public label?: string = null;\n\n /**\n * A string of text that is visually placed before the value.\n */\n @Prop({ reflect: true })\n public prefix?: string;\n\n /**\n * A string of text that is visually placed after the value.\n */\n @Prop({ reflect: true })\n public suffix?: string;\n\n /**\n * Set to `true` if info tile is disabled.\n */\n @Prop({ reflect: true })\n public disabled? = false;\n\n /**\n * If supplied, the info tile will display a notification badge.\n */\n @Prop({ reflect: true })\n public badge?: number | string;\n\n /**\n * Set to `true` to put the component in the `loading` state.\n * This does _not_ disable the link. To do so, the\n * `disabled` property should be set to `true` as well.\n */\n @Prop({ reflect: true })\n public loading? = false;\n\n /**\n * If supplied, the info tile will be a clickable link.\n *\n * Supplying a value also adds an elevated effect using a shadow,\n * as well as `cursor: pointer`, which appears on hover.\n * While we strongly recommend supplying a link whenever the\n * component should act as a link, if this is not possible, and\n * you need to provide interaction through a click handler,\n * you can still get the correct styling by supplying a `Link`\n * object with the `href` property set to `'#'`.\n */\n @Prop()\n public link?: Link;\n\n /**\n * Properties of the optional circular progress bar.\n *\n * Defaults:\n * - `maxValue`: 100\n * - `suffix`: %\n * - `displayPercentageColors`: false\n *\n * Colors change with intervals of 10 %.\n */\n @Prop()\n public progress?: InfoTileProgress;\n\n @Element()\n private host: HTMLElement;\n\n private handleMouseEnter: () => void;\n private handleMouseLeave: () => void;\n\n public componentWillLoad() {\n const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(\n this.host,\n );\n this.handleMouseEnter = handleMouseEnter;\n this.handleMouseLeave = handleMouseLeave;\n }\n\n public render() {\n const extendedAriaLabel =\n this.checkProps(this?.prefix) +\n this.value +\n ' ' +\n this.checkProps(this?.suffix) +\n this.checkProps(this?.label) +\n '. ' +\n this.checkProps(this?.progress?.prefix) +\n this.checkProps(this?.progress?.value) +\n this.checkProps(this?.progress?.suffix) +\n this.checkProps(this?.link?.title);\n\n const link = !this.disabled ? this.link?.href : '#';\n\n return (\n <Host\n onMouseEnter={this.handleMouseEnter}\n onMouseLeave={this.handleMouseLeave}\n >\n <a\n title={this.link?.title}\n href={link}\n target={this.link?.target}\n tabindex=\"0\"\n aria-label={extendedAriaLabel}\n aria-disabled={this.disabled}\n aria-busy={this.loading ? 'true' : 'false'}\n aria-live=\"polite\"\n class={{\n 'is-clickable': !!this.link?.href && !this.disabled,\n 'has-circular-progress':\n !!this.progress?.value ||\n this.progress?.value === 0,\n }}\n >\n {this.renderIcon()}\n {this.renderProgress()}\n <div class=\"value-group\">\n {this.renderPrefix()}\n <div class=\"value-and-suffix\">\n {this.renderValue()}\n {this.renderSuffix()}\n </div>\n {this.renderSpinner()}\n </div>\n {this.renderLabel()}\n </a>\n {this.renderNotification()}\n <div class=\"limel-3d-hover-effect-glow\" />\n </Host>\n );\n }\n\n private checkProps(propValue) {\n return !propValue ? '' : propValue + ' ';\n }\n\n private renderPrefix = () => {\n if (this.prefix) {\n return <span class=\"prefix\">{this.prefix}</span>;\n }\n };\n\n private renderValue = () => {\n const characterCount = (this.value ?? '').toString().length;\n\n if (!this.value && this.loading) {\n return <span class=\"value\">···</span>;\n }\n\n if (this.value) {\n return (\n <span\n class={{\n value: true,\n [`ch-${characterCount}`]: true,\n }}\n >\n {this.value}\n </span>\n );\n }\n };\n\n private renderSuffix = () => {\n if (this.suffix) {\n return <span class=\"suffix\">{this.suffix}</span>;\n }\n };\n\n private renderIcon = () => {\n if (this.icon) {\n return <limel-icon class=\"icon\" name={this.icon} />;\n }\n };\n\n private renderProgress = () => {\n if (this.progress?.value || this.progress?.value === 0) {\n return (\n <limel-circular-progress\n class=\"progress\"\n prefix={this.progress.prefix}\n value={this.progress.value}\n suffix={this.progress.suffix}\n maxValue={this.progress.maxValue}\n displayPercentageColors={\n this.progress.displayPercentageColors\n }\n />\n );\n }\n };\n\n private renderLabel = () => {\n if (this.label) {\n return <span class=\"label\">{this.label}</span>;\n }\n };\n\n private renderNotification = () => {\n if (this.badge) {\n return <limel-badge label={this.badge} />;\n }\n };\n\n private renderSpinner = () => {\n if (this.loading) {\n return <limel-linear-progress indeterminate={true} />;\n }\n };\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import { unified } from 'unified';
|
|
|
2
2
|
import remarkParse from 'remark-parse';
|
|
3
3
|
import remarkRehype from 'remark-rehype';
|
|
4
4
|
import remarkGfm from 'remark-gfm';
|
|
5
|
+
import rehypeParse from 'rehype-parse';
|
|
5
6
|
import rehypeExternalLinks from 'rehype-external-links';
|
|
6
7
|
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
|
|
7
8
|
import rehypeStringify from 'rehype-stringify';
|
|
@@ -45,6 +46,28 @@ export async function markdownToHTML(text, options) {
|
|
|
45
46
|
.process(text);
|
|
46
47
|
return file.toString();
|
|
47
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Sanitizes a given HTML string by removing dangerous tags and attributes.
|
|
51
|
+
*
|
|
52
|
+
* @param html - The string containing HTML to sanitize.
|
|
53
|
+
* @param whitelist - Optional whitelist of custom components.
|
|
54
|
+
* @returns The sanitized HTML string.
|
|
55
|
+
*/
|
|
56
|
+
export async function sanitizeHTML(html, whitelist) {
|
|
57
|
+
const file = await unified()
|
|
58
|
+
.use(rehypeParse)
|
|
59
|
+
.use(rehypeSanitize, Object.assign({}, getWhiteList(whitelist !== null && whitelist !== void 0 ? whitelist : [])))
|
|
60
|
+
.use(() => {
|
|
61
|
+
return (tree) => {
|
|
62
|
+
// Run the sanitizeStyle function on all elements, to sanitize
|
|
63
|
+
// the value of the `style` attribute, if there is one.
|
|
64
|
+
visit(tree, 'element', sanitizeStyle);
|
|
65
|
+
};
|
|
66
|
+
})
|
|
67
|
+
.use(rehypeStringify)
|
|
68
|
+
.process(html);
|
|
69
|
+
return file.toString();
|
|
70
|
+
}
|
|
48
71
|
function getWhiteList(allowedComponents) {
|
|
49
72
|
var _a, _b;
|
|
50
73
|
const defaultSchemaClone = [...((_a = defaultSchema.attributes['*']) !== null && _a !== void 0 ? _a : [])];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../src/components/markdown/markdown-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,cAAc,EAAE,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,eAAe,MAAM,kBAAkB,CAAC;AAC/C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CACh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CACR,aAAa,KAChB,QAAQ,EAAE;MACN,GAAG,CAAC,aAAa,CAAC,QAAQ,IAAI,EAAE,CAAC;MACjC,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;KAC7D,EACD,UAAU,kCACH,aAAa,CAAC,UAAU,KAC3B,CAAC,EAAE;QACC,GAAG,CAAC,MAAA,aAAa,CAAC,UAAU,CAAC,CAAC,mCAAI,EAAE,CAAC;QACrC,CAAC,WAAW,EAAE,WAAW,CAAC;OAC7B,EACD,GAAG,EAAE,0BAA0B,MAEtC,CAAC;EAEF,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE;IACvC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;GAClE;EAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkGfm from 'remark-gfm';\nimport rehypeExternalLinks from 'rehype-external-links';\nimport rehypeSanitize, { defaultSchema } from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeRaw from 'rehype-raw';\nimport { visit } from 'unist-util-visit';\nimport { sanitizeStyle } from './sanitize-style';\nimport { Node } from 'unist';\nimport { Schema } from 'rehype-sanitize/lib';\nimport { CustomElementDefinition } from '../../global/shared-types/custom-element.types';\n\n/**\n * Takes a string as input and returns a new string\n * where the text has been converted to HTML.\n *\n * If the text is formatted with .md markdown, it will\n * be transformed to HTML.\n *\n * If the text already is in HTML it will be sanitized and\n * \"dangerous\" tags such as <script> will be removed.\n *\n * @param text - The string to convert.\n * @param options - Options for the conversions.\n * @returns The resulting HTML.\n */\nexport async function markdownToHTML(\n text: string,\n options?: markdownToHTMLOptions,\n): Promise<string> {\n if (options?.forceHardLineBreaks) {\n text = text.replace(/(?<!\\\\)([\\n\\r])/g, ' $1');\n }\n\n const file = await unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeExternalLinks, { target: '_blank' })\n .use(rehypeRaw)\n .use(rehypeSanitize, {\n ...getWhiteList(options?.whitelist ?? []),\n })\n .use(() => {\n return (tree: Node) => {\n // Run the sanitizeStyle function on all elements, to sanitize\n // the value of the `style` attribute, if there is one.\n visit(tree, 'element', sanitizeStyle);\n };\n })\n .use(rehypeStringify)\n .process(text);\n\n return file.toString();\n}\n\nfunction getWhiteList(allowedComponents: CustomElementDefinition[]): Schema {\n const defaultSchemaClone = [...(defaultSchema.attributes['*'] ?? [])];\n const asteriskAttributeWhitelist = defaultSchemaClone.filter((attr) => {\n return attr !== 'height';\n });\n asteriskAttributeWhitelist.push('style');\n\n const whitelist: Schema = {\n ...defaultSchema,\n tagNames: [\n ...(defaultSchema.tagNames || []),\n ...allowedComponents.map((component) => component.tagName),\n ],\n attributes: {\n ...defaultSchema.attributes,\n p: [\n ...(defaultSchema.attributes.p ?? []),\n ['className', 'MsoNormal'],\n ], // Allow the class 'MsoNormal' on <p> elements\n '*': asteriskAttributeWhitelist,\n },\n };\n\n for (const component of allowedComponents) {\n whitelist.attributes[component.tagName] = component.attributes;\n }\n\n return whitelist;\n}\n\n/**\n * Options for markdownToHTML.\n */\nexport interface markdownToHTMLOptions {\n /**\n * Set to `true` to convert all soft line breaks to hard line breaks.\n */\n forceHardLineBreaks?: boolean;\n whitelist?: CustomElementDefinition[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"markdown-parser.js","sourceRoot":"","sources":["../../../src/components/markdown/markdown-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,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AW,CAAC;OAC7B,EACD,GAAG,EAAE,0BAA0B,MAEtC,CAAC;EAEF,KAAK,MAAM,SAAS,IAAI,iBAAiB,EAAE;IACvC,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;GAClE;EAED,OAAO,SAAS,CAAC;AACrB,CAAC","sourcesContent":["import { unified } from 'unified';\nimport remarkParse from 'remark-parse';\nimport remarkRehype from 'remark-rehype';\nimport remarkGfm from 'remark-gfm';\nimport rehypeParse from 'rehype-parse';\nimport rehypeExternalLinks from 'rehype-external-links';\nimport rehypeSanitize, { defaultSchema } from 'rehype-sanitize';\nimport rehypeStringify from 'rehype-stringify';\nimport rehypeRaw from 'rehype-raw';\nimport { visit } from 'unist-util-visit';\nimport { sanitizeStyle } from './sanitize-style';\nimport { Node } from 'unist';\nimport { Schema } from 'rehype-sanitize/lib';\nimport { CustomElementDefinition } from '../../global/shared-types/custom-element.types';\n\n/**\n * Takes a string as input and returns a new string\n * where the text has been converted to HTML.\n *\n * If the text is formatted with .md markdown, it will\n * be transformed to HTML.\n *\n * If the text already is in HTML it will be sanitized and\n * \"dangerous\" tags such as <script> will be removed.\n *\n * @param text - The string to convert.\n * @param options - Options for the conversions.\n * @returns The resulting HTML.\n */\nexport async function markdownToHTML(\n text: string,\n options?: markdownToHTMLOptions,\n): Promise<string> {\n if (options?.forceHardLineBreaks) {\n text = text.replace(/(?<!\\\\)([\\n\\r])/g, ' $1');\n }\n\n const file = await unified()\n .use(remarkParse)\n .use(remarkGfm)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeExternalLinks, { target: '_blank' })\n .use(rehypeRaw)\n .use(rehypeSanitize, {\n ...getWhiteList(options?.whitelist ?? []),\n })\n .use(() => {\n return (tree: Node) => {\n // Run the sanitizeStyle function on all elements, to sanitize\n // the value of the `style` attribute, if there is one.\n visit(tree, 'element', sanitizeStyle);\n };\n })\n .use(rehypeStringify)\n .process(text);\n\n return file.toString();\n}\n\n/**\n * Sanitizes a given HTML string by removing dangerous tags and attributes.\n *\n * @param html - The string containing HTML to sanitize.\n * @param whitelist - Optional whitelist of custom components.\n * @returns The sanitized HTML string.\n */\nexport async function sanitizeHTML(\n html: string,\n whitelist?: CustomElementDefinition[],\n): Promise<string> {\n const file = await unified()\n .use(rehypeParse)\n .use(rehypeSanitize, {\n ...getWhiteList(whitelist ?? []),\n })\n .use(() => {\n return (tree: Node) => {\n // Run the sanitizeStyle function on all elements, to sanitize\n // the value of the `style` attribute, if there is one.\n visit(tree, 'element', sanitizeStyle);\n };\n })\n .use(rehypeStringify)\n .process(html);\n\n return file.toString();\n}\n\nfunction getWhiteList(allowedComponents: CustomElementDefinition[]): Schema {\n const defaultSchemaClone = [...(defaultSchema.attributes['*'] ?? [])];\n const asteriskAttributeWhitelist = defaultSchemaClone.filter((attr) => {\n return attr !== 'height';\n });\n asteriskAttributeWhitelist.push('style');\n\n const whitelist: Schema = {\n ...defaultSchema,\n tagNames: [\n ...(defaultSchema.tagNames || []),\n ...allowedComponents.map((component) => component.tagName),\n ],\n attributes: {\n ...defaultSchema.attributes,\n p: [\n ...(defaultSchema.attributes.p ?? []),\n ['className', 'MsoNormal'],\n ], // Allow the class 'MsoNormal' on <p> elements\n '*': asteriskAttributeWhitelist,\n },\n };\n\n for (const component of allowedComponents) {\n whitelist.attributes[component.tagName] = component.attributes;\n }\n\n return whitelist;\n}\n\n/**\n * Options for markdownToHTML.\n */\nexport interface markdownToHTMLOptions {\n /**\n * Set to `true` to convert all soft line breaks to hard line breaks.\n */\n forceHardLineBreaks?: boolean;\n whitelist?: CustomElementDefinition[];\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { sanitizeHTML } from '../../markdown/markdown-parser';
|
|
2
2
|
/**
|
|
3
3
|
* @private
|
|
4
4
|
*/
|
|
5
5
|
export class HTMLConverter {
|
|
6
6
|
constructor(plugins) {
|
|
7
7
|
this.parseAsHTML = (text) => {
|
|
8
|
-
return
|
|
8
|
+
return sanitizeHTML(text, this.customNodes);
|
|
9
9
|
};
|
|
10
10
|
this.serialize = (view) => {
|
|
11
11
|
if (view.dom.textContent === '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-converter.js","sourceRoot":"","sources":["../../../../src/components/text-editor/utils/html-converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"html-converter.js","sourceRoot":"","sources":["../../../../src/components/text-editor/utils/html-converter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D;;GAEG;AACH,MAAM,OAAO,aAAa;EAGtB,YAAY,OAAkC;IAIvC,gBAAW,GAAG,CAAC,IAAY,EAAmB,EAAE;MACnD,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAChD,CAAC,CAAC;IAEK,cAAS,GAAG,CAAC,IAAgB,EAAU,EAAE;MAC5C,IAAI,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,EAAE,EAAE;QAC7B,OAAO,EAAE,CAAC;OACb;WAAM;QACH,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;OAC7B;IACL,CAAC,CAAC;IAbE,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;EAC/B,CAAC;CAaJ","sourcesContent":["import { ContentTypeConverter } from './content-type-converter';\nimport { EditorView } from 'prosemirror-view';\nimport { sanitizeHTML } from '../../markdown/markdown-parser';\nimport { CustomElementDefinition } from '../../../interface';\n\n/**\n * @private\n */\nexport class HTMLConverter implements ContentTypeConverter {\n private customNodes: CustomElementDefinition[];\n\n constructor(plugins: CustomElementDefinition[]) {\n this.customNodes = plugins;\n }\n\n public parseAsHTML = (text: string): Promise<string> => {\n return sanitizeHTML(text, this.customNodes);\n };\n\n public serialize = (view: EditorView): string => {\n if (view.dom.textContent === '') {\n return '';\n } else {\n return view.dom.innerHTML;\n }\n };\n}\n"]}
|
|
@@ -456,3 +456,117 @@ $clickable-normal-state-transitions: (
|
|
|
456
456
|
clip-path: inset(50%);
|
|
457
457
|
white-space: nowrap;
|
|
458
458
|
}
|
|
459
|
+
|
|
460
|
+
// This mixin designed to enhance the visual effects,
|
|
461
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
462
|
+
// is implemented in a component.
|
|
463
|
+
// This adds styles to a `<div class"limel-3d-hover-effect-glow" />`, needed to create
|
|
464
|
+
// a glow effect on a 3D element when the parent element is hovered.
|
|
465
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
466
|
+
// Parts of these styles are controlled by the `titleFollowingTheCursor` function.
|
|
467
|
+
@mixin limel-3d-hover-effect-glow($the3dElement, $border-radius) {
|
|
468
|
+
.limel-3d-hover-effect-glow {
|
|
469
|
+
transition:
|
|
470
|
+
background 0.4s ease,
|
|
471
|
+
opacity 0.4s ease;
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
|
|
474
|
+
position: absolute;
|
|
475
|
+
inset: 0;
|
|
476
|
+
border-radius: $border-radius;
|
|
477
|
+
|
|
478
|
+
opacity: 0.1;
|
|
479
|
+
#{$the3dElement}:hover & {
|
|
480
|
+
opacity: 0.5;
|
|
481
|
+
@media (prefers-reduced-motion) {
|
|
482
|
+
opacity: 0.2;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
background-image: radial-gradient(
|
|
487
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
488
|
+
rgb(var(--color-white), 0.3),
|
|
489
|
+
rgb(var(--color-white), 0)
|
|
490
|
+
);
|
|
491
|
+
|
|
492
|
+
mix-blend-mode: plus-lighter;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
497
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
498
|
+
// is implemented in a component.
|
|
499
|
+
@mixin parent-of-the-3d-element {
|
|
500
|
+
isolation: isolate;
|
|
501
|
+
transform-style: preserve-3d;
|
|
502
|
+
|
|
503
|
+
perspective: 1000px;
|
|
504
|
+
@media (prefers-reduced-motion) {
|
|
505
|
+
perspective: 2000px;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
@mixin the-3d-element {
|
|
510
|
+
position: relative;
|
|
511
|
+
|
|
512
|
+
transition-duration: 0.8s;
|
|
513
|
+
transition-property: transform, box-shadow, background-color;
|
|
514
|
+
transition-timing-function: ease-out;
|
|
515
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
516
|
+
|
|
517
|
+
&:focus {
|
|
518
|
+
outline: none;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
&:hover,
|
|
522
|
+
&:focus,
|
|
523
|
+
&:focus-visible,
|
|
524
|
+
&:focus-within {
|
|
525
|
+
will-change: background-color, box-shadow, transform;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
&:hover,
|
|
529
|
+
&:focus,
|
|
530
|
+
&:focus-visible,
|
|
531
|
+
&:active {
|
|
532
|
+
transition-duration: 0.2s;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
&:hover,
|
|
536
|
+
&:focus-visible {
|
|
537
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
&:hover {
|
|
541
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
542
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
543
|
+
}
|
|
544
|
+
&:focus-visible {
|
|
545
|
+
outline: none;
|
|
546
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
@mixin the-3d-element--clickable {
|
|
551
|
+
cursor: pointer;
|
|
552
|
+
box-shadow: var(--button-shadow-normal);
|
|
553
|
+
|
|
554
|
+
&:hover,
|
|
555
|
+
&:focus-visible {
|
|
556
|
+
// seems repetitive. But it's required for some scenarios, like for info tiles.
|
|
557
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-16);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
&:active {
|
|
561
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
562
|
+
box-shadow: var(--button-shadow-pressed);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
&:focus-visible {
|
|
566
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-hovered);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
&:focus-visible:active {
|
|
570
|
+
box-shadow: var(--shadow-depth-8-focused), var(--button-shadow-pressed);
|
|
571
|
+
}
|
|
572
|
+
}
|