@limetech/lime-elements 37.70.0 → 37.70.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 +8 -0
- package/dist/cjs/limel-card.cjs.entry.js +1 -1
- package/dist/cjs/limel-card.cjs.entry.js.map +1 -1
- package/dist/collection/components/card/card.css +18 -16
- package/dist/collection/style/mixins.scss +95 -0
- package/dist/collection/util/3d-tilt-hover-effect.js +124 -0
- package/dist/collection/util/3d-tilt-hover-effect.js.map +1 -0
- package/dist/esm/limel-card.entry.js +1 -1
- package/dist/esm/limel-card.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-ca929a0e.entry.js +2 -0
- package/dist/lime-elements/p-ca929a0e.entry.js.map +1 -0
- package/dist/lime-elements/style/mixins.scss +95 -0
- package/dist/scss/mixins.scss +95 -0
- package/dist/types/util/3d-tilt-hover-effect.d.ts +93 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-7f9e0f52.entry.js +0 -2
- package/dist/lime-elements/p-7f9e0f52.entry.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [37.70.1](https://github.com/Lundalogik/lime-elements/compare/v37.70.0...v37.70.1) (2024-11-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **card:** improve background color styles ([3376742](https://github.com/Lundalogik/lime-elements/commit/33767426e4d5f3ba735fd47dbf40f4b63c7f62d7))
|
|
8
|
+
|
|
1
9
|
## [37.70.0](https://github.com/Lundalogik/lime-elements/compare/v37.69.1...v37.70.0) (2024-11-21)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -6,7 +6,7 @@ const index = require('./index-d1052409.js');
|
|
|
6
6
|
const isItem = require('./isItem-3f8ad629.js');
|
|
7
7
|
const getIconProps = require('./get-icon-props-50be7440.js');
|
|
8
8
|
|
|
9
|
-
const cardCss = "@charset \"UTF-8\";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, var(--
|
|
9
|
+
const cardCss = "@charset \"UTF-8\";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, rgb(var(--contrast-300)))}:host(limel-card[orientation=landscape]) section{flex-direction:row}:host(limel-card[clickable]) section{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);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, rgb(var(--contrast-200)))}:host(limel-card[clickable]) section:focus{outline:none}:host(limel-card[clickable]) section:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:focus,:host(limel-card[clickable]) section:focus-visible{will-change:color, background-color, box-shadow, transform}:host(limel-card[clickable]) section:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));box-shadow:var(--button-shadow-hovered)}:host(limel-card[clickable]) section:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(limel-card[clickable]:hover) section{border-color:transparent}.body{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}img{transition:filter 0.6s ease;object-fit:cover;border-radius:calc(var(--card-border-radius, 0.95rem) / 1.4)}:host(limel-card[orientation=portrait]) img{width:100%}:host(limel-card[orientation=landscape]) img{max-width:40%;height:100%}section:hover img,section:focus-visible img{transition-duration:0.2s;filter:saturate(1.3)}limel-markdown{padding:0.5rem 0.75rem}header{display:flex;justify-content:center;gap:0.5rem;padding:0.25rem 0.75rem}:host(limel-card[orientation=landscape]) header{padding-top:0.5rem}header:has(limel-icon){padding-left:0.25rem}header .headings{flex-grow:1;display:flex;flex-direction:column;gap:0.125rem}header limel-icon{flex-shrink:0;width:2rem}header h1{font-size:1.125rem;font-weight:500;color:var(--card-heading-color, rgb(var(--contrast-1100)));letter-spacing:-0.03125rem}header h2{font-size:0.875rem;font-weight:400;color:var(--card-subheading-color, rgb(var(--contrast-1000)))}header h1,header h2{word-break:break-word;hyphens:auto;-webkit-hyphens:auto;margin:0}limel-action-bar{--action-bar-background-color:transparent;padding:0.5rem;margin-left:auto}";
|
|
10
10
|
|
|
11
11
|
const Card = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-card.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,OAAO,GAAG,6zGAA6zG;;MC2Bh0G,IAAI;;;;IAgJL,uBAAkB,GAAG,CACzB,KAAiD;MAEjD,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAIA,aAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;OAC1C;KACJ,CAAC;;;;;;mBA/GsD,EAAE;qBAO9B,KAAK;uBAOc,UAAU;;EAQlD,MAAM;IACT,QACIC,qBAAS,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IACrC,IAAI,CAAC,WAAW,EAAE,EACnBA,iBAAK,KAAK,EAAC,MAAM,IACZ,IAAI,CAAC,YAAY,EAAE,EACnB,IAAI,CAAC,UAAU,EAAE,EACjB,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,eAAe,EAAE,CACrB,CACA,EACZ;GACL;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,OAAO;KACV;IAED,OAAOA,iBAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAC,MAAM,GAAG,CAAC;GAC3E;EAEO,YAAY;IAChB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACjD,OAAO;KACV;IAED,QACIA,wBACK,IAAI,CAAC,UAAU,EAAE,EAClBA,iBAAK,KAAK,EAAC,UAAU,IAChB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACD,EACX;GACL;EAEO,UAAU;;IACd,MAAM,IAAI,GAAGC,wBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GACP,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,GAAG,SAAS,CAAC;IAEjE,IAAI,CAAC,IAAI,EAAE;MACP,OAAO;KACV;IAED,QACID,wBACI,KAAK,EAAE;QACH,KAAK,EAAE,GAAG,KAAK,EAAE;OACpB,EACD,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,IAAI,GACZ,EACJ;GACL;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACf,OAAO;KACV;IAED,OAAOA,oBAAK,IAAI,CAAC,OAAO,CAAM,CAAC;GAClC;EAEO,gBAAgB;IACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MAClB,OAAO;KACV;IAED,OAAOA,oBAAK,IAAI,CAAC,UAAU,CAAM,CAAC;GACrC;EAEO,UAAU;IACd,OAAOA,kBAAM,IAAI,EAAC,WAAW,GAAG,CAAC;GACpC;EAEO,WAAW;IACf,OAAOA,4BAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;GAChD;EAWO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;MACtB,OAAO;KACV;IAED,QACIA,8BACI,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,cAAc,EAAE,IAAI,CAAC,kBAAkB,GACzC,EACJ;GACL;;;;;;","names":["isItem","h","getIconName"],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n @include mixins.visualize-keyboard-focus;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n );\n\n :host(limel-card[clickable]:not([disabled='true']):not([disabled])) & {\n @include mixins.is-flat-clickable(\n $background-color:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n ),\n $background-color--hovered:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n :host(limel-card:hover) & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"version":3}
|
|
1
|
+
{"file":"limel-card.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,OAAO,GAAG,inGAAinG;;MC2BpnG,IAAI;;;;IAgJL,uBAAkB,GAAG,CACzB,KAAiD;MAEjD,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAIA,aAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;OAC1C;KACJ,CAAC;;;;;;mBA/GsD,EAAE;qBAO9B,KAAK;uBAOc,UAAU;;EAQlD,MAAM;IACT,QACIC,qBAAS,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IACrC,IAAI,CAAC,WAAW,EAAE,EACnBA,iBAAK,KAAK,EAAC,MAAM,IACZ,IAAI,CAAC,YAAY,EAAE,EACnB,IAAI,CAAC,UAAU,EAAE,EACjB,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,eAAe,EAAE,CACrB,CACA,EACZ;GACL;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,OAAO;KACV;IAED,OAAOA,iBAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAC,MAAM,GAAG,CAAC;GAC3E;EAEO,YAAY;IAChB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACjD,OAAO;KACV;IAED,QACIA,wBACK,IAAI,CAAC,UAAU,EAAE,EAClBA,iBAAK,KAAK,EAAC,UAAU,IAChB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACD,EACX;GACL;EAEO,UAAU;;IACd,MAAM,IAAI,GAAGC,wBAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GACP,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,GAAG,SAAS,CAAC;IAEjE,IAAI,CAAC,IAAI,EAAE;MACP,OAAO;KACV;IAED,QACID,wBACI,KAAK,EAAE;QACH,KAAK,EAAE,GAAG,KAAK,EAAE;OACpB,EACD,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,IAAI,GACZ,EACJ;GACL;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACf,OAAO;KACV;IAED,OAAOA,oBAAK,IAAI,CAAC,OAAO,CAAM,CAAC;GAClC;EAEO,gBAAgB;IACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MAClB,OAAO;KACV;IAED,OAAOA,oBAAK,IAAI,CAAC,UAAU,CAAM,CAAC;GACrC;EAEO,UAAU;IACd,OAAOA,kBAAM,IAAI,EAAC,WAAW,GAAG,CAAC;GACpC;EAEO,WAAW;IACf,OAAOA,4BAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;GAChD;EAWO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;MACtB,OAAO;KACV;IAED,QACIA,8BACI,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,cAAc,EAAE,IAAI,CAAC,kBAAkB,GACzC,EACJ;GACL;;;;;;","names":["isItem","h","getIconName"],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n* @prop --card-background-color--hovered: background color of the card, when hovered.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(--card-background-color, rgb(var(--contrast-300)));\n\n :host(limel-card[clickable]) & {\n @include mixins.visualize-keyboard-focus;\n @include mixins.is-flat-clickable(\n $background-color:\n var(--card-background-color, rgb(var(--contrast-200))),\n $background-color--hovered:\n var(\n --card-background-color--hovered,\n var(--card-background-color, rgb(var(--contrast-200)))\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n section:hover &,\n section:focus-visible & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n --action-bar-background-color: transparent;\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"version":3}
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;
|
|
63
63
|
* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;
|
|
64
64
|
* @prop --card-background-color: background color of the card.
|
|
65
|
+
* @prop --card-background-color--hovered: background color of the card, when hovered.
|
|
65
66
|
*/
|
|
66
67
|
* {
|
|
67
68
|
box-sizing: border-box;
|
|
@@ -82,34 +83,34 @@ section {
|
|
|
82
83
|
border-radius: var(--card-border-radius, 0.95rem);
|
|
83
84
|
border: 1px solid rgb(var(--contrast-500));
|
|
84
85
|
padding: 0.25rem;
|
|
85
|
-
background-color: var(--card-background-color, var(--
|
|
86
|
-
}
|
|
87
|
-
section:focus {
|
|
88
|
-
outline: none;
|
|
89
|
-
}
|
|
90
|
-
section:focus-visible {
|
|
91
|
-
outline: none;
|
|
92
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
86
|
+
background-color: var(--card-background-color, rgb(var(--contrast-300)));
|
|
93
87
|
}
|
|
94
88
|
:host(limel-card[orientation=landscape]) section {
|
|
95
89
|
flex-direction: row;
|
|
96
90
|
}
|
|
97
|
-
:host(limel-card[clickable]
|
|
91
|
+
:host(limel-card[clickable]) section {
|
|
98
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);
|
|
99
93
|
cursor: pointer;
|
|
100
94
|
color: var(--mdc-theme-on-surface);
|
|
101
|
-
background-color: var(--card-background-color, var(--
|
|
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);
|
|
102
103
|
}
|
|
103
|
-
:host(limel-card[clickable]
|
|
104
|
+
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:focus, :host(limel-card[clickable]) section:focus-visible {
|
|
104
105
|
will-change: color, background-color, box-shadow, transform;
|
|
105
106
|
}
|
|
106
|
-
:host(limel-card[clickable]
|
|
107
|
+
:host(limel-card[clickable]) section:hover {
|
|
107
108
|
transform: translate3d(0, 0.01rem, 0);
|
|
108
109
|
color: var(--mdc-theme-on-surface);
|
|
109
|
-
background-color: var(--card-background-color, var(--
|
|
110
|
+
background-color: var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));
|
|
110
111
|
box-shadow: var(--button-shadow-hovered);
|
|
111
112
|
}
|
|
112
|
-
:host(limel-card[clickable]
|
|
113
|
+
:host(limel-card[clickable]) section:active {
|
|
113
114
|
--limel-clickable-transform-timing-function: cubic-bezier(
|
|
114
115
|
0.83,
|
|
115
116
|
-0.15,
|
|
@@ -119,7 +120,7 @@ section:focus-visible {
|
|
|
119
120
|
transform: translate3d(0, 0.05rem, 0);
|
|
120
121
|
box-shadow: var(--button-shadow-pressed);
|
|
121
122
|
}
|
|
122
|
-
:host(limel-card[clickable]
|
|
123
|
+
:host(limel-card[clickable]) section:hover, :host(limel-card[clickable]) section:active {
|
|
123
124
|
--limel-clickable-transition-speed: 0.2s;
|
|
124
125
|
--limel-clickable-transform-speed: 0.16s;
|
|
125
126
|
}
|
|
@@ -146,7 +147,7 @@ img {
|
|
|
146
147
|
max-width: 40%;
|
|
147
148
|
height: 100%;
|
|
148
149
|
}
|
|
149
|
-
:
|
|
150
|
+
section:hover img, section:focus-visible img {
|
|
150
151
|
transition-duration: 0.2s;
|
|
151
152
|
filter: saturate(1.3);
|
|
152
153
|
}
|
|
@@ -197,6 +198,7 @@ header h2 {
|
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
limel-action-bar {
|
|
201
|
+
--action-bar-background-color: transparent;
|
|
200
202
|
padding: 0.5rem;
|
|
201
203
|
margin-left: auto;
|
|
202
204
|
}
|
|
@@ -456,3 +456,98 @@ $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
|
+
}
|
|
482
|
+
|
|
483
|
+
background-image: radial-gradient(
|
|
484
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
485
|
+
rgb(var(--color-white), 0.3),
|
|
486
|
+
rgb(var(--color-white), 0)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
mix-blend-mode: plus-lighter;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
494
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
495
|
+
// is implemented in a component.
|
|
496
|
+
@mixin parent-of-the-3d-element {
|
|
497
|
+
isolation: isolate;
|
|
498
|
+
transform-style: preserve-3d;
|
|
499
|
+
perspective: 1000px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
@mixin the-3d-element {
|
|
503
|
+
position: relative;
|
|
504
|
+
|
|
505
|
+
transition-duration: 0.8s;
|
|
506
|
+
transition-property: transform, box-shadow, background-color;
|
|
507
|
+
transition-timing-function: ease-out;
|
|
508
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
509
|
+
|
|
510
|
+
&:hover,
|
|
511
|
+
&:focus,
|
|
512
|
+
&:focus-visible,
|
|
513
|
+
&:focus-within {
|
|
514
|
+
will-change: background-color, box-shadow, transform;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
&:hover,
|
|
518
|
+
&:focus,
|
|
519
|
+
&:focus-visible,
|
|
520
|
+
&:active {
|
|
521
|
+
transition-duration: 0.2s;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
&:hover,
|
|
525
|
+
&:focus-visible {
|
|
526
|
+
box-shadow: var(--button-shadow-hovered);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&:hover {
|
|
530
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
531
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
532
|
+
}
|
|
533
|
+
&:focus-visible {
|
|
534
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@mixin the-3d-element--clickable {
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
box-shadow: var(--button-shadow-normal);
|
|
541
|
+
|
|
542
|
+
&:active {
|
|
543
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
544
|
+
box-shadow: var(--button-shadow-pressed);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&:focus-visible {
|
|
548
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-8-focused);
|
|
549
|
+
}
|
|
550
|
+
&:focus-visible:active {
|
|
551
|
+
box-shadow: var(--button-shadow-pressed), var(--shadow-depth-8-focused);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for creating a 3D tilt hover effect.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions that enables consumer components to display a nice 3D effect,
|
|
5
|
+
* when being hovered; enabling them to follow the cursor's position and tilt towards it.
|
|
6
|
+
*
|
|
7
|
+
* ## What you need, to make this work
|
|
8
|
+
* ### Typescript
|
|
9
|
+
* 1. Import the functions:
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import {
|
|
13
|
+
* tiltFollowingTheCursor,
|
|
14
|
+
* handleMouseEnter,
|
|
15
|
+
* handleMouseLeave,
|
|
16
|
+
* } from './path/to/3d-tilt-hover-effect';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* 2. In your component, define the necessary properties:
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* @Element() private element: HTMLElement;
|
|
23
|
+
* private the3dElementBounds: DOMRect;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* 3. If your component does not already have event handlers,
|
|
27
|
+
* implement them using the imported functions from this file:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* private handleMouseEnter = () => {
|
|
31
|
+
* handleMouseEnter(this.element, 'section', (bounds) => {
|
|
32
|
+
* this.the3dElementBounds = bounds;
|
|
33
|
+
* }, this.tiltFollowingTheCursor);
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* private handleMouseLeave = () => {
|
|
37
|
+
* handleMouseLeave(this.element, this.tiltFollowingTheCursor);
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* private tiltFollowingTheCursor = (e: MouseEvent) => {
|
|
41
|
+
* tiltFollowingTheCursor(e, this.the3dElementBounds, this.element);
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 4. Attach the event handlers to the relevant elements in your render method:
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* public render() {
|
|
49
|
+
* return (
|
|
50
|
+
* <section
|
|
51
|
+
* onMouseEnter={this.handleMouseEnter}
|
|
52
|
+
* onMouseLeave={this.handleMouseLeave}
|
|
53
|
+
* >
|
|
54
|
+
* Your content here
|
|
55
|
+
* </section>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* :::note
|
|
61
|
+
* - Ensure that the `element` and `the3dElementBounds` properties are properly
|
|
62
|
+
* defined in your component.
|
|
63
|
+
* - The `selector` parameter in `handleMouseEnter` should match the selector
|
|
64
|
+
* of the element you want to apply the 3D effect to.
|
|
65
|
+
* - The `tiltFollowingTheCursor` function calculates the 3D rotation and glow
|
|
66
|
+
* position based on the cursor's position relative to the element's bounds.
|
|
67
|
+
* :::
|
|
68
|
+
*
|
|
69
|
+
* ### HTML elements + CSS
|
|
70
|
+
* 1. Add a `<div class="limel-3d-hover-effect-glow" />` element to your component's template,
|
|
71
|
+
* inside the element you want to apply the 3D effect to, and preferably at the bottom of all
|
|
72
|
+
* other elements within that element (to avoid the need to specifying `z-index`es).
|
|
73
|
+
* 2. Add the following `mixin` to your component's SCSS file:
|
|
74
|
+
* `limel-3d-hover-effect-glow($the3dElement, $border-radius);`
|
|
75
|
+
*
|
|
76
|
+
* and don't forget to define the `$the3dElement` variables for the mixin to work
|
|
77
|
+
* (and optionally the `$border-radius`).
|
|
78
|
+
* 3. Keep in mind that the `<div class="limel-3d-hover-effect-glow" />` will be
|
|
79
|
+
* absolutely positioned inside the parent element, so make sure the parent element
|
|
80
|
+
* has `position` set.
|
|
81
|
+
* 4. Add the following `mixin` to the host element: `parent-of-the-3d-element`.
|
|
82
|
+
* 5. Add the following `mixin` to the 3D element: `the-3d-element`.
|
|
83
|
+
* 6. And if your element is supposed to be clickable, add this `mixin` as well: `the-3d-element--clickable`.
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
export const MOUSE_SCALE_FACTOR = 100;
|
|
87
|
+
export const ROTATION_DEGREE_MULTIPLIER = 1.6;
|
|
88
|
+
export const GLOW_POSITION_MULTIPLIER = 2;
|
|
89
|
+
export const CENTER_DIVISOR = 2;
|
|
90
|
+
export function tiltFollowingTheCursor(e, the3dElementBounds, element) {
|
|
91
|
+
const mouseX = e.clientX;
|
|
92
|
+
const mouseY = e.clientY;
|
|
93
|
+
const leftX = mouseX - the3dElementBounds.x;
|
|
94
|
+
const topY = mouseY - the3dElementBounds.y;
|
|
95
|
+
const center = {
|
|
96
|
+
x: leftX - the3dElementBounds.width / CENTER_DIVISOR,
|
|
97
|
+
y: topY - the3dElementBounds.height / CENTER_DIVISOR,
|
|
98
|
+
};
|
|
99
|
+
const distance = Math.sqrt(center.x ** CENTER_DIVISOR + center.y ** CENTER_DIVISOR);
|
|
100
|
+
const rotate3d = `
|
|
101
|
+
${center.y / MOUSE_SCALE_FACTOR},
|
|
102
|
+
${-center.x / MOUSE_SCALE_FACTOR},
|
|
103
|
+
0,
|
|
104
|
+
${Math.log(distance) * ROTATION_DEGREE_MULTIPLIER}deg
|
|
105
|
+
`;
|
|
106
|
+
element.style.setProperty('--limel-3d-hover-effect-rotate3d', rotate3d);
|
|
107
|
+
const glowPosition = `
|
|
108
|
+
${center.x * GLOW_POSITION_MULTIPLIER + the3dElementBounds.width / CENTER_DIVISOR}px
|
|
109
|
+
`;
|
|
110
|
+
element.style.setProperty('--limel-3d-hover-effect-glow-position', glowPosition);
|
|
111
|
+
}
|
|
112
|
+
export function handleMouseEnter(element, selector, setBounds, tiltCallback) {
|
|
113
|
+
const the3dElement = element.shadowRoot.querySelector(selector);
|
|
114
|
+
const bounds = the3dElement.getBoundingClientRect();
|
|
115
|
+
setBounds(bounds);
|
|
116
|
+
document.addEventListener('mousemove', tiltCallback);
|
|
117
|
+
}
|
|
118
|
+
export function handleMouseLeave(element, selector, tiltCallback) {
|
|
119
|
+
const the3dElement = element.shadowRoot.querySelector(selector);
|
|
120
|
+
document.removeEventListener('mousemove', tiltCallback);
|
|
121
|
+
the3dElement.style.removeProperty('--limel-3d-hover-effect-rotate3d');
|
|
122
|
+
the3dElement.style.removeProperty('--limel-3d-hover-effect-glow-position');
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=3d-tilt-hover-effect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"3d-tilt-hover-effect.js","sourceRoot":"","sources":["../../src/util/3d-tilt-hover-effect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoFG;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AACtC,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,CAAC;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,MAAM,UAAU,sBAAsB,CAClC,CAAa,EACb,kBAA2B,EAC3B,OAAoB;EAEpB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;EACzB,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC;EACzB,MAAM,KAAK,GAAG,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;EAC5C,MAAM,IAAI,GAAG,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;EAC3C,MAAM,MAAM,GAAG;IACX,CAAC,EAAE,KAAK,GAAG,kBAAkB,CAAC,KAAK,GAAG,cAAc;IACpD,CAAC,EAAE,IAAI,GAAG,kBAAkB,CAAC,MAAM,GAAG,cAAc;GACvD,CAAC;EACF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CACtB,MAAM,CAAC,CAAC,IAAI,cAAc,GAAG,MAAM,CAAC,CAAC,IAAI,cAAc,CAC1D,CAAC;EAEF,MAAM,QAAQ,GAAG;UACX,MAAM,CAAC,CAAC,GAAG,kBAAkB;UAC7B,CAAC,MAAM,CAAC,CAAC,GAAG,kBAAkB;;UAE9B,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,0BAA0B;KACpD,CAAC;EACF,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,kCAAkC,EAAE,QAAQ,CAAC,CAAC;EAExE,MAAM,YAAY,GAAG;UACf,MAAM,CAAC,CAAC,GAAG,wBAAwB,GAAG,kBAAkB,CAAC,KAAK,GAAG,cAAc;KACpF,CAAC;EACF,OAAO,CAAC,KAAK,CAAC,WAAW,CACrB,uCAAuC,EACvC,YAAY,CACf,CAAC;AACN,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC5B,OAAoB,EACpB,QAAgB,EAChB,SAAoC,EACpC,YAAqC;EAErC,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CACjD,QAAQ,CACI,CAAC;EACjB,MAAM,MAAM,GAAG,YAAY,CAAC,qBAAqB,EAAE,CAAC;EACpD,SAAS,CAAC,MAAM,CAAC,CAAC;EAClB,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC5B,OAAoB,EACpB,QAAgB,EAChB,YAAqC;EAErC,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CACjD,QAAQ,CACI,CAAC;EACjB,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;EACxD,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,kCAAkC,CAAC,CAAC;EACtE,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,uCAAuC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * Utility functions for creating a 3D tilt hover effect.\n *\n * This module provides functions that enables consumer components to display a nice 3D effect,\n * when being hovered; enabling them to follow the cursor's position and tilt towards it.\n *\n * ## What you need, to make this work\n * ### Typescript\n * 1. Import the functions:\n *\n * ```tsx\n * import {\n * tiltFollowingTheCursor,\n * handleMouseEnter,\n * handleMouseLeave,\n * } from './path/to/3d-tilt-hover-effect';\n * ```\n *\n * 2. In your component, define the necessary properties:\n *\n * ```tsx\n * @Element() private element: HTMLElement;\n * private the3dElementBounds: DOMRect;\n * ```\n *\n * 3. If your component does not already have event handlers,\n * implement them using the imported functions from this file:\n *\n * ```tsx\n * private handleMouseEnter = () => {\n * handleMouseEnter(this.element, 'section', (bounds) => {\n * this.the3dElementBounds = bounds;\n * }, this.tiltFollowingTheCursor);\n * };\n *\n * private handleMouseLeave = () => {\n * handleMouseLeave(this.element, this.tiltFollowingTheCursor);\n * };\n *\n * private tiltFollowingTheCursor = (e: MouseEvent) => {\n * tiltFollowingTheCursor(e, this.the3dElementBounds, this.element);\n * };\n * ```\n *\n * 4. Attach the event handlers to the relevant elements in your render method:\n *\n * ```tsx\n * public render() {\n * return (\n * <section\n * onMouseEnter={this.handleMouseEnter}\n * onMouseLeave={this.handleMouseLeave}\n * >\n * Your content here\n * </section>\n * );\n * }\n * ```\n *\n * :::note\n * - Ensure that the `element` and `the3dElementBounds` properties are properly\n * defined in your component.\n * - The `selector` parameter in `handleMouseEnter` should match the selector\n * of the element you want to apply the 3D effect to.\n * - The `tiltFollowingTheCursor` function calculates the 3D rotation and glow\n * position based on the cursor's position relative to the element's bounds.\n * :::\n *\n * ### HTML elements + CSS\n * 1. Add a `<div class=\"limel-3d-hover-effect-glow\" />` element to your component's template,\n * inside the element you want to apply the 3D effect to, and preferably at the bottom of all\n * other elements within that element (to avoid the need to specifying `z-index`es).\n * 2. Add the following `mixin` to your component's SCSS file:\n * `limel-3d-hover-effect-glow($the3dElement, $border-radius);`\n *\n * and don't forget to define the `$the3dElement` variables for the mixin to work\n * (and optionally the `$border-radius`).\n * 3. Keep in mind that the `<div class=\"limel-3d-hover-effect-glow\" />` will be\n * absolutely positioned inside the parent element, so make sure the parent element\n * has `position` set.\n * 4. Add the following `mixin` to the host element: `parent-of-the-3d-element`.\n * 5. Add the following `mixin` to the 3D element: `the-3d-element`.\n * 6. And if your element is supposed to be clickable, add this `mixin` as well: `the-3d-element--clickable`.\n *\n */\n\nexport const MOUSE_SCALE_FACTOR = 100;\nexport const ROTATION_DEGREE_MULTIPLIER = 1.6;\nexport const GLOW_POSITION_MULTIPLIER = 2;\nexport const CENTER_DIVISOR = 2;\n\nexport function tiltFollowingTheCursor(\n e: MouseEvent,\n the3dElementBounds: DOMRect,\n element: HTMLElement,\n) {\n const mouseX = e.clientX;\n const mouseY = e.clientY;\n const leftX = mouseX - the3dElementBounds.x;\n const topY = mouseY - the3dElementBounds.y;\n const center = {\n x: leftX - the3dElementBounds.width / CENTER_DIVISOR,\n y: topY - the3dElementBounds.height / CENTER_DIVISOR,\n };\n const distance = Math.sqrt(\n center.x ** CENTER_DIVISOR + center.y ** CENTER_DIVISOR,\n );\n\n const rotate3d = `\n ${center.y / MOUSE_SCALE_FACTOR},\n ${-center.x / MOUSE_SCALE_FACTOR},\n 0,\n ${Math.log(distance) * ROTATION_DEGREE_MULTIPLIER}deg\n `;\n element.style.setProperty('--limel-3d-hover-effect-rotate3d', rotate3d);\n\n const glowPosition = `\n ${center.x * GLOW_POSITION_MULTIPLIER + the3dElementBounds.width / CENTER_DIVISOR}px\n `;\n element.style.setProperty(\n '--limel-3d-hover-effect-glow-position',\n glowPosition,\n );\n}\n\nexport function handleMouseEnter(\n element: HTMLElement,\n selector: string,\n setBounds: (bounds: DOMRect) => void,\n tiltCallback: (e: MouseEvent) => void,\n) {\n const the3dElement = element.shadowRoot.querySelector(\n selector,\n ) as HTMLElement;\n const bounds = the3dElement.getBoundingClientRect();\n setBounds(bounds);\n document.addEventListener('mousemove', tiltCallback);\n}\n\nexport function handleMouseLeave(\n element: HTMLElement,\n selector: string,\n tiltCallback: (e: MouseEvent) => void,\n) {\n const the3dElement = element.shadowRoot.querySelector(\n selector,\n ) as HTMLElement;\n document.removeEventListener('mousemove', tiltCallback);\n the3dElement.style.removeProperty('--limel-3d-hover-effect-rotate3d');\n the3dElement.style.removeProperty('--limel-3d-hover-effect-glow-position');\n}\n"]}
|
|
@@ -2,7 +2,7 @@ import { r as registerInstance, c as createEvent, h } from './index-6156b4fd.js'
|
|
|
2
2
|
import { i as isItem } from './isItem-b0459122.js';
|
|
3
3
|
import { g as getIconName } from './get-icon-props-0b65f85e.js';
|
|
4
4
|
|
|
5
|
-
const cardCss = "@charset \"UTF-8\";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, var(--
|
|
5
|
+
const cardCss = "@charset \"UTF-8\";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, rgb(var(--contrast-300)))}:host(limel-card[orientation=landscape]) section{flex-direction:row}:host(limel-card[clickable]) section{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);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, rgb(var(--contrast-200)))}:host(limel-card[clickable]) section:focus{outline:none}:host(limel-card[clickable]) section:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:focus,:host(limel-card[clickable]) section:focus-visible{will-change:color, background-color, box-shadow, transform}:host(limel-card[clickable]) section:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));box-shadow:var(--button-shadow-hovered)}:host(limel-card[clickable]) section:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(limel-card[clickable]:hover) section{border-color:transparent}.body{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}img{transition:filter 0.6s ease;object-fit:cover;border-radius:calc(var(--card-border-radius, 0.95rem) / 1.4)}:host(limel-card[orientation=portrait]) img{width:100%}:host(limel-card[orientation=landscape]) img{max-width:40%;height:100%}section:hover img,section:focus-visible img{transition-duration:0.2s;filter:saturate(1.3)}limel-markdown{padding:0.5rem 0.75rem}header{display:flex;justify-content:center;gap:0.5rem;padding:0.25rem 0.75rem}:host(limel-card[orientation=landscape]) header{padding-top:0.5rem}header:has(limel-icon){padding-left:0.25rem}header .headings{flex-grow:1;display:flex;flex-direction:column;gap:0.125rem}header limel-icon{flex-shrink:0;width:2rem}header h1{font-size:1.125rem;font-weight:500;color:var(--card-heading-color, rgb(var(--contrast-1100)));letter-spacing:-0.03125rem}header h2{font-size:0.875rem;font-weight:400;color:var(--card-subheading-color, rgb(var(--contrast-1000)))}header h1,header h2{word-break:break-word;hyphens:auto;-webkit-hyphens:auto;margin:0}limel-action-bar{--action-bar-background-color:transparent;padding:0.5rem;margin-left:auto}";
|
|
6
6
|
|
|
7
7
|
const Card = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-card.entry.js","mappings":";;;;AAAA,MAAM,OAAO,GAAG,6zGAA6zG;;MC2Bh0G,IAAI;;;;IAgJL,uBAAkB,GAAG,CACzB,KAAiD;MAEjD,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;KACJ,CAAC;;;;;;mBA/GsD,EAAE;qBAO9B,KAAK;uBAOc,UAAU;;EAQlD,MAAM;IACT,QACI,eAAS,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IACrC,IAAI,CAAC,WAAW,EAAE,EACnB,WAAK,KAAK,EAAC,MAAM,IACZ,IAAI,CAAC,YAAY,EAAE,EACnB,IAAI,CAAC,UAAU,EAAE,EACjB,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,eAAe,EAAE,CACrB,CACA,EACZ;GACL;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,OAAO;KACV;IAED,OAAO,WAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAC,MAAM,GAAG,CAAC;GAC3E;EAEO,YAAY;IAChB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACjD,OAAO;KACV;IAED,QACI,kBACK,IAAI,CAAC,UAAU,EAAE,EAClB,WAAK,KAAK,EAAC,UAAU,IAChB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACD,EACX;GACL;EAEO,UAAU;;IACd,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GACP,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,GAAG,SAAS,CAAC;IAEjE,IAAI,CAAC,IAAI,EAAE;MACP,OAAO;KACV;IAED,QACI,kBACI,KAAK,EAAE;QACH,KAAK,EAAE,GAAG,KAAK,EAAE;OACpB,EACD,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,IAAI,GACZ,EACJ;GACL;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACf,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,OAAO,CAAM,CAAC;GAClC;EAEO,gBAAgB;IACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MAClB,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,UAAU,CAAM,CAAC;GACrC;EAEO,UAAU;IACd,OAAO,YAAM,IAAI,EAAC,WAAW,GAAG,CAAC;GACpC;EAEO,WAAW;IACf,OAAO,sBAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;GAChD;EAWO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;MACtB,OAAO;KACV;IAED,QACI,wBACI,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,cAAc,EAAE,IAAI,CAAC,kBAAkB,GACzC,EACJ;GACL;;;;;;","names":[],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n @include mixins.visualize-keyboard-focus;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n );\n\n :host(limel-card[clickable]:not([disabled='true']):not([disabled])) & {\n @include mixins.is-flat-clickable(\n $background-color:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n ),\n $background-color--hovered:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n :host(limel-card:hover) & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"version":3}
|
|
1
|
+
{"file":"limel-card.entry.js","mappings":";;;;AAAA,MAAM,OAAO,GAAG,inGAAinG;;MC2BpnG,IAAI;;;;IAgJL,uBAAkB,GAAG,CACzB,KAAiD;MAEjD,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;KACJ,CAAC;;;;;;mBA/GsD,EAAE;qBAO9B,KAAK;uBAOc,UAAU;;EAQlD,MAAM;IACT,QACI,eAAS,QAAQ,EAAE,IAAI,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,IACrC,IAAI,CAAC,WAAW,EAAE,EACnB,WAAK,KAAK,EAAC,MAAM,IACZ,IAAI,CAAC,YAAY,EAAE,EACnB,IAAI,CAAC,UAAU,EAAE,EACjB,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,eAAe,EAAE,CACrB,CACA,EACZ;GACL;EAEO,WAAW;IACf,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACb,OAAO;KACV;IAED,OAAO,WAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,EAAC,MAAM,GAAG,CAAC;GAC3E;EAEO,YAAY;IAChB,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACjD,OAAO;KACV;IAED,QACI,kBACK,IAAI,CAAC,UAAU,EAAE,EAClB,WAAK,KAAK,EAAC,UAAU,IAChB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,CAAC,gBAAgB,EAAE,CACtB,CACD,EACX;GACL;EAEO,UAAU;;IACd,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,MAAM,KAAK,GACP,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,KAAK,GAAG,SAAS,CAAC;IAEjE,IAAI,CAAC,IAAI,EAAE;MACP,OAAO;KACV;IAED,QACI,kBACI,KAAK,EAAE;QACH,KAAK,EAAE,GAAG,KAAK,EAAE;OACpB,EACD,KAAK,EAAE,IAAI,EACX,IAAI,EAAE,IAAI,GACZ,EACJ;GACL;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;MACf,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,OAAO,CAAM,CAAC;GAClC;EAEO,gBAAgB;IACpB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MAClB,OAAO;KACV;IAED,OAAO,cAAK,IAAI,CAAC,UAAU,CAAM,CAAC;GACrC;EAEO,UAAU;IACd,OAAO,YAAM,IAAI,EAAC,WAAW,GAAG,CAAC;GACpC;EAEO,WAAW;IACf,OAAO,sBAAgB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,CAAC;GAChD;EAWO,eAAe;IACnB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;MACtB,OAAO;KACV;IAED,QACI,wBACI,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,cAAc,EAAE,IAAI,CAAC,kBAAkB,GACzC,EACJ;GACL;;;;;;","names":[],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n* @prop --card-background-color--hovered: background color of the card, when hovered.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(--card-background-color, rgb(var(--contrast-300)));\n\n :host(limel-card[clickable]) & {\n @include mixins.visualize-keyboard-focus;\n @include mixins.is-flat-clickable(\n $background-color:\n var(--card-background-color, rgb(var(--contrast-200))),\n $background-color--hovered:\n var(\n --card-background-color--hovered,\n var(--card-background-color, rgb(var(--contrast-200)))\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n section:hover &,\n section:focus-visible & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n --action-bar-background-color: transparent;\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"version":3}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{p as e,b as l}from"./p-443111b3.js";export{s as setNonce}from"./p-443111b3.js";const i=()=>{const l=import.meta.url;const i={};if(l!==""){i.resourcesUrl=new URL(".",l).href}return e(i)};i().then((e=>l(JSON.parse('[["p-78b1aac6",[[17,"limel-text-editor",{"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"value":[513],"customElements":[16],"triggers":[16],"required":[516],"allowResize":[516,"allow-resize"],"ui":[513]}]]],["p-a451cece",[[1,"limel-file",{"value":[16],"label":[513],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"accept":[513],"language":[1]}]]],["p-7f9e0f52",[[1,"limel-card",{"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"actions":[16],"clickable":[516],"orientation":[513]}]]],["p-dd5affea",[[1,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"required":[4],"invalid":[516],"value":[16],"searcher":[16],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]}]]],["p-211456f2",[[17,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"items":[16]}]]],["p-488decb0",[[1,"limel-file-viewer",{"url":[513],"filename":[513],"alt":[513],"allowFullscreen":[516,"allow-fullscreen"],"allowOpenInNewTab":[516,"allow-open-in-new-tab"],"allowDownload":[516,"allow-download"],"language":[1],"officeViewer":[513,"office-viewer"],"actions":[16],"isFullscreen":[32],"fileType":[32],"loading":[32],"fileUrl":[32]}]]],["p-8f1b76df",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"readonly":[516],"isOpen":[32]}]]],["p-c85589d6",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[513],"format":[513],"language":[513],"formatter":[16],"internalFormat":[32],"showPortal":[32]}]]],["p-6500050d",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["p-dd031410",[[1,"limel-snackbar",{"open":[516],"message":[1],"timeout":[514],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[1],"offset":[32],"isOpen":[32],"closing":[32],"show":[64]},[[0,"changeOffset","onChangeIndex"]]]]],["p-3d6dc7de",[[1,"limel-tab-panel",{"tabs":[1040]}]]],["p-782aa617",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[16],"options":[16],"multiple":[4],"menuOpen":[32]}]]],["p-84e87a39",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]}]]],["p-d696f6b8",[[1,"limel-chart",{"language":[513],"accessibleLabel":[513,"accessible-label"],"accessibleItemsLabel":[513,"accessible-items-label"],"items":[16],"type":[513],"orientation":[513],"maxValue":[514,"max-value"],"axisIncrement":[514,"axis-increment"],"loading":[516]}]]],["p-00e3e9be",[[1,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"actions":[16]}]]],["p-fda881a3",[[1,"limel-help",{"value":[1],"trigger":[1],"readMoreLink":[16],"openDirection":[513,"open-direction"],"isOpen":[32]}]]],["p-634a3b1a",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[1],"layout":[1],"pageSize":[2,"page-size"],"totalRows":[2,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[4,"movable-columns"],"loading":[4],"page":[2],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[4],"selection":[16]}]]],["p-32844d2b",[[1,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"badge":[520],"loading":[516],"link":[16],"progress":[16]}]]],["p-27cc1f9e",[[1,"limel-switch",{"label":[513],"disabled":[516],"readonly":[516],"invalid":[516],"value":[516],"helperText":[513,"helper-text"],"readonlyLabels":[16],"fieldId":[32]}]]],["p-4b7ea1b9",[[1,"limel-dialog",{"heading":[1],"fullscreen":[516],"open":[1540],"closingActions":[16]}]]],["p-eb58b4b7",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["p-f3a613a3",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[16]}]]],["p-1bcdc70b",[[1,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["p-1e99b371",[[1,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[1]}]]],["p-6b0ef5ee",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32]}]]],["p-28c76ae8",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[4],"lineNumbers":[4,"line-numbers"],"fold":[4],"lint":[4],"colorScheme":[1,"color-scheme"],"random":[32]}]]],["p-16e4ca3e",[[1,"limel-config",{"config":[16]}]]],["p-ea98795d",[[1,"limel-flex-container",{"direction":[513],"justify":[513],"align":[513],"reverse":[516]}]]],["p-4d483ad2",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16]}]]],["p-b5f723e2",[[1,"limel-grid"]]],["p-a82a82b7",[[1,"limel-prosemirror-adapter",{"contentType":[1,"content-type"],"value":[1],"language":[513],"customElements":[16],"triggerCharacters":[16],"view":[32],"actionBarItems":[32],"link":[32],"isLinkMenuOpen":[32]}]]],["p-9c5f2c45",[[17,"limel-color-picker-palette",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"required":[516]}]]],["p-09434f79",[[0,"limel-dock-button",{"item":[16],"expanded":[516],"useMobileLayout":[516,"use-mobile-layout"],"isOpen":[32]}]]],["p-609b34fd",[[17,"limel-icon-button",{"icon":[513],"elevated":[516],"label":[513],"disabled":[516]}]]],["p-30ca30ec",[[1,"limel-tab-bar",{"tabs":[1040],"canScrollLeft":[32],"canScrollRight":[32]},[[9,"resize","handleWindowResize"]]]]],["p-0ec43bbc",[[1,"limel-checkbox",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"helperText":[513,"helper-text"],"checked":[516],"indeterminate":[516],"required":[516],"readonlyLabels":[16],"modified":[32]}]]],["p-0fef416f",[[1,"limel-header",{"icon":[1],"heading":[1],"subheading":[1],"supportingText":[1,"supporting-text"],"subheadingDivider":[1,"subheading-divider"]}]]],["p-d6660d2a",[[1,"limel-help-content",{"value":[1],"readMoreLink":[16]}]]],["p-97571329",[[0,"limel-progress-flow-item",{"item":[16],"disabled":[4],"readonly":[4],"currentStep":[4,"current-step"]}]]],["p-f340d860",[[1,"limel-circular-progress",{"value":[2],"maxValue":[2,"max-value"],"prefix":[513],"suffix":[1],"displayPercentageColors":[4,"display-percentage-colors"],"size":[513]}]]],["p-3fcb2b67",[[1,"limel-flatpickr-adapter",{"value":[16],"type":[1],"format":[1],"isOpen":[4,"is-open"],"inputElement":[16],"language":[1],"formatter":[16]}]]],["p-347c1107",[[1,"limel-file-dropzone",{"accept":[513],"disabled":[4],"text":[1],"helperText":[1,"helper-text"],"hasFileToDrop":[32]}],[1,"limel-file-input",{"accept":[513],"disabled":[516],"multiple":[516]}]]],["p-da20ff72",[[1,"limel-markdown",{"value":[1],"whitelist":[16]}]]],["p-5d08ef7d",[[1,"limel-portal",{"openDirection":[513,"open-direction"],"position":[513],"containerId":[513,"container-id"],"containerStyle":[16],"inheritParentWidth":[516,"inherit-parent-width"],"visible":[516],"anchor":[16]}]]],["p-d93f1964",[[1,"limel-icon",{"size":[513],"name":[513],"badge":[516]}]]],["p-9f8aa8e7",[[1,"limel-dynamic-label",{"value":[8],"defaultLabel":[16],"labels":[16]}],[1,"limel-helper-line",{"helperText":[513,"helper-text"],"length":[514],"maxLength":[514,"max-length"],"invalid":[516],"helperTextId":[513,"helper-text-id"]}]]],["p-0b3a043a",[[1,"limel-badge",{"label":[520]}],[1,"limel-tooltip",{"elementId":[513,"element-id"],"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514],"openDirection":[513,"open-direction"],"open":[32]}],[1,"limel-tooltip-content",{"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514]}]]],["p-97ae94e0",[[1,"limel-menu",{"items":[16],"disabled":[516],"openDirection":[513,"open-direction"],"surfaceWidth":[513,"surface-width"],"open":[1540],"badgeIcons":[516,"badge-icons"],"gridLayout":[516,"grid-layout"],"loading":[516],"currentSubMenu":[1040],"rootItem":[16],"searcher":[16],"emptyResultMessage":[1,"empty-result-message"],"loadingSubItems":[32],"searchValue":[32],"searchResults":[32]}],[1,"limel-breadcrumbs",{"items":[16],"divider":[1]}],[17,"limel-menu-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}],[1,"limel-input-field",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"prefix":[513],"suffix":[513],"required":[516],"value":[513],"trailingIcon":[513,"trailing-icon"],"leadingIcon":[513,"leading-icon"],"pattern":[513],"type":[513],"formatNumber":[516,"format-number"],"step":[520],"max":[514],"min":[514],"maxlength":[514],"minlength":[514],"completions":[16],"showLink":[516,"show-link"],"locale":[513],"isFocused":[32],"wasInvalid":[32],"showCompletions":[32]}],[1,"limel-spinner",{"size":[513],"limeBranded":[4,"lime-branded"]}],[17,"limel-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}],[1,"limel-menu-surface",{"open":[4],"allowClicksElement":[16]}]]],["p-2cbfe8f9",[[1,"limel-chip-set",{"value":[16],"type":[513],"label":[513],"helperText":[513,"helper-text"],"disabled":[516],"readonly":[516],"invalid":[516],"inputType":[513,"input-type"],"maxItems":[514,"max-items"],"required":[516],"searchLabel":[513,"search-label"],"emptyInputOnBlur":[516,"empty-input-on-blur"],"clearAllButton":[4,"clear-all-button"],"leadingIcon":[513,"leading-icon"],"delimiter":[513],"autocomplete":[513],"language":[1],"editMode":[32],"textValue":[32],"blurred":[32],"inputChipIndexSelected":[32],"selectedChipIds":[32],"getEditMode":[64],"setFocus":[64],"emptyInput":[64]}],[17,"limel-chip",{"language":[513],"text":[513],"icon":[1],"image":[16],"link":[16],"badge":[520],"disabled":[516],"readonly":[516],"selected":[516],"invalid":[516],"removable":[516],"type":[513],"loading":[516],"progress":[514],"identifier":[520],"menuItems":[16]}]]],["p-493e2b10",[[17,"limel-button",{"label":[513],"primary":[516],"outlined":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"justLoaded":[32]}]]],["p-0ee1d461",[[1,"limel-linear-progress",{"language":[513],"value":[514],"indeterminate":[516],"accessibleLabel":[513,"accessible-label"]}]]],["p-a8e24972",[[0,"limel-action-bar-overflow-menu",{"items":[16],"openDirection":[513,"open-direction"]}],[0,"limel-action-bar-item",{"item":[16],"isVisible":[516,"is-visible"],"selected":[516]}]]],["p-18b068c9",[[1,"limel-text-editor-link-menu",{"link":[16],"language":[513],"isOpen":[516,"is-open"]}],[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"layout":[513],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}]]],["p-c9598cfe",[[1,"limel-popover",{"open":[4],"openDirection":[513,"open-direction"]}],[1,"limel-popover-surface",{"contentCollection":[16]}]]]]'),e)));
|
|
1
|
+
import{p as e,b as l}from"./p-443111b3.js";export{s as setNonce}from"./p-443111b3.js";const i=()=>{const l=import.meta.url;const i={};if(l!==""){i.resourcesUrl=new URL(".",l).href}return e(i)};i().then((e=>l(JSON.parse('[["p-78b1aac6",[[17,"limel-text-editor",{"contentType":[1,"content-type"],"language":[513],"disabled":[516],"readonly":[516],"helperText":[513,"helper-text"],"placeholder":[513],"label":[513],"invalid":[516],"value":[513],"customElements":[16],"triggers":[16],"required":[516],"allowResize":[516,"allow-resize"],"ui":[513]}]]],["p-a451cece",[[1,"limel-file",{"value":[16],"label":[513],"required":[516],"disabled":[516],"readonly":[516],"invalid":[516],"accept":[513],"language":[1]}]]],["p-ca929a0e",[[1,"limel-card",{"heading":[513],"subheading":[513],"image":[16],"icon":[513],"value":[1],"actions":[16],"clickable":[516],"orientation":[513]}]]],["p-dd5affea",[[1,"limel-picker",{"disabled":[4],"readonly":[516],"label":[1],"searchLabel":[1,"search-label"],"helperText":[513,"helper-text"],"leadingIcon":[1,"leading-icon"],"emptyResultMessage":[1,"empty-result-message"],"required":[4],"invalid":[516],"value":[16],"searcher":[16],"multiple":[4],"delimiter":[513],"actions":[16],"actionPosition":[1,"action-position"],"actionScrollBehavior":[1,"action-scroll-behavior"],"badgeIcons":[516,"badge-icons"],"items":[32],"textValue":[32],"loading":[32],"chips":[32]}]]],["p-211456f2",[[17,"limel-split-button",{"label":[513],"primary":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"items":[16]}]]],["p-488decb0",[[1,"limel-file-viewer",{"url":[513],"filename":[513],"alt":[513],"allowFullscreen":[516,"allow-fullscreen"],"allowOpenInNewTab":[516,"allow-open-in-new-tab"],"allowDownload":[516,"allow-download"],"language":[1],"officeViewer":[513,"office-viewer"],"actions":[16],"isFullscreen":[32],"fileType":[32],"loading":[32],"fileUrl":[32]}]]],["p-8f1b76df",[[1,"limel-color-picker",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"tooltipLabel":[513,"tooltip-label"],"required":[516],"readonly":[516],"isOpen":[32]}]]],["p-c85589d6",[[1,"limel-date-picker",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"required":[516],"value":[16],"type":[513],"format":[513],"language":[513],"formatter":[16],"internalFormat":[32],"showPortal":[32]}]]],["p-6500050d",[[1,"limel-dock",{"dockItems":[16],"dockFooterItems":[16],"accessibleLabel":[513,"accessible-label"],"expanded":[516],"allowResize":[516,"allow-resize"],"mobileBreakPoint":[514,"mobile-break-point"],"useMobileLayout":[32]}]]],["p-dd031410",[[1,"limel-snackbar",{"open":[516],"message":[1],"timeout":[514],"actionText":[1,"action-text"],"dismissible":[4],"multiline":[4],"language":[1],"offset":[32],"isOpen":[32],"closing":[32],"show":[64]},[[0,"changeOffset","onChangeIndex"]]]]],["p-3d6dc7de",[[1,"limel-tab-panel",{"tabs":[1040]}]]],["p-782aa617",[[1,"limel-select",{"disabled":[516],"readonly":[516],"invalid":[516],"required":[516],"label":[513],"helperText":[513,"helper-text"],"value":[16],"options":[16],"multiple":[4],"menuOpen":[32]}]]],["p-84e87a39",[[1,"limel-button-group",{"value":[16],"disabled":[516],"selectedButtonId":[32]}]]],["p-d696f6b8",[[1,"limel-chart",{"language":[513],"accessibleLabel":[513,"accessible-label"],"accessibleItemsLabel":[513,"accessible-items-label"],"items":[16],"type":[513],"orientation":[513],"maxValue":[514,"max-value"],"axisIncrement":[514,"axis-increment"],"loading":[516]}]]],["p-00e3e9be",[[1,"limel-collapsible-section",{"isOpen":[1540,"is-open"],"header":[513],"actions":[16]}]]],["p-fda881a3",[[1,"limel-help",{"value":[1],"trigger":[1],"readMoreLink":[16],"openDirection":[513,"open-direction"],"isOpen":[32]}]]],["p-634a3b1a",[[1,"limel-table",{"data":[16],"columns":[16],"mode":[1],"layout":[1],"pageSize":[2,"page-size"],"totalRows":[2,"total-rows"],"sorting":[16],"activeRow":[1040],"movableColumns":[4,"movable-columns"],"loading":[4],"page":[2],"emptyMessage":[1,"empty-message"],"aggregates":[16],"selectable":[4],"selection":[16]}]]],["p-32844d2b",[[1,"limel-info-tile",{"value":[520],"icon":[1],"label":[513],"prefix":[513],"suffix":[513],"disabled":[516],"badge":[520],"loading":[516],"link":[16],"progress":[16]}]]],["p-27cc1f9e",[[1,"limel-switch",{"label":[513],"disabled":[516],"readonly":[516],"invalid":[516],"value":[516],"helperText":[513,"helper-text"],"readonlyLabels":[16],"fieldId":[32]}]]],["p-4b7ea1b9",[[1,"limel-dialog",{"heading":[1],"fullscreen":[516],"open":[1540],"closingActions":[16]}]]],["p-eb58b4b7",[[1,"limel-progress-flow",{"flowItems":[16],"disabled":[4],"readonly":[4]}]]],["p-f3a613a3",[[1,"limel-shortcut",{"icon":[513],"label":[513],"disabled":[516],"badge":[520],"link":[16]}]]],["p-1bcdc70b",[[1,"limel-banner",{"message":[513],"icon":[513],"isOpen":[32],"open":[64],"close":[64]}]]],["p-1e99b371",[[1,"limel-callout",{"heading":[513],"icon":[513],"type":[513],"language":[1]}]]],["p-6b0ef5ee",[[1,"limel-slider",{"disabled":[516],"readonly":[516],"factor":[514],"label":[513],"helperText":[513,"helper-text"],"unit":[513],"value":[514],"valuemax":[514],"valuemin":[514],"step":[514],"percentageClass":[32]}]]],["p-28c76ae8",[[1,"limel-code-editor",{"value":[1],"language":[1],"readonly":[4],"lineNumbers":[4,"line-numbers"],"fold":[4],"lint":[4],"colorScheme":[1,"color-scheme"],"random":[32]}]]],["p-16e4ca3e",[[1,"limel-config",{"config":[16]}]]],["p-ea98795d",[[1,"limel-flex-container",{"direction":[513],"justify":[513],"align":[513],"reverse":[516]}]]],["p-4d483ad2",[[1,"limel-form",{"schema":[16],"value":[16],"disabled":[4],"propsFactory":[16],"transformErrors":[16],"errors":[16]}]]],["p-b5f723e2",[[1,"limel-grid"]]],["p-a82a82b7",[[1,"limel-prosemirror-adapter",{"contentType":[1,"content-type"],"value":[1],"language":[513],"customElements":[16],"triggerCharacters":[16],"view":[32],"actionBarItems":[32],"link":[32],"isLinkMenuOpen":[32]}]]],["p-9c5f2c45",[[17,"limel-color-picker-palette",{"value":[513],"label":[513],"helperText":[513,"helper-text"],"required":[516]}]]],["p-09434f79",[[0,"limel-dock-button",{"item":[16],"expanded":[516],"useMobileLayout":[516,"use-mobile-layout"],"isOpen":[32]}]]],["p-609b34fd",[[17,"limel-icon-button",{"icon":[513],"elevated":[516],"label":[513],"disabled":[516]}]]],["p-30ca30ec",[[1,"limel-tab-bar",{"tabs":[1040],"canScrollLeft":[32],"canScrollRight":[32]},[[9,"resize","handleWindowResize"]]]]],["p-0ec43bbc",[[1,"limel-checkbox",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"helperText":[513,"helper-text"],"checked":[516],"indeterminate":[516],"required":[516],"readonlyLabels":[16],"modified":[32]}]]],["p-0fef416f",[[1,"limel-header",{"icon":[1],"heading":[1],"subheading":[1],"supportingText":[1,"supporting-text"],"subheadingDivider":[1,"subheading-divider"]}]]],["p-d6660d2a",[[1,"limel-help-content",{"value":[1],"readMoreLink":[16]}]]],["p-97571329",[[0,"limel-progress-flow-item",{"item":[16],"disabled":[4],"readonly":[4],"currentStep":[4,"current-step"]}]]],["p-f340d860",[[1,"limel-circular-progress",{"value":[2],"maxValue":[2,"max-value"],"prefix":[513],"suffix":[1],"displayPercentageColors":[4,"display-percentage-colors"],"size":[513]}]]],["p-3fcb2b67",[[1,"limel-flatpickr-adapter",{"value":[16],"type":[1],"format":[1],"isOpen":[4,"is-open"],"inputElement":[16],"language":[1],"formatter":[16]}]]],["p-347c1107",[[1,"limel-file-dropzone",{"accept":[513],"disabled":[4],"text":[1],"helperText":[1,"helper-text"],"hasFileToDrop":[32]}],[1,"limel-file-input",{"accept":[513],"disabled":[516],"multiple":[516]}]]],["p-da20ff72",[[1,"limel-markdown",{"value":[1],"whitelist":[16]}]]],["p-5d08ef7d",[[1,"limel-portal",{"openDirection":[513,"open-direction"],"position":[513],"containerId":[513,"container-id"],"containerStyle":[16],"inheritParentWidth":[516,"inherit-parent-width"],"visible":[516],"anchor":[16]}]]],["p-d93f1964",[[1,"limel-icon",{"size":[513],"name":[513],"badge":[516]}]]],["p-9f8aa8e7",[[1,"limel-dynamic-label",{"value":[8],"defaultLabel":[16],"labels":[16]}],[1,"limel-helper-line",{"helperText":[513,"helper-text"],"length":[514],"maxLength":[514,"max-length"],"invalid":[516],"helperTextId":[513,"helper-text-id"]}]]],["p-0b3a043a",[[1,"limel-badge",{"label":[520]}],[1,"limel-tooltip",{"elementId":[513,"element-id"],"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514],"openDirection":[513,"open-direction"],"open":[32]}],[1,"limel-tooltip-content",{"label":[513],"helperLabel":[513,"helper-label"],"maxlength":[514]}]]],["p-97ae94e0",[[1,"limel-menu",{"items":[16],"disabled":[516],"openDirection":[513,"open-direction"],"surfaceWidth":[513,"surface-width"],"open":[1540],"badgeIcons":[516,"badge-icons"],"gridLayout":[516,"grid-layout"],"loading":[516],"currentSubMenu":[1040],"rootItem":[16],"searcher":[16],"emptyResultMessage":[1,"empty-result-message"],"loadingSubItems":[32],"searchValue":[32],"searchResults":[32]}],[1,"limel-breadcrumbs",{"items":[16],"divider":[1]}],[17,"limel-menu-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}],[1,"limel-input-field",{"disabled":[516],"readonly":[516],"invalid":[516],"label":[513],"placeholder":[513],"helperText":[513,"helper-text"],"prefix":[513],"suffix":[513],"required":[516],"value":[513],"trailingIcon":[513,"trailing-icon"],"leadingIcon":[513,"leading-icon"],"pattern":[513],"type":[513],"formatNumber":[516,"format-number"],"step":[520],"max":[514],"min":[514],"maxlength":[514],"minlength":[514],"completions":[16],"showLink":[516,"show-link"],"locale":[513],"isFocused":[32],"wasInvalid":[32],"showCompletions":[32]}],[1,"limel-spinner",{"size":[513],"limeBranded":[4,"lime-branded"]}],[17,"limel-list",{"items":[16],"badgeIcons":[4,"badge-icons"],"iconSize":[1,"icon-size"],"type":[1],"maxLinesSecondaryText":[2,"max-lines-secondary-text"]}],[1,"limel-menu-surface",{"open":[4],"allowClicksElement":[16]}]]],["p-2cbfe8f9",[[1,"limel-chip-set",{"value":[16],"type":[513],"label":[513],"helperText":[513,"helper-text"],"disabled":[516],"readonly":[516],"invalid":[516],"inputType":[513,"input-type"],"maxItems":[514,"max-items"],"required":[516],"searchLabel":[513,"search-label"],"emptyInputOnBlur":[516,"empty-input-on-blur"],"clearAllButton":[4,"clear-all-button"],"leadingIcon":[513,"leading-icon"],"delimiter":[513],"autocomplete":[513],"language":[1],"editMode":[32],"textValue":[32],"blurred":[32],"inputChipIndexSelected":[32],"selectedChipIds":[32],"getEditMode":[64],"setFocus":[64],"emptyInput":[64]}],[17,"limel-chip",{"language":[513],"text":[513],"icon":[1],"image":[16],"link":[16],"badge":[520],"disabled":[516],"readonly":[516],"selected":[516],"invalid":[516],"removable":[516],"type":[513],"loading":[516],"progress":[514],"identifier":[520],"menuItems":[16]}]]],["p-493e2b10",[[17,"limel-button",{"label":[513],"primary":[516],"outlined":[516],"icon":[513],"disabled":[516],"loading":[516],"loadingFailed":[516,"loading-failed"],"justLoaded":[32]}]]],["p-0ee1d461",[[1,"limel-linear-progress",{"language":[513],"value":[514],"indeterminate":[516],"accessibleLabel":[513,"accessible-label"]}]]],["p-a8e24972",[[0,"limel-action-bar-overflow-menu",{"items":[16],"openDirection":[513,"open-direction"]}],[0,"limel-action-bar-item",{"item":[16],"isVisible":[516,"is-visible"],"selected":[516]}]]],["p-18b068c9",[[1,"limel-text-editor-link-menu",{"link":[16],"language":[513],"isOpen":[516,"is-open"]}],[1,"limel-action-bar",{"actions":[16],"accessibleLabel":[513,"accessible-label"],"layout":[513],"openDirection":[513,"open-direction"],"overflowCutoff":[32]}]]],["p-c9598cfe",[[1,"limel-popover",{"open":[4],"openDirection":[513,"open-direction"]}],[1,"limel-popover-surface",{"contentCollection":[16]}]]]]'),e)));
|
|
2
2
|
//# sourceMappingURL=lime-elements.esm.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e,c as r,h as i}from"./p-443111b3.js";import{i as o}from"./p-91741e79.js";import{g as a}from"./p-2f777fdb.js";const t='@charset "UTF-8";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, rgb(var(--contrast-300)))}:host(limel-card[orientation=landscape]) section{flex-direction:row}:host(limel-card[clickable]) section{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);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, rgb(var(--contrast-200)))}:host(limel-card[clickable]) section:focus{outline:none}:host(limel-card[clickable]) section:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:focus,:host(limel-card[clickable]) section:focus-visible{will-change:color, background-color, box-shadow, transform}:host(limel-card[clickable]) section:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--card-background-color--hovered, var(--card-background-color, rgb(var(--contrast-200))));box-shadow:var(--button-shadow-hovered)}:host(limel-card[clickable]) section:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(limel-card[clickable]) section:hover,:host(limel-card[clickable]) section:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(limel-card[clickable]:hover) section{border-color:transparent}.body{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}img{transition:filter 0.6s ease;object-fit:cover;border-radius:calc(var(--card-border-radius, 0.95rem) / 1.4)}:host(limel-card[orientation=portrait]) img{width:100%}:host(limel-card[orientation=landscape]) img{max-width:40%;height:100%}section:hover img,section:focus-visible img{transition-duration:0.2s;filter:saturate(1.3)}limel-markdown{padding:0.5rem 0.75rem}header{display:flex;justify-content:center;gap:0.5rem;padding:0.25rem 0.75rem}:host(limel-card[orientation=landscape]) header{padding-top:0.5rem}header:has(limel-icon){padding-left:0.25rem}header .headings{flex-grow:1;display:flex;flex-direction:column;gap:0.125rem}header limel-icon{flex-shrink:0;width:2rem}header h1{font-size:1.125rem;font-weight:500;color:var(--card-heading-color, rgb(var(--contrast-1100)));letter-spacing:-0.03125rem}header h2{font-size:0.875rem;font-weight:400;color:var(--card-subheading-color, rgb(var(--contrast-1000)))}header h1,header h2{word-break:break-word;hyphens:auto;-webkit-hyphens:auto;margin:0}limel-action-bar{--action-bar-background-color:transparent;padding:0.5rem;margin-left:auto}';const n=class{constructor(i){e(this,i);this.actionSelected=r(this,"actionSelected",7);this.handleActionSelect=e=>{e.stopPropagation();if(o(e.detail)){this.actionSelected.emit(e.detail)}};this.heading=undefined;this.subheading=undefined;this.image=undefined;this.icon=undefined;this.value=undefined;this.actions=[];this.clickable=false;this.orientation="portrait"}render(){return i("section",{tabindex:this.clickable?0:""},this.renderImage(),i("div",{class:"body"},this.renderHeader(),this.renderSlot(),this.renderValue(),this.renderActionBar()))}renderImage(){if(!this.image){return}return i("img",{src:this.image.src,alt:this.image.alt,loading:"lazy"})}renderHeader(){if(!this.heading&&!this.subheading&&!this.icon){return}return i("header",null,this.renderIcon(),i("div",{class:"headings"},this.renderHeading(),this.renderSubheading()))}renderIcon(){var e;const r=a(this.icon);const o=typeof this.icon!=="string"?(e=this.icon)===null||e===void 0?void 0:e.color:undefined;if(!r){return}return i("limel-icon",{style:{color:`${o}`},badge:true,name:r})}renderHeading(){if(!this.heading){return}return i("h1",null,this.heading)}renderSubheading(){if(!this.subheading){return}return i("h2",null,this.subheading)}renderSlot(){return i("slot",{name:"component"})}renderValue(){return i("limel-markdown",{value:this.value})}renderActionBar(){if(!this.actions.length){return}return i("limel-action-bar",{actions:this.actions,onItemSelected:this.handleActionSelect})}};n.style=t;export{n as limel_card};
|
|
2
|
+
//# sourceMappingURL=p-ca929a0e.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cardCss","Card","this","handleActionSelect","event","stopPropagation","isItem","detail","actionSelected","emit","render","h","tabindex","clickable","renderImage","class","renderHeader","renderSlot","renderValue","renderActionBar","image","src","alt","loading","heading","subheading","icon","renderIcon","renderHeading","renderSubheading","getIconName","color","_a","undefined","style","badge","name","value","actions","length","onItemSelected"],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n* @prop --card-background-color--hovered: background color of the card, when hovered.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(--card-background-color, rgb(var(--contrast-300)));\n\n :host(limel-card[clickable]) & {\n @include mixins.visualize-keyboard-focus;\n @include mixins.is-flat-clickable(\n $background-color:\n var(--card-background-color, rgb(var(--contrast-200))),\n $background-color--hovered:\n var(\n --card-background-color--hovered,\n var(--card-background-color, rgb(var(--contrast-200)))\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n section:hover &,\n section:focus-visible & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n --action-bar-background-color: transparent;\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"mappings":"0HAAA,MAAMA,EAAU,gnG,MC2BHC,EAAI,M,wEAgJLC,KAAAC,mBACJC,IAEAA,EAAMC,kBACN,GAAIC,EAAOF,EAAMG,QAAS,CACtBL,KAAKM,eAAeC,KAAKL,EAAMG,O,+HA7GiB,G,eAO5B,M,iBAOmB,U,CAQxCG,SACH,OACIC,EAAA,WAASC,SAAUV,KAAKW,UAAY,EAAI,IACnCX,KAAKY,cACNH,EAAA,OAAKI,MAAM,QACNb,KAAKc,eACLd,KAAKe,aACLf,KAAKgB,cACLhB,KAAKiB,mB,CAMdL,cACJ,IAAKZ,KAAKkB,MAAO,CACb,M,CAGJ,OAAOT,EAAA,OAAKU,IAAKnB,KAAKkB,MAAMC,IAAKC,IAAKpB,KAAKkB,MAAME,IAAKC,QAAQ,Q,CAG1DP,eACJ,IAAKd,KAAKsB,UAAYtB,KAAKuB,aAAevB,KAAKwB,KAAM,CACjD,M,CAGJ,OACIf,EAAA,cACKT,KAAKyB,aACNhB,EAAA,OAAKI,MAAM,YACNb,KAAK0B,gBACL1B,KAAK2B,oB,CAMdF,a,MACJ,MAAMD,EAAOI,EAAY5B,KAAKwB,MAC9B,MAAMK,SACK7B,KAAKwB,OAAS,UAAWM,EAAA9B,KAAKwB,QAAI,MAAAM,SAAA,SAAAA,EAAED,MAAQE,UAEvD,IAAKP,EAAM,CACP,M,CAGJ,OACIf,EAAA,cACIuB,MAAO,CACHH,MAAO,GAAGA,KAEdI,MAAO,KACPC,KAAMV,G,CAKVE,gBACJ,IAAK1B,KAAKsB,QAAS,CACf,M,CAGJ,OAAOb,EAAA,UAAKT,KAAKsB,Q,CAGbK,mBACJ,IAAK3B,KAAKuB,WAAY,CAClB,M,CAGJ,OAAOd,EAAA,UAAKT,KAAKuB,W,CAGbR,aACJ,OAAON,EAAA,QAAMyB,KAAK,a,CAGdlB,cACJ,OAAOP,EAAA,kBAAgB0B,MAAOnC,KAAKmC,O,CAY/BlB,kBACJ,IAAKjB,KAAKoC,QAAQC,OAAQ,CACtB,M,CAGJ,OACI5B,EAAA,oBACI2B,QAASpC,KAAKoC,QACdE,eAAgBtC,KAAKC,oB"}
|
|
@@ -456,3 +456,98 @@ $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
|
+
}
|
|
482
|
+
|
|
483
|
+
background-image: radial-gradient(
|
|
484
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
485
|
+
rgb(var(--color-white), 0.3),
|
|
486
|
+
rgb(var(--color-white), 0)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
mix-blend-mode: plus-lighter;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
494
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
495
|
+
// is implemented in a component.
|
|
496
|
+
@mixin parent-of-the-3d-element {
|
|
497
|
+
isolation: isolate;
|
|
498
|
+
transform-style: preserve-3d;
|
|
499
|
+
perspective: 1000px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
@mixin the-3d-element {
|
|
503
|
+
position: relative;
|
|
504
|
+
|
|
505
|
+
transition-duration: 0.8s;
|
|
506
|
+
transition-property: transform, box-shadow, background-color;
|
|
507
|
+
transition-timing-function: ease-out;
|
|
508
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
509
|
+
|
|
510
|
+
&:hover,
|
|
511
|
+
&:focus,
|
|
512
|
+
&:focus-visible,
|
|
513
|
+
&:focus-within {
|
|
514
|
+
will-change: background-color, box-shadow, transform;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
&:hover,
|
|
518
|
+
&:focus,
|
|
519
|
+
&:focus-visible,
|
|
520
|
+
&:active {
|
|
521
|
+
transition-duration: 0.2s;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
&:hover,
|
|
525
|
+
&:focus-visible {
|
|
526
|
+
box-shadow: var(--button-shadow-hovered);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&:hover {
|
|
530
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
531
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
532
|
+
}
|
|
533
|
+
&:focus-visible {
|
|
534
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@mixin the-3d-element--clickable {
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
box-shadow: var(--button-shadow-normal);
|
|
541
|
+
|
|
542
|
+
&:active {
|
|
543
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
544
|
+
box-shadow: var(--button-shadow-pressed);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&:focus-visible {
|
|
548
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-8-focused);
|
|
549
|
+
}
|
|
550
|
+
&:focus-visible:active {
|
|
551
|
+
box-shadow: var(--button-shadow-pressed), var(--shadow-depth-8-focused);
|
|
552
|
+
}
|
|
553
|
+
}
|
package/dist/scss/mixins.scss
CHANGED
|
@@ -456,3 +456,98 @@ $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
|
+
}
|
|
482
|
+
|
|
483
|
+
background-image: radial-gradient(
|
|
484
|
+
circle at var(--limel-3d-hover-effect-glow-position, 50% -20%),
|
|
485
|
+
rgb(var(--color-white), 0.3),
|
|
486
|
+
rgb(var(--color-white), 0)
|
|
487
|
+
);
|
|
488
|
+
|
|
489
|
+
mix-blend-mode: plus-lighter;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// These mixins below are designed to apply the necessary visual effects,
|
|
494
|
+
// when the `tiltFollowingTheCursor` utility function from `3d-tilt-hover-effect.ts`
|
|
495
|
+
// is implemented in a component.
|
|
496
|
+
@mixin parent-of-the-3d-element {
|
|
497
|
+
isolation: isolate;
|
|
498
|
+
transform-style: preserve-3d;
|
|
499
|
+
perspective: 1000px;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
@mixin the-3d-element {
|
|
503
|
+
position: relative;
|
|
504
|
+
|
|
505
|
+
transition-duration: 0.8s;
|
|
506
|
+
transition-property: transform, box-shadow, background-color;
|
|
507
|
+
transition-timing-function: ease-out;
|
|
508
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
509
|
+
|
|
510
|
+
&:hover,
|
|
511
|
+
&:focus,
|
|
512
|
+
&:focus-visible,
|
|
513
|
+
&:focus-within {
|
|
514
|
+
will-change: background-color, box-shadow, transform;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
&:hover,
|
|
518
|
+
&:focus,
|
|
519
|
+
&:focus-visible,
|
|
520
|
+
&:active {
|
|
521
|
+
transition-duration: 0.2s;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
&:hover,
|
|
525
|
+
&:focus-visible {
|
|
526
|
+
box-shadow: var(--button-shadow-hovered);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
&:hover {
|
|
530
|
+
transform: scale3d(1.01, 1.01, 1.01)
|
|
531
|
+
rotate3d(var(--limel-3d-hover-effect-rotate3d));
|
|
532
|
+
}
|
|
533
|
+
&:focus-visible {
|
|
534
|
+
transform: scale3d(1.01, 1.01, 1.01);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
@mixin the-3d-element--clickable {
|
|
539
|
+
cursor: pointer;
|
|
540
|
+
box-shadow: var(--button-shadow-normal);
|
|
541
|
+
|
|
542
|
+
&:active {
|
|
543
|
+
transform: scale3d(1, 1, 1) rotate3d(0, 0, 0, 0deg);
|
|
544
|
+
box-shadow: var(--button-shadow-pressed);
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
&:focus-visible {
|
|
548
|
+
box-shadow: var(--button-shadow-hovered), var(--shadow-depth-8-focused);
|
|
549
|
+
}
|
|
550
|
+
&:focus-visible:active {
|
|
551
|
+
box-shadow: var(--button-shadow-pressed), var(--shadow-depth-8-focused);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for creating a 3D tilt hover effect.
|
|
3
|
+
*
|
|
4
|
+
* This module provides functions that enables consumer components to display a nice 3D effect,
|
|
5
|
+
* when being hovered; enabling them to follow the cursor's position and tilt towards it.
|
|
6
|
+
*
|
|
7
|
+
* ## What you need, to make this work
|
|
8
|
+
* ### Typescript
|
|
9
|
+
* 1. Import the functions:
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* import {
|
|
13
|
+
* tiltFollowingTheCursor,
|
|
14
|
+
* handleMouseEnter,
|
|
15
|
+
* handleMouseLeave,
|
|
16
|
+
* } from './path/to/3d-tilt-hover-effect';
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* 2. In your component, define the necessary properties:
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* @Element() private element: HTMLElement;
|
|
23
|
+
* private the3dElementBounds: DOMRect;
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* 3. If your component does not already have event handlers,
|
|
27
|
+
* implement them using the imported functions from this file:
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* private handleMouseEnter = () => {
|
|
31
|
+
* handleMouseEnter(this.element, 'section', (bounds) => {
|
|
32
|
+
* this.the3dElementBounds = bounds;
|
|
33
|
+
* }, this.tiltFollowingTheCursor);
|
|
34
|
+
* };
|
|
35
|
+
*
|
|
36
|
+
* private handleMouseLeave = () => {
|
|
37
|
+
* handleMouseLeave(this.element, this.tiltFollowingTheCursor);
|
|
38
|
+
* };
|
|
39
|
+
*
|
|
40
|
+
* private tiltFollowingTheCursor = (e: MouseEvent) => {
|
|
41
|
+
* tiltFollowingTheCursor(e, this.the3dElementBounds, this.element);
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* 4. Attach the event handlers to the relevant elements in your render method:
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* public render() {
|
|
49
|
+
* return (
|
|
50
|
+
* <section
|
|
51
|
+
* onMouseEnter={this.handleMouseEnter}
|
|
52
|
+
* onMouseLeave={this.handleMouseLeave}
|
|
53
|
+
* >
|
|
54
|
+
* Your content here
|
|
55
|
+
* </section>
|
|
56
|
+
* );
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* :::note
|
|
61
|
+
* - Ensure that the `element` and `the3dElementBounds` properties are properly
|
|
62
|
+
* defined in your component.
|
|
63
|
+
* - The `selector` parameter in `handleMouseEnter` should match the selector
|
|
64
|
+
* of the element you want to apply the 3D effect to.
|
|
65
|
+
* - The `tiltFollowingTheCursor` function calculates the 3D rotation and glow
|
|
66
|
+
* position based on the cursor's position relative to the element's bounds.
|
|
67
|
+
* :::
|
|
68
|
+
*
|
|
69
|
+
* ### HTML elements + CSS
|
|
70
|
+
* 1. Add a `<div class="limel-3d-hover-effect-glow" />` element to your component's template,
|
|
71
|
+
* inside the element you want to apply the 3D effect to, and preferably at the bottom of all
|
|
72
|
+
* other elements within that element (to avoid the need to specifying `z-index`es).
|
|
73
|
+
* 2. Add the following `mixin` to your component's SCSS file:
|
|
74
|
+
* `limel-3d-hover-effect-glow($the3dElement, $border-radius);`
|
|
75
|
+
*
|
|
76
|
+
* and don't forget to define the `$the3dElement` variables for the mixin to work
|
|
77
|
+
* (and optionally the `$border-radius`).
|
|
78
|
+
* 3. Keep in mind that the `<div class="limel-3d-hover-effect-glow" />` will be
|
|
79
|
+
* absolutely positioned inside the parent element, so make sure the parent element
|
|
80
|
+
* has `position` set.
|
|
81
|
+
* 4. Add the following `mixin` to the host element: `parent-of-the-3d-element`.
|
|
82
|
+
* 5. Add the following `mixin` to the 3D element: `the-3d-element`.
|
|
83
|
+
* 6. And if your element is supposed to be clickable, add this `mixin` as well: `the-3d-element--clickable`.
|
|
84
|
+
*
|
|
85
|
+
*/
|
|
86
|
+
export declare const MOUSE_SCALE_FACTOR = 100;
|
|
87
|
+
export declare const ROTATION_DEGREE_MULTIPLIER = 1.6;
|
|
88
|
+
export declare const GLOW_POSITION_MULTIPLIER = 2;
|
|
89
|
+
export declare const CENTER_DIVISOR = 2;
|
|
90
|
+
export declare function tiltFollowingTheCursor(e: MouseEvent, the3dElementBounds: DOMRect, element: HTMLElement): void;
|
|
91
|
+
export declare function handleMouseEnter(element: HTMLElement, selector: string, setBounds: (bounds: DOMRect) => void, tiltCallback: (e: MouseEvent) => void): void;
|
|
92
|
+
export declare function handleMouseLeave(element: HTMLElement, selector: string, tiltCallback: (e: MouseEvent) => void): void;
|
|
93
|
+
//# sourceMappingURL=3d-tilt-hover-effect.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e,c as r,h as i}from"./p-443111b3.js";import{i as o}from"./p-91741e79.js";import{g as t}from"./p-2f777fdb.js";const a='@charset "UTF-8";*{box-sizing:border-box;min-width:0;min-height:0}:host(limel-card){display:flex;border-radius:var(--card-border-radius, 0.95rem)}section{box-sizing:border-box;display:flex;gap:0.5rem;flex-direction:column;border-radius:var(--card-border-radius, 0.95rem);border:1px solid rgb(var(--contrast-500));padding:0.25rem;background-color:var(--card-background-color, var(--lime-elevated-surface-background-color))}section:focus{outline:none}section:focus-visible{outline:none;box-shadow:var(--shadow-depth-8-focused)}:host(limel-card[orientation=landscape]) section{flex-direction:row}:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section{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);cursor:pointer;color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, var(--lime-elevated-surface-background-color))}:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:hover,:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:focus,:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:focus-visible{will-change:color, background-color, box-shadow, transform}:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:hover{transform:translate3d(0, 0.01rem, 0);color:var(--mdc-theme-on-surface);background-color:var(--card-background-color, var(--lime-elevated-surface-background-color));box-shadow:var(--button-shadow-hovered)}:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:active{--limel-clickable-transform-timing-function:cubic-bezier(\n 0.83,\n -0.15,\n 0.49,\n 1.16\n );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:hover,:host(limel-card[clickable]:not([disabled=true]):not([disabled])) section:active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}:host(limel-card[clickable]:hover) section{border-color:transparent}.body{flex-grow:1;display:flex;flex-direction:column;gap:0.5rem}img{transition:filter 0.6s ease;object-fit:cover;border-radius:calc(var(--card-border-radius, 0.95rem) / 1.4)}:host(limel-card[orientation=portrait]) img{width:100%}:host(limel-card[orientation=landscape]) img{max-width:40%;height:100%}:host(limel-card:hover) img{transition-duration:0.2s;filter:saturate(1.3)}limel-markdown{padding:0.5rem 0.75rem}header{display:flex;justify-content:center;gap:0.5rem;padding:0.25rem 0.75rem}:host(limel-card[orientation=landscape]) header{padding-top:0.5rem}header:has(limel-icon){padding-left:0.25rem}header .headings{flex-grow:1;display:flex;flex-direction:column;gap:0.125rem}header limel-icon{flex-shrink:0;width:2rem}header h1{font-size:1.125rem;font-weight:500;color:var(--card-heading-color, rgb(var(--contrast-1100)));letter-spacing:-0.03125rem}header h2{font-size:0.875rem;font-weight:400;color:var(--card-subheading-color, rgb(var(--contrast-1000)))}header h1,header h2{word-break:break-word;hyphens:auto;-webkit-hyphens:auto;margin:0}limel-action-bar{padding:0.5rem;margin-left:auto}';const n=class{constructor(i){e(this,i);this.actionSelected=r(this,"actionSelected",7);this.handleActionSelect=e=>{e.stopPropagation();if(o(e.detail)){this.actionSelected.emit(e.detail)}};this.heading=undefined;this.subheading=undefined;this.image=undefined;this.icon=undefined;this.value=undefined;this.actions=[];this.clickable=false;this.orientation="portrait"}render(){return i("section",{tabindex:this.clickable?0:""},this.renderImage(),i("div",{class:"body"},this.renderHeader(),this.renderSlot(),this.renderValue(),this.renderActionBar()))}renderImage(){if(!this.image){return}return i("img",{src:this.image.src,alt:this.image.alt,loading:"lazy"})}renderHeader(){if(!this.heading&&!this.subheading&&!this.icon){return}return i("header",null,this.renderIcon(),i("div",{class:"headings"},this.renderHeading(),this.renderSubheading()))}renderIcon(){var e;const r=t(this.icon);const o=typeof this.icon!=="string"?(e=this.icon)===null||e===void 0?void 0:e.color:undefined;if(!r){return}return i("limel-icon",{style:{color:`${o}`},badge:true,name:r})}renderHeading(){if(!this.heading){return}return i("h1",null,this.heading)}renderSubheading(){if(!this.subheading){return}return i("h2",null,this.subheading)}renderSlot(){return i("slot",{name:"component"})}renderValue(){return i("limel-markdown",{value:this.value})}renderActionBar(){if(!this.actions.length){return}return i("limel-action-bar",{actions:this.actions,onItemSelected:this.handleActionSelect})}};n.style=a;export{n as limel_card};
|
|
2
|
-
//# sourceMappingURL=p-7f9e0f52.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["cardCss","Card","this","handleActionSelect","event","stopPropagation","isItem","detail","actionSelected","emit","render","h","tabindex","clickable","renderImage","class","renderHeader","renderSlot","renderValue","renderActionBar","image","src","alt","loading","heading","subheading","icon","renderIcon","renderHeading","renderSubheading","getIconName","color","_a","undefined","style","badge","name","value","actions","length","onItemSelected"],"sources":["./src/components/card/card.scss?tag=limel-card&encapsulation=shadow","./src/components/card/card.tsx"],"sourcesContent":["/**\n* @prop --card-heading-color: color of the heading. Defaults to `--contrast-1100`;\n* @prop --card-subheading-color: color of the sub heading. Defaults to `--contrast-1000`;\n* @prop --card-border-radius: border radius of the card. Defaults to `0.95rem`;\n* @prop --card-background-color: background color of the card.\n*/\n\n@use '../../style/mixins';\n\n$default-border-radius: 0.95rem;\n\n* {\n box-sizing: border-box;\n min-width: 0;\n min-height: 0;\n}\n\n:host(limel-card) {\n display: flex;\n border-radius: var(--card-border-radius, $default-border-radius);\n}\n\nsection {\n box-sizing: border-box;\n @include mixins.visualize-keyboard-focus;\n\n display: flex;\n gap: 0.5rem;\n\n flex-direction: column;\n :host(limel-card[orientation='landscape']) & {\n flex-direction: row;\n }\n\n border-radius: var(--card-border-radius, $default-border-radius);\n border: 1px solid rgb(var(--contrast-500));\n\n padding: 0.25rem;\n background-color: var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n );\n\n :host(limel-card[clickable]:not([disabled='true']):not([disabled])) & {\n @include mixins.is-flat-clickable(\n $background-color:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n ),\n $background-color--hovered:\n var(\n --card-background-color,\n var(--lime-elevated-surface-background-color)\n )\n );\n }\n\n :host(limel-card[clickable]:hover) & {\n border-color: transparent;\n }\n}\n\n.body {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n}\n\nimg {\n transition: filter 0.6s ease;\n object-fit: cover;\n border-radius: calc(\n var(--card-border-radius, $default-border-radius) / 1.4\n );\n :host(limel-card[orientation='portrait']) & {\n width: 100%;\n }\n\n :host(limel-card[orientation='landscape']) & {\n max-width: 40%;\n height: 100%;\n }\n\n :host(limel-card:hover) & {\n transition-duration: 0.2s;\n filter: saturate(1.3);\n }\n}\n\nlimel-markdown {\n padding: 0.5rem 0.75rem;\n}\n\nheader {\n display: flex;\n justify-content: center;\n\n gap: 0.5rem;\n\n padding: 0.25rem 0.75rem;\n :host(limel-card[orientation='landscape']) & {\n padding-top: 0.5rem;\n }\n\n &:has(limel-icon) {\n padding-left: 0.25rem;\n }\n\n .headings {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 0.125rem;\n }\n\n limel-icon {\n flex-shrink: 0;\n width: 2rem;\n }\n\n h1 {\n font-size: 1.125rem;\n font-weight: 500;\n color: var(--card-heading-color, rgb(var(--contrast-1100)));\n letter-spacing: -0.03125rem; // 0.5px\n }\n\n h2 {\n font-size: 0.875rem;\n font-weight: 400;\n color: var(--card-subheading-color, rgb(var(--contrast-1000)));\n }\n\n h1,\n h2 {\n word-break: break-word;\n hyphens: auto;\n -webkit-hyphens: auto;\n margin: 0;\n }\n}\n\nlimel-action-bar {\n padding: 0.5rem;\n margin-left: auto;\n}\n","import { Component, h, Prop, Event, EventEmitter } 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';\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 public render() {\n return (\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 </section>\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"],"mappings":"0HAAA,MAAMA,EAAU,4zG,MC2BHC,EAAI,M,wEAgJLC,KAAAC,mBACJC,IAEAA,EAAMC,kBACN,GAAIC,EAAOF,EAAMG,QAAS,CACtBL,KAAKM,eAAeC,KAAKL,EAAMG,O,+HA7GiB,G,eAO5B,M,iBAOmB,U,CAQxCG,SACH,OACIC,EAAA,WAASC,SAAUV,KAAKW,UAAY,EAAI,IACnCX,KAAKY,cACNH,EAAA,OAAKI,MAAM,QACNb,KAAKc,eACLd,KAAKe,aACLf,KAAKgB,cACLhB,KAAKiB,mB,CAMdL,cACJ,IAAKZ,KAAKkB,MAAO,CACb,M,CAGJ,OAAOT,EAAA,OAAKU,IAAKnB,KAAKkB,MAAMC,IAAKC,IAAKpB,KAAKkB,MAAME,IAAKC,QAAQ,Q,CAG1DP,eACJ,IAAKd,KAAKsB,UAAYtB,KAAKuB,aAAevB,KAAKwB,KAAM,CACjD,M,CAGJ,OACIf,EAAA,cACKT,KAAKyB,aACNhB,EAAA,OAAKI,MAAM,YACNb,KAAK0B,gBACL1B,KAAK2B,oB,CAMdF,a,MACJ,MAAMD,EAAOI,EAAY5B,KAAKwB,MAC9B,MAAMK,SACK7B,KAAKwB,OAAS,UAAWM,EAAA9B,KAAKwB,QAAI,MAAAM,SAAA,SAAAA,EAAED,MAAQE,UAEvD,IAAKP,EAAM,CACP,M,CAGJ,OACIf,EAAA,cACIuB,MAAO,CACHH,MAAO,GAAGA,KAEdI,MAAO,KACPC,KAAMV,G,CAKVE,gBACJ,IAAK1B,KAAKsB,QAAS,CACf,M,CAGJ,OAAOb,EAAA,UAAKT,KAAKsB,Q,CAGbK,mBACJ,IAAK3B,KAAKuB,WAAY,CAClB,M,CAGJ,OAAOd,EAAA,UAAKT,KAAKuB,W,CAGbR,aACJ,OAAON,EAAA,QAAMyB,KAAK,a,CAGdlB,cACJ,OAAOP,EAAA,kBAAgB0B,MAAOnC,KAAKmC,O,CAY/BlB,kBACJ,IAAKjB,KAAKoC,QAAQC,OAAQ,CACtB,M,CAGJ,OACI5B,EAAA,oBACI2B,QAASpC,KAAKoC,QACdE,eAAgBtC,KAAKC,oB"}
|