@limetech/lime-elements 38.19.1 → 38.19.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/cjs/limel-banner.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-dock-button.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-dock.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-file.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-progress-flow.cjs.entry.js.map +1 -1
- package/dist/collection/components/banner/banner.css +0 -6
- package/dist/collection/components/dock/dock-button/dock-button.css +0 -6
- package/dist/collection/components/dock/dock.css +0 -6
- package/dist/collection/components/file/file.js +2 -1
- package/dist/collection/components/file/file.js.map +1 -1
- package/dist/collection/components/file-viewer/file-viewer.css +0 -6
- package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +0 -6
- package/dist/collection/components/progress-flow/progress-flow.css +0 -6
- package/dist/collection/global/shared-types/file.types.js.map +1 -1
- package/dist/esm/limel-banner.entry.js.map +1 -1
- package/dist/esm/limel-dock-button.entry.js.map +1 -1
- package/dist/esm/limel-dock.entry.js.map +1 -1
- package/dist/esm/limel-file-viewer.entry.js.map +1 -1
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-file.entry.js.map +1 -1
- package/dist/esm/limel-progress-flow-item.entry.js.map +1 -1
- package/dist/esm/limel-progress-flow.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0115bb1e.entry.js.map +1 -1
- package/dist/lime-elements/p-1e4ca584.entry.js.map +1 -1
- package/dist/lime-elements/p-3edf0f2c.entry.js.map +1 -1
- package/dist/lime-elements/{p-d66c17aa.entry.js → p-4f3a8659.entry.js} +2 -2
- package/dist/lime-elements/p-4f3a8659.entry.js.map +1 -0
- package/dist/lime-elements/p-a9ae1823.entry.js.map +1 -1
- package/dist/lime-elements/p-aaface1b.entry.js.map +1 -1
- package/dist/lime-elements/p-d05ebeb1.entry.js.map +1 -1
- package/dist/types/components/file/file.d.ts +1 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/types/global/shared-types/file.types.d.ts +6 -0
- package/package.json +1 -1
- package/dist/collection/style/internal/variables.scss +0 -10
- package/dist/lime-elements/p-d66c17aa.entry.js.map +0 -1
- package/dist/lime-elements/style/internal/variables.scss +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [38.19.2](https://github.com/Lundalogik/lime-elements/compare/v38.19.1...v38.19.2) (2025-07-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
* **file:** enable menus in chips in file picker ([bb94fb1](https://github.com/Lundalogik/lime-elements/commit/bb94fb1f2b12a4d1660a5b270fb07cb6d89948b2))
|
|
8
|
+
|
|
1
9
|
## [38.19.1](https://github.com/Lundalogik/lime-elements/compare/v38.19.0...v38.19.1) (2025-07-10)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-banner.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,smCAAsmC;;MCW3mC,MAAM;;;;;kBAcE,KAAK;;;;;EAMf,MAAM,IAAI;IACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;GACtB;;;;EAMM,MAAM,KAAK;IACd,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;GACvB;EAEM,MAAM;IACT,QACIA,iBACI,KAAK,EAAE,eAAe,IAAI,CAAC,MAAM,GAAG,mBAAmB,GAAG,EAAE,EAAE,IAE9DA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,iBAAK,KAAK,EAAC,cAAc,IACpB,IAAI,CAAC,UAAU,EAAE,EAClBA,qBAAM,IAAI,CAAC,OAAO,CAAO,CACvB,EACNA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,kBAAM,IAAI,EAAC,SAAS,GAAG,CACrB,CACJ,CACJ,CACJ,EACR;GACL;EAEO,UAAU;IACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACZ,OAAO;KACV;IAED,QACIA,iBAAK,KAAK,EAAC,mBAAmB,IAC1BA,wBAAY,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,GAAG,CACvD,EACR;GACL;;;;;;","names":["h"],"sources":["./src/components/banner/banner.scss?tag=limel-banner&encapsulation=shadow","./src/components/banner/banner.tsx"],"sourcesContent":["@use '../../style/
|
|
1
|
+
{"file":"limel-banner.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,SAAS,GAAG,smCAAsmC;;MCW3mC,MAAM;;;;;kBAcE,KAAK;;;;;EAMf,MAAM,IAAI;IACb,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;GACtB;;;;EAMM,MAAM,KAAK;IACd,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;GACvB;EAEM,MAAM;IACT,QACIA,iBACI,KAAK,EAAE,eAAe,IAAI,CAAC,MAAM,GAAG,mBAAmB,GAAG,EAAE,EAAE,IAE9DA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,iBAAK,KAAK,EAAC,cAAc,IACpB,IAAI,CAAC,UAAU,EAAE,EAClBA,qBAAM,IAAI,CAAC,OAAO,CAAO,CACvB,EACNA,iBAAK,KAAK,EAAC,sBAAsB,IAC7BA,kBAAM,IAAI,EAAC,SAAS,GAAG,CACrB,CACJ,CACJ,CACJ,EACR;GACL;EAEO,UAAU;IACd,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACZ,OAAO;KACV;IAED,QACIA,iBAAK,KAAK,EAAC,mBAAmB,IAC1BA,wBAAY,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,GAAG,CACvD,EACR;GACL;;;;;;","names":["h"],"sources":["./src/components/banner/banner.scss?tag=limel-banner&encapsulation=shadow","./src/components/banner/banner.tsx"],"sourcesContent":["@use '../../style/functions';\n\n/**\n * @prop --banner-icon-fill-color: Color of the banner icon.\n * @prop --banner-icon-background-color: Background color of the banner icon.\n */\n\n.lime-banner {\n min-height: 3.25rem;\n display: none;\n background-color: rgba(var(--contrast-100), 0.7);\n backdrop-filter: blur(functions.pxToRem(5));\n box-shadow: var(--shadow-depth-16);\n\n &.lime-banner--open {\n display: block;\n .lime-banner__surface {\n opacity: 1;\n }\n }\n .lime-banner__surface {\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n opacity: 0;\n }\n\n .lime-banner__content {\n display: flex;\n align-items: center;\n align-content: stretch;\n padding: functions.pxToRem(16);\n flex-wrap: wrap;\n }\n\n .icon-message {\n display: flex;\n align-items: center;\n }\n\n div[class^='mdc-typography'] {\n color: rgb(var(--contrast-1200));\n }\n\n .lime-banner__icon {\n margin: 0 functions.pxToRem(10);\n align-self: flex-start;\n }\n\n .lime-banner__actions {\n margin-left: functions.pxToRem(50);\n display: flex;\n justify-content: flex-end;\n }\n\n limel-icon {\n color: var(--banner-icon-fill-color, rgb(var(--contrast-100)));\n background-color: var(\n --banner-icon-background-color,\n rgb(var(--contrast-800))\n );\n }\n}\n@media screen and (max-width: 760px) {\n .lime-banner__content {\n flex-direction: column;\n gap: 0.5rem;\n }\n .icon-message {\n display: flex;\n align-items: center;\n }\n .lime-banner__actions {\n margin-left: 0;\n }\n}\n","import { Component, h, Method, Prop, State } from '@stencil/core';\n\n/**\n * @exampleComponent limel-example-banner\n * @slot buttons - Buttons to show in the banner\n */\n@Component({\n tag: 'limel-banner',\n shadow: true,\n styleUrl: 'banner.scss',\n})\nexport class Banner {\n /**\n * The text to show on the banner.\n */\n @Prop({ reflect: true })\n public message: string;\n\n /**\n * Set icon for the banner\n */\n @Prop({ reflect: true })\n public icon: string;\n\n @State()\n private isOpen = false;\n\n /**\n * Open the banner\n */\n @Method()\n public async open() {\n this.isOpen = true;\n }\n\n /**\n * Close the banner\n */\n @Method()\n public async close() {\n this.isOpen = false;\n }\n\n public render() {\n return (\n <div\n class={`lime-banner ${this.isOpen ? 'lime-banner--open' : ''}`}\n >\n <div class=\"lime-banner__surface\">\n <div class=\"lime-banner__content\">\n <div class=\"icon-message\">\n {this.renderIcon()}\n <div>{this.message}</div>\n </div>\n <div class=\"lime-banner__actions\">\n <slot name=\"buttons\" />\n </div>\n </div>\n </div>\n </div>\n );\n }\n\n private renderIcon(): HTMLElement {\n if (!this.icon) {\n return;\n }\n\n return (\n <div class=\"lime-banner__icon\">\n <limel-icon name={this.icon} badge={true} size=\"large\" />\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-dock-button.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,aAAa,GAAG,stFAAstF;;MCoB/tF,UAAU;EAiDnB;;;;;IA2EQ,uBAAkB,GAAG;MACzB,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;QAC/B,OAAOA,yBAAa,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAI,CAAC;OAClD;KACJ,CAAC;IAEM,gBAAW,GAAG,CAAC,KAAiB;MACpC,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;MACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACjC,CAAC;IAEM,8BAAyB,GAAG,CAAC,OAAoB;MACrD,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC;KACzC,CAAC;IAEM,mBAAc,G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,kBAAkB,EAAE,CACrB,EACX;GACL;EA4BO,UAAU;IACd,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACjB,OAAO;KACV;IAED,OAAOA,wBAAY,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC,MAAM,GAAG,CAAC;GAC5D;EAEO,WAAW;IACf,IAAI,IAAI,CAAC,QAAQ,EAAE;MACf,OAAOA,kBAAM,KAAK,EAAC,MAAM,IAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAQ,CAAC;KACtD;GACJ;EAEO,aAAa;IACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;MACnC,QACIA,2BACI,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,EACtB,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAClC,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE,GACxC,EACJ;KACL;IAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;MACxC,QACIA,2BACI,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAC5B,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE,GACxC,EACJ;KACL;GACJ;;;;;;;;;","names":["h","createRandomString"],"sources":["./src/components/dock/dock-button/dock-button.scss?tag=limel-dock-button","./src/components/dock/dock-button/dock-button.tsx"],"sourcesContent":["@use '../../../style/mixins';\n@use '../../../style/functions';\n@use '../../../style/internal/variables';\n\n.button {\n all: unset;\n isolation: isolate;\n position: relative;\n\n @include mixins.is-flat-inset-clickable(\n $color: var(--limel-dock-item-text-color),\n $background-color: var(--dock-background-color)\n );\n @include mixins.visualize-keyboard-focus;\n\n box-sizing: border-box;\n display: flex;\n align-items: center;\n\n width: 100%;\n height: var(--dock-item-height);\n\n border-radius: functions.pxToRem(6);\n font-size: functions.pxToRem(14);\n padding: 0 0.5rem;\n min-width: var(--dock-item-height);\n\n &:hover {\n z-index: 1;\n }\n\n &.selected {\n color: var(--limel-dock-item-text-color--selected);\n background-color: var(\n --dock-item-background-color--selected,\n rgb(var(--contrast-200))\n );\n\n box-shadow: var(--button-shadow-inset);\n\n &:focus-visible {\n box-shadow:\n var(--button-shadow-inset), var(--shadow-depth-8-focused);\n }\n\n .icon {\n color: var(--limel-dock-item-text--selected);\n }\n }\n}\n\nlimel-popover {\n // makes buttons that are wrapped in a popover become fullwidth\n display: grid;\n grid-template-columns: 100%;\n\n button[slot='trigger'][aria-expanded='true'] {\n box-shadow: var(--button-shadow-inset);\n }\n}\n\n.text {\n @include mixins.truncate-text();\n padding-left: 0.5rem;\n padding-right: 0.75rem;\n}\n\n.icon {\n flex-shrink: 0;\n width: calc(var(--dock-item-height) - 1rem);\n height: calc(var(--dock-item-height) - 1rem);\n color: var(--dock-item-icon-color, var(--limel-dock-item-text-color));\n}\n\nlimel-badge {\n position: absolute;\n top: -0.125rem;\n right: -0.125rem;\n}\n\n// 👇 Below is a hidden and private hack\n// only for usage in Lime CRM components.\n// It enables our customers to override\n// the default Home icon, using an external URL\n// or an SVG code.\n.icon {\n position: relative;\n\n &:before {\n text-align: center;\n pointer-events: none;\n position: absolute;\n inset: 0;\n background: {\n color: var(--dock-background-color, rgb(var(--contrast-100)));\n position: center;\n repeat: no-repeat;\n size: contain;\n image: var(--limel-custom-home-icon);\n }\n // Since `content` defaults to `undefined`\n // no pseudo element will be rendered, unless\n // the consumer defines something.\n content: var(--limel-custom-home-icon-enabler);\n\n .button.selected & {\n background-color: var(\n --dock-item-background-color--selected,\n rgb(var(--contrast-200))\n );\n }\n }\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { DockItem } from '../dock.types';\nimport { createRandomString } from '../../../util/random-string';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-dock-button',\n shadow: false,\n styleUrl: 'dock-button.scss',\n})\nexport class DockButton {\n /**\n * Item that is placed in the dock.\n */\n @Prop()\n public item!: DockItem;\n\n /**\n * When the dock is expanded or collapsed, dock items\n * show labels and tooltips as suitable for the layout.\n */\n @Prop({ reflect: true })\n public expanded? = false;\n\n /**\n * When dock is using mobile layout, dock items\n * show labels and tooltips as suitable for the layout.\n */\n @Prop({ reflect: true })\n public useMobileLayout? = false;\n\n /**\n * Fired when a dock item has been selected from the dock.\n */\n @Event()\n public itemSelected: EventEmitter<DockItem>;\n\n /**\n * Fired when a dock menu is opened.\n */\n @Event()\n public menuOpen: EventEmitter<DockItem>;\n\n /**\n * Indicated whether the popover that renders a component is open.\n */\n @State()\n private isOpen = false;\n\n /**\n * Fired when the popover is closed.\n */\n @Event()\n public close: EventEmitter<void>;\n\n private tooltipId: string;\n private customComponentElement: HTMLElement;\n private intersectionObserver?: IntersectionObserver;\n\n constructor() {\n this.tooltipId = createRandomString();\n }\n\n public render() {\n if (this.item?.dockMenu?.componentName) {\n return this.renderPopover();\n }\n\n return this.renderButton(this.handleClick);\n }\n\n @Watch('isOpen')\n protected openWatcher() {\n if (!this.isOpen) {\n return;\n }\n\n if (!this.intersectionObserver) {\n this.intersectionObserver = new IntersectionObserver(\n this.focusCustomComponentElement\n );\n this.intersectionObserver.observe(this.customComponentElement);\n }\n }\n\n public disconnectedCallback() {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n }\n\n private renderPopover() {\n const CustomComponent = this.item?.dockMenu.componentName;\n\n return (\n <limel-popover\n openDirection={this.useMobileLayout ? 'top' : 'right-start'}\n open={this.isOpen || this.item.dockMenu.menuOpen}\n onClose={this.onPopoverClose}\n >\n {this.renderButton(this.openPopover, 'trigger')}\n <CustomComponent\n ref={this.setCustomComponentElement}\n {...(this.item.dockMenu.props || {})}\n onClose={this.onPopoverClose}\n />\n </limel-popover>\n );\n }\n\n private renderButton(\n handleClick: (event: MouseEvent) => void,\n slot?: string\n ) {\n return (\n <button\n slot={slot}\n tabindex=\"0\"\n id={this.tooltipId}\n type=\"button\"\n class={{\n button: true,\n selected: this.item?.selected,\n }}\n onClick={handleClick}\n aria-live=\"polite\"\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderTooltip()}\n {this.renderNotification()}\n </button>\n );\n }\n\n private renderNotification = () => {\n if (this.item.badge !== undefined) {\n return <limel-badge label={this.item.badge} />;\n }\n };\n\n private openPopover = (event: MouseEvent) => {\n event.stopPropagation();\n this.isOpen = true;\n this.menuOpen.emit(this.item);\n };\n\n private setCustomComponentElement = (element: HTMLElement) => {\n this.customComponentElement = element;\n };\n\n private onPopoverClose = () => {\n this.isOpen = false;\n this.close.emit();\n };\n\n private handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.itemSelected.emit(this.item);\n };\n\n private renderIcon() {\n if (!this.item.icon) {\n return;\n }\n\n return <limel-icon name={this.item.icon} class=\"icon\" />;\n }\n\n private renderLabel() {\n if (this.expanded) {\n return <span class=\"text\">{this.item.label}</span>;\n }\n }\n\n private renderTooltip() {\n if (!this.expanded && this.item.label) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.label}\n helperLabel={this.item.helperLabel}\n openDirection={this.getOpenDirection()}\n />\n );\n }\n\n if (this.expanded && this.item.helperLabel) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.helperLabel}\n openDirection={this.getOpenDirection()}\n />\n );\n }\n }\n\n private focusCustomComponentElement = (\n entries: IntersectionObserverEntry[]\n ) => {\n const entry = entries.find(\n (e) => e.target === this.customComponentElement\n );\n if (!entry) {\n return;\n }\n\n if (!entry.isIntersecting) {\n return;\n }\n\n if (this.customComponentElement?.shadowRoot?.delegatesFocus) {\n this.customComponentElement?.focus();\n }\n };\n\n private getOpenDirection = () => {\n if (this.useMobileLayout) {\n return 'top';\n }\n\n return 'right';\n };\n}\n"],"version":3}
|
|
1
|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xC,EACJ;KACL;IAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;MACxC,QACIA,2BACI,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,WAAW,EAC5B,aAAa,EAAE,IAAI,CAAC,gBAAgB,EAAE,GACxC,EACJ;KACL;GACJ;;;;;;;;;","names":["h","createRandomString"],"sources":["./src/components/dock/dock-button/dock-button.scss?tag=limel-dock-button","./src/components/dock/dock-button/dock-button.tsx"],"sourcesContent":["@use '../../../style/mixins';\n@use '../../../style/functions';\n\n.button {\n all: unset;\n isolation: isolate;\n position: relative;\n\n @include mixins.is-flat-inset-clickable(\n $color: var(--limel-dock-item-text-color),\n $background-color: var(--dock-background-color)\n );\n @include mixins.visualize-keyboard-focus;\n\n box-sizing: border-box;\n display: flex;\n align-items: center;\n\n width: 100%;\n height: var(--dock-item-height);\n\n border-radius: functions.pxToRem(6);\n font-size: functions.pxToRem(14);\n padding: 0 0.5rem;\n min-width: var(--dock-item-height);\n\n &:hover {\n z-index: 1;\n }\n\n &.selected {\n color: var(--limel-dock-item-text-color--selected);\n background-color: var(\n --dock-item-background-color--selected,\n rgb(var(--contrast-200))\n );\n\n box-shadow: var(--button-shadow-inset);\n\n &:focus-visible {\n box-shadow:\n var(--button-shadow-inset), var(--shadow-depth-8-focused);\n }\n\n .icon {\n color: var(--limel-dock-item-text--selected);\n }\n }\n}\n\nlimel-popover {\n // makes buttons that are wrapped in a popover become fullwidth\n display: grid;\n grid-template-columns: 100%;\n\n button[slot='trigger'][aria-expanded='true'] {\n box-shadow: var(--button-shadow-inset);\n }\n}\n\n.text {\n @include mixins.truncate-text();\n padding-left: 0.5rem;\n padding-right: 0.75rem;\n}\n\n.icon {\n flex-shrink: 0;\n width: calc(var(--dock-item-height) - 1rem);\n height: calc(var(--dock-item-height) - 1rem);\n color: var(--dock-item-icon-color, var(--limel-dock-item-text-color));\n}\n\nlimel-badge {\n position: absolute;\n top: -0.125rem;\n right: -0.125rem;\n}\n\n// 👇 Below is a hidden and private hack\n// only for usage in Lime CRM components.\n// It enables our customers to override\n// the default Home icon, using an external URL\n// or an SVG code.\n.icon {\n position: relative;\n\n &:before {\n text-align: center;\n pointer-events: none;\n position: absolute;\n inset: 0;\n background: {\n color: var(--dock-background-color, rgb(var(--contrast-100)));\n position: center;\n repeat: no-repeat;\n size: contain;\n image: var(--limel-custom-home-icon);\n }\n // Since `content` defaults to `undefined`\n // no pseudo element will be rendered, unless\n // the consumer defines something.\n content: var(--limel-custom-home-icon-enabler);\n\n .button.selected & {\n background-color: var(\n --dock-item-background-color--selected,\n rgb(var(--contrast-200))\n );\n }\n }\n}\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { DockItem } from '../dock.types';\nimport { createRandomString } from '../../../util/random-string';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-dock-button',\n shadow: false,\n styleUrl: 'dock-button.scss',\n})\nexport class DockButton {\n /**\n * Item that is placed in the dock.\n */\n @Prop()\n public item!: DockItem;\n\n /**\n * When the dock is expanded or collapsed, dock items\n * show labels and tooltips as suitable for the layout.\n */\n @Prop({ reflect: true })\n public expanded? = false;\n\n /**\n * When dock is using mobile layout, dock items\n * show labels and tooltips as suitable for the layout.\n */\n @Prop({ reflect: true })\n public useMobileLayout? = false;\n\n /**\n * Fired when a dock item has been selected from the dock.\n */\n @Event()\n public itemSelected: EventEmitter<DockItem>;\n\n /**\n * Fired when a dock menu is opened.\n */\n @Event()\n public menuOpen: EventEmitter<DockItem>;\n\n /**\n * Indicated whether the popover that renders a component is open.\n */\n @State()\n private isOpen = false;\n\n /**\n * Fired when the popover is closed.\n */\n @Event()\n public close: EventEmitter<void>;\n\n private tooltipId: string;\n private customComponentElement: HTMLElement;\n private intersectionObserver?: IntersectionObserver;\n\n constructor() {\n this.tooltipId = createRandomString();\n }\n\n public render() {\n if (this.item?.dockMenu?.componentName) {\n return this.renderPopover();\n }\n\n return this.renderButton(this.handleClick);\n }\n\n @Watch('isOpen')\n protected openWatcher() {\n if (!this.isOpen) {\n return;\n }\n\n if (!this.intersectionObserver) {\n this.intersectionObserver = new IntersectionObserver(\n this.focusCustomComponentElement\n );\n this.intersectionObserver.observe(this.customComponentElement);\n }\n }\n\n public disconnectedCallback() {\n this.intersectionObserver?.disconnect();\n this.intersectionObserver = undefined;\n }\n\n private renderPopover() {\n const CustomComponent = this.item?.dockMenu.componentName;\n\n return (\n <limel-popover\n openDirection={this.useMobileLayout ? 'top' : 'right-start'}\n open={this.isOpen || this.item.dockMenu.menuOpen}\n onClose={this.onPopoverClose}\n >\n {this.renderButton(this.openPopover, 'trigger')}\n <CustomComponent\n ref={this.setCustomComponentElement}\n {...(this.item.dockMenu.props || {})}\n onClose={this.onPopoverClose}\n />\n </limel-popover>\n );\n }\n\n private renderButton(\n handleClick: (event: MouseEvent) => void,\n slot?: string\n ) {\n return (\n <button\n slot={slot}\n tabindex=\"0\"\n id={this.tooltipId}\n type=\"button\"\n class={{\n button: true,\n selected: this.item?.selected,\n }}\n onClick={handleClick}\n aria-live=\"polite\"\n >\n {this.renderIcon()}\n {this.renderLabel()}\n {this.renderTooltip()}\n {this.renderNotification()}\n </button>\n );\n }\n\n private renderNotification = () => {\n if (this.item.badge !== undefined) {\n return <limel-badge label={this.item.badge} />;\n }\n };\n\n private openPopover = (event: MouseEvent) => {\n event.stopPropagation();\n this.isOpen = true;\n this.menuOpen.emit(this.item);\n };\n\n private setCustomComponentElement = (element: HTMLElement) => {\n this.customComponentElement = element;\n };\n\n private onPopoverClose = () => {\n this.isOpen = false;\n this.close.emit();\n };\n\n private handleClick = (event: MouseEvent) => {\n event.stopPropagation();\n this.itemSelected.emit(this.item);\n };\n\n private renderIcon() {\n if (!this.item.icon) {\n return;\n }\n\n return <limel-icon name={this.item.icon} class=\"icon\" />;\n }\n\n private renderLabel() {\n if (this.expanded) {\n return <span class=\"text\">{this.item.label}</span>;\n }\n }\n\n private renderTooltip() {\n if (!this.expanded && this.item.label) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.label}\n helperLabel={this.item.helperLabel}\n openDirection={this.getOpenDirection()}\n />\n );\n }\n\n if (this.expanded && this.item.helperLabel) {\n return (\n <limel-tooltip\n elementId={this.tooltipId}\n label={this.item.helperLabel}\n openDirection={this.getOpenDirection()}\n />\n );\n }\n }\n\n private focusCustomComponentElement = (\n entries: IntersectionObserverEntry[]\n ) => {\n const entry = entries.find(\n (e) => e.target === this.customComponentElement\n );\n if (!entry) {\n return;\n }\n\n if (!entry.isIntersecting) {\n return;\n }\n\n if (this.customComponentElement?.shadowRoot?.delegatesFocus) {\n this.customComponentElement?.focus();\n }\n };\n\n private getOpenDirection = () => {\n if (this.useMobileLayout) {\n return 'top';\n }\n\n return 'right';\n };\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-dock.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,+sGAA+sG;;ACW/tG,MAAM,yBAAyB,GAAG,GAAG,CAAC;MAezB,IAAI;;;;;;;IAmHL,oBAAe,GAAG;MACtB,OAAO,IAAI,CAAC,eAAe,GAAG,IAAI,GAAGA,kBAAM,KAAK,EAAC,kBAAkB,GAAG,CAAC;KAC1E,CAAC;IAEM,mBAAc,GAAG,CAAC,IAAc;MACpC,QACIA,+BACI,KAAK,EAAE;UACH,WAAW,EAAE,IAAI;UACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SAC1B,EACD,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,eAAe,EAChD,eAAe,EAAE,IAAI,CAAC,eAAe,GACvC,EACJ;KACL,CAAC;IAEM,iBAAY,GAAG;MACnB,IAAI,MAAM,CAAC,UAAU,IAAI,IAAI,CAAC,gBAAgB,EAAE;QAC5C,IAAI,CAAC,eAAe,G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e,IAE7BA,wBAAY,IAAI,EAAC,aAAa,GAAG,CAC5B,EACX;GACL;;;;;;","names":["h","Host"],"sources":["./src/components/dock/dock.scss?tag=limel-dock&encapsulation=shadow","./src/components/dock/dock.tsx"],"sourcesContent":["@use '../../style/mixins';\n@use '../../style/functions';\n@use '../../style/internal/variables';\n\n/**\n* @prop --dock-expanded-max-width: The maximum width of the Dock when it is expanded. Defaults to `max-content` which means the Dock will adjust its width to the widest dock item.\n* @prop --dock-background-color: Background color of the whole component, defaults to `--contrast-100`.\n* @prop --dock-item-background-color--selected: Background color of selected dock item, defaults to `--contrast-200`.\n* @prop --dock-item-text-color: Text of dock items, defaults to `--contrast-1100`.\n* @prop --dock-item-text-color--selected: Text color of selected dock item, defaults to `--contrast-1300`.\n* @prop --dock-item-icon-color: Color of the optional icons used in each dock item. Only affects inactive dock items, defaults to text colors for default or selected states.\n* @prop --dock-padding-top: Space of top side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-top)`.\n* @prop --dock-padding-right: Space of the right side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-right)`.\n* @prop --dock-padding-bottom: Space of the bottom side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-bottom)`.\n* @prop --dock-padding-left: Space of the left side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-left)`.\n* @prop --popover-surface-width: Defines the width of the popover that is opened for dock items with custom components. Defaults to `auto`.\n*/\n\n:host(limel-dock) {\n --badge-background-color: rgb(var(--color-red-default));\n --badge-text-color: rgb(var(--color-white));\n\n --dock-item-height: 2.75rem;\n --limel-dock-padding: 0.25rem;\n --dock-expand-shrink-button-height: 1rem;\n\n --limel-dock-item-text-color: var(\n --dock-item-text-color,\n rgb(var(--contrast-1100))\n );\n --limel-dock-item-text-color--selected: var(\n --dock-item-text-color--selected,\n rgb(var(--contrast-1300))\n );\n\n isolation: isolate;\n position: relative;\n\n display: inline-flex;\n flex-direction: column;\n\n background-color: var(--dock-background-color, rgb(var(--contrast-100)));\n box-shadow: var(--shadow-depth-8);\n\n padding-top: var(--dock-padding-top);\n padding-right: var(--dock-padding-right);\n padding-bottom: var(--dock-padding-bottom);\n padding-left: var(--dock-padding-left);\n}\n\n:host(limel-dock:not(.has-mobile-layout)) {\n height: 100%;\n width: calc((var(--limel-dock-padding) * 2) + var(--dock-item-height));\n nav {\n padding-bottom: calc((var(--limel-dock-padding) + 0.25rem));\n }\n}\n\n:host(limel-dock.expanded) {\n width: var(--dock-expanded-max-width, max-content);\n}\n\n.footer-separator {\n margin-top: auto;\n justify-self: flex-end;\n}\n\nnav {\n box-sizing: border-box;\n display: inline-flex;\n flex-direction: column;\n gap: functions.pxToRem(6);\n flex-grow: 1;\n\n padding: var(--limel-dock-padding); // needed for the focus effect\n\n overflow-y: auto;\n scrollbar-width: none; // This hides the scrollbars appearing under in Firefox\n -ms-overflow-style: none; // Same as above for IE 11\n &::-webkit-scrollbar {\n display: none; // This hides the scrollbars appearing under in Chrome\n }\n\n :host(limel-dock.has-mobile-layout) & {\n justify-content: space-between;\n flex-direction: row;\n }\n}\n\n// 👇 Below is a hidden and private prop\n// only for usage in Lime CRM components.\n// It enables our customers to override\n// the default Home icon, using an external URL\n// or an SVG code.\nlimel-dock-button {\n &:first-of-type {\n // `--crm-custom-home-icon-enabler`: in the CRM must be set to `''`\n --limel-custom-home-icon-enabler: var(--crm-custom-home-icon-enabler);\n // `--crm-custom-home-icon` in the CRM must be set to a url to an image file, or an SVG code\n --limel-custom-home-icon: var(--crm-custom-home-icon);\n }\n}\n\n@import './partial-styles/shrink-expand-button';\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { DockItem } from './dock.types';\n\nconst DEFAULT_MOBILE_BREAKPOINT = 700;\n\n/**\n * @exampleComponent limel-example-dock-basic\n * @exampleComponent limel-example-dock-custom-component\n * @exampleComponent limel-example-dock-notification\n * @exampleComponent limel-example-dock-mobile\n * @exampleComponent limel-example-dock-expanded\n * @exampleComponent limel-example-dock-colors-css\n */\n@Component({\n tag: 'limel-dock',\n shadow: true,\n styleUrl: 'dock.scss',\n})\nexport class Dock {\n /**\n * Items that are placed in the dock.\n */\n @Prop()\n public dockItems: DockItem[] = [];\n\n /**\n * Items that are placed at the bottom of the dock. (Or at the end in mobile\n * layout.)\n */\n @Prop()\n public dockFooterItems?: DockItem[] = [];\n\n /**\n * A label used to describe the purpose of the navigation element to users\n * of assistive technologies, like screen readers. Especially useful when\n * there are multiple navigation elements in the user interface.\n * Example value: \"Primary navigation\"\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * Defines the width of the component, when it loads.\n * - `true`: shows both icons and labels of the Dock items.\n * - `false`: only shows icons of the doc items, and displays\n * their labels as tooltip.\n *\n * Note: when `useMobileLayout` is `true`, labels will always\n * be shown as tooltips. Read more below…\n */\n @Prop({ reflect: true })\n public expanded? = false;\n\n /**\n * Set to `false` if you do not want to allow end-users\n * to exapnd or shrink the Dock. This will hide the\n * expand/shrink button, and the only things that defines\n * the layout will be the `expanded` property, and\n * the `mobileBreakPoint`.\n */\n @Prop({ reflect: true })\n public allowResize? = true;\n\n /**\n * Defines the breakpoint in pixles, at which the component will be rendered\n * in a hoizontal layout. Default breakpoint is `700` pixels, which means\n * when the screen size is smaller than `700px`, the component will automatically\n * switch to a horizontal layout.\n */\n @Prop({ reflect: true })\n public mobileBreakPoint?: number = DEFAULT_MOBILE_BREAKPOINT;\n\n /**\n * Fired when a dock item has been selected from the dock.\n */\n @Event()\n public itemSelected: EventEmitter<DockItem>;\n\n /**\n * Fired when a dock menu is opened.\n */\n @Event()\n public menuOpen: EventEmitter<DockItem>;\n\n /**\n * Fired when the popover is closed.\n */\n @Event()\n public close: EventEmitter<void>;\n\n /**\n * Fired when a Dock is expanded or collapsed.\n */\n @Event()\n private dockExpanded: EventEmitter<boolean>;\n\n /**\n * Is used to render the component horizontally, and place\n * the Dock items in a row.\n */\n @State()\n private useMobileLayout = false;\n\n private resizeObserver: ResizeObserver;\n\n public componentDidLoad() {\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(document.body);\n }\n\n disconnectedCallback() {\n this.resizeObserver.disconnect();\n }\n\n public render() {\n return (\n <Host\n class={{\n dock: true,\n expanded: this.expanded,\n 'has-mobile-layout': this.useMobileLayout,\n }}\n >\n <nav aria-label={this.accessibleLabel}>\n {this.dockItems.map(this.renderDockItem)}\n {this.renderSeparator()}\n {this.dockFooterItems.map(this.renderDockItem)}\n </nav>\n {this.renderExpandShrinkToggle()}\n </Host>\n );\n }\n\n private renderSeparator = () => {\n return this.useMobileLayout ? null : <span class=\"footer-separator\" />;\n };\n\n private renderDockItem = (item: DockItem) => {\n return (\n <limel-dock-button\n class={{\n 'dock-item': true,\n selected: item.selected,\n }}\n item={item}\n expanded={this.expanded && !this.useMobileLayout}\n useMobileLayout={this.useMobileLayout}\n />\n );\n };\n\n private handleResize = () => {\n if (window.innerWidth <= this.mobileBreakPoint) {\n this.useMobileLayout = true;\n } else {\n this.useMobileLayout = false;\n }\n };\n\n private renderExpandShrinkToggle() {\n if (this.useMobileLayout || !this.allowResize) {\n return;\n }\n\n return (\n <button\n class={{\n 'expand-shrink': true,\n expanded: this.expanded,\n }}\n onClick={this.toggleDockWidth}\n >\n <limel-icon name=\"angle_right\" />\n </button>\n );\n }\n\n private toggleDockWidth = () => {\n this.expanded = !this.expanded;\n this.dockExpanded.emit(this.expanded);\n };\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-dock.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,OAAO,GAAG,+sGAA+sG;;ACW/tG,MAAM,yBAAyB,GAAG,GAAG,CAAC;MAezB,IAAI;;;;;;;IAmHL,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,CAAC,eAAe;OAC5C,IAEDD,+BAAiB,IAAI,CAAC,eAAe,IAChC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,EACvC,IAAI,CAAC,eAAe,EAAE,EACtB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAC5C,EACL,IAAI,CAAC,wBAAwB,EAAE,CAC7B,EACT;GACL;EA4BO,wBAAwB;IAC5B,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;MAC3C,OAAO;KACV;IAED,QACIA,oBACI,KAAK,EAAE;QACH,eAAe,EAAE,IAAI;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;OAC1B,EACD,OAAO,EAAE,IAAI,CAAC,eAAe,IAE7BA,wBAAY,IAAI,EAAC,aAAa,GAAG,CAC5B,EACX;GACL;;;;;;","names":["h","Host"],"sources":["./src/components/dock/dock.scss?tag=limel-dock&encapsulation=shadow","./src/components/dock/dock.tsx"],"sourcesContent":["@use '../../style/mixins';\n@use '../../style/functions';\n\n/**\n* @prop --dock-expanded-max-width: The maximum width of the Dock when it is expanded. Defaults to `max-content` which means the Dock will adjust its width to the widest dock item.\n* @prop --dock-background-color: Background color of the whole component, defaults to `--contrast-100`.\n* @prop --dock-item-background-color--selected: Background color of selected dock item, defaults to `--contrast-200`.\n* @prop --dock-item-text-color: Text of dock items, defaults to `--contrast-1100`.\n* @prop --dock-item-text-color--selected: Text color of selected dock item, defaults to `--contrast-1300`.\n* @prop --dock-item-icon-color: Color of the optional icons used in each dock item. Only affects inactive dock items, defaults to text colors for default or selected states.\n* @prop --dock-padding-top: Space of top side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-top)`.\n* @prop --dock-padding-right: Space of the right side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-right)`.\n* @prop --dock-padding-bottom: Space of the bottom side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-bottom)`.\n* @prop --dock-padding-left: Space of the left side of the Dock. Can be used with environment variables, to take into account safe areas on mobile devices with rounded screen corners or those that have a \"notch\". For instance can be set to `env(safe-area-inset-left)`.\n* @prop --popover-surface-width: Defines the width of the popover that is opened for dock items with custom components. Defaults to `auto`.\n*/\n\n:host(limel-dock) {\n --badge-background-color: rgb(var(--color-red-default));\n --badge-text-color: rgb(var(--color-white));\n\n --dock-item-height: 2.75rem;\n --limel-dock-padding: 0.25rem;\n --dock-expand-shrink-button-height: 1rem;\n\n --limel-dock-item-text-color: var(\n --dock-item-text-color,\n rgb(var(--contrast-1100))\n );\n --limel-dock-item-text-color--selected: var(\n --dock-item-text-color--selected,\n rgb(var(--contrast-1300))\n );\n\n isolation: isolate;\n position: relative;\n\n display: inline-flex;\n flex-direction: column;\n\n background-color: var(--dock-background-color, rgb(var(--contrast-100)));\n box-shadow: var(--shadow-depth-8);\n\n padding-top: var(--dock-padding-top);\n padding-right: var(--dock-padding-right);\n padding-bottom: var(--dock-padding-bottom);\n padding-left: var(--dock-padding-left);\n}\n\n:host(limel-dock:not(.has-mobile-layout)) {\n height: 100%;\n width: calc((var(--limel-dock-padding) * 2) + var(--dock-item-height));\n nav {\n padding-bottom: calc((var(--limel-dock-padding) + 0.25rem));\n }\n}\n\n:host(limel-dock.expanded) {\n width: var(--dock-expanded-max-width, max-content);\n}\n\n.footer-separator {\n margin-top: auto;\n justify-self: flex-end;\n}\n\nnav {\n box-sizing: border-box;\n display: inline-flex;\n flex-direction: column;\n gap: functions.pxToRem(6);\n flex-grow: 1;\n\n padding: var(--limel-dock-padding); // needed for the focus effect\n\n overflow-y: auto;\n scrollbar-width: none; // This hides the scrollbars appearing under in Firefox\n -ms-overflow-style: none; // Same as above for IE 11\n &::-webkit-scrollbar {\n display: none; // This hides the scrollbars appearing under in Chrome\n }\n\n :host(limel-dock.has-mobile-layout) & {\n justify-content: space-between;\n flex-direction: row;\n }\n}\n\n// 👇 Below is a hidden and private prop\n// only for usage in Lime CRM components.\n// It enables our customers to override\n// the default Home icon, using an external URL\n// or an SVG code.\nlimel-dock-button {\n &:first-of-type {\n // `--crm-custom-home-icon-enabler`: in the CRM must be set to `''`\n --limel-custom-home-icon-enabler: var(--crm-custom-home-icon-enabler);\n // `--crm-custom-home-icon` in the CRM must be set to a url to an image file, or an SVG code\n --limel-custom-home-icon: var(--crm-custom-home-icon);\n }\n}\n\n@import './partial-styles/shrink-expand-button';\n","import {\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Prop,\n State,\n} from '@stencil/core';\nimport { DockItem } from './dock.types';\n\nconst DEFAULT_MOBILE_BREAKPOINT = 700;\n\n/**\n * @exampleComponent limel-example-dock-basic\n * @exampleComponent limel-example-dock-custom-component\n * @exampleComponent limel-example-dock-notification\n * @exampleComponent limel-example-dock-mobile\n * @exampleComponent limel-example-dock-expanded\n * @exampleComponent limel-example-dock-colors-css\n */\n@Component({\n tag: 'limel-dock',\n shadow: true,\n styleUrl: 'dock.scss',\n})\nexport class Dock {\n /**\n * Items that are placed in the dock.\n */\n @Prop()\n public dockItems: DockItem[] = [];\n\n /**\n * Items that are placed at the bottom of the dock. (Or at the end in mobile\n * layout.)\n */\n @Prop()\n public dockFooterItems?: DockItem[] = [];\n\n /**\n * A label used to describe the purpose of the navigation element to users\n * of assistive technologies, like screen readers. Especially useful when\n * there are multiple navigation elements in the user interface.\n * Example value: \"Primary navigation\"\n */\n @Prop({ reflect: true })\n public accessibleLabel?: string;\n\n /**\n * Defines the width of the component, when it loads.\n * - `true`: shows both icons and labels of the Dock items.\n * - `false`: only shows icons of the doc items, and displays\n * their labels as tooltip.\n *\n * Note: when `useMobileLayout` is `true`, labels will always\n * be shown as tooltips. Read more below…\n */\n @Prop({ reflect: true })\n public expanded? = false;\n\n /**\n * Set to `false` if you do not want to allow end-users\n * to exapnd or shrink the Dock. This will hide the\n * expand/shrink button, and the only things that defines\n * the layout will be the `expanded` property, and\n * the `mobileBreakPoint`.\n */\n @Prop({ reflect: true })\n public allowResize? = true;\n\n /**\n * Defines the breakpoint in pixles, at which the component will be rendered\n * in a hoizontal layout. Default breakpoint is `700` pixels, which means\n * when the screen size is smaller than `700px`, the component will automatically\n * switch to a horizontal layout.\n */\n @Prop({ reflect: true })\n public mobileBreakPoint?: number = DEFAULT_MOBILE_BREAKPOINT;\n\n /**\n * Fired when a dock item has been selected from the dock.\n */\n @Event()\n public itemSelected: EventEmitter<DockItem>;\n\n /**\n * Fired when a dock menu is opened.\n */\n @Event()\n public menuOpen: EventEmitter<DockItem>;\n\n /**\n * Fired when the popover is closed.\n */\n @Event()\n public close: EventEmitter<void>;\n\n /**\n * Fired when a Dock is expanded or collapsed.\n */\n @Event()\n private dockExpanded: EventEmitter<boolean>;\n\n /**\n * Is used to render the component horizontally, and place\n * the Dock items in a row.\n */\n @State()\n private useMobileLayout = false;\n\n private resizeObserver: ResizeObserver;\n\n public componentDidLoad() {\n this.resizeObserver = new ResizeObserver(this.handleResize);\n this.resizeObserver.observe(document.body);\n }\n\n disconnectedCallback() {\n this.resizeObserver.disconnect();\n }\n\n public render() {\n return (\n <Host\n class={{\n dock: true,\n expanded: this.expanded,\n 'has-mobile-layout': this.useMobileLayout,\n }}\n >\n <nav aria-label={this.accessibleLabel}>\n {this.dockItems.map(this.renderDockItem)}\n {this.renderSeparator()}\n {this.dockFooterItems.map(this.renderDockItem)}\n </nav>\n {this.renderExpandShrinkToggle()}\n </Host>\n );\n }\n\n private renderSeparator = () => {\n return this.useMobileLayout ? null : <span class=\"footer-separator\" />;\n };\n\n private renderDockItem = (item: DockItem) => {\n return (\n <limel-dock-button\n class={{\n 'dock-item': true,\n selected: item.selected,\n }}\n item={item}\n expanded={this.expanded && !this.useMobileLayout}\n useMobileLayout={this.useMobileLayout}\n />\n );\n };\n\n private handleResize = () => {\n if (window.innerWidth <= this.mobileBreakPoint) {\n this.useMobileLayout = true;\n } else {\n this.useMobileLayout = false;\n }\n };\n\n private renderExpandShrinkToggle() {\n if (this.useMobileLayout || !this.allowResize) {\n return;\n }\n\n return (\n <button\n class={{\n 'expand-shrink': true,\n expanded: this.expanded,\n }}\n onClick={this.toggleDockWidth}\n >\n <limel-icon name=\"angle_right\" />\n </button>\n );\n }\n\n private toggleDockWidth = () => {\n this.expanded = !this.expanded;\n this.dockExpanded.emit(this.expanded);\n };\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-file-viewer.entry.cjs.js","mappings":";;;;;;;AAAA;;;;;SAKgB,eAAe,CAAC,QAAQ,EAAE,GAAG;EACzC,MAAM,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC;EACjC,IAAI,CAAC,QAAQ,EAAE;IACX,OAAO,SAAS,CAAC;GACpB;EAED,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;EAC1D,MAAM,iBAAiB,GAAG;IACtB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,EAAE,EAAE,OAAO;IACX,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,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;MACpC,OAAO,IAAI,CAAC,0BAA0B,EAAE,CAAC;KAC5C;IAED,IAAI,IAAI,CAAC,OAAO,EAAE;MACd,OAAOA,2BAAe,IAAI,EAAC,SAAS,EAAC,WAAW,EAAE,KAAK,GAAI,CAAC;KAC/D;IAED,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;GAClC;EAGS,MAAM,QAAQ,CAAC,MAAc,EAAE,MAAc;IACnD,IAAI,MAAM,KAAK,MAAM,EAAE;MACnB,OAAO;KACV;IAED,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACpB,IAAI,CAAC,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7D,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;GACvC;EAEO,gBAAgB;IACpB,MAAM,mBAAmB,GAAG;MACxB,GAAG,EAAE,IAAI,CAAC,SAAS;MACnB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,KAAK,EAAE,IAAI,CAAC,WAAW;MACvB,IAAI,EAAE,IAAI,CAAC,UAAU;MACrB,MAAM,EAAE,IAAI,CAAC,YAAY;KAC5B,CAAC;IACF,MAAM,kBAAkB,GACpB,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClC,IAAI,CAAC,0BAA0B,CAAC;IAEpC,OAAO,kBAAkB,EAAE,CAAC;GAC/B;EAoPO,cAAc,CAAC,GAAW;IAC9B,OAAOC,sBAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC5C;;;;;;;;;;","names":["h","translate"],"sources":["./src/components/file-viewer/extension-mapping.tsx","./src/components/file-viewer/fullscreen.ts","./src/components/file-viewer/file-viewer.scss?tag=limel-file-viewer&encapsulation=shadow","./src/components/file-viewer/file-viewer.tsx"],"sourcesContent":["/**\n *\n * @param fileName\n * @param url\n */\nexport function detectExtension(fileName, url): any {\n const pathLike = fileName || url;\n if (!pathLike) {\n return 'unknown';\n }\n\n const extension = pathLike.split('.').pop().toLowerCase();\n const extensionsToTypes = {\n pdf: 'pdf',\n jpg: 'image',\n jpeg: 'image',\n heic: 'image',\n bmp: 'image',\n png: 'image',\n gif: 'image',\n svg: 'image',\n svgz: 'image',\n ep: 'image',\n eps: 'image',\n avi: 'video',\n flv: 'video',\n h264: 'video',\n mov: 'video',\n mp4: 'video',\n mwv: 'video',\n mkv: 'video',\n mp3: 'audio',\n wav: 'audio',\n wma: 'audio',\n ogg: 'audio',\n txt: 'text',\n json: 'text',\n html: 'text',\n xml: 'text',\n // Word\n doc: 'office',\n docx: 'office',\n odt: 'office',\n dot: 'office',\n dotx: 'office',\n docm: 'office', // not supported\n dotm: 'office', // not yet tested\n // Presentation\n pot: 'office', // not tested\n ppt: 'office',\n pptx: 'office',\n odp: 'office',\n potx: 'office', // not supported\n potm: 'office', // not supported\n pps: 'office',\n ppsx: 'office',\n ppsm: 'office', // not supported\n pptm: 'office', // not supported\n ppam: 'office', // not tested\n pages: 'office', // not supported (Apple)\n // Spreadsheet\n xls: 'office',\n xlsx: 'office',\n xlsm: 'office',\n xlsb: 'office',\n ods: 'office',\n csv: 'office', // not supported\n numbers: 'office', // not supported (Apple)\n };\n\n return extensionsToTypes[extension] || 'unknown';\n}\n","export class Fullscreen {\n private enter: () => void;\n private exit: () => void;\n\n constructor(element: any) {\n this.enter =\n element.requestFullscreen ||\n element.msRequestFullscreen ||\n element.mozRequestFullScreen ||\n element.webkitRequestFullscreen;\n this.enter = this.enter.bind(element);\n const doc: any = window.document;\n this.exit =\n doc.exitFullscreen ||\n doc.msExitFullscreen ||\n doc.mozCancelFullScreen ||\n doc.webkitExitFullscreen;\n }\n\n public requestFullscreen = () => {\n if (this.enter) {\n this.enter();\n }\n };\n\n public exitFullscreen = () => {\n if (this.exit) {\n this.exit.bind(window.document)();\n }\n };\n\n public toggle = () => {\n const doc: any = window.document;\n const isFullscreen =\n doc.fullscreenElement ||\n doc.mozFullScreenElement ||\n doc.webkitFullscreenElement ||\n doc.msFullscreenElement;\n\n if (isFullscreen) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n };\n\n public isSupported(): boolean {\n return !!this.requestFullscreen;\n }\n}\n","@use '../../style/internal/variables';\n@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n\n$size-of-buttons: 2rem;\n\n:host {\n isolation: isolate;\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n\n* {\n box-sizing: border-box;\n}\n\nimg,\nvideo,\naudio,\nobject,\niframe {\n max-height: 100%;\n max-width: 100%;\n box-sizing: border-box;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n min-height: 20rem; // makes sure to get minimum comfortable space for viewing office files, and Microsoft Office viewers toolbars\n}\n\nimg {\n min-width: 7rem;\n object-fit: contain; // increases or decreases the size of the image to fill the box whilst preserving its aspect-ratio.\n}\n\nvideo {\n width: 100%;\n height: auto;\n}\n\naudio {\n width: 100%;\n}\n\nobject {\n width: 100%;\n height: 100%;\n}\n\nobject[type='application/pdf'] {\n min-height: 20rem;\n // makes sure to get browsers' native controls for the PDF\n}\n\nobject[type='text/plain'] {\n border-radius: 0.25rem;\n padding-right: $size-of-buttons;\n\n overflow-y: auto;\n}\n\n@mixin plain-text-in-fullscreen {\n background-color: rgb(var(--color-gray-darker));\n\n object[type='text/plain'] {\n max-width: 50rem;\n max-height: calc(100% - 2rem);\n }\n}\n\n:host(:fullscreen) {\n @include plain-text-in-fullscreen;\n}\n:host(:-webkit-full-screen) {\n // this is repetition of the previous block,\n // but needed for Safari to work.\n // Cannot write SCSS rules for `:host` using commas for some reason.\n // e.g.: `:host(:fullscreen), :host(:-webkit-full-screen)`.\n // So you have to repeat it sadly.\n @include plain-text-in-fullscreen;\n}\n\n@import './partial-styles/ui-controls.scss';\n","import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages } from '../date-picker/date.types';\nimport { ListItem } from '../list/list-item.types';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\nimport { LimelMenuCustomEvent } from '../../components';\n\n/**\n * This is a smart component that automatically detects\n * the most common file types such as image, audio, video, and text,\n * and properly displays them in the browser.\n * The component is also capable to render the most common office files.\n *\n * :::note\n * Image files will always be contained in their containers, which means\n * they automatically increase or decrease in size to fill their containing box\n * whilst preserving their aspect-ratio.\n *\n * Text and PDF files will also always respect the width and height of the\n * container in which the `limel-file-viewer` is loaded.\n * :::\n *\n * For some file types such as text and images, the component will display a\n * download button and a button to open the file in a new browser tab.\n * This will allow users to preview the file in a fullscreen mode with the\n * browser and take advantage of for example native zooming and panning\n * functionalities.\n *\n * @exampleComponent limel-example-file-viewer-basic\n * @exampleComponent limel-example-file-viewer-office\n * @exampleComponent limel-example-file-viewer-filename\n * @exampleComponent limel-example-file-viewer-inbuilt-actions\n * @exampleComponent limel-example-file-viewer-custom-actions\n * @exampleComponent limel-example-file-viewer-with-picker\n *\n * @beta\n */\n\n@Component({\n tag: 'limel-file-viewer',\n shadow: true,\n styleUrl: 'file-viewer.scss',\n})\nexport class FileViewer {\n /**\n * Link to the file\n */\n @Prop({ reflect: true })\n public url: string;\n\n /**\n * The name of the file that must also contains its extension.\n * This overrides the filename that the `url` ends with.\n * Useful when the `url` does not contain the filename.\n * When specified, the `filename` will be used as filename of\n * the downloaded file.\n */\n @Prop({ reflect: true })\n public filename?: string;\n\n /**\n * An optional alternative text, mainly for assistive technologies and screen readers.\n * It is used for only image files, as an `alt` attribute.\n * Should optimally hold a description of the image,\n * which is also displayed on the page if the image can't be loaded for some reason.\n */\n @Prop({ reflect: true })\n public alt?: string;\n\n /**\n * Displays a button that allows the user to view the file\n * in fullscreen mode.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowFullscreen?: boolean = false;\n\n /**\n * Displays a button that allows the user to open the file\n * in a new browser tab.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowOpenInNewTab?: boolean = false;\n\n /**\n * Displays a button that allows the user to download the file.\n * Note that due to the browser's security policies,\n * the file should be hosted on the same domain\n * for the download button to work properly.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowDownload?: boolean = false;\n\n /**\n * Defines the localization for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Defines the third-party viewer that should be used to render\n * the content of office files, such as word processing documents,\n * presentations, or spreadsheets.\n */\n @Prop({ reflect: true })\n public officeViewer: OfficeViewer = 'microsoft-office';\n\n /**\n * An array of custom actions that can be displayed\n * as an action menu on the file which is being displayed.\n */\n @Prop()\n public actions: ListItem[];\n\n /**\n * Emitted when a custom action is selected from the action menu.\n */\n @Event()\n public action: EventEmitter<ListItem>;\n\n @Element()\n public HostElement: HTMLLimelFileViewerElement;\n\n private fullscreen: Fullscreen;\n\n @State()\n private isFullscreen: boolean = false;\n\n @State()\n private fileType: FileType;\n\n /**\n * True while the file is being loaded.\n */\n @State()\n private loading: boolean = true;\n\n @State()\n private fileUrl: string = '';\n\n constructor() {\n this.fullscreen = new Fullscreen(this.HostElement);\n }\n\n public async componentWillLoad() {\n this.fileType = detectExtension(this.filename, this.url);\n await this.createURL(this.fileType);\n }\n\n public render() {\n if (!this.isOfficeFileAccessibleViaURL) {\n return this.renderNoFileSupportMessage();\n }\n\n if (this.loading) {\n return <limel-spinner size=\"x-small\" limeBranded={false} />;\n }\n\n return this.renderFileViewer();\n }\n\n @Watch('url')\n protected async watchUrl(newUrl: string, oldUrl: string) {\n if (newUrl === oldUrl) {\n return;\n }\n\n this.loading = true;\n this.fileType = detectExtension(this.filename, this.fileUrl);\n await this.createURL(this.fileType);\n }\n\n private renderFileViewer() {\n const fileViewerFunctions = {\n pdf: this.renderPdf,\n image: this.renderImage,\n video: this.renderVideo,\n audio: this.renderAudio,\n text: this.renderText,\n office: this.renderOffice,\n };\n const fileViewerFunction =\n fileViewerFunctions[this.fileType] ||\n this.renderNoFileSupportMessage;\n\n return fileViewerFunction();\n }\n\n private renderPdf = () => {\n return [\n <div class=\"action-menu-for-pdf-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe src={this.fileUrl} loading=\"lazy\" />,\n ];\n };\n\n private renderImage = () => {\n return [\n this.renderButtons(),\n <img src={this.fileUrl} alt={this.alt} loading=\"lazy\" />,\n ];\n };\n\n private renderVideo = () => {\n return (\n <video controls>\n <source src={this.fileUrl} />\n </video>\n );\n };\n\n private renderAudio = () => {\n return (\n <audio controls>\n <source src={this.fileUrl} />\n </audio>\n );\n };\n\n private renderText = () => {\n return [\n this.renderButtons(),\n <object data={this.fileUrl} type=\"text/plain\">\n {`Text content from: ${this.filename || this.url}`}\n <a\n href={this.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Open text file in new tab\n </a>\n </object>,\n ];\n };\n\n private renderOffice = () => {\n return [\n <div class=\"action-menu-for-office-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe\n src={\n this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true'\n }\n loading=\"lazy\"\n />,\n ];\n };\n\n private isOfficeFileAccessibleViaURL = () => {\n return (\n this.fileType === 'office' &&\n !(\n this.fileUrl.startsWith('http://') ||\n this.fileUrl.startsWith('https://')\n )\n );\n };\n\n private getOfficeViewerUrl = () => {\n const officeViewers = {\n 'microsoft-office':\n 'https://view.officeapps.live.com/op/embed.aspx?src=',\n 'google-drive': 'https://docs.google.com/gview?url=',\n };\n\n return officeViewers[this.officeViewer];\n };\n\n private renderNoFileSupportMessage = () => {\n return (\n <div class=\"no-support\" role=\"alert\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>\n {this.getTranslation(\n 'file-viewer.message.unsupported-filetype'\n )}\n </p>\n {this.renderDownloadButton()}\n </div>\n );\n };\n\n private renderButtons = () => {\n return (\n <div class=\"buttons\">\n {this.renderActionMenu()}\n {this.renderToggleFullscreenButton()}\n {this.renderDownloadButton()}\n {this.renderOpenInNewTabButton()}\n </div>\n );\n };\n\n private renderToggleFullscreenButton = () => {\n if (!this.allowFullscreen || !this.fullscreen.isSupported()) {\n return;\n }\n\n const icon = this.isFullscreen ? 'multiply' : 'fit_to_width';\n\n const label = this.isFullscreen\n ? this.getTranslation('file-viewer.exit-fullscreen')\n : this.getTranslation('file-viewer.open-in-fullscreen');\n\n return [\n <button\n class=\"button--toggle-fullscreen\"\n id=\"tooltip-toggle-fullscreen\"\n role=\"button\"\n onClick={this.handleToggleFullscreen}\n >\n <limel-icon name={icon} />\n <limel-tooltip\n label={label}\n elementId=\"tooltip-toggle-fullscreen\"\n openDirection=\"left\"\n />\n </button>,\n ];\n };\n\n private renderDownloadButton = () => {\n if (!this.allowDownload || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--download\"\n id=\"tooltip-download\"\n role=\"button\"\n download={this.filename ?? ''}\n href={this.fileUrl}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.download')}\n elementId=\"tooltip-download\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderOpenInNewTabButton = () => {\n if (!this.allowOpenInNewTab || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--new-tab\"\n id=\"tooltip-new-tab\"\n role=\"button\"\n href={this.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <limel-icon name=\"external_link\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.open-in-new-tab')}\n elementId=\"tooltip-new-tab\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderActionMenu = () => {\n if (!this.actions || this.isFullscreen) {\n return;\n }\n\n return (\n <limel-menu\n class=\"action-menu\"\n items={this.actions}\n onSelect={this.emitOnAction}\n open-direction=\"left\"\n >\n <button\n class=\"button--action\"\n id=\"tooltip-more\"\n role=\"button\"\n slot=\"trigger\"\n >\n <limel-icon name=\"menu_2\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.more-actions')}\n elementId=\"tooltip-more\"\n openDirection=\"left\"\n />\n </button>\n </limel-menu>\n );\n };\n\n private createURL = async (fileType: string) => {\n if (['pdf'].includes(fileType)) {\n const response = await fetch(this.url);\n const blob = await response.blob();\n\n this.fileUrl = URL.createObjectURL(blob);\n } else {\n this.fileUrl = this.url;\n }\n\n this.loading = false;\n };\n\n private handleToggleFullscreen = () => {\n if (this.fullscreen.isSupported()) {\n this.fullscreen.toggle();\n this.isFullscreen = !this.isFullscreen;\n }\n };\n\n private emitOnAction = (event: LimelMenuCustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(key, this.language);\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-file-viewer.entry.cjs.js","mappings":";;;;;;;AAAA;;;;;SAKgB,eAAe,CAAC,QAAQ,EAAE,GAAG;EACzC,MAAM,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC;EACjC,IAAI,CAAC,QAAQ,EAAE;IACX,OAAO,SAAS,CAAC;GACpB;EAED,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC;EAC1D,MAAM,iBAAiB,GAAG;IACtB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,IAAI,EAAE,OAAO;IACb,EAAE,EAAE,OAAO;IACX,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EA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,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC5C;;;;;;;;;;","names":["h","translate"],"sources":["./src/components/file-viewer/extension-mapping.tsx","./src/components/file-viewer/fullscreen.ts","./src/components/file-viewer/file-viewer.scss?tag=limel-file-viewer&encapsulation=shadow","./src/components/file-viewer/file-viewer.tsx"],"sourcesContent":["/**\n *\n * @param fileName\n * @param url\n */\nexport function detectExtension(fileName, url): any {\n const pathLike = fileName || url;\n if (!pathLike) {\n return 'unknown';\n }\n\n const extension = pathLike.split('.').pop().toLowerCase();\n const extensionsToTypes = {\n pdf: 'pdf',\n jpg: 'image',\n jpeg: 'image',\n heic: 'image',\n bmp: 'image',\n png: 'image',\n gif: 'image',\n svg: 'image',\n svgz: 'image',\n ep: 'image',\n eps: 'image',\n avi: 'video',\n flv: 'video',\n h264: 'video',\n mov: 'video',\n mp4: 'video',\n mwv: 'video',\n mkv: 'video',\n mp3: 'audio',\n wav: 'audio',\n wma: 'audio',\n ogg: 'audio',\n txt: 'text',\n json: 'text',\n html: 'text',\n xml: 'text',\n // Word\n doc: 'office',\n docx: 'office',\n odt: 'office',\n dot: 'office',\n dotx: 'office',\n docm: 'office', // not supported\n dotm: 'office', // not yet tested\n // Presentation\n pot: 'office', // not tested\n ppt: 'office',\n pptx: 'office',\n odp: 'office',\n potx: 'office', // not supported\n potm: 'office', // not supported\n pps: 'office',\n ppsx: 'office',\n ppsm: 'office', // not supported\n pptm: 'office', // not supported\n ppam: 'office', // not tested\n pages: 'office', // not supported (Apple)\n // Spreadsheet\n xls: 'office',\n xlsx: 'office',\n xlsm: 'office',\n xlsb: 'office',\n ods: 'office',\n csv: 'office', // not supported\n numbers: 'office', // not supported (Apple)\n };\n\n return extensionsToTypes[extension] || 'unknown';\n}\n","export class Fullscreen {\n private enter: () => void;\n private exit: () => void;\n\n constructor(element: any) {\n this.enter =\n element.requestFullscreen ||\n element.msRequestFullscreen ||\n element.mozRequestFullScreen ||\n element.webkitRequestFullscreen;\n this.enter = this.enter.bind(element);\n const doc: any = window.document;\n this.exit =\n doc.exitFullscreen ||\n doc.msExitFullscreen ||\n doc.mozCancelFullScreen ||\n doc.webkitExitFullscreen;\n }\n\n public requestFullscreen = () => {\n if (this.enter) {\n this.enter();\n }\n };\n\n public exitFullscreen = () => {\n if (this.exit) {\n this.exit.bind(window.document)();\n }\n };\n\n public toggle = () => {\n const doc: any = window.document;\n const isFullscreen =\n doc.fullscreenElement ||\n doc.mozFullScreenElement ||\n doc.webkitFullscreenElement ||\n doc.msFullscreenElement;\n\n if (isFullscreen) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n };\n\n public isSupported(): boolean {\n return !!this.requestFullscreen;\n }\n}\n","@use '../../style/internal/shared_input-select-picker';\n@use '../../style/mixins';\n\n$size-of-buttons: 2rem;\n\n:host {\n isolation: isolate;\n position: relative;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n}\n\n* {\n box-sizing: border-box;\n}\n\nimg,\nvideo,\naudio,\nobject,\niframe {\n max-height: 100%;\n max-width: 100%;\n box-sizing: border-box;\n}\n\niframe {\n border: none;\n width: 100%;\n height: 100%;\n min-height: 20rem; // makes sure to get minimum comfortable space for viewing office files, and Microsoft Office viewers toolbars\n}\n\nimg {\n min-width: 7rem;\n object-fit: contain; // increases or decreases the size of the image to fill the box whilst preserving its aspect-ratio.\n}\n\nvideo {\n width: 100%;\n height: auto;\n}\n\naudio {\n width: 100%;\n}\n\nobject {\n width: 100%;\n height: 100%;\n}\n\nobject[type='application/pdf'] {\n min-height: 20rem;\n // makes sure to get browsers' native controls for the PDF\n}\n\nobject[type='text/plain'] {\n border-radius: 0.25rem;\n padding-right: $size-of-buttons;\n\n overflow-y: auto;\n}\n\n@mixin plain-text-in-fullscreen {\n background-color: rgb(var(--color-gray-darker));\n\n object[type='text/plain'] {\n max-width: 50rem;\n max-height: calc(100% - 2rem);\n }\n}\n\n:host(:fullscreen) {\n @include plain-text-in-fullscreen;\n}\n:host(:-webkit-full-screen) {\n // this is repetition of the previous block,\n // but needed for Safari to work.\n // Cannot write SCSS rules for `:host` using commas for some reason.\n // e.g.: `:host(:fullscreen), :host(:-webkit-full-screen)`.\n // So you have to repeat it sadly.\n @include plain-text-in-fullscreen;\n}\n\n@import './partial-styles/ui-controls.scss';\n","import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages } from '../date-picker/date.types';\nimport { ListItem } from '../list/list-item.types';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\nimport { LimelMenuCustomEvent } from '../../components';\n\n/**\n * This is a smart component that automatically detects\n * the most common file types such as image, audio, video, and text,\n * and properly displays them in the browser.\n * The component is also capable to render the most common office files.\n *\n * :::note\n * Image files will always be contained in their containers, which means\n * they automatically increase or decrease in size to fill their containing box\n * whilst preserving their aspect-ratio.\n *\n * Text and PDF files will also always respect the width and height of the\n * container in which the `limel-file-viewer` is loaded.\n * :::\n *\n * For some file types such as text and images, the component will display a\n * download button and a button to open the file in a new browser tab.\n * This will allow users to preview the file in a fullscreen mode with the\n * browser and take advantage of for example native zooming and panning\n * functionalities.\n *\n * @exampleComponent limel-example-file-viewer-basic\n * @exampleComponent limel-example-file-viewer-office\n * @exampleComponent limel-example-file-viewer-filename\n * @exampleComponent limel-example-file-viewer-inbuilt-actions\n * @exampleComponent limel-example-file-viewer-custom-actions\n * @exampleComponent limel-example-file-viewer-with-picker\n *\n * @beta\n */\n\n@Component({\n tag: 'limel-file-viewer',\n shadow: true,\n styleUrl: 'file-viewer.scss',\n})\nexport class FileViewer {\n /**\n * Link to the file\n */\n @Prop({ reflect: true })\n public url: string;\n\n /**\n * The name of the file that must also contains its extension.\n * This overrides the filename that the `url` ends with.\n * Useful when the `url` does not contain the filename.\n * When specified, the `filename` will be used as filename of\n * the downloaded file.\n */\n @Prop({ reflect: true })\n public filename?: string;\n\n /**\n * An optional alternative text, mainly for assistive technologies and screen readers.\n * It is used for only image files, as an `alt` attribute.\n * Should optimally hold a description of the image,\n * which is also displayed on the page if the image can't be loaded for some reason.\n */\n @Prop({ reflect: true })\n public alt?: string;\n\n /**\n * Displays a button that allows the user to view the file\n * in fullscreen mode.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowFullscreen?: boolean = false;\n\n /**\n * Displays a button that allows the user to open the file\n * in a new browser tab.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowOpenInNewTab?: boolean = false;\n\n /**\n * Displays a button that allows the user to download the file.\n * Note that due to the browser's security policies,\n * the file should be hosted on the same domain\n * for the download button to work properly.\n * Not displayed for office files!\n */\n @Prop({ reflect: true })\n public allowDownload?: boolean = false;\n\n /**\n * Defines the localization for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Defines the third-party viewer that should be used to render\n * the content of office files, such as word processing documents,\n * presentations, or spreadsheets.\n */\n @Prop({ reflect: true })\n public officeViewer: OfficeViewer = 'microsoft-office';\n\n /**\n * An array of custom actions that can be displayed\n * as an action menu on the file which is being displayed.\n */\n @Prop()\n public actions: ListItem[];\n\n /**\n * Emitted when a custom action is selected from the action menu.\n */\n @Event()\n public action: EventEmitter<ListItem>;\n\n @Element()\n public HostElement: HTMLLimelFileViewerElement;\n\n private fullscreen: Fullscreen;\n\n @State()\n private isFullscreen: boolean = false;\n\n @State()\n private fileType: FileType;\n\n /**\n * True while the file is being loaded.\n */\n @State()\n private loading: boolean = true;\n\n @State()\n private fileUrl: string = '';\n\n constructor() {\n this.fullscreen = new Fullscreen(this.HostElement);\n }\n\n public async componentWillLoad() {\n this.fileType = detectExtension(this.filename, this.url);\n await this.createURL(this.fileType);\n }\n\n public render() {\n if (!this.isOfficeFileAccessibleViaURL) {\n return this.renderNoFileSupportMessage();\n }\n\n if (this.loading) {\n return <limel-spinner size=\"x-small\" limeBranded={false} />;\n }\n\n return this.renderFileViewer();\n }\n\n @Watch('url')\n protected async watchUrl(newUrl: string, oldUrl: string) {\n if (newUrl === oldUrl) {\n return;\n }\n\n this.loading = true;\n this.fileType = detectExtension(this.filename, this.fileUrl);\n await this.createURL(this.fileType);\n }\n\n private renderFileViewer() {\n const fileViewerFunctions = {\n pdf: this.renderPdf,\n image: this.renderImage,\n video: this.renderVideo,\n audio: this.renderAudio,\n text: this.renderText,\n office: this.renderOffice,\n };\n const fileViewerFunction =\n fileViewerFunctions[this.fileType] ||\n this.renderNoFileSupportMessage;\n\n return fileViewerFunction();\n }\n\n private renderPdf = () => {\n return [\n <div class=\"action-menu-for-pdf-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe src={this.fileUrl} loading=\"lazy\" />,\n ];\n };\n\n private renderImage = () => {\n return [\n this.renderButtons(),\n <img src={this.fileUrl} alt={this.alt} loading=\"lazy\" />,\n ];\n };\n\n private renderVideo = () => {\n return (\n <video controls>\n <source src={this.fileUrl} />\n </video>\n );\n };\n\n private renderAudio = () => {\n return (\n <audio controls>\n <source src={this.fileUrl} />\n </audio>\n );\n };\n\n private renderText = () => {\n return [\n this.renderButtons(),\n <object data={this.fileUrl} type=\"text/plain\">\n {`Text content from: ${this.filename || this.url}`}\n <a\n href={this.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Open text file in new tab\n </a>\n </object>,\n ];\n };\n\n private renderOffice = () => {\n return [\n <div class=\"action-menu-for-office-files\">\n {this.renderActionMenu()}\n </div>,\n <iframe\n src={\n this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true'\n }\n loading=\"lazy\"\n />,\n ];\n };\n\n private isOfficeFileAccessibleViaURL = () => {\n return (\n this.fileType === 'office' &&\n !(\n this.fileUrl.startsWith('http://') ||\n this.fileUrl.startsWith('https://')\n )\n );\n };\n\n private getOfficeViewerUrl = () => {\n const officeViewers = {\n 'microsoft-office':\n 'https://view.officeapps.live.com/op/embed.aspx?src=',\n 'google-drive': 'https://docs.google.com/gview?url=',\n };\n\n return officeViewers[this.officeViewer];\n };\n\n private renderNoFileSupportMessage = () => {\n return (\n <div class=\"no-support\" role=\"alert\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>\n {this.getTranslation(\n 'file-viewer.message.unsupported-filetype'\n )}\n </p>\n {this.renderDownloadButton()}\n </div>\n );\n };\n\n private renderButtons = () => {\n return (\n <div class=\"buttons\">\n {this.renderActionMenu()}\n {this.renderToggleFullscreenButton()}\n {this.renderDownloadButton()}\n {this.renderOpenInNewTabButton()}\n </div>\n );\n };\n\n private renderToggleFullscreenButton = () => {\n if (!this.allowFullscreen || !this.fullscreen.isSupported()) {\n return;\n }\n\n const icon = this.isFullscreen ? 'multiply' : 'fit_to_width';\n\n const label = this.isFullscreen\n ? this.getTranslation('file-viewer.exit-fullscreen')\n : this.getTranslation('file-viewer.open-in-fullscreen');\n\n return [\n <button\n class=\"button--toggle-fullscreen\"\n id=\"tooltip-toggle-fullscreen\"\n role=\"button\"\n onClick={this.handleToggleFullscreen}\n >\n <limel-icon name={icon} />\n <limel-tooltip\n label={label}\n elementId=\"tooltip-toggle-fullscreen\"\n openDirection=\"left\"\n />\n </button>,\n ];\n };\n\n private renderDownloadButton = () => {\n if (!this.allowDownload || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--download\"\n id=\"tooltip-download\"\n role=\"button\"\n download={this.filename ?? ''}\n href={this.fileUrl}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.download')}\n elementId=\"tooltip-download\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderOpenInNewTabButton = () => {\n if (!this.allowOpenInNewTab || this.isFullscreen) {\n return;\n }\n\n return (\n <a\n class=\"button--new-tab\"\n id=\"tooltip-new-tab\"\n role=\"button\"\n href={this.fileUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n <limel-icon name=\"external_link\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.open-in-new-tab')}\n elementId=\"tooltip-new-tab\"\n openDirection=\"left\"\n />\n </a>\n );\n };\n\n private renderActionMenu = () => {\n if (!this.actions || this.isFullscreen) {\n return;\n }\n\n return (\n <limel-menu\n class=\"action-menu\"\n items={this.actions}\n onSelect={this.emitOnAction}\n open-direction=\"left\"\n >\n <button\n class=\"button--action\"\n id=\"tooltip-more\"\n role=\"button\"\n slot=\"trigger\"\n >\n <limel-icon name=\"menu_2\" />\n <limel-tooltip\n label={this.getTranslation('file-viewer.more-actions')}\n elementId=\"tooltip-more\"\n openDirection=\"left\"\n />\n </button>\n </limel-menu>\n );\n };\n\n private createURL = async (fileType: string) => {\n if (['pdf'].includes(fileType)) {\n const response = await fetch(this.url);\n const blob = await response.blob();\n\n this.fileUrl = URL.createObjectURL(blob);\n } else {\n this.fileUrl = this.url;\n }\n\n this.loading = false;\n };\n\n private handleToggleFullscreen = () => {\n if (this.fullscreen.isSupported()) {\n this.fullscreen.toggle();\n this.isFullscreen = !this.isFullscreen;\n }\n };\n\n private emitOnAction = (event: LimelMenuCustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(key, this.language);\n }\n}\n"],"version":3}
|
|
@@ -68,7 +68,7 @@ const File = class {
|
|
|
68
68
|
title: fileMetadata.getFileExtensionTitle(this.value),
|
|
69
69
|
color: fileMetadata.getFileColor(this.value),
|
|
70
70
|
backgroundColor: fileMetadata.getFileBackgroundColor(this.value),
|
|
71
|
-
}, href: this.value.href }),
|
|
71
|
+
}, href: this.value.href, menuItems: this.value.menuItems }),
|
|
72
72
|
];
|
|
73
73
|
}
|
|
74
74
|
renderChipset() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,OAAO,GAAG,mpBAAmpB;;ACYnqB,MAAM,iBAAiB,GAAS;EAC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I,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAC5B,CACL,CAAC;IAEF,IAAI,IAAI,CAAC,KAAK,EAAE;MACZ,OAAO,OAAO,CAAC;KAClB;IAED,QACIA,8BACI,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAEvC,OAAO,CACO,EACrB;GACL;EAeO,cAAc,CAAC,KAAY;IAC/B,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;GAC1B;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAOK,sBAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC5C;;;;;;","names":["h","getFileIcon","getFileExtensionTitle","getFileColor","getFileBackgroundColor","translate"],"sources":["./src/components/file/file.scss?tag=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["@use '../../style/mixins';\n\n/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n\n:host(limel-file) {\n position: relative;\n}\n\n.drag-and-drop-tip {\n pointer-events: none;\n position: absolute;\n box-sizing: border-box;\n margin: 0.25rem;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-wrap: nowrap;\n\n border-radius: 0.25rem;\n border: 1px dashed rgb(var(--contrast-700));\n\n padding: 0 0.5rem;\n\n .invisible-label-mock {\n flex-shrink: 0;\n opacity: 0;\n padding-right: 1rem;\n padding-left: 1.5rem;\n }\n\n .tip {\n font-size: smaller;\n color: var(--mdc-theme-text-secondary-on-background);\n\n // Below tries to render text in two lines,\n // and then truncate if there is no more space\n height: auto;\n max-height: 3rem;\n line-height: 1;\n @include mixins.truncate-text-on-line(2);\n }\n}\n","import translate from '../../global/translations';\nimport { Chip } from '../chip-set/chip.types';\nimport { Languages } from '../date-picker/date.types';\nimport { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from '../../util/file-metadata';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n *\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n public render() {\n return [\n <limel-file-dropzone\n disabled={this.disabled || this.readonly || !!this.value}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n >\n {this.renderChipset()}\n </limel-file-dropzone>,\n this.renderDragAndDropTip(),\n ];\n }\n\n private renderDragAndDropTip() {\n if (this.value || this.disabled || this.readonly) {\n return;\n }\n\n return (\n <div class=\"drag-and-drop-tip\">\n <span class=\"invisible-label-mock\" role=\"presentation\">\n {this.label}\n </span>\n <span class=\"tip\">{this.dropZoneTip()}</span>\n </div>\n );\n }\n\n private dropZoneTip = (): string => {\n return this.getTranslation('file.drag-and-drop-tips');\n };\n\n private handleNewFiles = (event: CustomEvent<FileInfo[]>) => {\n this.preventAndStop(event);\n this.change.emit(event.detail[0]);\n };\n\n private getChipArray(): Chip[] {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: {\n name: getFileIcon(this.value),\n title: getFileExtensionTitle(this.value),\n color: getFileColor(this.value),\n backgroundColor: getFileBackgroundColor(this.value),\n },\n href: this.value.href,\n },\n ];\n }\n\n private renderChipset() {\n const chipset = (\n <limel-chip-set\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onInteract={this.handleChipInteract}\n required={this.required}\n type=\"input\"\n value={this.getChipArray()}\n />\n );\n\n if (this.value) {\n return chipset;\n }\n\n return (\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n >\n {chipset}\n </limel-file-input>\n );\n }\n\n private handleChipSetChange = (event: CustomEvent) => {\n event.stopPropagation();\n const file = event.detail.length === 0 ? event.detail[0] : null;\n if (!file) {\n this.change.emit(file);\n }\n };\n\n private handleChipInteract = (event: CustomEvent<Chip>) => {\n this.preventAndStop(event);\n this.interact.emit(event.detail.id);\n };\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(key, this.language);\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-file.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,OAAO,GAAG,mpBAAmpB;;ACYnqB,MAAM,iBAAiB,GAAS;EAC5B,EAAE,EAAE,IAAI;EACR,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,IAAI;CAClB,CAAC;MA0CW,IAAI;;;;;IA2FL,gBAAW,GAAG;MAClB,OAAO,IAAI,CAAC,cAAc,CAAC,yBAAyB,CAAC,CAAC;KACzD,CAAC;IAEM,mBAAc,GAAG,CAAC,KAA8B;MACpD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;MAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACrC,CAAC;IAuDM,wBAAmB,GAAG,CAAC,KAAkB;MAC7C,KAAK,CAAC,eAAe,EAAE,CAAC;MACxB,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;MAChE,IAAI,CAAC,IAAI,EAAE;QACP,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;OAC1B;KACJ,CAAC;IAEM,uBAAkB,GAAG,CAAC,KAAwB;MAClD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;MAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;KACvC,CA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AAI,CAAC,KAAK,CAAC,SAAS;KAEtC,CAAC;GACL;EAEO,aAAa;IACjB,MAAM,OAAO,IACTJ,4BACI,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,WAAW,EAAC,iBAAiB,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAClC,UAAU,EAAE,IAAI,CAAC,kBAAkB,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,GAC5B,CACL,CAAC;IAEF,IAAI,IAAI,CAAC,KAAK,EAAE;MACZ,OAAO,OAAO,CAAC;KAClB;IAED,QACIA,8BACI,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,IAEvC,OAAO,CACO,EACrB;GACL;EAeO,cAAc,CAAC,KAAY;IAC/B,KAAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;GAC1B;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAOK,sBAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;GAC5C;;;;;;","names":["h","getFileIcon","getFileExtensionTitle","getFileColor","getFileBackgroundColor","translate"],"sources":["./src/components/file/file.scss?tag=limel-file&encapsulation=shadow","./src/components/file/file.tsx"],"sourcesContent":["@use '../../style/mixins';\n\n/**\n * @prop --icon-background-color: Background color of the icon. Defaults to `--contrast-400`.\n * @prop --icon-color: Color of the icon. Defaults to `--contrast-1100`.\n */\n\n:host(limel-file) {\n position: relative;\n}\n\n.drag-and-drop-tip {\n pointer-events: none;\n position: absolute;\n box-sizing: border-box;\n margin: 0.25rem;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: flex-end;\n flex-wrap: nowrap;\n\n border-radius: 0.25rem;\n border: 1px dashed rgb(var(--contrast-700));\n\n padding: 0 0.5rem;\n\n .invisible-label-mock {\n flex-shrink: 0;\n opacity: 0;\n padding-right: 1rem;\n padding-left: 1.5rem;\n }\n\n .tip {\n font-size: smaller;\n color: var(--mdc-theme-text-secondary-on-background);\n\n // Below tries to render text in two lines,\n // and then truncate if there is no more space\n height: auto;\n max-height: 3rem;\n line-height: 1;\n @include mixins.truncate-text-on-line(2);\n }\n}\n","import translate from '../../global/translations';\nimport { Chip } from '../chip-set/chip.types';\nimport { Languages } from '../date-picker/date.types';\nimport { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from '../../util/file-metadata';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n *\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-menu-items\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n public render() {\n return [\n <limel-file-dropzone\n disabled={this.disabled || this.readonly || !!this.value}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n >\n {this.renderChipset()}\n </limel-file-dropzone>,\n this.renderDragAndDropTip(),\n ];\n }\n\n private renderDragAndDropTip() {\n if (this.value || this.disabled || this.readonly) {\n return;\n }\n\n return (\n <div class=\"drag-and-drop-tip\">\n <span class=\"invisible-label-mock\" role=\"presentation\">\n {this.label}\n </span>\n <span class=\"tip\">{this.dropZoneTip()}</span>\n </div>\n );\n }\n\n private dropZoneTip = (): string => {\n return this.getTranslation('file.drag-and-drop-tips');\n };\n\n private handleNewFiles = (event: CustomEvent<FileInfo[]>) => {\n this.preventAndStop(event);\n this.change.emit(event.detail[0]);\n };\n\n private getChipArray(): Chip[] {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: {\n name: getFileIcon(this.value),\n title: getFileExtensionTitle(this.value),\n color: getFileColor(this.value),\n backgroundColor: getFileBackgroundColor(this.value),\n },\n href: this.value.href,\n menuItems: this.value.menuItems,\n },\n ];\n }\n\n private renderChipset() {\n const chipset = (\n <limel-chip-set\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onInteract={this.handleChipInteract}\n required={this.required}\n type=\"input\"\n value={this.getChipArray()}\n />\n );\n\n if (this.value) {\n return chipset;\n }\n\n return (\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n >\n {chipset}\n </limel-file-input>\n );\n }\n\n private handleChipSetChange = (event: CustomEvent) => {\n event.stopPropagation();\n const file = event.detail.length === 0 ? event.detail[0] : null;\n if (!file) {\n this.change.emit(file);\n }\n };\n\n private handleChipInteract = (event: CustomEvent<Chip>) => {\n this.preventAndStop(event);\n this.interact.emit(event.detail.id);\n };\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(key, this.language);\n }\n}\n"],"version":3}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"limel-progress-flow-item.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,mBAAmB,GAAG,gmIAAgmI;;MCmB/mI,gBAAgB;;;;IA2EjB,gBAAW,GAAG;MAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB,CAAC;gBArEsB,IAAI;oBAMV,KAAK;oBAML,KAAK;uBAMO,KAAK;;EAQ5B,MAAM;;IACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACZ,OAAO;KACV;IAED,OAAO;MACHA,oBACI,QAAQ,EAAC,GAAG,EACZ,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAC5B,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;UACH,IAAI,EAAE,IAAI;UACV,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IAEzC,OAAOD,wBAAY,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,OAAO,EAAC,KAAK,EAAC,MAAM,GAAG,CAAC;GAC/D;EAEO,aAAa;IACjB,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;MACzB,OAAO;KACV;IAED,OAAOA,iBAAK,KAAK,EAAC,SAAS,GAAG,CAAC;GAClC;EAEO,cAAc;IAClB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;MACpB,OAAO;KACV;IAED,OAAOA,wBAAY,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,GAAG,CAAC;GACvD;;;;;;;","names":["h","getIconName"],"sources":["./src/components/progress-flow/progress-flow-item/progress-flow-item.scss?tag=limel-progress-flow-item","./src/components/progress-flow/progress-flow-item/progress-flow-item.tsx"],"sourcesContent":["@use '../../../style/mixins';\n@use '../../../style/functions';\n
|
|
1
|
+
{"file":"limel-progress-flow-item.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,mBAAmB,GAAG,gmIAAgmI;;MCmB/mI,gBAAgB;;;;IA2EjB,gBAAW,GAAG;MAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;KACxB,CAAC;gBArEsB,IAAI;oBAMV,KAAK;oBAML,KAAK;uBAMO,KAAK;;EAQ5B,MAAM;;IACT,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;MACZ,OAAO;KACV;IAED,OAAO;MACHA,oBACI,QAAQ,EAAC,GAAG,EACZ,KAAK,EAAE,IAAI,CAAC,cAAc,EAAE,EAC5B,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;UACH,IAAI,EAAE,IAAI;UACV,QAAQ,EAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,QAAQ;UAC7B,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE;UAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ;SAC1B,EACD,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,QAAQ,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AOA,iBAAK,KAAK,EAAC,SAAS,GAAG,CAAC;GAClC;EAEO,cAAc;IAClB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE;MACpB,OAAO;KACV;IAED,OAAOA,wBAAY,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,WAAW,GAAG,CAAC;GACvD;;;;;;;","names":["h","getIconName"],"sources":["./src/components/progress-flow/progress-flow-item/progress-flow-item.scss?tag=limel-progress-flow-item","./src/components/progress-flow/progress-flow-item/progress-flow-item.tsx"],"sourcesContent":["@use '../../../style/mixins';\n@use '../../../style/functions';\n\n$limel-progress-flow-step-content: 2;\n$limel-progress-flow-divider: 1;\n\n.flow-item {\n --step-background: var(\n --progress-flow-step-background-color,\n rgb(var(--contrast-600))\n );\n --step-background--selected: var(\n --progress-flow-step-background-color--selected,\n var(--mdc-theme-primary)\n );\n --step-background--passed: var(\n --progress-flow-step-background-color--passed,\n var(--step-background--selected)\n );\n\n --step-text: var(\n --progress-flow-step-text-color,\n rgb(var(--contrast-1200))\n );\n --step-text--selected: var(\n --progress-flow-step-text-color--selected,\n var(--mdc-theme-on-primary)\n );\n --step-text--passed: var(\n --progress-flow-step-text-color--passed,\n var(--step-text--selected)\n );\n\n --step-divider-color: var(\n --progress-flow-step-divider-color,\n rgb(var(--contrast-100))\n );\n\n position: relative;\n width: 100%;\n\n display: flex;\n flex-direction: column;\n align-items: stretch;\n\n &:not(.off-progress-item, .last) {\n .divider {\n &:after {\n content: '';\n }\n }\n }\n\n &.off-progress-item {\n padding-left: functions.pxToRem(8);\n }\n\n &.first-off-progress-item {\n padding-left: functions.pxToRem(16);\n }\n}\n\n.step {\n transition:\n background-color 0.2s ease,\n box-shadow 0.2s ease;\n\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n width: 100%;\n height: var(--step-height);\n border: none;\n font-size: functions.pxToRem(14);\n\n &.disabled {\n cursor: not-allowed;\n\n &.readonly {\n opacity: 1;\n cursor: default;\n }\n }\n\n &:focus {\n outline: none;\n }\n\n &:focus-visible {\n box-shadow: var(--shadow-depth-8-focused);\n }\n\n .flow-item:not(.off-progress-item, .first) & {\n padding-left: calc(var(--step-height) / 2);\n }\n\n .flow-item:not(.selected) & {\n &:not(.disabled) {\n cursor: pointer;\n &:hover {\n box-shadow: var(--button-shadow-normal);\n }\n &:active {\n box-shadow: var(--button-shadow-pressed);\n }\n }\n }\n\n .off-progress-item & {\n border-radius: functions.pxToRem(4);\n padding: 0 functions.pxToRem(12);\n\n .icon {\n margin-left: 0;\n }\n }\n .flow-item.first & {\n border-top-left-radius: var(--step-height);\n border-bottom-left-radius: var(--step-height);\n padding-left: functions.pxToRem(20);\n }\n .flow-item.last & {\n border-top-right-radius: var(--step-height);\n border-bottom-right-radius: var(--step-height);\n padding-right: functions.pxToRem(20);\n }\n}\n\n.divider {\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--step-height);\n height: var(--step-height);\n\n position: absolute;\n z-index: $limel-progress-flow-divider;\n right: calc(var(--step-height) / 2 * -1);\n overflow: hidden;\n\n &:after {\n position: absolute;\n display: block;\n\n box-sizing: border-box;\n transition: background-color 0.2s ease;\n\n width: 100%;\n height: 100%;\n right: calc(var(--step-height) / 5);\n transform: rotate(45deg);\n border: {\n style: solid;\n width: functions.pxToRem(2) functions.pxToRem(2) 0 0;\n radius: 0 functions.pxToRem(8) 0 0;\n color: var(--step-divider-color);\n }\n }\n .flow-item.last & {\n width: 0;\n }\n}\n\n.text,\n.secondary-text {\n @include mixins.truncate-text();\n max-width: var(--max-text-width);\n z-index: $limel-progress-flow-step-content;\n}\n\n.secondary-text {\n font-size: functions.pxToRem(12);\n margin: auto;\n padding-left: calc(var(--step-height) / 2);\n}\n\n.icon {\n margin: 0 functions.pxToRem(8) 0 functions.pxToRem(4);\n z-index: $limel-progress-flow-step-content;\n}\n\n@import './partial-styles/_selected-indicator';\n@import './partial-styles/_colors';\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n} from '@stencil/core';\nimport { FlowItem } from '../progress-flow.types';\nimport { getIconName } from '../../icon/get-icon-props';\n\n/**\n * @private\n */\n@Component({\n tag: 'limel-progress-flow-item',\n shadow: false,\n styleUrl: 'progress-flow-item.scss',\n})\nexport class ProgressFlowItem {\n @Element()\n public element: HTMLLimelProgressFlowItemElement;\n\n /**\n * The flow item that should be rendered\n */\n @Prop()\n public item: FlowItem = null;\n\n /**\n * True if the flow item should be disabled\n */\n @Prop()\n public disabled = false;\n\n /**\n * True if the flow item should be readonly\n */\n @Prop()\n public readonly = false;\n\n /**\n * True for current step\n */\n @Prop()\n public currentStep: boolean = false;\n\n /**\n * Fired when clicking on the flow item\n */\n @Event()\n public interact: EventEmitter<void>;\n\n public render() {\n if (!this.item) {\n return;\n }\n\n return [\n <button\n tabindex=\"0\"\n title={this.getToolTipText()}\n type=\"button\"\n class={{\n step: true,\n selected: this.item?.selected,\n disabled: this.isDisabled(),\n readonly: this.readonly,\n }}\n onClick={this.handleClick}\n disabled={this.isDisabled()}\n aria-current={this.currentStep ? 'step' : null}\n >\n {this.renderIcon()}\n <span class=\"text\">{this.item.text}</span>\n {this.renderDivider()}\n {this.renderLockIcon()}\n </button>,\n this.renderSecondaryText(),\n ];\n }\n\n private isDisabled() {\n return this.item?.disabled || this.readonly || this.disabled;\n }\n\n private getToolTipText() {\n if (!this.item.secondaryText) {\n return this.item.text;\n }\n\n return [this.item.text, this.item.secondaryText].join(' · ');\n }\n\n private handleClick = () => {\n this.interact.emit();\n };\n\n private renderSecondaryText() {\n if (!this.item?.secondaryText) {\n return;\n }\n\n return <div class=\"secondary-text\">{this.item.secondaryText}</div>;\n }\n\n private renderIcon() {\n if (!this.item.icon) {\n return;\n }\n\n const name = getIconName(this.item.icon);\n\n return <limel-icon name={name} size=\"small\" class=\"icon\" />;\n }\n\n private renderDivider() {\n if (this.item.isOffProgress) {\n return;\n }\n\n return <div class=\"divider\" />;\n }\n\n private renderLockIcon() {\n if (!this.isDisabled()) {\n return;\n }\n\n return <limel-ic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src/components/progress-flow/progress-flow.tsx"],"sourcesContent":["@use '../../style/functions';\n@use '../../style/internal/variables';\n\n/**\n* @prop --progress-flow-step-background-color: Background color of steps, defaults to `--contrast-600`.\n* @prop --progress-flow-step-background-color--selected: Background color of selected step, defaults to `--lime-primary-color`.\n* @prop --progress-flow-step-background-color--passed: Background color of passed steps, defaults to the background color the step has when selected.\n* @prop --progress-flow-step-text-color: Text of steps, defaults to `--contrast-1200`.\n* @prop --progress-flow-step-text-color--selected: Text color of selected step, defaults to `--lime-primary-color`.\n* @prop --progress-flow-step-text-color--passed: Text color of passed steps, defaults to the text color the step has when selected.\n* @prop --progress-flow-step-divider-color: Color of the arrow shaped dividers between steps which must be the same as component's background, defaults to `--contrast-100`.\n* @prop --progress-flow-icon-color--inactive: Color of the optional icons used in each step. Only affects inactive steps, defaults to text colors for inactive, active, or passed step.\n*/\n\n:host {\n --step-height: 2rem;\n --selected-indicator-right: -0.5rem;\n --max-text-width: 10rem;\n\n isolation: isolate;\n box-sizing: border-box;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n\n overflow-x: auto;\n scrollbar-width: none; // This hides the scrollbars appearing under in Firefox\n -ms-overflow-style: none; // Same as above for IE 11\n padding: functions.pxToRem(4); // needed for the focus effect\n\n &::-webkit-scrollbar {\n display: none; // This hides the scrollbars appearing under in Chrome\n }\n}\n\n:host(.is-narrow) {\n --step-height: 1.5rem;\n --selected-indicator-right: 0;\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n} from '@stencil/core';\nimport { FlowItem } from './progress-flow.types';\nimport { getIconColor } from '../icon/get-icon-props';\n\n/**\n * @exampleComponent limel-example-progress-flow-basic\n * @exampleComponent limel-example-progress-flow-secondary-text\n * @exampleComponent limel-example-progress-flow-disabled-step\n * @exampleComponent limel-example-progress-flow-colors\n * @exampleComponent limel-example-progress-flow-colors-css\n * @exampleComponent limel-example-progress-flow-off-progress-steps\n * @exampleComponent limel-example-progress-flow-narrow\n */\n@Component({\n tag: 'limel-progress-flow',\n shadow: true,\n styleUrl: 'progress-flow.scss',\n})\nexport class ProgressFlow {\n @Element()\n public element: HTMLLimelProgressFlowElement;\n\n /**\n * What flow items to render\n */\n @Prop()\n public flowItems: FlowItem[] = [];\n\n /**\n * Set to `true` to disable the progress flow.\n * Use `disabled` to indicate that the component can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop()\n public disabled = false;\n\n /**\n * Disables the progress flow when `true`.\n * This does not visualize the component that much differently.\n * But since the component does not provide any feedback that users can\n * interact with the component, it makes it perfect for illustrative and\n * informative porpuses.\n */\n @Prop()\n public readonly = false;\n\n /**\n * Fired when a new value has been selected from the progress flow\n */\n @Event()\n public change: EventEmitter<FlowItem>;\n\n private selectedItemIndex: number;\n\n public componentDidRender() {\n this.scrollToSelectedItem();\n }\n\n public componentDidLoad() {\n this.triggerIconColorWarning();\n }\n\n public render() {\n const regularFlowItems = this.flowItems.filter((item) => {\n return !item.isOffProgress;\n });\n const endPhaseItems = this.flowItems.filter((item) => {\n return item.isOffProgress;\n });\n this.selectedItemIndex = regularFlowItems.findIndex((item) => {\n return item.selected;\n });\n\n return [\n regularFlowItems.map(this.renderRegularFlowItem),\n endPhaseItems.map(this.renderEndPhaseItem),\n ];\n }\n\n private renderRegularFlowItem = (\n item: FlowItem,\n index: number,\n array: FlowItem[]\n ) => {\n return (\n <limel-progress-flow-item\n class={{\n 'flow-item': true,\n first: index === 0,\n last: index === array.length - 1,\n passed: index < this.selectedItemIndex,\n selected: item.selected,\n }}\n style={this.getItemStyle(item)}\n disabled={this.disabled || this.readonly}\n readonly={this.readonly}\n item={item}\n onInteract={this.handleFlowItemClick(item)}\n data-tracking-value={item.value}\n currentStep={index === this.selectedItemIndex}\n />\n );\n };\n\n private renderEndPhaseItem = (\n item: FlowItem,\n index: number,\n array: FlowItem[]\n ) => {\n return (\n <limel-progress-flow-item\n class={{\n 'flow-item': true,\n 'off-progress-item': true,\n selected: item.selected,\n 'first-off-progress-item': index === 0,\n 'last-off-progress-item': index === array.length - 1,\n }}\n style={this.getItemStyle(item)}\n disabled={this.disabled || this.readonly}\n readonly={this.readonly}\n item={item}\n onInteract={this.handleFlowItemClick(item)}\n data-tracking-value={item.value}\n />\n );\n };\n\n private handleFlowItemClick = (flowItem: FlowItem) => () => {\n if (!flowItem.selected && !flowItem.disabled && !this.disabled) {\n this.change.emit(flowItem);\n }\n };\n\n private getItemStyle(flowItem: FlowItem) {\n const color = getIconColor(flowItem.icon, flowItem.iconColor);\n const style: any = {};\n\n if (flowItem?.selectedColor) {\n style['--progress-flow-step-background-color--selected'] =\n flowItem.selectedColor;\n }\n\n if (flowItem?.passedColor) {\n style['--progress-flow-step-background-color--passed'] =\n flowItem.passedColor;\n }\n\n if (color) {\n style['--progress-flow-icon-color--inactive'] = color;\n }\n\n return style;\n }\n\n private scrollToSelectedItem() {\n const selectedElement = this.getElementForSelectedItem();\n if (selectedElement) {\n const selectedItemLeftPosition =\n selectedElement.offsetLeft - this.element.offsetLeft;\n const selectedElementLeftPositionCentered =\n selectedItemLeftPosition - this.element.offsetWidth / 2;\n const selectedElementCentered =\n selectedElementLeftPositionCentered +\n selectedElement.offsetWidth / 2;\n this.element.scrollTo({\n behavior: 'smooth',\n left: selectedElementCentered,\n });\n }\n }\n\n private getElementForSelectedItem(): HTMLLimelProgressFlowItemElement {\n return this.element.shadowRoot.querySelector('.flow-item.selected');\n }\n\n private triggerIconColorWarning() {\n for (const flowItem of this.flowItems) {\n if (flowItem.iconColor) {\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\"\n );\n }\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"limel-progress-flow.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,sXAAsX;;MCyBjY,YAAY;;;;IA8Db,0BAAqB,GAAG,CAC5B,IAAc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,WAAW,EAAE;MACvB,KAAK,CAAC,+CAA+C,CAAC;QAClD,QAAQ,CAAC,WAAW,CAAC;KAC5B;IAED,IAAI,KAAK,EAAE;MACP,KAAK,CAAC,sCAAsC,CAAC,GAAG,KAAK,CAAC;KACzD;IAED,OAAO,KAAK,CAAC;GAChB;EAEO,oBAAoB;IACxB,MAAM,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;IACzD,IAAI,eAAe,EAAE;MACjB,MAAM,wBAAwB,GAC1B,eAAe,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;MACzD,MAAM,mCAAmC,GACrC,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;MAC5D,MAAM,uBAAuB,GACzB,mCAAmC;QACnC,eAAe,CAAC,WAAW,GAAG,CAAC,CAAC;MACpC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QAClB,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,uBAAuB;OAChC,CAAC,CAAC;KACN;GACJ;EAEO,yBAAyB;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;GACvE;EAEO,uBAAuB;IAC3B,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE;MACnC,IAAI,QAAQ,CAAC,SAAS,EAAE;QACpB,OAAO,CAAC,IAAI,CACR,sKAAsK,CACzK,CAAC;OACL;KACJ;GACJ;;;;;;;","names":["index","h","getIconColor"],"sources":["./src/components/progress-flow/progress-flow.scss?tag=limel-progress-flow&encapsulation=shadow","./src/components/progress-flow/progress-flow.tsx"],"sourcesContent":["@use '../../style/functions';\n\n/**\n* @prop --progress-flow-step-background-color: Background color of steps, defaults to `--contrast-600`.\n* @prop --progress-flow-step-background-color--selected: Background color of selected step, defaults to `--lime-primary-color`.\n* @prop --progress-flow-step-background-color--passed: Background color of passed steps, defaults to the background color the step has when selected.\n* @prop --progress-flow-step-text-color: Text of steps, defaults to `--contrast-1200`.\n* @prop --progress-flow-step-text-color--selected: Text color of selected step, defaults to `--lime-primary-color`.\n* @prop --progress-flow-step-text-color--passed: Text color of passed steps, defaults to the text color the step has when selected.\n* @prop --progress-flow-step-divider-color: Color of the arrow shaped dividers between steps which must be the same as component's background, defaults to `--contrast-100`.\n* @prop --progress-flow-icon-color--inactive: Color of the optional icons used in each step. Only affects inactive steps, defaults to text colors for inactive, active, or passed step.\n*/\n\n:host {\n --step-height: 2rem;\n --selected-indicator-right: -0.5rem;\n --max-text-width: 10rem;\n\n isolation: isolate;\n box-sizing: border-box;\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n\n overflow-x: auto;\n scrollbar-width: none; // This hides the scrollbars appearing under in Firefox\n -ms-overflow-style: none; // Same as above for IE 11\n padding: functions.pxToRem(4); // needed for the focus effect\n\n &::-webkit-scrollbar {\n display: none; // This hides the scrollbars appearing under in Chrome\n }\n}\n\n:host(.is-narrow) {\n --step-height: 1.5rem;\n --selected-indicator-right: 0;\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Prop,\n} from '@stencil/core';\nimport { FlowItem } from './progress-flow.types';\nimport { getIconColor } from '../icon/get-icon-props';\n\n/**\n * @exampleComponent limel-example-progress-flow-basic\n * @exampleComponent limel-example-progress-flow-secondary-text\n * @exampleComponent limel-example-progress-flow-disabled-step\n * @exampleComponent limel-example-progress-flow-colors\n * @exampleComponent limel-example-progress-flow-colors-css\n * @exampleComponent limel-example-progress-flow-off-progress-steps\n * @exampleComponent limel-example-progress-flow-narrow\n */\n@Component({\n tag: 'limel-progress-flow',\n shadow: true,\n styleUrl: 'progress-flow.scss',\n})\nexport class ProgressFlow {\n @Element()\n public element: HTMLLimelProgressFlowElement;\n\n /**\n * What flow items to render\n */\n @Prop()\n public flowItems: FlowItem[] = [];\n\n /**\n * Set to `true` to disable the progress flow.\n * Use `disabled` to indicate that the component can normally be interacted\n * with, but is currently disabled. This tells the user that if certain\n * requirements are met, the field may become enabled again.\n */\n @Prop()\n public disabled = false;\n\n /**\n * Disables the progress flow when `true`.\n * This does not visualize the component that much differently.\n * But since the component does not provide any feedback that users can\n * interact with the component, it makes it perfect for illustrative and\n * informative porpuses.\n */\n @Prop()\n public readonly = false;\n\n /**\n * Fired when a new value has been selected from the progress flow\n */\n @Event()\n public change: EventEmitter<FlowItem>;\n\n private selectedItemIndex: number;\n\n public componentDidRender() {\n this.scrollToSelectedItem();\n }\n\n public componentDidLoad() {\n this.triggerIconColorWarning();\n }\n\n public render() {\n const regularFlowItems = this.flowItems.filter((item) => {\n return !item.isOffProgress;\n });\n const endPhaseItems = this.flowItems.filter((item) => {\n return item.isOffProgress;\n });\n this.selectedItemIndex = regularFlowItems.findIndex((item) => {\n return item.selected;\n });\n\n return [\n regularFlowItems.map(this.renderRegularFlowItem),\n endPhaseItems.map(this.renderEndPhaseItem),\n ];\n }\n\n private renderRegularFlowItem = (\n item: FlowItem,\n index: number,\n array: FlowItem[]\n ) => {\n return (\n <limel-progress-flow-item\n class={{\n 'flow-item': true,\n first: index === 0,\n last: index === array.length - 1,\n passed: index < this.selectedItemIndex,\n selected: item.selected,\n }}\n style={this.getItemStyle(item)}\n disabled={this.disabled || this.readonly}\n readonly={this.readonly}\n item={item}\n onInteract={this.handleFlowItemClick(item)}\n data-tracking-value={item.value}\n currentStep={index === this.selectedItemIndex}\n />\n );\n };\n\n private renderEndPhaseItem = (\n item: FlowItem,\n index: number,\n array: FlowItem[]\n ) => {\n return (\n <limel-progress-flow-item\n class={{\n 'flow-item': true,\n 'off-progress-item': true,\n selected: item.selected,\n 'first-off-progress-item': index === 0,\n 'last-off-progress-item': index === array.length - 1,\n }}\n style={this.getItemStyle(item)}\n disabled={this.disabled || this.readonly}\n readonly={this.readonly}\n item={item}\n onInteract={this.handleFlowItemClick(item)}\n data-tracking-value={item.value}\n />\n );\n };\n\n private handleFlowItemClick = (flowItem: FlowItem) => () => {\n if (!flowItem.selected && !flowItem.disabled && !this.disabled) {\n this.change.emit(flowItem);\n }\n };\n\n private getItemStyle(flowItem: FlowItem) {\n const color = getIconColor(flowItem.icon, flowItem.iconColor);\n const style: any = {};\n\n if (flowItem?.selectedColor) {\n style['--progress-flow-step-background-color--selected'] =\n flowItem.selectedColor;\n }\n\n if (flowItem?.passedColor) {\n style['--progress-flow-step-background-color--passed'] =\n flowItem.passedColor;\n }\n\n if (color) {\n style['--progress-flow-icon-color--inactive'] = color;\n }\n\n return style;\n }\n\n private scrollToSelectedItem() {\n const selectedElement = this.getElementForSelectedItem();\n if (selectedElement) {\n const selectedItemLeftPosition =\n selectedElement.offsetLeft - this.element.offsetLeft;\n const selectedElementLeftPositionCentered =\n selectedItemLeftPosition - this.element.offsetWidth / 2;\n const selectedElementCentered =\n selectedElementLeftPositionCentered +\n selectedElement.offsetWidth / 2;\n this.element.scrollTo({\n behavior: 'smooth',\n left: selectedElementCentered,\n });\n }\n }\n\n private getElementForSelectedItem(): HTMLLimelProgressFlowItemElement {\n return this.element.shadowRoot.querySelector('.flow-item.selected');\n }\n\n private triggerIconColorWarning() {\n for (const flowItem of this.flowItems) {\n if (flowItem.iconColor) {\n console.warn(\n \"The `iconColor` prop is deprecated now! Use the new `Icon` interface and instead of `iconColor: 'color-name'` write `icon {name: 'icon-name', color: 'color-name'}`.\"\n );\n }\n }\n }\n}\n"],"version":3}
|
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
* Nothing in this file may output any CSS
|
|
5
5
|
* without being explicitly called by outside code.
|
|
6
6
|
*/
|
|
7
|
-
/*
|
|
8
|
-
* This file is imported into every component!
|
|
9
|
-
*
|
|
10
|
-
* Nothing in this file may output any CSS
|
|
11
|
-
* without being explicitly used by outside code.
|
|
12
|
-
*/
|
|
13
7
|
/**
|
|
14
8
|
* @prop --banner-icon-fill-color: Color of the banner icon.
|
|
15
9
|
* @prop --banner-icon-background-color: Background color of the banner icon.
|
|
@@ -79,12 +79,6 @@
|
|
|
79
79
|
* Nothing in this file may output any CSS
|
|
80
80
|
* without being explicitly called by outside code.
|
|
81
81
|
*/
|
|
82
|
-
/*
|
|
83
|
-
* This file is imported into every component!
|
|
84
|
-
*
|
|
85
|
-
* Nothing in this file may output any CSS
|
|
86
|
-
* without being explicitly used by outside code.
|
|
87
|
-
*/
|
|
88
82
|
.button {
|
|
89
83
|
all: unset;
|
|
90
84
|
isolation: isolate;
|
|
@@ -79,12 +79,6 @@
|
|
|
79
79
|
* Nothing in this file may output any CSS
|
|
80
80
|
* without being explicitly called by outside code.
|
|
81
81
|
*/
|
|
82
|
-
/*
|
|
83
|
-
* This file is imported into every component!
|
|
84
|
-
*
|
|
85
|
-
* Nothing in this file may output any CSS
|
|
86
|
-
* without being explicitly used by outside code.
|
|
87
|
-
*/
|
|
88
82
|
/**
|
|
89
83
|
* @prop --dock-expanded-max-width: The maximum width of the Dock when it is expanded. Defaults to `max-content` which means the Dock will adjust its width to the widest dock item.
|
|
90
84
|
* @prop --dock-background-color: Background color of the whole component, defaults to `--contrast-100`.
|
|
@@ -37,6 +37,7 @@ const DEFAULT_FILE_CHIP = {
|
|
|
37
37
|
*
|
|
38
38
|
* @exampleComponent limel-example-file
|
|
39
39
|
* @exampleComponent limel-example-file-custom-icon
|
|
40
|
+
* @exampleComponent limel-example-file-menu-items
|
|
40
41
|
* @exampleComponent limel-example-file-accepted-types
|
|
41
42
|
* @exampleComponent limel-example-file-composite
|
|
42
43
|
*/
|
|
@@ -91,7 +92,7 @@ export class File {
|
|
|
91
92
|
title: getFileExtensionTitle(this.value),
|
|
92
93
|
color: getFileColor(this.value),
|
|
93
94
|
backgroundColor: getFileBackgroundColor(this.value),
|
|
94
|
-
}, href: this.value.href }),
|
|
95
|
+
}, href: this.value.href, menuItems: this.value.menuItems }),
|
|
95
96
|
];
|
|
96
97
|
}
|
|
97
98
|
renderChipset() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/components/file/file.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,WAAW,GACd,MAAM,0BAA0B,CAAC;AAGlC,MAAM,iBAAiB,GAAS;EAC5B,EAAE,EAAE,IAAI;EACR,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,IAAI;CAClB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/components/file/file.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxE,OAAO,EACH,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,WAAW,GACd,MAAM,0BAA0B,CAAC;AAGlC,MAAM,iBAAiB,GAAS;EAC5B,EAAE,EAAE,IAAI;EACR,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,IAAI;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,MAAM,OAAO,IAAI;;IA2FL,gBAAW,GAAG,GAAW,EAAE;MAC/B,OAAO,IAAI,CAAC,cAAc,CAAC,yBAAyB,CAAC,CAAC;IAC1D,CAAC,CAAC;IAEM,mBAAc,GAAG,CAAC,KAA8B,EAAE,EAAE;MACxD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;MAC3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC;IAuDM,wBAAmB,GAAG,CAAC,KAAkB,EAAE,EAAE;MACjD,KAAK,CAAC,eAAe,EAAE,CAAC;M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AAK,CAAC,eAAe,EAAE,CAAC;IACxB,KAAK,CAAC,cAAc,EAAE,CAAC;EAC3B,CAAC;EAEO,cAAc,CAAC,GAAW;IAC9B,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;EAC7C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import translate from '../../global/translations';\nimport { Chip } from '../chip-set/chip.types';\nimport { Languages } from '../date-picker/date.types';\nimport { Component, Event, EventEmitter, h, Prop } from '@stencil/core';\nimport {\n getFileBackgroundColor,\n getFileColor,\n getFileExtensionTitle,\n getFileIcon,\n} from '../../util/file-metadata';\nimport { FileInfo } from '../../global/shared-types/file.types';\n\nconst DEFAULT_FILE_CHIP: Chip = {\n id: null,\n text: null,\n removable: true,\n};\n\n/**\n * This component lets end-users select a *single* file from their device\n * storage. Regardless of the user's device or operating system, this component\n * opens up a file picker dialog that allows the user to choose a file.\n *\n * ## Using correct labels\n *\n * This file picker can be used in different contexts. The component's distinct\n * visual design including the upload icon hints end-users that this is not a\n * normal input field like other fields in the form for example.\n *\n * :::important\n * you need to use a descriptive `label` that clarifies the\n * functionality of the file picker, and/or provides users with clear\n * instructions.\n *\n * Depending on the context, you may need to avoid labels such as:\n * - File\n * - Document\n *\n * and instead consider using labels like:\n * - Attach a file\n * - Upload a file\n * - Choose a document\n * - Choose a file\n *\n * and similar phrases...\n * :::\n *\n * @exampleComponent limel-example-file\n * @exampleComponent limel-example-file-custom-icon\n * @exampleComponent limel-example-file-menu-items\n * @exampleComponent limel-example-file-accepted-types\n * @exampleComponent limel-example-file-composite\n */\n@Component({\n tag: 'limel-file',\n shadow: true,\n styleUrl: 'file.scss',\n})\nexport class File {\n /**\n * The selected file.\n */\n @Prop()\n public value: FileInfo;\n\n /**\n * The input label.\n */\n @Prop({ reflect: true })\n public label: string;\n\n /**\n * Set to `true` to indicate that the field is required.\n */\n @Prop({ reflect: true })\n public required: boolean = false;\n\n /**\n * True if the input should be disabled\n */\n @Prop({ reflect: true })\n public disabled: boolean = false;\n\n /**\n * Set to `true` to disable adding and removing files, but allow interaction\n * with any already existing file.\n */\n @Prop({ reflect: true })\n public readonly: boolean = false;\n\n /**\n * Set to `true` to indicate that the current value of the chosen file is\n * invalid.\n */\n @Prop({ reflect: true })\n public invalid = false;\n\n /**\n * The [accepted file types](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#unique_file_type_specifiers)\n */\n @Prop({ reflect: true })\n public accept: string = '*';\n\n /**\n * Defines the localisation for translations.\n */\n @Prop()\n public language: Languages = 'en';\n\n /**\n * Dispatched when a file is selected/deselected\n */\n @Event()\n private change: EventEmitter<FileInfo>;\n\n /**\n * Dispatched when clicking on a chip\n */\n @Event()\n private interact: EventEmitter<number | string>;\n\n public render() {\n return [\n <limel-file-dropzone\n disabled={this.disabled || this.readonly || !!this.value}\n accept={this.accept}\n onFilesSelected={this.handleNewFiles}\n >\n {this.renderChipset()}\n </limel-file-dropzone>,\n this.renderDragAndDropTip(),\n ];\n }\n\n private renderDragAndDropTip() {\n if (this.value || this.disabled || this.readonly) {\n return;\n }\n\n return (\n <div class=\"drag-and-drop-tip\">\n <span class=\"invisible-label-mock\" role=\"presentation\">\n {this.label}\n </span>\n <span class=\"tip\">{this.dropZoneTip()}</span>\n </div>\n );\n }\n\n private dropZoneTip = (): string => {\n return this.getTranslation('file.drag-and-drop-tips');\n };\n\n private handleNewFiles = (event: CustomEvent<FileInfo[]>) => {\n this.preventAndStop(event);\n this.change.emit(event.detail[0]);\n };\n\n private getChipArray(): Chip[] {\n if (!this.value) {\n return [];\n }\n\n return [\n {\n ...DEFAULT_FILE_CHIP,\n text: this.value.filename,\n id: this.value.id,\n icon: {\n name: getFileIcon(this.value),\n title: getFileExtensionTitle(this.value),\n color: getFileColor(this.value),\n backgroundColor: getFileBackgroundColor(this.value),\n },\n href: this.value.href,\n menuItems: this.value.menuItems,\n },\n ];\n }\n\n private renderChipset() {\n const chipset = (\n <limel-chip-set\n disabled={this.disabled}\n readonly={this.readonly}\n invalid={this.invalid}\n label={this.label}\n leadingIcon=\"upload_to_cloud\"\n language={this.language}\n onChange={this.handleChipSetChange}\n onInteract={this.handleChipInteract}\n required={this.required}\n type=\"input\"\n value={this.getChipArray()}\n />\n );\n\n if (this.value) {\n return chipset;\n }\n\n return (\n <limel-file-input\n accept={this.accept}\n disabled={this.disabled || this.readonly}\n >\n {chipset}\n </limel-file-input>\n );\n }\n\n private handleChipSetChange = (event: CustomEvent) => {\n event.stopPropagation();\n const file = event.detail.length === 0 ? event.detail[0] : null;\n if (!file) {\n this.change.emit(file);\n }\n };\n\n private handleChipInteract = (event: CustomEvent<Chip>) => {\n this.preventAndStop(event);\n this.interact.emit(event.detail.id);\n };\n\n private preventAndStop(event: Event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n private getTranslation(key: string) {\n return translate.get(key, this.language);\n }\n}\n"]}
|