@limetech/lime-elements 37.1.0-next.62 → 37.1.0-next.64
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/dist/cjs/limel-breadcrumbs_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-breadcrumbs_3.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-file-viewer.cjs.entry.js +3 -3
- package/dist/cjs/limel-file-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-list.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js.map +1 -1
- package/dist/collection/components/checkbox/checkbox.css +51 -10
- package/dist/collection/components/chip-set/chip-set.css +50 -8
- package/dist/collection/components/file-viewer/file-viewer.js +3 -3
- package/dist/collection/components/file-viewer/file-viewer.js.map +1 -1
- package/dist/collection/components/input-field/input-field.css +20 -6
- package/dist/collection/components/list/list.css +102 -20
- package/dist/collection/components/menu-list/menu-list.css +102 -20
- package/dist/collection/components/select/select.css +55 -8
- package/dist/collection/components/slider/slider.css +56 -7
- package/dist/collection/components/switch/switch.css +51 -14
- package/dist/collection/style/mixins.scss +30 -0
- package/dist/esm/limel-breadcrumbs_3.entry.js +1 -1
- package/dist/esm/limel-breadcrumbs_3.entry.js.map +1 -1
- package/dist/esm/limel-checkbox.entry.js +1 -1
- package/dist/esm/limel-checkbox.entry.js.map +1 -1
- package/dist/esm/limel-chip-set.entry.js +1 -1
- package/dist/esm/limel-chip-set.entry.js.map +1 -1
- package/dist/esm/limel-file-viewer.entry.js +3 -3
- package/dist/esm/limel-file-viewer.entry.js.map +1 -1
- package/dist/esm/limel-input-field.entry.js +1 -1
- package/dist/esm/limel-input-field.entry.js.map +1 -1
- package/dist/esm/limel-list.entry.js +1 -1
- package/dist/esm/limel-list.entry.js.map +1 -1
- package/dist/esm/limel-select.entry.js +1 -1
- package/dist/esm/limel-select.entry.js.map +1 -1
- package/dist/esm/limel-slider.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js.map +1 -1
- package/dist/esm/limel-switch.entry.js +1 -1
- package/dist/esm/limel-switch.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-65459443.entry.js → p-06d23be1.entry.js} +8 -8
- package/dist/lime-elements/{p-65459443.entry.js.map → p-06d23be1.entry.js.map} +1 -1
- package/dist/lime-elements/{p-cf736097.entry.js → p-098b044e.entry.js} +2 -2
- package/dist/lime-elements/{p-cf736097.entry.js.map → p-098b044e.entry.js.map} +1 -1
- package/dist/lime-elements/{p-f1b0951f.entry.js → p-0c0974f7.entry.js} +5 -5
- package/dist/lime-elements/{p-f1b0951f.entry.js.map → p-0c0974f7.entry.js.map} +1 -1
- package/dist/lime-elements/{p-5dd76e36.entry.js → p-411542a4.entry.js} +5 -5
- package/dist/lime-elements/{p-5dd76e36.entry.js.map → p-411542a4.entry.js.map} +1 -1
- package/dist/lime-elements/p-9f4438a2.entry.js +2 -0
- package/dist/lime-elements/p-9f4438a2.entry.js.map +1 -0
- package/dist/lime-elements/{p-5bee567b.entry.js → p-bbc48da6.entry.js} +4 -4
- package/dist/lime-elements/{p-5bee567b.entry.js.map → p-bbc48da6.entry.js.map} +1 -1
- package/dist/lime-elements/{p-eb1edb6f.entry.js → p-bbffe078.entry.js} +2 -2
- package/dist/lime-elements/p-bbffe078.entry.js.map +1 -0
- package/dist/lime-elements/p-cd969c37.entry.js +82 -0
- package/dist/lime-elements/{p-9c54dcf6.entry.js.map → p-cd969c37.entry.js.map} +1 -1
- package/dist/lime-elements/p-ee2e27ee.entry.js +2 -0
- package/dist/lime-elements/{p-0191d535.entry.js.map → p-ee2e27ee.entry.js.map} +1 -1
- package/dist/lime-elements/style/mixins.scss +30 -0
- package/dist/scss/mixins.scss +30 -0
- package/package.json +2 -2
- package/dist/lime-elements/p-0191d535.entry.js +0 -2
- package/dist/lime-elements/p-950703a9.entry.js +0 -2
- package/dist/lime-elements/p-950703a9.entry.js.map +0 -1
- package/dist/lime-elements/p-9c54dcf6.entry.js +0 -82
- package/dist/lime-elements/p-eb1edb6f.entry.js.map +0 -1
|
@@ -35,13 +35,13 @@ export class FileViewer {
|
|
|
35
35
|
this.renderPdf = () => {
|
|
36
36
|
return [
|
|
37
37
|
h("div", { class: "action-menu-for-pdf-files" }, this.renderActionMenu()),
|
|
38
|
-
h("iframe", { src: this.fileUrl }),
|
|
38
|
+
h("iframe", { src: this.fileUrl, loading: "lazy" }),
|
|
39
39
|
];
|
|
40
40
|
};
|
|
41
41
|
this.renderImage = () => {
|
|
42
42
|
return [
|
|
43
43
|
this.renderButtons(),
|
|
44
|
-
h("img", { src: this.fileUrl, alt: this.alt }),
|
|
44
|
+
h("img", { src: this.fileUrl, alt: this.alt, loading: "lazy" }),
|
|
45
45
|
];
|
|
46
46
|
};
|
|
47
47
|
this.renderVideo = () => {
|
|
@@ -59,7 +59,7 @@ export class FileViewer {
|
|
|
59
59
|
this.renderOffice = () => {
|
|
60
60
|
return [
|
|
61
61
|
h("div", { class: "action-menu-for-office-files" }, this.renderActionMenu()),
|
|
62
|
-
h("iframe", { src: this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true',
|
|
62
|
+
h("iframe", { src: this.getOfficeViewerUrl() + this.fileUrl + '&embedded=true', loading: "lazy" }),
|
|
63
63
|
];
|
|
64
64
|
};
|
|
65
65
|
this.isOfficeFileAccessibleViaURL = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-viewer.js","sourceRoot":"","sources":["../../../src/components/file-viewer/file-viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,EAEL,KAAK,GACR,MAAM,eAAe,CAAC;AAEvB,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,MAAM,OAAO,UAAU;EAmGnB;IAgDQ,cAAS,GAAG,GAAG,EAAE;MACrB,OAAO;QACH,WAAK,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,gBAAgB,EAAE,CACtB;QACN,cAAQ,GAAG,EAAE,IAAI,CAAC,OAAO,GAAI;OAChC,CAAC;IACN,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACvB,OAAO;QACH,IAAI,CAAC,aAAa,EAAE;QACpB,WAAK,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI;OAC5C,CAAC;IACN,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACvB,OAAO,CACH,aAAO,QAAQ;QACX,cAAQ,GAAG,EAAE,IAAI,CAAC,OAAO,GAAI,CACzB,CACX,CAAC;IACN,CAAC,CAAC;IAEM,gBAAW,GAAG,GAAG,EAAE;MACvB,OAAO,CACH,aAAO,QAAQ;QACX,cAAQ,GAAG,EAAE,IAAI,CAAC,OAAO,GAAI,CACzB,CACX,CAAC;IACN,CAAC,CAAC;IAEM,eAAU,GAAG,GAAG,EAAE;MACtB,OAAO;Q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages, ListItem } from '@limetech/lime-elements';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\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 * @exampleComponent limel-example-file-viewer\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 * @private\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} />,\n ];\n };\n\n private renderImage = () => {\n return [\n this.renderButtons(),\n <img src={this.fileUrl} alt={this.alt} />,\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 ];\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 frameborder=\"0\"\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\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>{this.getTranslation('message.unsupported-filetype')}</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 // eslint-disable-next-line multiline-ternary\n const label = this.isFullscreen\n ? // eslint-disable-next-line multiline-ternary\n this.getTranslation('exit-fullscreen')\n : this.getTranslation('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 ? this.filename : ''}\n href={this.fileUrl}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('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('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('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: CustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(`file-viewer.${key}`, this.language);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"file-viewer.js","sourceRoot":"","sources":["../../../src/components/file-viewer/file-viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,CAAC,EACD,IAAI,EACJ,KAAK,EACL,KAAK,EAEL,KAAK,GACR,MAAM,eAAe,CAAC;AAEvB,OAAO,SAAS,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAOH,MAAM,OAAO,UAAU;EAmGnB;IAgDQ,cAAS,GAAG,GAAG,EAAE;MACrB,OAAO;QACH,WAAK,KAAK,EAAC,2BAA2B,IACjC,IAAI,CAAC,gBAAgB,EAAE,CACtB;QACN,cAAQ,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAC,MAAM,GAAG;OAC/C,CAAC;IACN,CAAC,CAAC;IAEM,gBAAW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AI,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;EAChC,CAAC;EAwOO,cAAc,CAAC,GAAW;IAC9B,OAAO,SAAS,CAAC,GAAG,CAAC,eAAe,GAAG,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;EAC9D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ","sourcesContent":["import {\n Component,\n Element,\n h,\n Prop,\n State,\n Event,\n EventEmitter,\n Watch,\n} from '@stencil/core';\nimport { Languages, ListItem } from '@limetech/lime-elements';\nimport translate from '../../global/translations';\nimport { detectExtension } from './extension-mapping';\nimport { Fullscreen } from './fullscreen';\nimport { FileType, OfficeViewer } from './file-viewer.types';\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 * @exampleComponent limel-example-file-viewer\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 * @private\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 ];\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\">\n <limel-icon\n class=\"icon--warning\"\n name=\"brake_warning\"\n size=\"large\"\n role=\"presentation\"\n />\n <p>{this.getTranslation('message.unsupported-filetype')}</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 // eslint-disable-next-line multiline-ternary\n const label = this.isFullscreen\n ? // eslint-disable-next-line multiline-ternary\n this.getTranslation('exit-fullscreen')\n : this.getTranslation('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 ? this.filename : ''}\n href={this.fileUrl}\n target=\"_blank\"\n >\n <limel-icon name=\"download_2\" />\n <limel-tooltip\n label={this.getTranslation('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('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('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: CustomEvent<ListItem>) => {\n event.stopPropagation();\n this.action.emit(event.detail);\n };\n\n private getTranslation(key: string) {\n return translate.get(`file-viewer.${key}`, this.language);\n }\n}\n"]}
|
|
@@ -321,9 +321,26 @@
|
|
|
321
321
|
margin-top: 0.5rem;
|
|
322
322
|
margin-bottom: 0;
|
|
323
323
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
|
|
325
|
+
:host(limel-input-field:focus),
|
|
326
|
+
:host(limel-input-field:focus-visible),
|
|
327
|
+
:host(limel-input-field:focus-within),
|
|
328
|
+
:host(limel-input-field[invalid]) {
|
|
329
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
330
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
:host(limel-input-field),
|
|
334
|
+
:host(limel-input-field[invalid=false]) {
|
|
335
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
336
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
:host(limel-input-field:focus) limel-helper-line,
|
|
340
|
+
:host(limel-input-field:focus-visible) limel-helper-line,
|
|
341
|
+
:host(limel-input-field:focus-within) limel-helper-line,
|
|
342
|
+
:host(limel-input-field:hover) limel-helper-line {
|
|
343
|
+
will-change: grid-template-rows;
|
|
327
344
|
}
|
|
328
345
|
|
|
329
346
|
@keyframes mdc-ripple-fg-radius-in {
|
|
@@ -2037,9 +2054,6 @@
|
|
|
2037
2054
|
z-index: 2;
|
|
2038
2055
|
}
|
|
2039
2056
|
|
|
2040
|
-
:not(.mdc-text-field--focused):not(.mdc-text-field--invalid) + limel-helper-line {
|
|
2041
|
-
opacity: 0;
|
|
2042
|
-
}
|
|
2043
2057
|
:not(.mdc-text-field--focused):not(.mdc-text-field--invalid) .mdc-text-field__input[type=number] {
|
|
2044
2058
|
color: transparent;
|
|
2045
2059
|
-webkit-text-fill-color: transparent;
|
|
@@ -850,19 +850,60 @@
|
|
|
850
850
|
color: var(--lime-error-text-color);
|
|
851
851
|
}
|
|
852
852
|
|
|
853
|
-
|
|
854
|
-
|
|
853
|
+
/**
|
|
854
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
855
|
+
* node module, for consumer projects to import.
|
|
856
|
+
* That means this file cannot import from any file that isn't
|
|
857
|
+
* also exported, keeping the same relative path.
|
|
858
|
+
*
|
|
859
|
+
* Or, just don't import anything, that works too.
|
|
860
|
+
*/
|
|
861
|
+
/**
|
|
862
|
+
* This mixin will mask out the content that is close to
|
|
863
|
+
* the edges of a scrollable area.
|
|
864
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
865
|
+
* as an argument for `$direction`.
|
|
866
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
867
|
+
* as an argument for `$direction`.
|
|
868
|
+
*
|
|
869
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
870
|
+
* the size of the fade-out edge effect is the same as the
|
|
871
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
872
|
+
* scrollable area that does not have a padding will fade out before
|
|
873
|
+
* any scrolling has been done.
|
|
874
|
+
* This is why this mixin already adds paddings, which automatically
|
|
875
|
+
* default to the size of the fade-out effect.
|
|
876
|
+
* This size defaults to `1rem`, but to override the size use
|
|
877
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
878
|
+
* when `vertically` argument is set, and use
|
|
879
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
880
|
+
* when `horizontally` argument is set.
|
|
881
|
+
* Of course you can also programmatically increase and decrease the
|
|
882
|
+
* size of these variables for each edge, based on the amount of
|
|
883
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
884
|
+
* to add a custom padding where the mixin is used, to override
|
|
885
|
+
* the paddings that are automatically added by the mixin in the
|
|
886
|
+
* compiled CSS code.
|
|
887
|
+
*/
|
|
888
|
+
:host(limel-checkbox:focus),
|
|
889
|
+
:host(limel-checkbox:focus-visible),
|
|
890
|
+
:host(limel-checkbox:focus-within),
|
|
891
|
+
:host(limel-checkbox[invalid]) {
|
|
892
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
893
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
855
894
|
}
|
|
856
895
|
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
896
|
+
:host(limel-checkbox),
|
|
897
|
+
:host(limel-checkbox[invalid=false]) {
|
|
898
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
899
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
861
900
|
}
|
|
862
|
-
|
|
863
|
-
:host(:focus
|
|
864
|
-
:host(:focus-
|
|
865
|
-
|
|
901
|
+
|
|
902
|
+
:host(limel-checkbox:focus) limel-helper-line,
|
|
903
|
+
:host(limel-checkbox:focus-visible) limel-helper-line,
|
|
904
|
+
:host(limel-checkbox:focus-within) limel-helper-line,
|
|
905
|
+
:host(limel-checkbox:hover) limel-helper-line {
|
|
906
|
+
will-change: grid-template-rows;
|
|
866
907
|
}
|
|
867
908
|
|
|
868
909
|
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
@@ -5259,19 +5300,60 @@ a.mdc-list-item {
|
|
|
5259
5300
|
color: var(--lime-error-text-color);
|
|
5260
5301
|
}
|
|
5261
5302
|
|
|
5262
|
-
|
|
5263
|
-
|
|
5303
|
+
/**
|
|
5304
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
5305
|
+
* node module, for consumer projects to import.
|
|
5306
|
+
* That means this file cannot import from any file that isn't
|
|
5307
|
+
* also exported, keeping the same relative path.
|
|
5308
|
+
*
|
|
5309
|
+
* Or, just don't import anything, that works too.
|
|
5310
|
+
*/
|
|
5311
|
+
/**
|
|
5312
|
+
* This mixin will mask out the content that is close to
|
|
5313
|
+
* the edges of a scrollable area.
|
|
5314
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
5315
|
+
* as an argument for `$direction`.
|
|
5316
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
5317
|
+
* as an argument for `$direction`.
|
|
5318
|
+
*
|
|
5319
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
5320
|
+
* the size of the fade-out edge effect is the same as the
|
|
5321
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
5322
|
+
* scrollable area that does not have a padding will fade out before
|
|
5323
|
+
* any scrolling has been done.
|
|
5324
|
+
* This is why this mixin already adds paddings, which automatically
|
|
5325
|
+
* default to the size of the fade-out effect.
|
|
5326
|
+
* This size defaults to `1rem`, but to override the size use
|
|
5327
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
5328
|
+
* when `vertically` argument is set, and use
|
|
5329
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
5330
|
+
* when `horizontally` argument is set.
|
|
5331
|
+
* Of course you can also programmatically increase and decrease the
|
|
5332
|
+
* size of these variables for each edge, based on the amount of
|
|
5333
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
5334
|
+
* to add a custom padding where the mixin is used, to override
|
|
5335
|
+
* the paddings that are automatically added by the mixin in the
|
|
5336
|
+
* compiled CSS code.
|
|
5337
|
+
*/
|
|
5338
|
+
:host(limel-checkbox:focus),
|
|
5339
|
+
:host(limel-checkbox:focus-visible),
|
|
5340
|
+
:host(limel-checkbox:focus-within),
|
|
5341
|
+
:host(limel-checkbox[invalid]) {
|
|
5342
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
5343
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
5264
5344
|
}
|
|
5265
5345
|
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5346
|
+
:host(limel-checkbox),
|
|
5347
|
+
:host(limel-checkbox[invalid=false]) {
|
|
5348
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
5349
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
5270
5350
|
}
|
|
5271
|
-
|
|
5272
|
-
:host(:focus
|
|
5273
|
-
:host(:focus-
|
|
5274
|
-
|
|
5351
|
+
|
|
5352
|
+
:host(limel-checkbox:focus) limel-helper-line,
|
|
5353
|
+
:host(limel-checkbox:focus-visible) limel-helper-line,
|
|
5354
|
+
:host(limel-checkbox:focus-within) limel-helper-line,
|
|
5355
|
+
:host(limel-checkbox:hover) limel-helper-line {
|
|
5356
|
+
will-change: grid-template-rows;
|
|
5275
5357
|
}
|
|
5276
5358
|
|
|
5277
5359
|
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
@@ -920,19 +920,60 @@
|
|
|
920
920
|
color: var(--lime-error-text-color);
|
|
921
921
|
}
|
|
922
922
|
|
|
923
|
-
|
|
924
|
-
|
|
923
|
+
/**
|
|
924
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
925
|
+
* node module, for consumer projects to import.
|
|
926
|
+
* That means this file cannot import from any file that isn't
|
|
927
|
+
* also exported, keeping the same relative path.
|
|
928
|
+
*
|
|
929
|
+
* Or, just don't import anything, that works too.
|
|
930
|
+
*/
|
|
931
|
+
/**
|
|
932
|
+
* This mixin will mask out the content that is close to
|
|
933
|
+
* the edges of a scrollable area.
|
|
934
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
935
|
+
* as an argument for `$direction`.
|
|
936
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
937
|
+
* as an argument for `$direction`.
|
|
938
|
+
*
|
|
939
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
940
|
+
* the size of the fade-out edge effect is the same as the
|
|
941
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
942
|
+
* scrollable area that does not have a padding will fade out before
|
|
943
|
+
* any scrolling has been done.
|
|
944
|
+
* This is why this mixin already adds paddings, which automatically
|
|
945
|
+
* default to the size of the fade-out effect.
|
|
946
|
+
* This size defaults to `1rem`, but to override the size use
|
|
947
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
948
|
+
* when `vertically` argument is set, and use
|
|
949
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
950
|
+
* when `horizontally` argument is set.
|
|
951
|
+
* Of course you can also programmatically increase and decrease the
|
|
952
|
+
* size of these variables for each edge, based on the amount of
|
|
953
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
954
|
+
* to add a custom padding where the mixin is used, to override
|
|
955
|
+
* the paddings that are automatically added by the mixin in the
|
|
956
|
+
* compiled CSS code.
|
|
957
|
+
*/
|
|
958
|
+
:host(limel-checkbox:focus),
|
|
959
|
+
:host(limel-checkbox:focus-visible),
|
|
960
|
+
:host(limel-checkbox:focus-within),
|
|
961
|
+
:host(limel-checkbox[invalid]) {
|
|
962
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
963
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
925
964
|
}
|
|
926
965
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
966
|
+
:host(limel-checkbox),
|
|
967
|
+
:host(limel-checkbox[invalid=false]) {
|
|
968
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
969
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
931
970
|
}
|
|
932
|
-
|
|
933
|
-
:host(:focus
|
|
934
|
-
:host(:focus-
|
|
935
|
-
|
|
971
|
+
|
|
972
|
+
:host(limel-checkbox:focus) limel-helper-line,
|
|
973
|
+
:host(limel-checkbox:focus-visible) limel-helper-line,
|
|
974
|
+
:host(limel-checkbox:focus-within) limel-helper-line,
|
|
975
|
+
:host(limel-checkbox:hover) limel-helper-line {
|
|
976
|
+
will-change: grid-template-rows;
|
|
936
977
|
}
|
|
937
978
|
|
|
938
979
|
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
@@ -5333,19 +5374,60 @@ a.mdc-list-item {
|
|
|
5333
5374
|
color: var(--lime-error-text-color);
|
|
5334
5375
|
}
|
|
5335
5376
|
|
|
5336
|
-
|
|
5337
|
-
|
|
5377
|
+
/**
|
|
5378
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
5379
|
+
* node module, for consumer projects to import.
|
|
5380
|
+
* That means this file cannot import from any file that isn't
|
|
5381
|
+
* also exported, keeping the same relative path.
|
|
5382
|
+
*
|
|
5383
|
+
* Or, just don't import anything, that works too.
|
|
5384
|
+
*/
|
|
5385
|
+
/**
|
|
5386
|
+
* This mixin will mask out the content that is close to
|
|
5387
|
+
* the edges of a scrollable area.
|
|
5388
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
5389
|
+
* as an argument for `$direction`.
|
|
5390
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
5391
|
+
* as an argument for `$direction`.
|
|
5392
|
+
*
|
|
5393
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
5394
|
+
* the size of the fade-out edge effect is the same as the
|
|
5395
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
5396
|
+
* scrollable area that does not have a padding will fade out before
|
|
5397
|
+
* any scrolling has been done.
|
|
5398
|
+
* This is why this mixin already adds paddings, which automatically
|
|
5399
|
+
* default to the size of the fade-out effect.
|
|
5400
|
+
* This size defaults to `1rem`, but to override the size use
|
|
5401
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
5402
|
+
* when `vertically` argument is set, and use
|
|
5403
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
5404
|
+
* when `horizontally` argument is set.
|
|
5405
|
+
* Of course you can also programmatically increase and decrease the
|
|
5406
|
+
* size of these variables for each edge, based on the amount of
|
|
5407
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
5408
|
+
* to add a custom padding where the mixin is used, to override
|
|
5409
|
+
* the paddings that are automatically added by the mixin in the
|
|
5410
|
+
* compiled CSS code.
|
|
5411
|
+
*/
|
|
5412
|
+
:host(limel-checkbox:focus),
|
|
5413
|
+
:host(limel-checkbox:focus-visible),
|
|
5414
|
+
:host(limel-checkbox:focus-within),
|
|
5415
|
+
:host(limel-checkbox[invalid]) {
|
|
5416
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
5417
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
5338
5418
|
}
|
|
5339
5419
|
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5420
|
+
:host(limel-checkbox),
|
|
5421
|
+
:host(limel-checkbox[invalid=false]) {
|
|
5422
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
5423
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
5344
5424
|
}
|
|
5345
|
-
|
|
5346
|
-
:host(:focus
|
|
5347
|
-
:host(:focus-
|
|
5348
|
-
|
|
5425
|
+
|
|
5426
|
+
:host(limel-checkbox:focus) limel-helper-line,
|
|
5427
|
+
:host(limel-checkbox:focus-visible) limel-helper-line,
|
|
5428
|
+
:host(limel-checkbox:focus-within) limel-helper-line,
|
|
5429
|
+
:host(limel-checkbox:hover) limel-helper-line {
|
|
5430
|
+
will-change: grid-template-rows;
|
|
5349
5431
|
}
|
|
5350
5432
|
|
|
5351
5433
|
.lime-checkbox--readonly.mdc-checkbox--disabled {
|
|
@@ -1777,17 +1777,64 @@ select.limel-select__native-control {
|
|
|
1777
1777
|
display: none;
|
|
1778
1778
|
}
|
|
1779
1779
|
|
|
1780
|
-
|
|
1781
|
-
|
|
1780
|
+
/**
|
|
1781
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
1782
|
+
* node module, for consumer projects to import.
|
|
1783
|
+
* That means this file cannot import from any file that isn't
|
|
1784
|
+
* also exported, keeping the same relative path.
|
|
1785
|
+
*
|
|
1786
|
+
* Or, just don't import anything, that works too.
|
|
1787
|
+
*/
|
|
1788
|
+
/**
|
|
1789
|
+
* This mixin will mask out the content that is close to
|
|
1790
|
+
* the edges of a scrollable area.
|
|
1791
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
1792
|
+
* as an argument for `$direction`.
|
|
1793
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
1794
|
+
* as an argument for `$direction`.
|
|
1795
|
+
*
|
|
1796
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
1797
|
+
* the size of the fade-out edge effect is the same as the
|
|
1798
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
1799
|
+
* scrollable area that does not have a padding will fade out before
|
|
1800
|
+
* any scrolling has been done.
|
|
1801
|
+
* This is why this mixin already adds paddings, which automatically
|
|
1802
|
+
* default to the size of the fade-out effect.
|
|
1803
|
+
* This size defaults to `1rem`, but to override the size use
|
|
1804
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
1805
|
+
* when `vertically` argument is set, and use
|
|
1806
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
1807
|
+
* when `horizontally` argument is set.
|
|
1808
|
+
* Of course you can also programmatically increase and decrease the
|
|
1809
|
+
* size of these variables for each edge, based on the amount of
|
|
1810
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
1811
|
+
* to add a custom padding where the mixin is used, to override
|
|
1812
|
+
* the paddings that are automatically added by the mixin in the
|
|
1813
|
+
* compiled CSS code.
|
|
1814
|
+
*/
|
|
1815
|
+
:host(limel-select:focus),
|
|
1816
|
+
:host(limel-select:focus-visible),
|
|
1817
|
+
:host(limel-select:focus-within),
|
|
1818
|
+
:host(limel-select[invalid]) {
|
|
1819
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
1820
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
1782
1821
|
}
|
|
1783
1822
|
|
|
1784
|
-
|
|
1785
|
-
|
|
1823
|
+
:host(limel-select),
|
|
1824
|
+
:host(limel-select[invalid=false]) {
|
|
1825
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
1826
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
1786
1827
|
}
|
|
1787
1828
|
|
|
1788
|
-
:host(:focus) limel-helper-line,
|
|
1789
|
-
:host(:focus-visible) limel-helper-line,
|
|
1790
|
-
:host(:focus-within) limel-helper-line,
|
|
1829
|
+
:host(limel-select:focus) limel-helper-line,
|
|
1830
|
+
:host(limel-select:focus-visible) limel-helper-line,
|
|
1831
|
+
:host(limel-select:focus-within) limel-helper-line,
|
|
1832
|
+
:host(limel-select:hover) limel-helper-line {
|
|
1833
|
+
will-change: grid-template-rows;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
.limel-select--focused + limel-helper-line,
|
|
1791
1837
|
.limel-select--invalid limel-helper-line {
|
|
1792
|
-
|
|
1838
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
1839
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
1793
1840
|
}
|
|
@@ -913,13 +913,62 @@
|
|
|
913
913
|
background-color: var(--mdc-theme-primary);
|
|
914
914
|
}
|
|
915
915
|
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
916
|
+
/**
|
|
917
|
+
* Note! This file is exported to `dist/scss/` in the published
|
|
918
|
+
* node module, for consumer projects to import.
|
|
919
|
+
* That means this file cannot import from any file that isn't
|
|
920
|
+
* also exported, keeping the same relative path.
|
|
921
|
+
*
|
|
922
|
+
* Or, just don't import anything, that works too.
|
|
923
|
+
*/
|
|
924
|
+
/**
|
|
925
|
+
* This mixin will mask out the content that is close to
|
|
926
|
+
* the edges of a scrollable area.
|
|
927
|
+
* - If the scrollable content has `overflow-y`, use `vertically`
|
|
928
|
+
* as an argument for `$direction`.
|
|
929
|
+
- If the scrollable content has `overflow-x`, use `horizontally`
|
|
930
|
+
* as an argument for `$direction`.
|
|
931
|
+
*
|
|
932
|
+
* For the visual effect to work smoothly, we need to make sure that
|
|
933
|
+
* the size of the fade-out edge effect is the same as the
|
|
934
|
+
* internal paddings of the scrollable area. Otherwise, content of a
|
|
935
|
+
* scrollable area that does not have a padding will fade out before
|
|
936
|
+
* any scrolling has been done.
|
|
937
|
+
* This is why this mixin already adds paddings, which automatically
|
|
938
|
+
* default to the size of the fade-out effect.
|
|
939
|
+
* This size defaults to `1rem`, but to override the size use
|
|
940
|
+
* `--limel-top-edge-fade-height` & `--limel-bottom-edge-fade-height`
|
|
941
|
+
* when `vertically` argument is set, and use
|
|
942
|
+
* `--limel-left-edge-fade-width` & `--limel-right-edge-fade-width`
|
|
943
|
+
* when `horizontally` argument is set.
|
|
944
|
+
* Of course you can also programmatically increase and decrease the
|
|
945
|
+
* size of these variables for each edge, based on the amount of
|
|
946
|
+
* scrolling that has been done by the user. In this case, make sure
|
|
947
|
+
* to add a custom padding where the mixin is used, to override
|
|
948
|
+
* the paddings that are automatically added by the mixin in the
|
|
949
|
+
* compiled CSS code.
|
|
950
|
+
*/
|
|
951
|
+
:host(limel-slider:focus),
|
|
952
|
+
:host(limel-slider:focus-visible),
|
|
953
|
+
:host(limel-slider:focus-within),
|
|
954
|
+
:host(limel-slider[invalid]) {
|
|
955
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
956
|
+
--limel-h-l-grid-template-rows: 1fr;
|
|
919
957
|
}
|
|
920
958
|
|
|
921
|
-
:host(
|
|
922
|
-
:host(
|
|
923
|
-
|
|
924
|
-
|
|
959
|
+
:host(limel-slider),
|
|
960
|
+
:host(limel-slider[invalid=false]) {
|
|
961
|
+
--limel-h-l-grid-template-rows-transition-speed: 0.3s;
|
|
962
|
+
--limel-h-l-grid-template-rows: 0fr;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
:host(limel-slider:focus) limel-helper-line,
|
|
966
|
+
:host(limel-slider:focus-visible) limel-helper-line,
|
|
967
|
+
:host(limel-slider:focus-within) limel-helper-line,
|
|
968
|
+
:host(limel-slider:hover) limel-helper-line {
|
|
969
|
+
will-change: grid-template-rows;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
limel-helper-line {
|
|
973
|
+
order: 3;
|
|
925
974
|
}
|