@aquera/nile-elements 0.1.36 → 0.1.38-beta-1.0
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/README.md +13 -0
- package/demo/index.html +9 -9
- package/demo/variables.css +13 -0
- package/dist/{fixture-2b5b3aba.esm.js → fixture-add72f26.esm.js} +1 -1
- package/dist/{fixture-7bfb866e.cjs.js → fixture-cb376a7f.cjs.js} +3 -3
- package/dist/fixture-cb376a7f.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/lit-html-39a6718c.esm.js +6 -0
- package/dist/lit-html-9b3af046.cjs.js +6 -0
- package/dist/lit-html-9b3af046.cjs.js.map +1 -0
- package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
- package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.test.esm.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js +1 -1
- package/dist/nile-button/nile-button.test.esm.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
- package/dist/nile-card/nile-card.test.cjs.js +1 -1
- package/dist/nile-card/nile-card.test.esm.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
- package/dist/nile-file-preview/index.cjs.js +2 -0
- package/dist/nile-file-preview/index.cjs.js.map +1 -0
- package/dist/nile-file-preview/index.esm.js +1 -0
- package/dist/nile-file-preview/nile-file-preview.cjs.js +2 -0
- package/dist/nile-file-preview/nile-file-preview.cjs.js.map +1 -0
- package/dist/nile-file-preview/nile-file-preview.css.cjs.js +2 -0
- package/dist/nile-file-preview/nile-file-preview.css.cjs.js.map +1 -0
- package/dist/nile-file-preview/nile-file-preview.css.esm.js +510 -0
- package/dist/nile-file-preview/nile-file-preview.esm.js +3 -0
- package/dist/nile-file-preview/nile-file-preview.template.cjs.js +2 -0
- package/dist/nile-file-preview/nile-file-preview.template.cjs.js.map +1 -0
- package/dist/nile-file-preview/nile-file-preview.template.esm.js +179 -0
- package/dist/nile-file-preview/nile-file-preview.test.cjs.js +2 -0
- package/dist/nile-file-preview/nile-file-preview.test.cjs.js.map +1 -0
- package/dist/nile-file-preview/nile-file-preview.test.esm.js +1 -0
- package/dist/nile-file-preview/types/index.cjs.js +2 -0
- package/dist/nile-file-preview/types/index.cjs.js.map +1 -0
- package/dist/nile-file-preview/types/index.esm.js +1 -0
- package/dist/nile-file-preview/types/nile-file-preview.enums.cjs.js +2 -0
- package/dist/nile-file-preview/types/nile-file-preview.enums.cjs.js.map +1 -0
- package/dist/nile-file-preview/types/nile-file-preview.enums.esm.js +1 -0
- package/dist/nile-file-preview/types/nile-file-preview.interface.cjs.js +2 -0
- package/dist/nile-file-preview/types/nile-file-preview.interface.cjs.js.map +1 -0
- package/dist/nile-file-preview/types/nile-file-preview.interface.esm.js +1 -0
- package/dist/nile-file-preview/utils/index.cjs.js +2 -0
- package/dist/nile-file-preview/utils/index.cjs.js.map +1 -0
- package/dist/nile-file-preview/utils/index.esm.js +1 -0
- package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js +2 -0
- package/dist/nile-file-preview/utils/nile-file-preview.util.cjs.js.map +1 -0
- package/dist/nile-file-preview/utils/nile-file-preview.util.esm.js +1 -0
- package/dist/nile-file-upload/index.cjs.js +2 -0
- package/dist/nile-file-upload/index.cjs.js.map +1 -0
- package/dist/nile-file-upload/index.esm.js +1 -0
- package/dist/nile-file-upload/nile-file-upload.cjs.js +2 -0
- package/dist/nile-file-upload/nile-file-upload.cjs.js.map +1 -0
- package/dist/nile-file-upload/nile-file-upload.css.cjs.js +2 -0
- package/dist/nile-file-upload/nile-file-upload.css.cjs.js.map +1 -0
- package/dist/nile-file-upload/nile-file-upload.css.esm.js +536 -0
- package/dist/nile-file-upload/nile-file-upload.esm.js +3 -0
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js +10 -0
- package/dist/nile-file-upload/nile-file-upload.template.cjs.js.map +1 -0
- package/dist/nile-file-upload/nile-file-upload.template.esm.js +163 -0
- package/dist/nile-file-upload/nile-file-upload.test.cjs.js +2 -0
- package/dist/nile-file-upload/nile-file-upload.test.cjs.js.map +1 -0
- package/dist/nile-file-upload/nile-file-upload.test.esm.js +1 -0
- package/dist/nile-file-upload/types/file-upload.enums.cjs.js +2 -0
- package/dist/nile-file-upload/types/file-upload.enums.cjs.js.map +1 -0
- package/dist/nile-file-upload/types/file-upload.enums.esm.js +1 -0
- package/dist/nile-file-upload/types/file-upload.type.cjs.js +2 -0
- package/dist/nile-file-upload/types/file-upload.type.cjs.js.map +1 -0
- package/dist/nile-file-upload/types/file-upload.type.esm.js +1 -0
- package/dist/nile-file-upload/types/index.cjs.js +2 -0
- package/dist/nile-file-upload/types/index.cjs.js.map +1 -0
- package/dist/nile-file-upload/types/index.esm.js +1 -0
- package/dist/nile-file-upload/utils/drag-drop.util.cjs.js +2 -0
- package/dist/nile-file-upload/utils/drag-drop.util.cjs.js.map +1 -0
- package/dist/nile-file-upload/utils/drag-drop.util.esm.js +1 -0
- package/dist/nile-file-upload/utils/file-validation.util.cjs.js +2 -0
- package/dist/nile-file-upload/utils/file-validation.util.cjs.js.map +1 -0
- package/dist/nile-file-upload/utils/file-validation.util.esm.js +1 -0
- package/dist/nile-filter-chip/index.cjs.js +2 -0
- package/dist/nile-filter-chip/index.cjs.js.map +1 -0
- package/dist/nile-filter-chip/index.esm.js +1 -0
- package/dist/nile-filter-chip/nile-filter-chip.cjs.js +2 -0
- package/dist/nile-filter-chip/nile-filter-chip.cjs.js.map +1 -0
- package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js +2 -0
- package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js.map +1 -0
- package/dist/nile-filter-chip/nile-filter-chip.css.esm.js +121 -0
- package/dist/nile-filter-chip/nile-filter-chip.esm.js +43 -0
- package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +2 -0
- package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js.map +1 -0
- package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +20 -0
- package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.test.esm.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
- package/dist/nile-icon/nile-icon.test.esm.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js +1 -1
- package/dist/nile-input/nile-input.test.esm.js +1 -1
- package/dist/nile-link/nile-link.test.cjs.js +1 -1
- package/dist/nile-link/nile-link.test.esm.js +1 -1
- package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
- package/dist/nile-loader/nile-loader.test.esm.js +1 -1
- package/dist/nile-popover/index.cjs.js +1 -1
- package/dist/nile-popover/index.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +3 -11
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.esm.js +7 -13
- package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.test.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.test.esm.js +3 -3
- package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.test.esm.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
- package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
- package/dist/nile-radio/nile-radio.test.esm.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js +1 -1
- package/dist/nile-select/nile-select.test.esm.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.css.js +32 -43
- package/dist/src/nile-file-preview/nile-file-preview.css.js.map +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.d.ts +3 -1
- package/dist/src/nile-file-preview/nile-file-preview.js +27 -5
- package/dist/src/nile-file-preview/nile-file-preview.js.map +1 -1
- package/dist/src/nile-file-preview/nile-file-preview.template.d.ts +2 -0
- package/dist/src/nile-file-preview/nile-file-preview.template.js +114 -48
- package/dist/src/nile-file-preview/nile-file-preview.template.js.map +1 -1
- package/dist/src/nile-file-preview/types/index.d.ts +2 -2
- package/dist/src/nile-file-preview/types/index.js +2 -2
- package/dist/src/nile-file-preview/types/index.js.map +1 -1
- package/dist/src/nile-file-preview/types/nile-file-preview.enums.d.ts +28 -0
- package/dist/src/nile-file-preview/types/nile-file-preview.enums.js +33 -0
- package/dist/src/nile-file-preview/types/nile-file-preview.enums.js.map +1 -0
- package/dist/src/nile-file-preview/types/nile-file-preview.interface.d.ts +4 -0
- package/dist/src/nile-file-preview/types/nile-file-preview.interface.js +2 -0
- package/dist/src/nile-file-preview/types/nile-file-preview.interface.js.map +1 -0
- package/dist/src/nile-file-preview/utils/index.d.ts +1 -1
- package/dist/src/nile-file-preview/utils/index.js +1 -1
- package/dist/src/nile-file-preview/utils/index.js.map +1 -1
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.d.ts +4 -0
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.js +38 -0
- package/dist/src/nile-file-preview/utils/nile-file-preview.util.js.map +1 -0
- package/dist/src/nile-file-upload/nile-file-upload.css.js +2 -1
- package/dist/src/nile-file-upload/nile-file-upload.css.js.map +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.d.ts +3 -0
- package/dist/src/nile-file-upload/nile-file-upload.js +22 -5
- package/dist/src/nile-file-upload/nile-file-upload.js.map +1 -1
- package/dist/src/nile-file-upload/nile-file-upload.template.js +27 -19
- package/dist/src/nile-file-upload/nile-file-upload.template.js.map +1 -1
- package/dist/src/nile-file-upload/types/file-upload.enums.d.ts +9 -2
- package/dist/src/nile-file-upload/types/file-upload.enums.js +8 -1
- package/dist/src/nile-file-upload/types/file-upload.enums.js.map +1 -1
- package/dist/src/nile-file-upload/utils/drag-drop.util.d.ts +5 -1
- package/dist/src/nile-file-upload/utils/drag-drop.util.js +9 -1
- package/dist/src/nile-file-upload/utils/drag-drop.util.js.map +1 -1
- package/dist/src/nile-file-upload/utils/file-validation.util.d.ts +3 -1
- package/dist/src/nile-file-upload/utils/file-validation.util.js +72 -10
- package/dist/src/nile-file-upload/utils/file-validation.util.js.map +1 -1
- package/dist/src/nile-filter-chip/index.d.ts +1 -0
- package/dist/src/nile-filter-chip/index.js +2 -0
- package/dist/src/nile-filter-chip/index.js.map +1 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.css.d.ts +12 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.css.js +133 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.css.js.map +1 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.d.ts +36 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.js +141 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.js.map +1 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.test.d.ts +1 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.test.js +80 -0
- package/dist/src/nile-filter-chip/nile-filter-chip.test.js.map +1 -0
- package/dist/src/nile-tooltip/nile-tooltip-utils.d.ts +18 -0
- package/dist/src/nile-tooltip/nile-tooltip-utils.js +216 -0
- package/dist/src/nile-tooltip/nile-tooltip-utils.js.map +1 -0
- package/dist/src/nile-tooltip/nile-tooltip.test.d.ts +1 -0
- package/dist/src/nile-tooltip/nile-tooltip.test.js +148 -0
- package/dist/src/nile-tooltip/nile-tooltip.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -1
- package/src/nile-file-preview/index.ts +1 -0
- package/src/nile-file-preview/nile-file-preview.css.ts +524 -0
- package/src/nile-file-preview/nile-file-preview.template.ts +248 -0
- package/src/nile-file-preview/nile-file-preview.test.ts +38 -0
- package/src/nile-file-preview/nile-file-preview.ts +173 -0
- package/src/nile-file-preview/types/index.ts +2 -0
- package/src/nile-file-preview/types/nile-file-preview.enums.ts +31 -0
- package/src/nile-file-preview/types/nile-file-preview.interface.ts +4 -0
- package/src/nile-file-preview/utils/index.ts +1 -0
- package/src/nile-file-preview/utils/nile-file-preview.util.ts +47 -0
- package/src/nile-file-upload/index.ts +1 -0
- package/src/nile-file-upload/nile-file-upload.css.ts +550 -0
- package/src/nile-file-upload/nile-file-upload.template.ts +201 -0
- package/src/nile-file-upload/nile-file-upload.test.ts +38 -0
- package/src/nile-file-upload/nile-file-upload.ts +149 -0
- package/src/nile-file-upload/types/file-upload.enums.ts +39 -0
- package/src/nile-file-upload/types/file-upload.type.ts +5 -0
- package/src/nile-file-upload/types/index.ts +2 -0
- package/src/nile-file-upload/utils/drag-drop.util.ts +106 -0
- package/src/nile-file-upload/utils/file-validation.util.ts +163 -0
- package/src/nile-filter-chip/index.ts +1 -0
- package/src/nile-filter-chip/nile-filter-chip.css.ts +138 -0
- package/src/nile-filter-chip/nile-filter-chip.test.ts +92 -0
- package/src/nile-filter-chip/nile-filter-chip.ts +136 -0
- package/vscode-html-custom-data.json +192 -0
- package/dist/fixture-7bfb866e.cjs.js.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-validation.util.js","sourceRoot":"","sources":["../../../../src/nile-file-upload/utils/file-validation.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG5D,+BAA+B;AAC/B,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAW,EAAE;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CA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,QAA0C,EAC1C,YAA6B;IAE7B,IAAI,YAAY,KAAK,eAAe,CAAC,OAAO,EAAE,CAAC;QAC7C,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,QAA0C,EAC1C,YAA6B;IAE7B,IAAI,YAAY,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QAC3C,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;AACH,CAAC","sourcesContent":["import { DragHandler } from \"./drag-drop.util\";\nimport { FileUploadState, FileUploadError } from \"../types\";\nimport { NileFileUpload } from \"../nile-file-upload\";\n\n// to check the duplicate files\nexport const areDuplicates = (files: File[], uploadedFiles: File[]): boolean => {\n return files.some(file =>\n uploadedFiles.some(existing =>\n file.name === existing.name &&\n file.size === existing.size &&\n file.lastModified === existing.lastModified\n )\n );\n};\n\n// set up the drag handler\nexport const setUpDragHandler = (\n nileFileUpload: NileFileUpload,\n dragHandler: DragHandler\n): void => {\n dragHandler.onStateChange((newState: FileUploadState) => {\n nileFileUpload.state = newState;\n });\n\n dragHandler.onFileDrop((files: File[]) => {\n if (!nileFileUpload.allowMultiple) {\n const total = nileFileUpload.uploadedFiles.length + files.length;\n if (total > 1) {\n nileFileUpload.errorMessage = FileUploadError.MULTIPLE_NOT_ALLOWED;\n nileFileUpload.requestUpdate();\n return;\n }\n }\n\n if (!nileFileUpload.allowDuplicates) {\n const duplicates = areDuplicates(files, nileFileUpload.uploadedFiles);\n if (duplicates) {\n nileFileUpload.errorMessage = FileUploadError.DUPLICATES_NOT_ALLOWED;\n nileFileUpload.requestUpdate();\n return;\n }\n }\n nileFileUpload.uploadedFiles = [...nileFileUpload.uploadedFiles, ...files];\n nileFileUpload.requestUpdate();\n });\n};\n\n// global listenrers\nexport const addGlobalListeners = (dragHandler: DragHandler): void => {\n document.addEventListener('dragover', dragHandler.preventDragOver, { passive: false });\n document.addEventListener('drop', dragHandler.preventDrop, { passive: false });\n}\n\n// for hover & dragging functionality\nexport const addInternalListeners = (nileFileUpload: NileFileUpload, dragHandler: DragHandler): void => {\n nileFileUpload.addEventListener('mouseenter', (e) => handleHoverIn(nileFileUpload.setState, nileFileUpload.state));\n nileFileUpload.addEventListener('mouseleave', (e) => handleHoverOut(nileFileUpload.setState, nileFileUpload.state));\n nileFileUpload.addEventListener('dragenter', (e) => dragHandler.dragEnter(e));\n nileFileUpload.addEventListener('dragleave', (e) => dragHandler.dragLeave(e));\n nileFileUpload.addEventListener('dragover', (e) => dragHandler.dragOver(e));\n nileFileUpload.addEventListener('drop', (e) => dragHandler.drop(e));\n}\n\nexport function handleHoverIn(\n setState: (state: FileUploadState) => void,\n currentState: FileUploadState\n): void {\n if (currentState === FileUploadState.DEFAULT) {\n setState(FileUploadState.HOVER);\n }\n}\n\nexport function handleHoverOut(\n setState: (state: FileUploadState) => void,\n currentState: FileUploadState\n): void {\n if (currentState === FileUploadState.HOVER) {\n setState(FileUploadState.DEFAULT);\n }\n}"]}
|
1
|
+
{"version":3,"file":"file-validation.util.js","sourceRoot":"","sources":["../../../../src/nile-file-upload/utils/file-validation.util.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG7E,iFAAiF;AACjF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,aAAqB,EAAW,EAAE;IAC7E,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvB,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAC5B,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;QAC3B,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI;QAC3B,IAAI,CAAC,YAAY,KAAK,QAAQ,CAAC,YAAY,CAC5C,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,0BAA0B;AAC1B,MAAM,CAAC,M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C,CAAC;QACN,CAAC,CAAC;QAEF,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QAChC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrB,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,cAA8B,EAAE,cAAyC,EAAE,EAAE;IAC5G,QAAQ,CAAC,gBAAgB,CAAC,eAAe,CAAC,kBAAkB,EAAE,CAAC,CAAc,EAAE,EAAE;QAC/E,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QACnC,MAAM,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAE7C,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;QACD,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACpC,cAAc,CAAC,aAAa,GAAG,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC;QAElG,cAAc,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,eAAe,CAAC,qBAAqB,EAAE;YAClF,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;SAC/B,CAAC,CAAC,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { DragHandler } from \"./drag-drop.util\";\nimport { FileUploadState, FileUploadError, FileUploadEvent } from \"../types\";\nimport { NileFileUpload } from \"../nile-file-upload\";\n\n// write a function to check for duplicatse in the files name it as areDuplicates\nexport const areDuplicates = (files: File[], uploadedFiles: File[]): boolean => {\n return files.some(file =>\n uploadedFiles.some(existing =>\n file.name === existing.name &&\n file.size === existing.size &&\n file.lastModified === existing.lastModified\n )\n );\n};\n\n// set up the drag handler\nexport const setUpDragHandler = (\n nileFileUpload: NileFileUpload,\n dragHandler: DragHandler\n): void => {\n dragHandler.onStateChange((newState: FileUploadState) => {\n nileFileUpload.state = newState;\n });\n\n dragHandler.onFileDrop((files: File[]) => {\n let { allowMultiple, uploadedFiles, errorMessage, requestUpdate } = nileFileUpload;\n\n if (!allowMultiple) {\n const total = uploadedFiles.length + files.length;\n if (total > 1) {\n errorMessage = FileUploadError.MULTIPLE_NOT_ALLOWED;\n requestUpdate();\n return;\n }\n }\n\n let newFiles = files;\n\n if (!nileFileUpload.allowDuplicates) {\n newFiles = files.filter(file =>\n !nileFileUpload.uploadedFiles.some(\n uploaded =>\n uploaded.name === file.name &&\n uploaded.size === file.size &&\n uploaded.type === file.type\n )\n );\n\n if (newFiles.length === 0) {\n nileFileUpload.errorMessage = FileUploadError.DUPLICATES_NOT_ALLOWED;\n nileFileUpload.requestUpdate();\n return;\n }\n }\n\n nileFileUpload.uploadedFiles = [...nileFileUpload.uploadedFiles, ...newFiles];\n nileFileUpload.requestUpdate();\n });\n\n dragHandler.setErrorMessage((errorMessage: string) => {\n nileFileUpload.errorMessage = errorMessage;\n });\n};\n\n\n// global listenrers\nexport const addGlobalListeners = (dragHandler: DragHandler): void => {\n document.addEventListener('dragover', dragHandler.preventDragOver, { passive: false });\n document.addEventListener('drop', dragHandler.preventDrop, { passive: false });\n}\n\n// for hover & dragging functionality\nexport const addInternalListeners = (nileFileUpload: NileFileUpload, dragHandler: DragHandler, uploadRequests: any): void => {\n nileFileUpload.addEventListener('mouseenter', (e) => handleHoverIn(nileFileUpload.setState, nileFileUpload.state));\n nileFileUpload.addEventListener('mouseleave', (e) => handleHoverOut(nileFileUpload.setState, nileFileUpload.state));\n nileFileUpload.addEventListener('dragenter', (e) => dragHandler.dragEnter(e));\n nileFileUpload.addEventListener('dragleave', (e) => dragHandler.dragLeave(e));\n nileFileUpload.addEventListener('dragover', (e) => dragHandler.dragOver(e));\n nileFileUpload.addEventListener('drop', (e) => dragHandler.drop(e)); \n\n cancelFileUpload(nileFileUpload, uploadRequests);\n}\n\nexport function handleHoverIn(\n setState: (state: FileUploadState) => void,\n currentState: FileUploadState\n): void {\n if (currentState === FileUploadState.DEFAULT) {\n setState(FileUploadState.HOVER);\n }\n}\n\nexport function handleHoverOut(\n setState: (state: FileUploadState) => void,\n currentState: FileUploadState\n): void {\n if (currentState === FileUploadState.HOVER) {\n setState(FileUploadState.DEFAULT);\n }\n}\n\nexport function uploadFiles(nileFileUpload: NileFileUpload) {\n const { uploadedFiles, fileUploadUrl, uploadRequests } = nileFileUpload;\n if (!fileUploadUrl || !uploadedFiles?.length) return;\n\n for (const file of uploadedFiles) {\n const formData = new FormData();\n formData.append('file', file);\n\n const xhr = new XMLHttpRequest();\n uploadRequests.set(file, xhr);\n\n xhr.upload.onprogress = (e) => {\n const percent = Math.floor((e.loaded / e.total) * 100);\n nileFileUpload.dispatchEvent(new CustomEvent(FileUploadEvent.NILE_UPLOAD_PROGRESS, {\n detail: { file, progress: percent }\n }));\n };\n\n xhr.onload = () => {\n uploadRequests.delete(file);\n if (xhr.status === 201) {\n // Remove the successfully uploaded file\n nileFileUpload.uploadedFiles = nileFileUpload.uploadedFiles.filter(f => f !== file);\n\n nileFileUpload.dispatchEvent(new CustomEvent(FileUploadEvent.NILE_UPLOAD_SUCCESS, {\n detail: { file, response: xhr.response }\n }));\n } else {\n nileFileUpload.dispatchEvent(new CustomEvent(FileUploadEvent.SERVER_SIDE_ERROR, {\n detail: { file, status: xhr.status, response: xhr.response }\n }));\n }\n };\n\n xhr.onerror = () => {\n uploadRequests.delete(file);\n nileFileUpload.dispatchEvent(new CustomEvent(FileUploadEvent.NILE_NETWORK_ERROR, {\n detail: { file, status: xhr.status, response: xhr.response }\n }));\n };\n\n xhr.open('POST', fileUploadUrl);\n xhr.send(formData);\n }\n}\n\nexport const cancelFileUpload = (nileFileUpload: NileFileUpload, uploadRequests: Map<File, XMLHttpRequest>) => {\n document.addEventListener(FileUploadEvent.NILE_CANCEL_UPLOAD, (e: CustomEvent) => {\n const fileToCancel = e.detail.file;\n const xhr = uploadRequests.get(fileToCancel);\n\n if (xhr) {\n xhr.abort();\n }\n uploadRequests.delete(fileToCancel);\n nileFileUpload.uploadedFiles = nileFileUpload.uploadedFiles.filter(file => file !== fileToCancel);\n\n nileFileUpload.dispatchEvent(new CustomEvent(FileUploadEvent.NILE_UPLOAD_CANCELLED, {\n detail: { file: fileToCancel }\n }));\n });\n};\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { NileFilterChip } from './nile-filter-chip';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-filter-chip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { NileFilterChip } from './nile-filter-chip';"]}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* FilterChip CSS
|
9
|
+
*/
|
10
|
+
export declare const styles: import("lit").CSSResult;
|
11
|
+
declare const _default: import("lit").CSSResult[];
|
12
|
+
export default _default;
|
@@ -0,0 +1,133 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { css } from 'lit';
|
8
|
+
/**
|
9
|
+
* FilterChip CSS
|
10
|
+
*/
|
11
|
+
export const styles = css `
|
12
|
+
|
13
|
+
|
14
|
+
.filter-chips {
|
15
|
+
display: flex;
|
16
|
+
align-items: center;
|
17
|
+
}
|
18
|
+
|
19
|
+
|
20
|
+
.chip {
|
21
|
+
display: inline-flex;
|
22
|
+
align-items: center;
|
23
|
+
height: 30px;
|
24
|
+
padding: 8px;
|
25
|
+
border: 1px solid var(--nile-filter-chip-chip-border-color-stroke);
|
26
|
+
border-radius: 4px;
|
27
|
+
font-size: 14px;
|
28
|
+
background-color: var(--nile-filter-chip-background-default);
|
29
|
+
color: var(--nile-filter-chip-text-default);
|
30
|
+
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
31
|
+
cursor: pointer;
|
32
|
+
box-sizing: border-box;
|
33
|
+
}
|
34
|
+
|
35
|
+
.chip:hover {
|
36
|
+
background-color: var(--nile-filter-chip-hover-background);
|
37
|
+
}
|
38
|
+
.chip:active {
|
39
|
+
background-color: var(--nile-filter-chip-active-background);
|
40
|
+
border-color: var(--nile-filter-chip-active-border-color-stroke);
|
41
|
+
}
|
42
|
+
:host([active]) .chip {
|
43
|
+
background-color: var(--nile-filter-chip-active-background);
|
44
|
+
border-color: var(--nile-filter-chip-active-border-color-stroke);
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
.icon {
|
49
|
+
color: var(--nile-filter-chip-icon-color-default);
|
50
|
+
display: flex;
|
51
|
+
align-items: center;
|
52
|
+
justify-content: center;
|
53
|
+
vertical-align: middle;
|
54
|
+
position: relative;
|
55
|
+
top: 12px;
|
56
|
+
}
|
57
|
+
|
58
|
+
.label {
|
59
|
+
font-weight: 500;
|
60
|
+
color: var(--nile-filter-chip-label-color-default);
|
61
|
+
}
|
62
|
+
|
63
|
+
nile-badge::part(base) {
|
64
|
+
width: auto;
|
65
|
+
height: 14px;
|
66
|
+
border-radius: 100px;
|
67
|
+
padding: 6px;
|
68
|
+
gap: 10px;
|
69
|
+
font-size: 8px;
|
70
|
+
display: inline-flex;
|
71
|
+
align-items: center;
|
72
|
+
justify-content: center;
|
73
|
+
line-height: 1;
|
74
|
+
}
|
75
|
+
|
76
|
+
.chip-container {
|
77
|
+
display: flex;
|
78
|
+
justify-content: space-between;
|
79
|
+
align-items: center;
|
80
|
+
width: 100%;
|
81
|
+
}
|
82
|
+
|
83
|
+
.clear-all-container {
|
84
|
+
margin-left: 18px;
|
85
|
+
white-space: nowrap;
|
86
|
+
cursor: pointer;
|
87
|
+
}
|
88
|
+
|
89
|
+
|
90
|
+
.value {
|
91
|
+
color: var(--nile-filter-chip-values-color-default);
|
92
|
+
display: inline-block;
|
93
|
+
overflow: hidden;
|
94
|
+
text-overflow: ellipsis;
|
95
|
+
white-space: nowrap;
|
96
|
+
max-width: 140px;
|
97
|
+
vertical-align: bottom;
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
.close-icon {
|
102
|
+
color: var(--nile-filter-chip-close-icon-color-default);
|
103
|
+
cursor: pointer;
|
104
|
+
display: flex;
|
105
|
+
align-items: center;
|
106
|
+
border-radius: 50%;
|
107
|
+
transition: background-color 0.2s;
|
108
|
+
}
|
109
|
+
|
110
|
+
.close-icon:hover {
|
111
|
+
background-color: var(--nile-filter-chip-close-icon-hover-background);
|
112
|
+
color: var(--nile-filter-chip-close-icon-hover-color);
|
113
|
+
}
|
114
|
+
|
115
|
+
.label-wrapper {
|
116
|
+
margin-right: 4px;
|
117
|
+
}
|
118
|
+
|
119
|
+
::slotted([slot="icon"]) {
|
120
|
+
margin-right: 6px;
|
121
|
+
}
|
122
|
+
|
123
|
+
.value-wrapper {
|
124
|
+
margin-right: 4px;
|
125
|
+
}
|
126
|
+
|
127
|
+
.badge-wrapper {
|
128
|
+
margin-right: 12px;
|
129
|
+
}
|
130
|
+
|
131
|
+
`;
|
132
|
+
export default [styles];
|
133
|
+
//# sourceMappingURL=nile-filter-chip.css.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-filter-chip.css.js","sourceRoot":"","sources":["../../../src/nile-filter-chip/nile-filter-chip.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB;;GAEG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwHxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit';\n\n/**\n * FilterChip CSS\n */\n\nexport const styles = css`\n\n\n .filter-chips {\n display: flex;\n align-items: center;\n }\n\n\n .chip {\n display: inline-flex;\n align-items: center;\n height: 30px;\n padding: 8px;\n border: 1px solid var(--nile-filter-chip-chip-border-color-stroke);\n border-radius: 4px;\n font-size: 14px;\n background-color: var(--nile-filter-chip-background-default);\n color: var(--nile-filter-chip-text-default);\n transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;\n cursor: pointer;\n box-sizing: border-box;\n }\n\n .chip:hover {\n background-color: var(--nile-filter-chip-hover-background);\n }\n .chip:active {\n background-color: var(--nile-filter-chip-active-background);\n border-color: var(--nile-filter-chip-active-border-color-stroke);\n}\n:host([active]) .chip {\n background-color: var(--nile-filter-chip-active-background);\n border-color: var(--nile-filter-chip-active-border-color-stroke);\n}\n\n\n .icon {\n color: var(--nile-filter-chip-icon-color-default);\n display: flex;\n align-items: center;\n justify-content: center;\n vertical-align: middle;\n position: relative;\n top: 12px;\n }\n\n .label {\n font-weight: 500;\n color: var(--nile-filter-chip-label-color-default);\n }\n\n nile-badge::part(base) {\n width: auto;\n height: 14px;\n border-radius: 100px;\n padding: 6px;\n gap: 10px;\n font-size: 8px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n line-height: 1;\n }\n\n .chip-container {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n }\n\n .clear-all-container {\n margin-left: 18px;\n white-space: nowrap;\n cursor: pointer;\n }\n\n\n .value {\n color: var(--nile-filter-chip-values-color-default);\n display: inline-block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: 140px;\n vertical-align: bottom;\n}\n\n\n .close-icon {\n color: var(--nile-filter-chip-close-icon-color-default);\n cursor: pointer;\n display: flex;\n align-items: center;\n border-radius: 50%;\n transition: background-color 0.2s;\n }\n\n .close-icon:hover {\n background-color: var(--nile-filter-chip-close-icon-hover-background);\n color: var(--nile-filter-chip-close-icon-hover-color);\n }\n\n.label-wrapper {\n margin-right: 4px;\n}\n\n::slotted([slot=\"icon\"]) {\n margin-right: 6px;\n}\n\n.value-wrapper {\n margin-right: 4px; \n}\n\n.badge-wrapper {\n margin-right: 12px; \n}\n\n`;\n\nexport default [styles];\n\n "]}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { CSSResultArray, TemplateResult } from 'lit';
|
2
|
+
import NileElement from '../internal/nile-element';
|
3
|
+
/**
|
4
|
+
* Nile filter-chip component.
|
5
|
+
*
|
6
|
+
* @tag nile-filter-chip
|
7
|
+
*/
|
8
|
+
export declare class NileFilterChip extends NileElement {
|
9
|
+
label: string;
|
10
|
+
value: string;
|
11
|
+
viewMoreCount: number;
|
12
|
+
editable: boolean;
|
13
|
+
closable: boolean;
|
14
|
+
icon: string;
|
15
|
+
removeIcon: string;
|
16
|
+
active: boolean;
|
17
|
+
private static activeChips;
|
18
|
+
static get styles(): CSSResultArray;
|
19
|
+
connectedCallback(): void;
|
20
|
+
disconnectedCallback(): void;
|
21
|
+
private registerChip;
|
22
|
+
private unregisterChip;
|
23
|
+
private handleClose;
|
24
|
+
private handleClick;
|
25
|
+
private getLabelSlot;
|
26
|
+
private getValueSlot;
|
27
|
+
private getviewMoreCountSlot;
|
28
|
+
private getCloseIconSlot;
|
29
|
+
render(): TemplateResult;
|
30
|
+
}
|
31
|
+
export default NileFilterChip;
|
32
|
+
declare global {
|
33
|
+
interface HTMLElementTagNameMap {
|
34
|
+
'nile-filter-chip': NileFilterChip;
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,141 @@
|
|
1
|
+
var NileFilterChip_1;
|
2
|
+
import { __decorate } from "tslib";
|
3
|
+
import { html } from 'lit';
|
4
|
+
import { customElement, property } from 'lit/decorators.js';
|
5
|
+
import NileElement from '../internal/nile-element';
|
6
|
+
import { styles } from './nile-filter-chip.css';
|
7
|
+
/**
|
8
|
+
* Nile filter-chip component.
|
9
|
+
*
|
10
|
+
* @tag nile-filter-chip
|
11
|
+
*/
|
12
|
+
let NileFilterChip = NileFilterChip_1 = class NileFilterChip extends NileElement {
|
13
|
+
constructor() {
|
14
|
+
super(...arguments);
|
15
|
+
this.label = '';
|
16
|
+
this.value = '';
|
17
|
+
this.viewMoreCount = 0;
|
18
|
+
this.editable = false;
|
19
|
+
this.closable = false;
|
20
|
+
this.icon = '';
|
21
|
+
this.removeIcon = '';
|
22
|
+
this.active = false;
|
23
|
+
}
|
24
|
+
static get styles() {
|
25
|
+
return [styles];
|
26
|
+
}
|
27
|
+
connectedCallback() {
|
28
|
+
super.connectedCallback();
|
29
|
+
this.registerChip();
|
30
|
+
}
|
31
|
+
disconnectedCallback() {
|
32
|
+
super.disconnectedCallback();
|
33
|
+
this.unregisterChip();
|
34
|
+
}
|
35
|
+
registerChip() {
|
36
|
+
NileFilterChip_1.activeChips.push(this);
|
37
|
+
}
|
38
|
+
unregisterChip() {
|
39
|
+
NileFilterChip_1.activeChips = NileFilterChip_1.activeChips.filter((chip) => chip !== this);
|
40
|
+
}
|
41
|
+
handleClose(event) {
|
42
|
+
event.stopPropagation();
|
43
|
+
this.dispatchEvent(new CustomEvent('nile-close', { detail: { value: this.value, viewMoreCount: this.viewMoreCount } }));
|
44
|
+
this.remove();
|
45
|
+
}
|
46
|
+
handleClick() {
|
47
|
+
this.dispatchEvent(new CustomEvent('nile-click', { detail: { value: this.value, viewMoreCount: this.viewMoreCount } }));
|
48
|
+
}
|
49
|
+
getLabelSlot() {
|
50
|
+
return html `
|
51
|
+
<span class="label-wrapper">
|
52
|
+
<slot name="label">
|
53
|
+
<span class="label" part="label">${this.label}:</span>
|
54
|
+
</slot>
|
55
|
+
</span>
|
56
|
+
|
57
|
+
`;
|
58
|
+
}
|
59
|
+
getValueSlot() {
|
60
|
+
return html `
|
61
|
+
<span class="value-wrapper">
|
62
|
+
<slot name="value">
|
63
|
+
<span class="value" part="value">${this.value}</span>
|
64
|
+
</slot>
|
65
|
+
</span>
|
66
|
+
|
67
|
+
`;
|
68
|
+
}
|
69
|
+
getviewMoreCountSlot() {
|
70
|
+
return html `
|
71
|
+
<slot name="suffix">
|
72
|
+
${this.viewMoreCount
|
73
|
+
? html `
|
74
|
+
<span class="badge-wrapper">
|
75
|
+
<nile-badge variant="primary" pilltype="pill-color">
|
76
|
+
+${this.viewMoreCount}
|
77
|
+
</nile-badge>
|
78
|
+
</span>
|
79
|
+
|
80
|
+
`
|
81
|
+
: html ``}
|
82
|
+
</slot>
|
83
|
+
`;
|
84
|
+
}
|
85
|
+
getCloseIconSlot() {
|
86
|
+
return html `
|
87
|
+
${this.closable
|
88
|
+
? html `
|
89
|
+
<span class="close-icon" @click="${this.handleClose}">
|
90
|
+
<nile-icon name="${this.removeIcon || 'close'}" size="12"></nile-icon>
|
91
|
+
</span>
|
92
|
+
`
|
93
|
+
: html ``}
|
94
|
+
`;
|
95
|
+
}
|
96
|
+
render() {
|
97
|
+
return html `
|
98
|
+
<div class="chip" @click="${this.handleClick}">
|
99
|
+
<slot name="icon">
|
100
|
+
${this.icon ? html `<span class="icon">${this.icon}</span>` : html ``}
|
101
|
+
</slot>
|
102
|
+
${this.getLabelSlot()}
|
103
|
+
<slot name="content"></slot>
|
104
|
+
${this.getValueSlot()}
|
105
|
+
${this.getviewMoreCountSlot()}
|
106
|
+
${this.getCloseIconSlot()}
|
107
|
+
</div>
|
108
|
+
`;
|
109
|
+
}
|
110
|
+
};
|
111
|
+
NileFilterChip.activeChips = [];
|
112
|
+
__decorate([
|
113
|
+
property({ type: String })
|
114
|
+
], NileFilterChip.prototype, "label", void 0);
|
115
|
+
__decorate([
|
116
|
+
property({ type: String })
|
117
|
+
], NileFilterChip.prototype, "value", void 0);
|
118
|
+
__decorate([
|
119
|
+
property({ type: Number })
|
120
|
+
], NileFilterChip.prototype, "viewMoreCount", void 0);
|
121
|
+
__decorate([
|
122
|
+
property({ type: Boolean })
|
123
|
+
], NileFilterChip.prototype, "editable", void 0);
|
124
|
+
__decorate([
|
125
|
+
property({ type: Boolean })
|
126
|
+
], NileFilterChip.prototype, "closable", void 0);
|
127
|
+
__decorate([
|
128
|
+
property({ type: String })
|
129
|
+
], NileFilterChip.prototype, "icon", void 0);
|
130
|
+
__decorate([
|
131
|
+
property({ type: String })
|
132
|
+
], NileFilterChip.prototype, "removeIcon", void 0);
|
133
|
+
__decorate([
|
134
|
+
property({ type: Boolean, reflect: true })
|
135
|
+
], NileFilterChip.prototype, "active", void 0);
|
136
|
+
NileFilterChip = NileFilterChip_1 = __decorate([
|
137
|
+
customElement('nile-filter-chip')
|
138
|
+
], NileFilterChip);
|
139
|
+
export { NileFilterChip };
|
140
|
+
export default NileFilterChip;
|
141
|
+
//# sourceMappingURL=nile-filter-chip.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-filter-chip.js","sourceRoot":"","sources":["../../../src/nile-filter-chip/nile-filter-chip.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAc,IAAI,EAAuC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;;;;GAIG;AAEI,IAAM,cAAc,sBAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QACuB,UAAK,GAAG,EAAE,CAAC;QACX,UAAK,GAAG,EAAE,CAAC;QACX,kBAAa,GAAW,CAAC,CAAC;QACzB,aAAQ,GAAG,KAAK,CAAC;QACjB,aAAQ,GAAG,KAAK,CAAC;QAClB,SAAI,GAAG,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,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAiB;AACA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAgB;AARhD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAoH1B;;AAED,eAAe,cAAc,CAAC","sourcesContent":["import { LitElement, html, css, CSSResultArray, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport NileElement from '../internal/nile-element';\nimport { styles } from './nile-filter-chip.css';\n\n/**\n * Nile filter-chip component.\n *\n * @tag nile-filter-chip\n */\n@customElement('nile-filter-chip')\nexport class NileFilterChip extends NileElement {\n @property({ type: String }) label = '';\n @property({ type: String }) value = '';\n @property({ type: Number }) viewMoreCount: number = 0;\n @property({ type: Boolean }) editable = false;\n @property({ type: Boolean }) closable = false;\n @property({ type: String }) icon = '';\n @property({ type: String }) removeIcon = '';\n @property({ type: Boolean, reflect: true }) active = false;\n\n\n private static activeChips: NileFilterChip[] = [];\n\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.registerChip();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.unregisterChip();\n }\n\n private registerChip() {\n NileFilterChip.activeChips.push(this);\n }\n\n private unregisterChip() {\n NileFilterChip.activeChips = NileFilterChip.activeChips.filter(\n (chip) => chip !== this\n );\n }\n\n private handleClose(event: Event) {\n event.stopPropagation();\n this.dispatchEvent(\n new CustomEvent('nile-close', { detail: { value: this.value, viewMoreCount: this.viewMoreCount } })\n );\n this.remove();\n }\n\n private handleClick() {\n this.dispatchEvent(\n new CustomEvent('nile-click', { detail: { value: this.value, viewMoreCount: this.viewMoreCount } })\n );\n }\n\n private getLabelSlot(): TemplateResult {\n return html`\n <span class=\"label-wrapper\">\n <slot name=\"label\">\n <span class=\"label\" part=\"label\">${this.label}:</span>\n </slot>\n </span>\n\n `;\n }\n\n private getValueSlot(): TemplateResult {\n return html`\n <span class=\"value-wrapper\">\n <slot name=\"value\">\n <span class=\"value\" part=\"value\">${this.value}</span>\n </slot>\n </span>\n\n `;\n }\n\n private getviewMoreCountSlot(): TemplateResult {\n return html`\n <slot name=\"suffix\">\n ${this.viewMoreCount\n ? html`\n <span class=\"badge-wrapper\">\n <nile-badge variant=\"primary\" pilltype=\"pill-color\">\n +${this.viewMoreCount}\n </nile-badge>\n </span>\n\n `\n : html``}\n </slot>\n `;\n }\n\n private getCloseIconSlot(): TemplateResult {\n return html`\n ${this.closable\n ? html`\n <span class=\"close-icon\" @click=\"${this.handleClose}\">\n <nile-icon name=\"${this.removeIcon || 'close'}\" size=\"12\"></nile-icon>\n </span>\n `\n : html``}\n `;\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"chip\" @click=\"${this.handleClick}\">\n <slot name=\"icon\">\n ${this.icon ? html`<span class=\"icon\">${this.icon}</span>` : html``}\n </slot>\n ${this.getLabelSlot()}\n <slot name=\"content\"></slot>\n ${this.getValueSlot()}\n ${this.getviewMoreCountSlot()}\n ${this.getCloseIconSlot()}\n </div>\n `;\n }\n}\n\nexport default NileFilterChip;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-filter-chip': NileFilterChip;\n }\n}\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
import './nile-filter-chip';
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { fixture, expect, html, oneEvent } from '@open-wc/testing';
|
2
|
+
import './nile-filter-chip';
|
3
|
+
import { NileFilterChip } from './nile-filter-chip';
|
4
|
+
describe('<nile-filter-chip>', () => {
|
5
|
+
afterEach(() => {
|
6
|
+
NileFilterChip.activeChips = [];
|
7
|
+
});
|
8
|
+
it('registers and unregisters itself in activeChips', async () => {
|
9
|
+
const el = await fixture(html `
|
10
|
+
<nile-filter-chip label="L" value="T"></nile-filter-chip>
|
11
|
+
`);
|
12
|
+
expect(NileFilterChip.activeChips).to.include(el);
|
13
|
+
el.remove();
|
14
|
+
await el.updateComplete;
|
15
|
+
expect(NileFilterChip.activeChips).to.not.include(el);
|
16
|
+
});
|
17
|
+
it('renders fallback label and value', async () => {
|
18
|
+
const el = await fixture(html `
|
19
|
+
<nile-filter-chip label="MyLabel" value="MyText"></nile-filter-chip>
|
20
|
+
`);
|
21
|
+
const label = el.shadowRoot.querySelector('.label');
|
22
|
+
const value = el.shadowRoot.querySelector('.value');
|
23
|
+
expect(label.textContent).to.equal('MyLabel:');
|
24
|
+
expect(value.textContent.trim()).to.equal('MyText');
|
25
|
+
});
|
26
|
+
it('renders slotted label and value over fallback', async () => {
|
27
|
+
const el = await fixture(html `
|
28
|
+
<nile-filter-chip>
|
29
|
+
<span slot="label">SLOT-LBL</span>
|
30
|
+
<span slot="value">SLOT-VAL</span>
|
31
|
+
</nile-filter-chip>
|
32
|
+
`);
|
33
|
+
const slottedLabel = el.querySelector('[slot="label"]');
|
34
|
+
const slottedValue = el.querySelector('[slot="value"]');
|
35
|
+
expect(slottedLabel.textContent).to.equal('SLOT-LBL');
|
36
|
+
expect(slottedValue.textContent).to.equal('SLOT-VAL');
|
37
|
+
});
|
38
|
+
it('renders an icon when the `icon` property is set', async () => {
|
39
|
+
const el = await fixture(html `
|
40
|
+
<nile-filter-chip icon="★" label="L" value="T"></nile-filter-chip>
|
41
|
+
`);
|
42
|
+
const iconSpan = el.shadowRoot.querySelector('.icon');
|
43
|
+
expect(iconSpan).to.exist;
|
44
|
+
expect(iconSpan.textContent).to.equal('★');
|
45
|
+
});
|
46
|
+
it('does not render a badge when viewMoreCount is zero', async () => {
|
47
|
+
const el = await fixture(html `
|
48
|
+
<nile-filter-chip viewMoreCount="0" label="L" value="T"></nile-filter-chip>
|
49
|
+
`);
|
50
|
+
expect(el.shadowRoot.querySelector('nile-badge')).to.be.null;
|
51
|
+
});
|
52
|
+
it('renders a +badge when viewMoreCount > 0', async () => {
|
53
|
+
const el = await fixture(html `
|
54
|
+
<nile-filter-chip viewMoreCount="5" label="L" value="T"></nile-filter-chip>
|
55
|
+
`);
|
56
|
+
const badge = el.shadowRoot.querySelector('nile-badge');
|
57
|
+
expect(badge).to.exist;
|
58
|
+
expect(badge.textContent).to.contain('+5');
|
59
|
+
});
|
60
|
+
it('dispatches `nile-click` on chip click', async () => {
|
61
|
+
const el = await fixture(html `
|
62
|
+
<nile-filter-chip label="L" value="T"></nile-filter-chip>
|
63
|
+
`);
|
64
|
+
const chip = el.shadowRoot.querySelector('.chip');
|
65
|
+
setTimeout(() => chip.click());
|
66
|
+
const ev = await oneEvent(el, 'nile-click');
|
67
|
+
expect(ev.detail).to.deep.equal({ value: 'T', viewMoreCount: 0 });
|
68
|
+
});
|
69
|
+
it('dispatches `nile-close` on close icon click and removes itself', async () => {
|
70
|
+
const el = await fixture(html `
|
71
|
+
<nile-filter-chip closable viewMoreCount="2" value="TT"></nile-filter-chip>
|
72
|
+
`);
|
73
|
+
const closeIcon = el.shadowRoot.querySelector('.close-icon');
|
74
|
+
setTimeout(() => closeIcon.click());
|
75
|
+
const ev = await oneEvent(el, 'nile-close');
|
76
|
+
expect(ev.detail).to.deep.equal({ value: 'TT', viewMoreCount: 2 });
|
77
|
+
expect(document.body.contains(el)).to.be.false;
|
78
|
+
});
|
79
|
+
});
|
80
|
+
//# sourceMappingURL=nile-filter-chip.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nile-filter-chip.test.js","sourceRoot":"","sources":["../../../src/nile-filter-chip/nile-filter-chip.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,SAAS,CAAC,GAAG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AC,CAAC","sourcesContent":["import { fixture, expect, html, oneEvent } from '@open-wc/testing';\nimport './nile-filter-chip';\nimport { NileFilterChip } from './nile-filter-chip';\n\ndescribe('<nile-filter-chip>', () => {\n afterEach(() => {\n (NileFilterChip as any).activeChips = [];\n });\n\n it('registers and unregisters itself in activeChips', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip label=\"L\" value=\"T\"></nile-filter-chip>\n `);\n expect((NileFilterChip as any).activeChips).to.include(el);\n el.remove();\n await el.updateComplete;\n expect((NileFilterChip as any).activeChips).to.not.include(el);\n });\n\n it('renders fallback label and value', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip label=\"MyLabel\" value=\"MyText\"></nile-filter-chip>\n `);\n const label = el.shadowRoot!.querySelector('.label')! as HTMLElement;\n const value = el.shadowRoot!.querySelector('.value')! as HTMLElement;\n expect(label.textContent).to.equal('MyLabel:');\n expect(value.textContent!.trim()).to.equal('MyText');\n });\n\n it('renders slotted label and value over fallback', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip>\n <span slot=\"label\">SLOT-LBL</span>\n <span slot=\"value\">SLOT-VAL</span>\n </nile-filter-chip>\n `);\n const slottedLabel = el.querySelector('[slot=\"label\"]')! as HTMLElement;\n const slottedValue = el.querySelector('[slot=\"value\"]')! as HTMLElement;\n expect(slottedLabel.textContent).to.equal('SLOT-LBL');\n expect(slottedValue.textContent).to.equal('SLOT-VAL');\n });\n\n it('renders an icon when the `icon` property is set', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip icon=\"★\" label=\"L\" value=\"T\"></nile-filter-chip>\n `);\n const iconSpan = el.shadowRoot!.querySelector('.icon')! as HTMLElement;\n expect(iconSpan).to.exist;\n expect(iconSpan.textContent).to.equal('★');\n });\n\n it('does not render a badge when viewMoreCount is zero', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip viewMoreCount=\"0\" label=\"L\" value=\"T\"></nile-filter-chip>\n `);\n expect(el.shadowRoot!.querySelector('nile-badge')).to.be.null;\n });\n\n it('renders a +badge when viewMoreCount > 0', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip viewMoreCount=\"5\" label=\"L\" value=\"T\"></nile-filter-chip>\n `);\n const badge = el.shadowRoot!.querySelector('nile-badge')! as HTMLElement;\n expect(badge).to.exist;\n expect(badge.textContent).to.contain('+5');\n });\n\n\n\n it('dispatches `nile-click` on chip click', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip label=\"L\" value=\"T\"></nile-filter-chip>\n `);\n const chip = el.shadowRoot!.querySelector('.chip')! as HTMLElement;\n setTimeout(() => chip.click());\n const ev = await oneEvent(el, 'nile-click');\n expect(ev.detail).to.deep.equal({ value: 'T', viewMoreCount: 0 });\n });\n\n it('dispatches `nile-close` on close icon click and removes itself', async () => {\n const el = await fixture<NileFilterChip>(html`\n <nile-filter-chip closable viewMoreCount=\"2\" value=\"TT\"></nile-filter-chip>\n `);\n const closeIcon = el.shadowRoot!.querySelector('.close-icon')! as HTMLElement;\n setTimeout(() => closeIcon.click());\n const ev = await oneEvent(el, 'nile-close');\n expect(ev.detail).to.deep.equal({ value: 'TT', viewMoreCount: 2 });\n expect(document.body.contains(el)).to.be.false;\n });\n\n \n});\n"]}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export declare function isInViewport(element: HTMLElement): boolean;
|
2
|
+
export declare function getValidTooltipPosition(triggerRect: DOMRect, tooltipRect: DOMRect, originalPlacement: string, distance: number, skidding: number, caretSize: number, viewportWidth: number, viewportHeight: number): {
|
3
|
+
top: number;
|
4
|
+
left: number;
|
5
|
+
placement: string;
|
6
|
+
};
|
7
|
+
export interface CaretPositionInput {
|
8
|
+
placement: string;
|
9
|
+
tooltipRect: DOMRect;
|
10
|
+
triggerRect: DOMRect;
|
11
|
+
caretSize: number;
|
12
|
+
left: number;
|
13
|
+
top: number;
|
14
|
+
}
|
15
|
+
export declare function getCaretPosition({ placement, tooltipRect, triggerRect, caretSize, left, top }: CaretPositionInput): {
|
16
|
+
caretLeft: number;
|
17
|
+
caretTop: number;
|
18
|
+
};
|