@prolibu-suite/cobalt-core 0.1.2 → 0.2.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/custom-elements.json +15359 -5571
- package/dist/cjs/co-accordion.cjs.entry.js +19 -4
- package/dist/cjs/co-app-shell.cjs.entry.js +1 -1
- package/dist/cjs/co-autocomplete.cjs.entry.js +51 -6
- package/dist/cjs/co-avatar.cjs.entry.js +40 -7
- package/dist/cjs/co-badge.cjs.entry.js +1 -1
- package/dist/cjs/co-button-group.cjs.entry.js +1 -1
- package/dist/cjs/co-button.cjs.entry.js +10 -5
- package/dist/cjs/co-calendar_3.cjs.entry.js +692 -0
- package/dist/cjs/co-card.cjs.entry.js +21 -4
- package/dist/cjs/co-checkbox-group.cjs.entry.js +7 -5
- package/dist/cjs/co-checkbox.cjs.entry.js +4 -4
- package/dist/cjs/co-chip.cjs.entry.js +3 -3
- package/dist/cjs/co-color-picker.cjs.entry.js +109 -0
- package/dist/cjs/co-column-picker.cjs.entry.js +443 -0
- package/dist/cjs/co-combobox.cjs.entry.js +51 -15
- package/dist/cjs/co-command-search.cjs.entry.js +14 -7
- package/dist/cjs/co-data-table-pagination.cjs.entry.js +5 -5
- package/dist/cjs/co-data-table.cjs.entry.js +17 -5
- package/dist/cjs/co-date-picker.cjs.entry.js +177 -0
- package/dist/cjs/co-date-range-picker.cjs.entry.js +378 -0
- package/dist/cjs/co-date-range.cjs.entry.js +13 -259
- package/dist/cjs/co-empty-state.cjs.entry.js +2 -2
- package/dist/cjs/co-fab.cjs.entry.js +3 -3
- package/dist/cjs/co-file-field.cjs.entry.js +498 -0
- package/dist/cjs/co-helper-text.cjs.entry.js +3 -3
- package/dist/cjs/co-icon-button.cjs.entry.js +4 -4
- package/dist/cjs/co-icon.cjs.entry.js +7 -4
- package/dist/cjs/co-input.cjs.entry.js +13 -8
- package/dist/cjs/co-json-field.cjs.entry.js +109 -0
- package/dist/cjs/co-lightbox.cjs.entry.js +344 -0
- package/dist/cjs/co-list-item.cjs.entry.js +14 -4
- package/dist/cjs/co-loader.cjs.entry.js +1 -1
- package/dist/cjs/co-menu-divider.cjs.entry.js +2 -2
- package/dist/cjs/co-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/co-menu.cjs.entry.js +2 -2
- package/dist/cjs/co-modal.cjs.entry.js +13 -3
- package/dist/cjs/co-navbar.cjs.entry.js +4 -4
- package/dist/cjs/co-number-field.cjs.entry.js +47 -11
- package/dist/cjs/co-overlay.cjs.entry.js +2 -2
- package/dist/cjs/co-page-header.cjs.entry.js +2 -2
- package/dist/cjs/co-phone-field.cjs.entry.js +376 -0
- package/dist/cjs/co-popover.cjs.entry.js +4 -4
- package/dist/cjs/co-progress-bar.cjs.entry.js +3 -3
- package/dist/cjs/co-progress-circle.cjs.entry.js +38 -0
- package/dist/cjs/co-radio-group.cjs.entry.js +7 -5
- package/dist/cjs/co-radio.cjs.entry.js +4 -4
- package/dist/cjs/co-rating.cjs.entry.js +4 -4
- package/dist/cjs/co-ref-field.cjs.entry.js +191 -21
- package/dist/cjs/co-rich-text-editor.cjs.entry.js +235 -0
- package/dist/cjs/co-rich-text-toolbar.cjs.entry.js +184 -0
- package/dist/cjs/co-rich-text-viewer.cjs.entry.js +82 -0
- package/dist/cjs/co-row.cjs.entry.js +3 -3
- package/dist/cjs/co-select.cjs.entry.js +119 -18
- package/dist/cjs/co-separator.cjs.entry.js +2 -2
- package/dist/cjs/co-sidebar-nav.cjs.entry.js +30 -5
- package/dist/cjs/co-sidebar.cjs.entry.js +3 -3
- package/dist/cjs/co-slider.cjs.entry.js +3 -3
- package/dist/cjs/co-switch.cjs.entry.js +9 -6
- package/dist/cjs/co-tab-group.cjs.entry.js +2 -2
- package/dist/cjs/co-tab.cjs.entry.js +3 -3
- package/dist/cjs/co-tags-field.cjs.entry.js +205 -0
- package/dist/cjs/co-textarea.cjs.entry.js +92 -0
- package/dist/cjs/co-toast.cjs.entry.js +2 -2
- package/dist/cjs/co-toggle-button-group.cjs.entry.js +7 -4
- package/dist/cjs/co-toggle-button.cjs.entry.js +4 -4
- package/dist/cjs/co-tooltip.cjs.entry.js +12 -6
- package/dist/cjs/co-transfer-list.cjs.entry.js +20 -6
- package/dist/cjs/cobalt.cjs.js +2 -2
- package/dist/cjs/dateI18n-BdiNAl0_.js +106 -0
- package/dist/cjs/dates-D8D-aS5d.js +432 -0
- package/dist/cjs/index-CaEJnpZe.js +27213 -0
- package/dist/cjs/{index-BEovErzl.js → index-DoFnrUVH.js} +79 -11
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/normalizeText-B-v-XPKf.js +96 -0
- package/dist/cjs/overlayScroll-ifzDNeyb.js +25 -0
- package/dist/cjs/overlayscrollbars-BlBHo2Xx.js +2842 -0
- package/dist/cjs/{positioning-DozpXyBd.js → positioning-DwHW399W.js} +40 -25
- package/dist/cjs/requiredMark-DA6y-4rp.js +16 -0
- package/dist/cjs/sanitizer-CjHZAkOm.js +1883 -0
- package/dist/cobalt/cobalt.css +1 -1
- package/dist/cobalt/cobalt.esm.js +1 -1
- package/dist/cobalt/{p-1021f612.entry.js → p-01fc77c4.entry.js} +1 -1
- package/dist/cobalt/p-0a6d8061.entry.js +1 -0
- package/dist/cobalt/{p-ff6a647c.entry.js → p-0bf288cd.entry.js} +1 -1
- package/dist/cobalt/p-136bdbd2.entry.js +1 -0
- package/dist/cobalt/{p-1b7d6808.entry.js → p-15708d32.entry.js} +1 -1
- package/dist/cobalt/{p-cc93ab05.entry.js → p-1578b019.entry.js} +1 -1
- package/dist/cobalt/{p-1b5c723a.entry.js → p-1e0282b8.entry.js} +1 -1
- package/dist/cobalt/p-23d48581.entry.js +1 -0
- package/dist/cobalt/p-2718ff27.entry.js +1 -0
- package/dist/cobalt/p-273afd93.entry.js +1 -0
- package/dist/cobalt/{p-c9b0e73f.entry.js → p-2b4d8535.entry.js} +1 -1
- package/dist/cobalt/p-3190d715.entry.js +1 -0
- package/dist/cobalt/p-3f9b3fcb.entry.js +1 -0
- package/dist/cobalt/p-41228dce.entry.js +1 -0
- package/dist/cobalt/{p-5a13e3a0.entry.js → p-44672953.entry.js} +1 -1
- package/dist/cobalt/{p-4cf6d1f4.entry.js → p-522fcdb7.entry.js} +1 -1
- package/dist/cobalt/p-53ce9023.entry.js +1 -0
- package/dist/cobalt/{p-4d8ff00a.entry.js → p-54f26e95.entry.js} +1 -1
- package/dist/cobalt/p-5d01bd4d.entry.js +1 -0
- package/dist/cobalt/p-5e7141aa.entry.js +1 -0
- package/dist/cobalt/p-5f905739.entry.js +1 -0
- package/dist/cobalt/{p-fb047df8.entry.js → p-6404bd21.entry.js} +1 -1
- package/dist/cobalt/p-654bbc2a.entry.js +1 -0
- package/dist/cobalt/p-6678ac0a.entry.js +1 -0
- package/dist/cobalt/{p-e808916c.entry.js → p-66a912dd.entry.js} +1 -1
- package/dist/cobalt/p-6759ee1c.entry.js +1 -0
- package/dist/cobalt/p-69a40bfd.entry.js +1 -0
- package/dist/cobalt/p-6a6a62cb.entry.js +1 -0
- package/dist/cobalt/p-6d43b6cd.entry.js +1 -0
- package/dist/cobalt/p-759c3dd0.entry.js +1 -0
- package/dist/cobalt/p-782f729f.entry.js +1 -0
- package/dist/cobalt/{p-ebd1555e.entry.js → p-7ef766c6.entry.js} +1 -1
- package/dist/cobalt/p-7f818368.entry.js +1 -0
- package/dist/cobalt/p-83b89bf8.entry.js +1 -0
- package/dist/cobalt/p-88dc561a.entry.js +1 -0
- package/dist/cobalt/{p-4905b51d.entry.js → p-8c27aff7.entry.js} +1 -1
- package/dist/cobalt/{p-a7fa4484.entry.js → p-95d14878.entry.js} +1 -1
- package/dist/cobalt/{p-1d7da33f.entry.js → p-97c20011.entry.js} +1 -1
- package/dist/cobalt/p-996179f7.entry.js +1 -0
- package/dist/cobalt/p-9c533830.entry.js +1 -0
- package/dist/cobalt/p-9d89bf47.entry.js +1 -0
- package/dist/cobalt/p-BKmfyPZK.js +2 -0
- package/dist/cobalt/p-BchB6Hdr.js +1 -0
- package/dist/cobalt/p-C1DCLOEl.js +1 -0
- package/dist/cobalt/p-C2mZ7x_Y.js +1 -0
- package/dist/cobalt/p-CQY6Ul7q.js +1 -0
- package/dist/cobalt/p-CyYF8IJE.js +1 -0
- package/dist/cobalt/p-DcK0GGZC.js +2 -0
- package/dist/cobalt/p-DqyWGweA.js +1 -0
- package/dist/cobalt/p-Qqq8fysz.js +1 -0
- package/dist/cobalt/p-aa17c70b.entry.js +1 -0
- package/dist/cobalt/{p-416bb5ae.entry.js → p-aa63812a.entry.js} +1 -1
- package/dist/cobalt/p-ad4c1b41.entry.js +1 -0
- package/dist/cobalt/p-ae4d3207.entry.js +1 -0
- package/dist/cobalt/p-af64da37.entry.js +1 -0
- package/dist/cobalt/p-b758c2e6.entry.js +1 -0
- package/dist/cobalt/p-bb07da22.entry.js +1 -0
- package/dist/cobalt/p-beb9c11d.entry.js +1 -0
- package/dist/cobalt/p-c6a242e4.entry.js +1 -0
- package/dist/cobalt/p-c87285b6.entry.js +1 -0
- package/dist/cobalt/p-cd57e8b4.entry.js +1 -0
- package/dist/cobalt/{p-4ffba5a3.entry.js → p-ce3a535f.entry.js} +1 -1
- package/dist/cobalt/p-d17e1444.entry.js +1 -0
- package/dist/cobalt/p-d958566a.entry.js +1 -0
- package/dist/cobalt/p-dd873bf8.entry.js +1 -0
- package/dist/cobalt/p-def448e4.entry.js +1 -0
- package/dist/cobalt/p-e4de8865.entry.js +1 -0
- package/dist/cobalt/{p-3b2f7959.entry.js → p-e8b58332.entry.js} +1 -1
- package/dist/cobalt/p-eba0bf7f.entry.js +1 -0
- package/dist/cobalt/p-f0e8fa7d.entry.js +1 -0
- package/dist/cobalt/{p-e50c4c6f.entry.js → p-f2c5cb74.entry.js} +1 -1
- package/dist/cobalt/p-f8728b21.entry.js +1 -0
- package/dist/cobalt/{p-697df797.entry.js → p-f97ad9ad.entry.js} +1 -1
- package/dist/cobalt/p-fad3605d.entry.js +1 -0
- package/dist/cobalt/{p-319937c3.entry.js → p-fe9e85b6.entry.js} +1 -1
- package/dist/cobalt/p-ff2690e5.entry.js +1 -0
- package/dist/cobalt/p-ox7HzCZn.js +10 -0
- package/dist/collection/collection-manifest.json +17 -1
- package/dist/collection/components/co-accordion/co-accordion.css +19 -1
- package/dist/collection/components/co-accordion/co-accordion.js +46 -4
- package/dist/collection/components/co-autocomplete/co-autocomplete.css +725 -7
- package/dist/collection/components/co-autocomplete/co-autocomplete.js +88 -4
- package/dist/collection/components/co-avatar/co-avatar.css +7 -0
- package/dist/collection/components/co-avatar/co-avatar.js +35 -6
- package/dist/collection/components/co-button/co-button.css +8 -5
- package/dist/collection/components/co-button/co-button.js +46 -3
- package/dist/collection/components/co-calendar/co-calendar.css +236 -0
- package/dist/collection/components/co-calendar/co-calendar.js +728 -0
- package/dist/collection/components/co-card/co-card.css +28 -5
- package/dist/collection/components/co-card/co-card.js +47 -4
- package/dist/collection/components/co-checkbox/co-checkbox.js +3 -3
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.css +26 -0
- package/dist/collection/components/co-checkbox-group/co-checkbox-group.js +25 -3
- package/dist/collection/components/co-chip/co-chip.js +2 -2
- package/dist/collection/components/co-color-picker/co-color-picker.css +224 -0
- package/dist/collection/components/co-color-picker/co-color-picker.js +333 -0
- package/dist/collection/components/co-color-picker/presets.js +19 -0
- package/dist/collection/components/co-column-picker/co-column-picker.css +490 -0
- package/dist/collection/components/co-column-picker/co-column-picker.js +675 -0
- package/dist/collection/components/co-column-picker/column-picker-node.js +34 -0
- package/dist/collection/components/co-column-picker/utils/column-picker-tree.js +221 -0
- package/dist/collection/components/co-combobox/co-combobox.css +788 -21
- package/dist/collection/components/co-combobox/co-combobox.js +130 -15
- package/dist/collection/components/co-command-search/co-command-search.css +4 -0
- package/dist/collection/components/co-command-search/co-command-search.js +12 -5
- package/dist/collection/components/co-data-table/co-data-table.css +1 -1
- package/dist/collection/components/co-data-table/co-data-table.js +15 -3
- package/dist/collection/components/co-data-table-pagination/co-data-table-pagination.js +4 -4
- package/dist/collection/components/co-date-field/co-date-field.css +239 -0
- package/dist/collection/components/co-date-field/co-date-field.js +746 -0
- package/dist/collection/components/co-date-picker/co-date-picker.css +112 -0
- package/dist/collection/components/co-date-picker/co-date-picker.js +801 -0
- package/dist/collection/components/co-date-range/co-date-range.css +3 -254
- package/dist/collection/components/co-date-range/co-date-range.js +29 -433
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.css +251 -0
- package/dist/collection/components/co-date-range-picker/co-date-range-picker.js +1142 -0
- package/dist/collection/components/co-drawer/co-drawer.css +19 -0
- package/dist/collection/components/co-drawer/co-drawer.js +46 -2
- package/dist/collection/components/co-empty-state/co-empty-state.js +1 -1
- package/dist/collection/components/co-fab/co-fab.js +2 -2
- package/dist/collection/components/co-file-field/co-file-field.css +389 -0
- package/dist/collection/components/co-file-field/co-file-field.js +841 -0
- package/dist/collection/components/co-file-field/co-file-field.utils.js +47 -0
- package/dist/collection/components/co-helper-text/co-helper-text.js +2 -2
- package/dist/collection/components/co-icon/co-icon.js +6 -3
- package/dist/collection/components/co-icon-button/co-icon-button.css +10 -0
- package/dist/collection/components/co-icon-button/co-icon-button.js +4 -4
- package/dist/collection/components/co-input/co-input.css +56 -10
- package/dist/collection/components/co-input/co-input.js +34 -9
- package/dist/collection/components/co-json-field/co-json-field.css +169 -0
- package/dist/collection/components/co-json-field/co-json-field.js +453 -0
- package/dist/collection/components/co-lightbox/co-lightbox.css +164 -0
- package/dist/collection/components/co-lightbox/co-lightbox.js +451 -0
- package/dist/collection/components/co-list-item/co-list-item.css +5 -0
- package/dist/collection/components/co-list-item/co-list-item.js +12 -2
- package/dist/collection/components/co-menu/co-menu.js +1 -1
- package/dist/collection/components/co-menu-divider/co-menu-divider.js +1 -1
- package/dist/collection/components/co-modal/co-modal.css +17 -3
- package/dist/collection/components/co-modal/co-modal.js +51 -1
- package/dist/collection/components/co-navbar/co-navbar.css +1 -1
- package/dist/collection/components/co-navbar/co-navbar.js +2 -2
- package/dist/collection/components/co-number-field/co-number-field.css +70 -0
- package/dist/collection/components/co-number-field/co-number-field.js +143 -13
- package/dist/collection/components/co-overlay/co-overlay.js +1 -1
- package/dist/collection/components/co-page-header/co-page-header.js +1 -1
- package/dist/collection/components/co-phone-field/co-phone-field.css +265 -0
- package/dist/collection/components/co-phone-field/co-phone-field.js +392 -0
- package/dist/collection/components/co-phone-field/dial-codes.js +208 -0
- package/dist/collection/components/co-popover/co-popover.js +2 -2
- package/dist/collection/components/co-progress-bar/co-progress-bar.js +2 -2
- package/dist/collection/components/co-progress-circle/co-progress-circle.css +50 -0
- package/dist/collection/components/co-progress-circle/co-progress-circle.js +148 -0
- package/dist/collection/components/co-radio/co-radio.js +3 -3
- package/dist/collection/components/co-radio-group/co-radio-group.css +26 -0
- package/dist/collection/components/co-radio-group/co-radio-group.js +25 -3
- package/dist/collection/components/co-rating/co-rating.js +3 -3
- package/dist/collection/components/co-ref-field/co-ref-field.css +816 -54
- package/dist/collection/components/co-ref-field/co-ref-field.js +0 -0
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.css +238 -0
- package/dist/collection/components/co-rich-text-editor/co-rich-text-editor.js +868 -0
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.css +55 -0
- package/dist/collection/components/co-rich-text-toolbar/co-rich-text-toolbar.js +289 -0
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.css +78 -0
- package/dist/collection/components/co-rich-text-viewer/co-rich-text-viewer.js +232 -0
- package/dist/collection/components/co-row/co-row.js +2 -2
- package/dist/collection/components/co-select/co-select.css +845 -7
- package/dist/collection/components/co-select/co-select.js +240 -17
- package/dist/collection/components/co-separator/co-separator.js +1 -1
- package/dist/collection/components/co-sidebar/co-sidebar.js +2 -2
- package/dist/collection/components/co-sidebar-nav/co-sidebar-nav.js +29 -4
- package/dist/collection/components/co-slider/co-slider.js +2 -2
- package/dist/collection/components/co-switch/co-switch.css +17 -0
- package/dist/collection/components/co-switch/co-switch.js +27 -4
- package/dist/collection/components/co-tab/co-tab.js +2 -2
- package/dist/collection/components/co-tab-group/co-tab-group.js +1 -1
- package/dist/collection/components/co-tags-field/co-tags-field.css +272 -0
- package/dist/collection/components/co-tags-field/co-tags-field.js +590 -0
- package/dist/collection/components/co-textarea/co-textarea.css +261 -0
- package/dist/collection/components/co-textarea/co-textarea.js +484 -0
- package/dist/collection/components/co-toast/co-toast.js +1 -1
- package/dist/collection/components/co-toggle-button/co-toggle-button.css +6 -4
- package/dist/collection/components/co-toggle-button/co-toggle-button.js +2 -2
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.css +16 -0
- package/dist/collection/components/co-toggle-button-group/co-toggle-button-group.js +25 -2
- package/dist/collection/components/co-tooltip/co-tooltip.css +16 -0
- package/dist/collection/components/co-tooltip/co-tooltip.js +9 -3
- package/dist/collection/components/co-transfer-list/co-transfer-list.css +683 -7
- package/dist/collection/components/co-transfer-list/co-transfer-list.js +17 -4
- package/dist/collection/utils/dateI18n.js +101 -0
- package/dist/collection/utils/fileI18n.js +76 -0
- package/dist/collection/utils/icon-config.js +22 -0
- package/dist/collection/utils/lightboxI18n.js +42 -0
- package/dist/collection/utils/normalizeText.js +94 -0
- package/dist/collection/utils/overlayScroll.js +20 -0
- package/dist/collection/utils/positioning.js +40 -25
- package/dist/collection/utils/requiredMark.js +11 -0
- package/dist/components/co-accordion.js +1 -1
- package/dist/components/co-autocomplete.js +1 -1
- package/dist/components/co-avatar.js +1 -1
- package/dist/components/co-button.js +1 -1
- package/dist/components/co-calendar.d.ts +11 -0
- package/dist/components/co-calendar.js +1 -0
- package/dist/components/co-card.js +1 -1
- package/dist/components/co-checkbox-group.js +1 -1
- package/dist/components/co-checkbox.js +1 -1
- package/dist/components/co-chip.js +1 -1
- package/dist/components/co-color-picker.d.ts +11 -0
- package/dist/components/co-color-picker.js +1 -0
- package/dist/components/co-column-picker.d.ts +11 -0
- package/dist/components/co-column-picker.js +1 -0
- package/dist/components/co-combobox.js +1 -1
- package/dist/components/co-command-search.js +1 -1
- package/dist/components/co-data-table-pagination.js +1 -1
- package/dist/components/co-data-table.js +1 -1
- package/dist/components/co-date-field.d.ts +11 -0
- package/dist/components/co-date-field.js +1 -0
- package/dist/components/co-date-picker.d.ts +11 -0
- package/dist/components/co-date-picker.js +1 -0
- package/dist/components/co-date-range-picker.d.ts +11 -0
- package/dist/components/co-date-range-picker.js +1 -0
- package/dist/components/co-date-range.js +1 -1
- package/dist/components/co-drawer.js +1 -1
- package/dist/components/co-empty-state.js +1 -1
- package/dist/components/co-fab.js +1 -1
- package/dist/components/co-file-field.d.ts +11 -0
- package/dist/components/co-file-field.js +1 -0
- package/dist/components/co-helper-text.js +1 -1
- package/dist/components/co-icon-button.js +1 -1
- package/dist/components/co-icon.js +1 -1
- package/dist/components/co-input.js +1 -1
- package/dist/components/co-json-field.d.ts +11 -0
- package/dist/components/co-json-field.js +1 -0
- package/dist/components/co-lightbox.d.ts +11 -0
- package/dist/components/co-lightbox.js +1 -0
- package/dist/components/co-list-item.js +1 -1
- package/dist/components/co-menu-divider.js +1 -1
- package/dist/components/co-menu-item.js +1 -1
- package/dist/components/co-menu.js +1 -1
- package/dist/components/co-modal.js +1 -1
- package/dist/components/co-navbar.js +1 -1
- package/dist/components/co-number-field.js +1 -1
- package/dist/components/co-overlay.js +1 -1
- package/dist/components/co-page-header.js +1 -1
- package/dist/components/co-phone-field.d.ts +11 -0
- package/dist/components/co-phone-field.js +1 -0
- package/dist/components/co-popover.js +1 -1
- package/dist/components/co-progress-bar.js +1 -1
- package/dist/components/co-progress-circle.d.ts +11 -0
- package/dist/components/co-progress-circle.js +1 -0
- package/dist/components/co-radio-group.js +1 -1
- package/dist/components/co-radio.js +1 -1
- package/dist/components/co-rating.js +1 -1
- package/dist/components/co-ref-field.js +1 -1
- package/dist/components/co-rich-text-editor.d.ts +11 -0
- package/dist/components/co-rich-text-editor.js +1 -0
- package/dist/components/co-rich-text-toolbar.d.ts +11 -0
- package/dist/components/co-rich-text-toolbar.js +1 -0
- package/dist/components/co-rich-text-viewer.d.ts +11 -0
- package/dist/components/co-rich-text-viewer.js +1 -0
- package/dist/components/co-row.js +1 -1
- package/dist/components/co-select.js +1 -1
- package/dist/components/co-separator.js +1 -1
- package/dist/components/co-sidebar-nav.js +1 -1
- package/dist/components/co-sidebar.js +1 -1
- package/dist/components/co-slider.js +1 -1
- package/dist/components/co-switch.js +1 -1
- package/dist/components/co-tab-group.js +1 -1
- package/dist/components/co-tab.js +1 -1
- package/dist/components/co-tags-field.d.ts +11 -0
- package/dist/components/co-tags-field.js +1 -0
- package/dist/components/co-textarea.d.ts +11 -0
- package/dist/components/co-textarea.js +1 -0
- package/dist/components/co-toast.js +1 -1
- package/dist/components/co-toggle-button-group.js +1 -1
- package/dist/components/co-toggle-button.js +1 -1
- package/dist/components/co-tooltip.js +1 -1
- package/dist/components/co-transfer-list.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-FBICWTuN.js → p-BXdfh__-.js} +1 -1
- package/dist/components/p-BchB6Hdr.js +1 -0
- package/dist/components/p-BeWXpX8I.js +1 -0
- package/dist/components/p-BiW0ubLs.js +1 -0
- package/dist/components/p-C1DCLOEl.js +1 -0
- package/dist/components/p-C2mZ7x_Y.js +1 -0
- package/dist/components/p-C9tHLXKS.js +1 -0
- package/dist/components/p-CQY6Ul7q.js +1 -0
- package/dist/components/p-CWneqh4n.js +1 -0
- package/dist/components/{p-B18FTYLq.js → p-CaMgu2_g.js} +1 -1
- package/dist/components/p-CyYF8IJE.js +1 -0
- package/dist/components/p-DBhNS7JD.js +1 -0
- package/dist/components/p-DObrQi5F.js +1 -0
- package/dist/components/p-DPi_U-Kl.js +1 -0
- package/dist/components/p-DcK0GGZC.js +2 -0
- package/dist/components/p-DqyWGweA.js +1 -0
- package/dist/components/{p-cpdUXBiS.js → p-MiSJXuBx.js} +1 -1
- package/dist/components/p-Sgn-2g8m.js +1 -0
- package/dist/components/{p-Cr8Yc0zj.js → p-jDjfGZJp.js} +1 -1
- package/dist/components/p-o8hrDIKe.js +1 -0
- package/dist/components/p-ox7HzCZn.js +10 -0
- package/dist/esm/co-accordion.entry.js +19 -4
- package/dist/esm/co-app-shell.entry.js +1 -1
- package/dist/esm/co-autocomplete.entry.js +51 -6
- package/dist/esm/co-avatar.entry.js +39 -6
- package/dist/esm/co-badge.entry.js +1 -1
- package/dist/esm/co-button-group.entry.js +1 -1
- package/dist/esm/co-button.entry.js +10 -5
- package/dist/esm/co-calendar_3.entry.js +688 -0
- package/dist/esm/co-card.entry.js +21 -4
- package/dist/esm/co-checkbox-group.entry.js +7 -5
- package/dist/esm/co-checkbox.entry.js +4 -4
- package/dist/esm/co-chip.entry.js +3 -3
- package/dist/esm/co-color-picker.entry.js +107 -0
- package/dist/esm/co-column-picker.entry.js +441 -0
- package/dist/esm/co-combobox.entry.js +51 -15
- package/dist/esm/co-command-search.entry.js +14 -7
- package/dist/esm/co-data-table-pagination.entry.js +5 -5
- package/dist/esm/co-data-table.entry.js +17 -5
- package/dist/esm/co-date-picker.entry.js +175 -0
- package/dist/esm/co-date-range-picker.entry.js +376 -0
- package/dist/esm/co-date-range.entry.js +13 -259
- package/dist/esm/co-empty-state.entry.js +2 -2
- package/dist/esm/co-fab.entry.js +3 -3
- package/dist/esm/co-file-field.entry.js +496 -0
- package/dist/esm/co-helper-text.entry.js +3 -3
- package/dist/esm/co-icon-button.entry.js +4 -4
- package/dist/esm/co-icon.entry.js +7 -4
- package/dist/esm/co-input.entry.js +13 -8
- package/dist/esm/co-json-field.entry.js +107 -0
- package/dist/esm/co-lightbox.entry.js +342 -0
- package/dist/esm/co-list-item.entry.js +14 -4
- package/dist/esm/co-loader.entry.js +1 -1
- package/dist/esm/co-menu-divider.entry.js +2 -2
- package/dist/esm/co-menu-item.entry.js +1 -1
- package/dist/esm/co-menu.entry.js +2 -2
- package/dist/esm/co-modal.entry.js +13 -3
- package/dist/esm/co-navbar.entry.js +4 -4
- package/dist/esm/co-number-field.entry.js +47 -11
- package/dist/esm/co-overlay.entry.js +2 -2
- package/dist/esm/co-page-header.entry.js +2 -2
- package/dist/esm/co-phone-field.entry.js +374 -0
- package/dist/esm/co-popover.entry.js +4 -4
- package/dist/esm/co-progress-bar.entry.js +3 -3
- package/dist/esm/co-progress-circle.entry.js +36 -0
- package/dist/esm/co-radio-group.entry.js +7 -5
- package/dist/esm/co-radio.entry.js +4 -4
- package/dist/esm/co-rating.entry.js +4 -4
- package/dist/esm/co-ref-field.entry.js +191 -21
- package/dist/esm/co-rich-text-editor.entry.js +233 -0
- package/dist/esm/co-rich-text-toolbar.entry.js +182 -0
- package/dist/esm/co-rich-text-viewer.entry.js +80 -0
- package/dist/esm/co-row.entry.js +3 -3
- package/dist/esm/co-select.entry.js +119 -18
- package/dist/esm/co-separator.entry.js +2 -2
- package/dist/esm/co-sidebar-nav.entry.js +30 -5
- package/dist/esm/co-sidebar.entry.js +3 -3
- package/dist/esm/co-slider.entry.js +3 -3
- package/dist/esm/co-switch.entry.js +9 -6
- package/dist/esm/co-tab-group.entry.js +2 -2
- package/dist/esm/co-tab.entry.js +3 -3
- package/dist/esm/co-tags-field.entry.js +203 -0
- package/dist/esm/co-textarea.entry.js +90 -0
- package/dist/esm/co-toast.entry.js +2 -2
- package/dist/esm/co-toggle-button-group.entry.js +7 -4
- package/dist/esm/co-toggle-button.entry.js +4 -4
- package/dist/esm/co-tooltip.entry.js +12 -6
- package/dist/esm/co-transfer-list.entry.js +20 -6
- package/dist/esm/cobalt.js +3 -3
- package/dist/esm/dateI18n-C1DCLOEl.js +103 -0
- package/dist/esm/dates-CyYF8IJE.js +416 -0
- package/dist/esm/{index-B0lqrhFo.js → index-BKmfyPZK.js} +79 -11
- package/dist/esm/index-BjAqSidM.js +27200 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/normalizeText-CQY6Ul7q.js +92 -0
- package/dist/esm/overlayScroll-Bpv882_z.js +23 -0
- package/dist/esm/overlayscrollbars-ox7HzCZn.js +2840 -0
- package/dist/esm/{positioning-Am-OlB8h.js → positioning-C2mZ7x_Y.js} +40 -25
- package/dist/esm/requiredMark-DFvtYtkE.js +14 -0
- package/dist/esm/sanitizer-DcK0GGZC.js +1880 -0
- package/dist/types/components/co-accordion/co-accordion.d.ts +12 -2
- package/dist/types/components/co-autocomplete/co-autocomplete.d.ts +11 -0
- package/dist/types/components/co-avatar/co-avatar.d.ts +6 -2
- package/dist/types/components/co-button/co-button.d.ts +4 -0
- package/dist/types/components/co-calendar/co-calendar.d.ts +108 -0
- package/dist/types/components/co-card/co-card.d.ts +10 -2
- package/dist/types/components/co-checkbox-group/co-checkbox-group.d.ts +2 -0
- package/dist/types/components/co-color-picker/co-color-picker.d.ts +48 -0
- package/dist/types/components/co-color-picker/presets.d.ts +10 -0
- package/dist/types/components/co-column-picker/co-column-picker.d.ts +60 -0
- package/dist/types/components/co-column-picker/column-picker-node.d.ts +18 -0
- package/dist/types/components/co-column-picker/utils/column-picker-tree.d.ts +37 -0
- package/dist/types/components/co-combobox/co-combobox.d.ts +14 -1
- package/dist/types/components/co-command-search/co-command-search.d.ts +2 -0
- package/dist/types/components/co-data-table/co-data-table.d.ts +1 -0
- package/dist/types/components/co-date-field/co-date-field.d.ts +96 -0
- package/dist/types/components/co-date-picker/co-date-picker.d.ts +92 -0
- package/dist/types/components/co-date-range/co-date-range.d.ts +12 -50
- package/dist/types/components/co-date-range-picker/co-date-range-picker.d.ts +112 -0
- package/dist/types/components/co-drawer/co-drawer.d.ts +4 -0
- package/dist/types/components/co-file-field/co-file-field.d.ts +146 -0
- package/dist/types/components/co-file-field/co-file-field.utils.d.ts +18 -0
- package/dist/types/components/co-icon-button/co-icon-button.d.ts +1 -1
- package/dist/types/components/co-input/co-input.d.ts +4 -1
- package/dist/types/components/co-json-field/co-json-field.d.ts +66 -0
- package/dist/types/components/co-lightbox/co-lightbox.d.ts +95 -0
- package/dist/types/components/co-list-item/co-list-item.d.ts +1 -0
- package/dist/types/components/co-modal/co-modal.d.ts +4 -0
- package/dist/types/components/co-number-field/co-number-field.d.ts +16 -2
- package/dist/types/components/co-phone-field/co-phone-field.d.ts +56 -0
- package/dist/types/components/co-phone-field/dial-codes.d.ts +14 -0
- package/dist/types/components/co-progress-circle/co-progress-circle.d.ts +16 -0
- package/dist/types/components/co-radio-group/co-radio-group.d.ts +2 -0
- package/dist/types/components/co-ref-field/co-ref-field.d.ts +54 -1
- package/dist/types/components/co-rich-text-editor/co-rich-text-editor.d.ts +94 -0
- package/dist/types/components/co-rich-text-toolbar/co-rich-text-toolbar.d.ts +42 -0
- package/dist/types/components/co-rich-text-viewer/co-rich-text-viewer.d.ts +32 -0
- package/dist/types/components/co-select/co-select.d.ts +31 -1
- package/dist/types/components/co-switch/co-switch.d.ts +2 -0
- package/dist/types/components/co-tags-field/co-tags-field.d.ts +82 -0
- package/dist/types/components/co-textarea/co-textarea.d.ts +65 -0
- package/dist/types/components/co-toggle-button-group/co-toggle-button-group.d.ts +2 -0
- package/dist/types/components/co-transfer-list/co-transfer-list.d.ts +4 -0
- package/dist/types/components.d.ts +3796 -422
- package/dist/types/utils/dateI18n.d.ts +39 -0
- package/dist/types/utils/fileI18n.d.ts +34 -0
- package/dist/types/utils/icon-config.d.ts +20 -0
- package/dist/types/utils/lightboxI18n.d.ts +12 -0
- package/dist/types/utils/normalizeText.d.ts +41 -0
- package/dist/types/utils/overlayScroll.d.ts +17 -0
- package/dist/types/utils/positioning.d.ts +7 -14
- package/dist/types/utils/requiredMark.d.ts +13 -0
- package/package.json +9 -1
- package/dist/cjs/co-drawer.cjs.entry.js +0 -75
- package/dist/cjs/color-YhUkm10t.js +0 -32
- package/dist/cobalt/p-08afdc51.entry.js +0 -1
- package/dist/cobalt/p-1d3338b6.entry.js +0 -1
- package/dist/cobalt/p-1d91ec93.entry.js +0 -1
- package/dist/cobalt/p-230a23f3.entry.js +0 -1
- package/dist/cobalt/p-31bc842d.entry.js +0 -1
- package/dist/cobalt/p-37c1f700.entry.js +0 -1
- package/dist/cobalt/p-4dd7499c.entry.js +0 -1
- package/dist/cobalt/p-4e7ce8ee.entry.js +0 -1
- package/dist/cobalt/p-6793c51e.entry.js +0 -1
- package/dist/cobalt/p-689e38b3.entry.js +0 -1
- package/dist/cobalt/p-7028880b.entry.js +0 -1
- package/dist/cobalt/p-72113ec2.entry.js +0 -1
- package/dist/cobalt/p-8e54e74d.entry.js +0 -1
- package/dist/cobalt/p-92c39eed.entry.js +0 -1
- package/dist/cobalt/p-9887b828.entry.js +0 -1
- package/dist/cobalt/p-9a5c6600.entry.js +0 -1
- package/dist/cobalt/p-Am-OlB8h.js +0 -1
- package/dist/cobalt/p-B0lqrhFo.js +0 -2
- package/dist/cobalt/p-BG4WRR22.js +0 -1
- package/dist/cobalt/p-a1b248ad.entry.js +0 -1
- package/dist/cobalt/p-a470b764.entry.js +0 -1
- package/dist/cobalt/p-a4d55b1a.entry.js +0 -1
- package/dist/cobalt/p-b6840df4.entry.js +0 -1
- package/dist/cobalt/p-b89d54d9.entry.js +0 -1
- package/dist/cobalt/p-ba84631a.entry.js +0 -1
- package/dist/cobalt/p-c7517f86.entry.js +0 -1
- package/dist/cobalt/p-ca41eec2.entry.js +0 -1
- package/dist/cobalt/p-d29c77cb.entry.js +0 -1
- package/dist/cobalt/p-d9d8b10e.entry.js +0 -1
- package/dist/cobalt/p-da55678f.entry.js +0 -1
- package/dist/cobalt/p-dc5598d1.entry.js +0 -1
- package/dist/cobalt/p-e2c9cb00.entry.js +0 -1
- package/dist/cobalt/p-ebd68f56.entry.js +0 -1
- package/dist/cobalt/p-f051f44d.entry.js +0 -1
- package/dist/cobalt/p-fe1447a3.entry.js +0 -1
- package/dist/components/p-Am-OlB8h.js +0 -1
- package/dist/components/p-BG4WRR22.js +0 -1
- package/dist/components/p-wwWquAtm.js +0 -1
- package/dist/esm/co-drawer.entry.js +0 -73
- package/dist/esm/color-BG4WRR22.js +0 -30
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-DoFnrUVH.js');
|
|
4
|
+
var requiredMark = require('./requiredMark-DA6y-4rp.js');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Built-in UI string dictionary for co-file-field.
|
|
8
|
+
*
|
|
9
|
+
* Strategy mirrors dateI18n: the component ships es/en/pt strings keyed by the
|
|
10
|
+
* `locale` prop, with per-string prop overrides (uploadButtonText, dropText,
|
|
11
|
+
* uploadedTitle, helperText) for full host control. Templates use `{n}` (max
|
|
12
|
+
* files) and `{x}` (formatted max size) placeholders.
|
|
13
|
+
*/
|
|
14
|
+
const DICT = {
|
|
15
|
+
es: {
|
|
16
|
+
uploadButton: 'Cargar archivo',
|
|
17
|
+
dropHint: 'Arrastra y suelta archivos aquí',
|
|
18
|
+
helperBoth: 'Puedes subir hasta {n} archivos, cada uno hasta {x}',
|
|
19
|
+
helperFiles: 'Puedes subir hasta {n} archivos',
|
|
20
|
+
helperBytes: 'Cada archivo hasta {x}',
|
|
21
|
+
uploadedTitle: 'Archivos subidos',
|
|
22
|
+
removeFile: 'Eliminar archivo',
|
|
23
|
+
copyUrl: 'Copiar enlace',
|
|
24
|
+
copied: 'Copiado',
|
|
25
|
+
dragToReorder: 'Arrastra para reordenar',
|
|
26
|
+
openPreview: 'Abrir vista previa',
|
|
27
|
+
errInvalidFormat: 'Formato no permitido: .{x}',
|
|
28
|
+
errTooLarge: 'Archivo demasiado grande: {x}',
|
|
29
|
+
errMaxFiles: 'Puedes subir hasta {n} archivos',
|
|
30
|
+
},
|
|
31
|
+
en: {
|
|
32
|
+
uploadButton: 'Upload file',
|
|
33
|
+
dropHint: 'Drag and drop files here',
|
|
34
|
+
helperBoth: 'You can upload up to {n} files, each up to {x}',
|
|
35
|
+
helperFiles: 'You can upload up to {n} files',
|
|
36
|
+
helperBytes: 'Each file up to {x}',
|
|
37
|
+
uploadedTitle: 'Uploaded files',
|
|
38
|
+
removeFile: 'Remove file',
|
|
39
|
+
copyUrl: 'Copy link',
|
|
40
|
+
copied: 'Copied',
|
|
41
|
+
dragToReorder: 'Drag to reorder',
|
|
42
|
+
openPreview: 'Open preview',
|
|
43
|
+
errInvalidFormat: 'Invalid format: .{x}',
|
|
44
|
+
errTooLarge: 'File too large: {x}',
|
|
45
|
+
errMaxFiles: 'You can upload up to {n} files',
|
|
46
|
+
},
|
|
47
|
+
pt: {
|
|
48
|
+
uploadButton: 'Carregar arquivo',
|
|
49
|
+
dropHint: 'Arraste e solte arquivos aqui',
|
|
50
|
+
helperBoth: 'Você pode enviar até {n} arquivos, cada um até {x}',
|
|
51
|
+
helperFiles: 'Você pode enviar até {n} arquivos',
|
|
52
|
+
helperBytes: 'Cada arquivo até {x}',
|
|
53
|
+
uploadedTitle: 'Arquivos enviados',
|
|
54
|
+
removeFile: 'Remover arquivo',
|
|
55
|
+
copyUrl: 'Copiar link',
|
|
56
|
+
copied: 'Copiado',
|
|
57
|
+
dragToReorder: 'Arraste para reordenar',
|
|
58
|
+
openPreview: 'Abrir pré-visualização',
|
|
59
|
+
errInvalidFormat: 'Formato inválido: .{x}',
|
|
60
|
+
errTooLarge: 'Arquivo muito grande: {x}',
|
|
61
|
+
errMaxFiles: 'Você pode enviar até {n} arquivos',
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
/** Map any BCP-47 locale (e.g. "es-CO") to a supported language; fallback 'en'. */
|
|
65
|
+
function langFromLocale(locale) {
|
|
66
|
+
const l = (locale || '').toLowerCase();
|
|
67
|
+
if (l.startsWith('es'))
|
|
68
|
+
return 'es';
|
|
69
|
+
if (l.startsWith('pt'))
|
|
70
|
+
return 'pt';
|
|
71
|
+
return 'en';
|
|
72
|
+
}
|
|
73
|
+
/** Resolve the built-in UI strings for a locale. */
|
|
74
|
+
function getFileStrings(locale) {
|
|
75
|
+
return DICT[langFromLocale(locale)];
|
|
76
|
+
}
|
|
77
|
+
/** Fill the `{n}` / `{x}` placeholders of a template string. */
|
|
78
|
+
function fillTemplate(tpl, vars) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
return tpl.replace('{n}', String((_a = vars.n) !== null && _a !== void 0 ? _a : '')).replace('{x}', (_b = vars.x) !== null && _b !== void 0 ? _b : '');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Format bytes like the Figma spec: "59.25 KB" (base 1024, up to 2 decimals). */
|
|
84
|
+
function formatBytes(bytes) {
|
|
85
|
+
if (bytes == null || isNaN(bytes))
|
|
86
|
+
return '';
|
|
87
|
+
if (bytes < 1024)
|
|
88
|
+
return `${bytes} B`;
|
|
89
|
+
const fmt = (n) => n.toFixed(2).replace(/\.?0+$/, '');
|
|
90
|
+
if (bytes < 1024 * 1024)
|
|
91
|
+
return `${fmt(bytes / 1024)} KB`;
|
|
92
|
+
return `${fmt(bytes / (1024 * 1024))} MB`;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Left-truncate long file names ("....nshot from 2024-07-12.png"), keeping the
|
|
96
|
+
* tail where the date/extension lives — same convention as the V1 selector.
|
|
97
|
+
* The CSS rtl+ellipsis trick is avoided on purpose: bidi reorders leading
|
|
98
|
+
* digits/punctuation, and file names start with digits all the time.
|
|
99
|
+
*/
|
|
100
|
+
function truncateLeft(name, max = 35) {
|
|
101
|
+
if (!name || name.length <= max)
|
|
102
|
+
return name;
|
|
103
|
+
return `...${name.slice(-max)}`;
|
|
104
|
+
}
|
|
105
|
+
const IMAGE_EXTS = new Set(['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'avif', 'bmp']);
|
|
106
|
+
function hasImageExtension(item) {
|
|
107
|
+
const base = (item.name || item.url || '').split('?')[0];
|
|
108
|
+
const i = base.lastIndexOf('.');
|
|
109
|
+
return i >= 0 && IMAGE_EXTS.has(base.slice(i + 1).toLowerCase());
|
|
110
|
+
}
|
|
111
|
+
/** An item renders in the previews grid when it's a stored image we can show. */
|
|
112
|
+
function isImage(item) {
|
|
113
|
+
if (item.status !== 'done')
|
|
114
|
+
return false;
|
|
115
|
+
const src = item.thumbnail || item.url;
|
|
116
|
+
if (!src)
|
|
117
|
+
return false;
|
|
118
|
+
if (item.thumbnail)
|
|
119
|
+
return true;
|
|
120
|
+
return hasImageExtension(item);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Best lightbox source: the original `url` only when it is itself an image —
|
|
124
|
+
* a PDF that entered the grid via its server-generated thumbnail must open
|
|
125
|
+
* the thumbnail (an `<img>` can't render the PDF).
|
|
126
|
+
*/
|
|
127
|
+
function previewSrc(item) {
|
|
128
|
+
return hasImageExtension(item) ? item.url || item.thumbnail : item.thumbnail || item.url;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const coFileFieldCss = () => `:host{display:block;font-family:var(--co-font-family-primary);font-size:var(--co-font-size-14);letter-spacing:var(--co-font-letter-spacing-body);line-height:1}.co-file-field{display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__labels{display:flex;align-items:center;justify-content:space-between;padding:0 var(--co-spacing-xs)}.co-file-field__label{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);font-weight:400;line-height:1;white-space:nowrap;cursor:default}.co-field-required{margin-left:2px;color:var(--co-color-status-error)}.co-field-required__caption{margin-left:4px;color:var(--co-semantic-text-muted);font-size:var(--co-font-size-12);font-weight:400}.co-field-required__caption::before{content:var(--co-field-required-text, ' (required)')}.co-file-field__dropzone{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--co-spacing-md);padding:var(--co-spacing-4xl) var(--co-spacing-2xl);background:var(--co-semantic-surface-hover);border:1px dashed var(--co-semantic-border-default);border-radius:var(--co-border-radius-sm);cursor:pointer;text-align:center;transition:border-color 0.15s ease, background 0.15s ease}.co-file-field__dropzone:hover{border-color:var(--co-semantic-border-focus)}.co-file-field__dropzone--drag{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__upload-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-sm2);padding:var(--co-spacing-md) var(--co-spacing-xl);margin-bottom:var(--co-spacing-xs);background:var(--co-semantic-surface-secondary);color:var(--co-semantic-text-default);border:none;border-radius:var(--co-border-radius-full);box-shadow:var(--co-shadow-lg);font-family:inherit;font-size:var(--co-font-size-16);font-weight:400;letter-spacing:var(--co-font-letter-spacing-body);line-height:1;cursor:pointer;transition:box-shadow 0.15s ease, transform 0.15s ease}.co-file-field__upload-btn:hover{box-shadow:var(--co-shadow-xl, var(--co-shadow-lg));transform:translateY(-1px)}.co-file-field__upload-btn co-icon{display:inline-flex;flex-shrink:0}.co-file-field__dropzone-text{color:var(--co-semantic-text-default);font-size:var(--co-font-size-18);line-height:1.25}.co-file-field__dropzone-hint{color:var(--co-semantic-text-secondary);font-size:var(--co-font-size-14);line-height:1.25}.co-file-field__actions{display:contents}.co-file-field__input{display:none}.co-file-field__uploaded{display:flex;flex-direction:column;gap:var(--co-spacing-lg);margin-top:var(--co-spacing-sm2)}.co-file-field__uploaded-title{color:var(--co-semantic-text-default);font-size:var(--co-font-size-22);font-weight:500;letter-spacing:-0.03em;line-height:1.25}.co-file-field__previews{display:grid;grid-template-columns:repeat(auto-fill, minmax(240px, 282px));gap:var(--co-spacing-md)}.co-file-field__preview{padding:0;border:none;border-radius:var(--co-border-radius-sm);overflow:hidden;aspect-ratio:3 / 2;background:var(--co-semantic-surface-hover);cursor:pointer}.co-file-field__preview img{display:block;width:100%;height:100%;object-fit:cover;transition:transform 0.2s ease}.co-file-field__preview:hover img{transform:scale(1.02)}.co-file-field__list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--co-spacing-sm2)}.co-file-field__row{display:flex;align-items:center;gap:var(--co-spacing-lg);padding:var(--co-spacing-xl);background:var(--co-semantic-surface-hover);border:1px solid transparent;border-radius:var(--co-border-radius-sm)}.co-file-field__row--error{border-color:var(--co-semantic-status-error)}.co-file-field__row--dragging{opacity:0.5}.co-file-field__row--drop-target{border-color:var(--co-semantic-border-focus);background:var(--co-semantic-surface-hover)}.co-file-field__drag-handle{flex-shrink:0;display:flex;align-items:center;color:var(--co-semantic-text-secondary);cursor:grab}.co-file-field__drag-handle:active{cursor:grabbing}.co-file-field__row-icon{flex-shrink:0;color:var(--co-semantic-text-secondary);display:flex;align-items:center}.co-file-field__row--error .co-file-field__row-icon{color:var(--co-semantic-status-error)}.co-file-field__row-icon--spin{animation:co-file-spin 0.8s linear infinite}@keyframes co-file-spin{to{transform:rotate(360deg)}}.co-file-field__row-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:var(--co-spacing-xs)}.co-file-field__row-name{color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.co-file-field__row-error{color:var(--co-semantic-status-error);font-size:var(--co-font-size-12)}.co-file-field__row-size{flex-shrink:0;color:var(--co-semantic-text-default);font-size:var(--co-font-size-14);line-height:1;white-space:nowrap}.co-file-field__progress{position:relative;height:4px;border-radius:var(--co-border-radius-full);background:var(--co-semantic-surface-hover);overflow:hidden}.co-file-field__progress-bar{position:absolute;inset:0;width:40%;border-radius:var(--co-border-radius-full);background:var(--co-semantic-border-focus);transition:width 0.2s ease}.co-file-field__progress-bar:not([style]){animation:co-file-indeterminate 1.2s ease-in-out infinite}@keyframes co-file-indeterminate{0%{left:-40%}100%{left:100%}}.co-file-field__action{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;border:none;background:transparent;cursor:pointer;color:var(--co-semantic-text-secondary);transition:color 0.15s ease}.co-file-field__action:hover{color:var(--co-semantic-text-default)}.co-file-field__action--copied,.co-file-field__action--copied:hover{color:var(--co-color-primary-verde)}.co-file-field__helper{display:flex;align-items:center;gap:var(--co-spacing-xs);padding:0 var(--co-spacing-xs)}.co-file-field__helper-icon{flex-shrink:0;color:var(--co-semantic-text-muted);display:flex;align-items:center}.co-file-field__helper-text{color:var(--co-semantic-text-muted);font-size:var(--co-font-size-14);line-height:1}.co-file-field--disabled{opacity:0.6;pointer-events:none}.co-file-field--invalid .co-file-field__dropzone,.co-file-field--error .co-file-field__dropzone{border-color:var(--co-semantic-status-error)}.co-file-field__helper--error .co-file-field__helper-icon,.co-file-field__helper--error .co-file-field__helper-text{color:var(--co-semantic-status-error)}:host([layout='horizontal']) .co-file-field{display:grid;grid-template-columns:var(--co-field-label-width, max-content) 1fr;align-items:start;column-gap:var(--co-spacing-md);row-gap:var(--co-spacing-sm2)}:host([layout='horizontal']) .co-file-field__labels{grid-column:1;grid-row:1;padding-top:var(--co-spacing-sm2);min-width:0}:host([layout='horizontal']) .co-file-field__label{white-space:normal}:host([layout='horizontal']) .co-file-field>:not(.co-file-field__labels){grid-column:2;min-width:0}`;
|
|
132
|
+
|
|
133
|
+
const CoFileField = class {
|
|
134
|
+
constructor(hostRef) {
|
|
135
|
+
index.registerInstance(this, hostRef);
|
|
136
|
+
this.coFilesSelected = index.createEvent(this, "coFilesSelected", 3);
|
|
137
|
+
this.coRemove = index.createEvent(this, "coRemove", 3);
|
|
138
|
+
this.coClear = index.createEvent(this, "coClear", 3);
|
|
139
|
+
this.coReorder = index.createEvent(this, "coReorder", 3);
|
|
140
|
+
this.coCopy = index.createEvent(this, "coCopy", 3);
|
|
141
|
+
this.coPreviewOpen = index.createEvent(this, "coPreviewOpen", 3);
|
|
142
|
+
this.disabled = false;
|
|
143
|
+
this.readonly = false;
|
|
144
|
+
this.required = false;
|
|
145
|
+
this.multiple = false;
|
|
146
|
+
/** Max number of files (multiple mode). */
|
|
147
|
+
this.maxFiles = 100;
|
|
148
|
+
/** External validation status (e.g. from a form controller). */
|
|
149
|
+
this.status = 'default';
|
|
150
|
+
/** Label layout: vertical (label above) or horizontal (label beside) */
|
|
151
|
+
this.layout = 'vertical';
|
|
152
|
+
/** Allow drag-reordering of the uploaded list (multiple mode). */
|
|
153
|
+
this.reorderable = true;
|
|
154
|
+
/** Controlled file list, JSON array of {@link FileItem} (owned by the host). */
|
|
155
|
+
this.files = '[]';
|
|
156
|
+
this.dragOver = false;
|
|
157
|
+
this.localError = '';
|
|
158
|
+
this.copiedKey = '';
|
|
159
|
+
/** Row key armed for dragging (handle pressed). */
|
|
160
|
+
this.armedKey = '';
|
|
161
|
+
/** Row key currently being dragged. */
|
|
162
|
+
this.dragKey = '';
|
|
163
|
+
/** Row key currently hovered as drop target. */
|
|
164
|
+
this.overKey = '';
|
|
165
|
+
this.failedPreviews = new Set();
|
|
166
|
+
this.tempSeq = 0;
|
|
167
|
+
this.lastFilesStr = '';
|
|
168
|
+
this.lastParsed = [];
|
|
169
|
+
this.handleDragOver = (e) => {
|
|
170
|
+
if (this.disabled || this.readonly || this.dragKey)
|
|
171
|
+
return;
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
this.dragOver = true;
|
|
174
|
+
};
|
|
175
|
+
this.handleDragLeave = (e) => {
|
|
176
|
+
// dragleave also fires when entering a child of the dropzone — ignore
|
|
177
|
+
// those so the highlight doesn't flicker during the drag.
|
|
178
|
+
const to = e.relatedTarget;
|
|
179
|
+
if (to && e.currentTarget instanceof Node && e.currentTarget.contains(to))
|
|
180
|
+
return;
|
|
181
|
+
this.dragOver = false;
|
|
182
|
+
};
|
|
183
|
+
this.handleDrop = (e) => {
|
|
184
|
+
var _a;
|
|
185
|
+
e.preventDefault();
|
|
186
|
+
this.dragOver = false;
|
|
187
|
+
if (this.dragKey)
|
|
188
|
+
return; // internal row reorder, not a file drop
|
|
189
|
+
if ((_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.files)
|
|
190
|
+
this.handleFiles(e.dataTransfer.files);
|
|
191
|
+
};
|
|
192
|
+
this.handleBrowse = (e) => {
|
|
193
|
+
var _a;
|
|
194
|
+
if (this.disabled || this.readonly)
|
|
195
|
+
return;
|
|
196
|
+
if (e && this.fromActionsSlot(e))
|
|
197
|
+
return;
|
|
198
|
+
(_a = this.inputEl) === null || _a === void 0 ? void 0 : _a.click();
|
|
199
|
+
};
|
|
200
|
+
this.handleInputChange = (e) => {
|
|
201
|
+
const input = e.target;
|
|
202
|
+
if (input.files)
|
|
203
|
+
this.handleFiles(input.files);
|
|
204
|
+
input.value = ''; // allow re-selecting the same file
|
|
205
|
+
};
|
|
206
|
+
// ── Reorder ───────────────────────────────────────────────────
|
|
207
|
+
this.disarmDrag = () => {
|
|
208
|
+
if (this.armedKey && !this.dragKey)
|
|
209
|
+
this.armedKey = '';
|
|
210
|
+
};
|
|
211
|
+
this.handleRowDragEnd = () => {
|
|
212
|
+
this.resetDragState();
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
connectedCallback() {
|
|
216
|
+
window.addEventListener('mouseup', this.disarmDrag);
|
|
217
|
+
}
|
|
218
|
+
disconnectedCallback() {
|
|
219
|
+
window.removeEventListener('mouseup', this.disarmDrag);
|
|
220
|
+
clearTimeout(this.copiedTimer);
|
|
221
|
+
this.closeLightbox();
|
|
222
|
+
}
|
|
223
|
+
get parsedFiles() {
|
|
224
|
+
const raw = this.files;
|
|
225
|
+
if (typeof raw !== 'string' || !raw.trim())
|
|
226
|
+
return [];
|
|
227
|
+
if (raw === this.lastFilesStr)
|
|
228
|
+
return this.lastParsed;
|
|
229
|
+
let parsed = [];
|
|
230
|
+
try {
|
|
231
|
+
const p = JSON.parse(raw);
|
|
232
|
+
if (Array.isArray(p))
|
|
233
|
+
parsed = p;
|
|
234
|
+
}
|
|
235
|
+
catch (_a) {
|
|
236
|
+
/* not JSON */
|
|
237
|
+
}
|
|
238
|
+
this.lastFilesStr = raw;
|
|
239
|
+
this.lastParsed = parsed;
|
|
240
|
+
return parsed;
|
|
241
|
+
}
|
|
242
|
+
get strings() {
|
|
243
|
+
return getFileStrings(this.locale);
|
|
244
|
+
}
|
|
245
|
+
get acceptList() {
|
|
246
|
+
const raw = this.accept;
|
|
247
|
+
if (!raw)
|
|
248
|
+
return [];
|
|
249
|
+
let parts = [];
|
|
250
|
+
try {
|
|
251
|
+
const p = JSON.parse(raw);
|
|
252
|
+
if (Array.isArray(p))
|
|
253
|
+
parts = p.map(String);
|
|
254
|
+
}
|
|
255
|
+
catch (_a) {
|
|
256
|
+
parts = raw.split(',');
|
|
257
|
+
}
|
|
258
|
+
return parts
|
|
259
|
+
.map((s) => s.trim().toLowerCase().replace(/^\./, ''))
|
|
260
|
+
.filter((s) => s && s !== '*');
|
|
261
|
+
}
|
|
262
|
+
get isInvalid() {
|
|
263
|
+
return this.status === 'error' || !!this.localError;
|
|
264
|
+
}
|
|
265
|
+
get inputAccept() {
|
|
266
|
+
const list = this.acceptList;
|
|
267
|
+
if (!list.length)
|
|
268
|
+
return undefined;
|
|
269
|
+
return list.map((e) => (e.includes('/') ? e : `.${e}`)).join(',');
|
|
270
|
+
}
|
|
271
|
+
extOf(name) {
|
|
272
|
+
const i = name.lastIndexOf('.');
|
|
273
|
+
return i >= 0 ? name.slice(i + 1).toLowerCase() : '';
|
|
274
|
+
}
|
|
275
|
+
validate(file) {
|
|
276
|
+
const list = this.acceptList;
|
|
277
|
+
if (list.length) {
|
|
278
|
+
const ext = this.extOf(file.name);
|
|
279
|
+
const okExt = list.includes(ext);
|
|
280
|
+
const okMime = list.some((a) => a.includes('/') && file.type === a);
|
|
281
|
+
if (!okExt && !okMime)
|
|
282
|
+
return fillTemplate(this.strings.errInvalidFormat, { x: ext });
|
|
283
|
+
}
|
|
284
|
+
if (this.maxBytes && file.size > this.maxBytes) {
|
|
285
|
+
return fillTemplate(this.strings.errTooLarge, { x: formatBytes(file.size) });
|
|
286
|
+
}
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
handleFiles(fileList) {
|
|
290
|
+
if (this.disabled || this.readonly)
|
|
291
|
+
return;
|
|
292
|
+
this.localError = '';
|
|
293
|
+
const incoming = Array.from(fileList);
|
|
294
|
+
if (!incoming.length)
|
|
295
|
+
return;
|
|
296
|
+
const selected = this.multiple ? incoming : incoming.slice(0, 1);
|
|
297
|
+
// Capacity check (multiple only).
|
|
298
|
+
if (this.multiple) {
|
|
299
|
+
const room = this.maxFiles - this.parsedFiles.length;
|
|
300
|
+
if (room <= 0) {
|
|
301
|
+
this.localError = fillTemplate(this.strings.errMaxFiles, { n: this.maxFiles });
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
if (selected.length > room)
|
|
305
|
+
selected.length = room;
|
|
306
|
+
}
|
|
307
|
+
const valid = [];
|
|
308
|
+
const tempIds = [];
|
|
309
|
+
for (const file of selected) {
|
|
310
|
+
const err = this.validate(file);
|
|
311
|
+
if (err) {
|
|
312
|
+
this.localError = err;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
valid.push(file);
|
|
316
|
+
tempIds.push(`tmp-${Date.now()}-${this.tempSeq++}`);
|
|
317
|
+
}
|
|
318
|
+
if (valid.length)
|
|
319
|
+
this.coFilesSelected.emit({ files: valid, tempIds });
|
|
320
|
+
}
|
|
321
|
+
/** True when the event originates from the host's `actions` slot content. */
|
|
322
|
+
fromActionsSlot(e) {
|
|
323
|
+
return e
|
|
324
|
+
.composedPath()
|
|
325
|
+
.some((n) => { var _a, _b; return ((_b = (_a = n).getAttribute) === null || _b === void 0 ? void 0 : _b.call(_a, 'slot')) === 'actions'; });
|
|
326
|
+
}
|
|
327
|
+
keyFor(item) {
|
|
328
|
+
var _a;
|
|
329
|
+
// Hosts normally assign id/tempId; the compound fallback keeps two
|
|
330
|
+
// same-named files apart (must stay in lock-step with form-vue's keyOf).
|
|
331
|
+
return item.id || item.tempId || `${item.name}:${(_a = item.size) !== null && _a !== void 0 ? _a : ''}`;
|
|
332
|
+
}
|
|
333
|
+
// ── Copy ──────────────────────────────────────────────────────
|
|
334
|
+
handleCopy(item) {
|
|
335
|
+
var _a;
|
|
336
|
+
const url = item.url || '';
|
|
337
|
+
if (!url)
|
|
338
|
+
return;
|
|
339
|
+
const key = this.keyFor(item);
|
|
340
|
+
this.coCopy.emit({ id: key, url });
|
|
341
|
+
if ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText) {
|
|
342
|
+
navigator.clipboard
|
|
343
|
+
.writeText(url)
|
|
344
|
+
.then(() => {
|
|
345
|
+
this.copiedKey = key;
|
|
346
|
+
clearTimeout(this.copiedTimer);
|
|
347
|
+
this.copiedTimer = setTimeout(() => (this.copiedKey = ''), 1500);
|
|
348
|
+
})
|
|
349
|
+
.catch(() => {
|
|
350
|
+
/* clipboard blocked — coCopy already notified the host */
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
// ── Preview (in-app lightbox) ─────────────────────────────────
|
|
355
|
+
/**
|
|
356
|
+
* Opens the clicked image in a co-lightbox with the SAME gallery the
|
|
357
|
+
* previews grid shows. The lightbox is created imperatively on
|
|
358
|
+
* `document.body`: an open co-drawer keeps `transform: translateX(0)`,
|
|
359
|
+
* which would trap a `position: fixed` overlay rendered inline here.
|
|
360
|
+
*/
|
|
361
|
+
handlePreviewOpen(item) {
|
|
362
|
+
const url = item.url || item.thumbnail;
|
|
363
|
+
if (!url)
|
|
364
|
+
return;
|
|
365
|
+
this.coPreviewOpen.emit({ id: this.keyFor(item), url });
|
|
366
|
+
const gallery = this.parsedFiles.filter((it) => isImage(it) && !this.failedPreviews.has(this.keyFor(it)));
|
|
367
|
+
const images = gallery.map((it) => ({
|
|
368
|
+
src: previewSrc(it),
|
|
369
|
+
thumbnail: it.thumbnail,
|
|
370
|
+
alt: it.name,
|
|
371
|
+
}));
|
|
372
|
+
const startIndex = Math.max(0, gallery.findIndex((it) => this.keyFor(it) === this.keyFor(item)));
|
|
373
|
+
this.closeLightbox();
|
|
374
|
+
const lb = document.createElement('co-lightbox');
|
|
375
|
+
lb.images = JSON.stringify(images);
|
|
376
|
+
lb.startIndex = startIndex;
|
|
377
|
+
if (this.locale)
|
|
378
|
+
lb.locale = this.locale;
|
|
379
|
+
lb.addEventListener('coClose', () => this.closeLightbox());
|
|
380
|
+
document.body.appendChild(lb);
|
|
381
|
+
this.lightboxEl = lb;
|
|
382
|
+
// Open on the next frame so the opacity transition runs.
|
|
383
|
+
requestAnimationFrame(() => {
|
|
384
|
+
lb.open = true;
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
closeLightbox() {
|
|
388
|
+
const lb = this.lightboxEl;
|
|
389
|
+
this.lightboxEl = undefined;
|
|
390
|
+
if (!lb)
|
|
391
|
+
return;
|
|
392
|
+
lb.open = false; // fade out, then drop the node
|
|
393
|
+
setTimeout(() => lb.remove(), 220);
|
|
394
|
+
}
|
|
395
|
+
handlePreviewError(item) {
|
|
396
|
+
this.failedPreviews = new Set([...this.failedPreviews, this.keyFor(item)]);
|
|
397
|
+
}
|
|
398
|
+
handleRowDragStart(e, key) {
|
|
399
|
+
if (this.armedKey !== key) {
|
|
400
|
+
e.preventDefault();
|
|
401
|
+
return;
|
|
402
|
+
}
|
|
403
|
+
this.dragKey = key;
|
|
404
|
+
if (e.dataTransfer) {
|
|
405
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
406
|
+
e.dataTransfer.setData('text/plain', key);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
handleRowDragOver(e, key) {
|
|
410
|
+
if (!this.dragKey || this.dragKey === key)
|
|
411
|
+
return;
|
|
412
|
+
e.preventDefault();
|
|
413
|
+
if (e.dataTransfer)
|
|
414
|
+
e.dataTransfer.dropEffect = 'move';
|
|
415
|
+
this.overKey = key;
|
|
416
|
+
}
|
|
417
|
+
handleRowDrop(e, key) {
|
|
418
|
+
e.preventDefault();
|
|
419
|
+
e.stopPropagation();
|
|
420
|
+
const keys = this.parsedFiles.map((it) => this.keyFor(it));
|
|
421
|
+
const from = keys.indexOf(this.dragKey);
|
|
422
|
+
const to = keys.indexOf(key);
|
|
423
|
+
this.resetDragState();
|
|
424
|
+
if (from < 0 || to < 0 || from === to)
|
|
425
|
+
return;
|
|
426
|
+
keys.splice(to, 0, ...keys.splice(from, 1));
|
|
427
|
+
this.coReorder.emit(keys);
|
|
428
|
+
}
|
|
429
|
+
resetDragState() {
|
|
430
|
+
this.armedKey = '';
|
|
431
|
+
this.dragKey = '';
|
|
432
|
+
this.overKey = '';
|
|
433
|
+
}
|
|
434
|
+
// ── Derived text ──────────────────────────────────────────────
|
|
435
|
+
capacityHint(s) {
|
|
436
|
+
const x = this.maxBytes ? formatBytes(this.maxBytes) : '';
|
|
437
|
+
if (this.multiple && this.maxBytes)
|
|
438
|
+
return fillTemplate(s.helperBoth, { n: this.maxFiles, x });
|
|
439
|
+
if (this.multiple)
|
|
440
|
+
return fillTemplate(s.helperFiles, { n: this.maxFiles });
|
|
441
|
+
if (this.maxBytes)
|
|
442
|
+
return fillTemplate(s.helperBytes, { x });
|
|
443
|
+
return '';
|
|
444
|
+
}
|
|
445
|
+
render() {
|
|
446
|
+
const s = this.strings;
|
|
447
|
+
const items = this.parsedFiles;
|
|
448
|
+
const helper = this.localError || this.helperText;
|
|
449
|
+
const atCapacity = this.multiple && items.length >= this.maxFiles;
|
|
450
|
+
const showDropzone = !this.readonly && (this.multiple ? !atCapacity : items.length === 0);
|
|
451
|
+
const statusClass = this.status !== 'default' ? `co-file-field--${this.status}` : '';
|
|
452
|
+
const previews = items.filter((it) => isImage(it) && !this.failedPreviews.has(this.keyFor(it)));
|
|
453
|
+
const canReorder = this.reorderable && this.multiple && !this.disabled && !this.readonly && items.length > 1;
|
|
454
|
+
const capacity = this.capacityHint(s);
|
|
455
|
+
return (index.h("div", { key: 'ec349a2beeea1fb9195d9e117056270c125dce4c', class: {
|
|
456
|
+
'co-file-field': true,
|
|
457
|
+
'co-file-field--disabled': this.disabled,
|
|
458
|
+
'co-file-field--invalid': this.isInvalid,
|
|
459
|
+
[statusClass]: !!statusClass,
|
|
460
|
+
}, part: "wrapper" }, this.label && (index.h("div", { key: 'e89a935967628ef58775a1449a44b19dea35bfe4', class: "co-file-field__labels" }, index.h("label", { key: 'e24cccf041b29fc39706dacb8d3eb3c06fd8ee9d', class: "co-file-field__label", part: "label" }, this.label, index.h(requiredMark.RequiredMark, { key: 'ae32e17c9411158e0f69cd508f12e56bd56ed7a4', required: this.required })))), showDropzone && (index.h("div", { key: '6216f8858dc7195dfe3999a8ac636409ef12eb3d', class: {
|
|
461
|
+
'co-file-field__dropzone': true,
|
|
462
|
+
'co-file-field__dropzone--drag': this.dragOver,
|
|
463
|
+
}, part: "dropzone", role: "button", tabIndex: this.disabled ? -1 : 0, onClick: this.handleBrowse, onKeyDown: (e) => {
|
|
464
|
+
if ((e.key === 'Enter' || e.key === ' ') && !this.fromActionsSlot(e)) {
|
|
465
|
+
e.preventDefault();
|
|
466
|
+
this.handleBrowse();
|
|
467
|
+
}
|
|
468
|
+
}, onDragOver: this.handleDragOver, onDragLeave: this.handleDragLeave, onDrop: this.handleDrop }, index.h("button", { key: 'ee667570d661b19a8fbd43f8673fc4817c95c6db', class: "co-file-field__upload-btn", part: "upload-button", type: "button", tabIndex: -1 }, index.h("co-icon", { key: '8f6663547642c9005f706e8f7289ffe58f6226c5', name: "file-arrow-up", size: 18 }), index.h("span", { key: '39e1d8c2a875b9e6249138d4b4b9ce0d2dbf4ad4' }, this.uploadButtonText || s.uploadButton)), index.h("span", { key: '2f317b69e38a99ec24d661145efbdb9d77ff2f67', class: "co-file-field__dropzone-text" }, this.dropText || s.dropHint), capacity && index.h("span", { key: 'ba3c34747e83aa42e3eb0a821ed49dd4b27457b1', class: "co-file-field__dropzone-hint" }, capacity), index.h("div", { key: 'b44d49306d37ec6569ee85047b57298dbf97bf96', class: "co-file-field__actions", part: "actions" }, index.h("slot", { key: '36a17ecbc89b70cc140045ce1b2c6b251d5363e7', name: "actions" })), index.h("input", { key: '07d10d77c3673fd8f92b5eacadf342469400c1cb', ref: (el) => (this.inputEl = el), class: "co-file-field__input", type: "file", multiple: this.multiple, accept: this.inputAccept, disabled: this.disabled, onChange: this.handleInputChange, "aria-hidden": "true", tabIndex: -1 }))), items.length > 0 && (index.h("div", { key: '5fb766f14920218f0cc3cfa80256af8542dbc44e', class: "co-file-field__uploaded" }, this.multiple && (index.h("div", { key: 'a133328f198a7d7947cbfb1e77b822f70310ec1a', class: "co-file-field__uploaded-title", part: "uploaded-title" }, `${this.uploadedTitle || s.uploadedTitle} (${items.length})`)), previews.length > 0 && (index.h("div", { key: 'cef939986d1f70d907dcb6f3f048b4fb1fe5156d', class: "co-file-field__previews", part: "previews" }, previews.map((item) => (index.h("button", { class: "co-file-field__preview", part: "preview", type: "button", key: `prev-${this.keyFor(item)}`, title: item.name, "aria-label": s.openPreview, onClick: () => this.handlePreviewOpen(item) }, index.h("img", { src: item.thumbnail || item.url, alt: item.name, loading: "lazy", onError: () => this.handlePreviewError(item) })))))), index.h("ul", { key: 'db43db11520f245328ee76de839112d7a4c766e5', class: "co-file-field__list", part: "list" }, items.map((item) => {
|
|
469
|
+
const key = this.keyFor(item);
|
|
470
|
+
const draggable = canReorder && item.status === 'done';
|
|
471
|
+
return (index.h("li", { class: {
|
|
472
|
+
'co-file-field__row': true,
|
|
473
|
+
[`co-file-field__row--${item.status}`]: true,
|
|
474
|
+
'co-file-field__row--dragging': this.dragKey === key,
|
|
475
|
+
'co-file-field__row--drop-target': this.overKey === key,
|
|
476
|
+
}, part: "row", key: key, draggable: this.armedKey === key, onDragStart: (e) => this.handleRowDragStart(e, key), onDragOver: (e) => this.handleRowDragOver(e, key), onDrop: (e) => this.handleRowDrop(e, key), onDragEnd: this.handleRowDragEnd }, draggable ? (index.h("span", { class: "co-file-field__drag-handle", part: "drag-handle", title: s.dragToReorder, onMouseDown: () => (this.armedKey = key) }, index.h("co-icon", { name: "list", size: 18 }))) : (index.h("co-icon", { name: item.status === 'error'
|
|
477
|
+
? 'warning-circle'
|
|
478
|
+
: item.status === 'uploading'
|
|
479
|
+
? 'spinner-gap'
|
|
480
|
+
: 'file', size: 18, class: {
|
|
481
|
+
'co-file-field__row-icon': true,
|
|
482
|
+
'co-file-field__row-icon--spin': item.status === 'uploading',
|
|
483
|
+
} })), index.h("div", { class: "co-file-field__row-body" }, index.h("span", { class: "co-file-field__row-name", title: item.name }, truncateLeft(item.name)), item.status === 'uploading' && (index.h("div", { class: "co-file-field__progress" }, index.h("div", { class: "co-file-field__progress-bar", style: typeof item.progress === 'number'
|
|
484
|
+
? { width: `${item.progress}%` }
|
|
485
|
+
: undefined }))), item.status === 'error' && item.error && (index.h("span", { class: "co-file-field__row-error" }, item.error))), item.size != null && (index.h("span", { class: "co-file-field__row-size" }, formatBytes(item.size))), item.status === 'done' && !!item.url && (index.h("button", { class: {
|
|
486
|
+
'co-file-field__action': true,
|
|
487
|
+
'co-file-field__action--copied': this.copiedKey === key,
|
|
488
|
+
}, type: "button", tabIndex: -1, title: this.copiedKey === key ? s.copied : s.copyUrl, "aria-label": s.copyUrl, onClick: () => this.handleCopy(item) }, index.h("co-icon", { name: this.copiedKey === key ? 'check' : 'copy', size: 18 }))), !this.disabled && !this.readonly && (index.h("button", { class: "co-file-field__action", type: "button", tabIndex: -1, title: s.removeFile, "aria-label": s.removeFile, onClick: () => this.coRemove.emit(key) }, index.h("co-icon", { name: "trash", size: 18 })))));
|
|
489
|
+
})))), helper && (index.h("div", { key: 'ce339d27da1fd8a224bebd1a7d7ed16a3571cfec', class: {
|
|
490
|
+
'co-file-field__helper': true,
|
|
491
|
+
'co-file-field__helper--error': this.isInvalid,
|
|
492
|
+
}, part: "helper" }, this.isInvalid && (index.h("co-icon", { key: '691ff2e82d45ee55e8087dd86c4389f05ecee268', name: "warning-circle", size: 14, class: "co-file-field__helper-icon" })), index.h("span", { key: '0f35c1734cbfd2bae2be1d85948fcca8ad92e5c2', class: "co-file-field__helper-text" }, helper)))));
|
|
493
|
+
}
|
|
494
|
+
get el() { return index.getElement(this); }
|
|
495
|
+
};
|
|
496
|
+
CoFileField.style = coFileFieldCss();
|
|
497
|
+
|
|
498
|
+
exports.co_file_field = CoFileField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DoFnrUVH.js');
|
|
4
4
|
|
|
5
5
|
const coHelperTextCss = () => `:host{display:block}.co-helper-text{display:flex;align-items:center;gap:var(--co-spacing-xs);font-family:var(--co-font-family-primary);font-size:var(--co-font-size-12);line-height:1.4}.co-helper-text__icon{flex-shrink:0}.co-helper-text--default{color:var(--co-semantic-text-muted)}.co-helper-text--error{color:var(--co-semantic-status-error)}.co-helper-text--success{color:var(--co-semantic-status-success)}.co-helper-text--warning{color:var(--co-semantic-status-warning)}.co-helper-text--info{color:var(--co-semantic-status-info)}`;
|
|
6
6
|
|
|
@@ -18,10 +18,10 @@ const CoHelperText = class {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (index.h("div", { key: '
|
|
21
|
+
return (index.h("div", { key: '730e2f2657f5656ea6992bff86be3903615c51d1', class: {
|
|
22
22
|
'co-helper-text': true,
|
|
23
23
|
[`co-helper-text--${this.status}`]: true,
|
|
24
|
-
}, part: "helper-text" }, index.h("co-icon", { key: '
|
|
24
|
+
}, part: "helper-text" }, index.h("co-icon", { key: '8612481e2e111104047506dc8ca93980723ed6b2', name: this.STATUS_ICON[this.status], size: 14, weight: "fill", class: "co-helper-text__icon" }), index.h("span", { key: '9842f85b0f184f4d5e05c989535add23d4c423cc', class: "co-helper-text__message" }, index.h("slot", { key: '940cf28c1c0f5033c16970ac469029d1ebb1e5e4' }, this.message))));
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
CoHelperText.style = coHelperTextCss();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DoFnrUVH.js');
|
|
4
4
|
|
|
5
|
-
const coIconButtonCss = () => `:host{display:inline-flex}.co-icon-button{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;border:none;outline:none;padding:0;flex-shrink:0;transition:opacity 0.15s ease;box-sizing:border-box;-webkit-font-smoothing:antialiased;backdrop-filter:var(--co-icon-button-backdrop-filter, none);-webkit-backdrop-filter:var(--co-icon-button-backdrop-filter, none)}.co-icon-button--filled{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary)}.co-icon-button--outlined{background:var(--co-icon-button-bg, var(--co-semantic-surface-secondary));color:var(--co-icon-button-color, var(--co-semantic-on-secondary));border:1px solid var(--co-icon-button-border, var(--co-semantic-border-subtle))}.co-icon-button--rounded.co-icon-button--xl{width:80px;height:80px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--lg{width:64px;height:64px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--md{width:56px;height:56px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--sm{width:48px;height:48px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--xs{width:32px;height:32px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--xxs{width:24px;height:24px;border-radius:var(--co-border-radius-full)}.co-icon-button--square.co-icon-button--xl{width:80px;height:80px;border-radius:var(--co-border-radius-xl);}.co-icon-button--square.co-icon-button--lg{width:64px;height:64px;border-radius:var(--co-border-radius-lg);}.co-icon-button--square.co-icon-button--md{width:56px;height:56px;border-radius:var(--co-border-radius-lg);}.co-icon-button--square.co-icon-button--sm{width:48px;height:48px;border-radius:var(--co-border-radius-sm);}.co-icon-button--square.co-icon-button--xs{width:32px;height:32px;border-radius:var(--co-border-radius-xs);}.co-icon-button--square.co-icon-button--xxs{width:24px;height:24px;border-radius:var(--co-spacing-sm);}.co-icon-button--xl ::slotted(*){width:32px;height:32px}.co-icon-button--lg ::slotted(*){width:24px;height:24px}.co-icon-button--md ::slotted(*){width:20px;height:20px}.co-icon-button--sm ::slotted(*){width:18px;height:18px}.co-icon-button--xs ::slotted(*){width:16px;height:16px}.co-icon-button--xxs ::slotted(*){width:12px;height:12px}.co-icon-button--disabled,.co-icon-button:disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}.co-icon-button:hover:not(:disabled){opacity:0.88}`;
|
|
5
|
+
const coIconButtonCss = () => `:host{display:inline-flex}.co-icon-button{display:inline-flex;align-items:center;justify-content:center;cursor:pointer;border:none;outline:none;padding:0;flex-shrink:0;transition:opacity 0.15s ease;box-sizing:border-box;-webkit-font-smoothing:antialiased;backdrop-filter:var(--co-icon-button-backdrop-filter, none);-webkit-backdrop-filter:var(--co-icon-button-backdrop-filter, none)}.co-icon-button--filled{background:var(--co-semantic-surface-primary);color:var(--co-semantic-on-primary)}.co-icon-button--outlined{background:var(--co-icon-button-bg, var(--co-semantic-surface-secondary));color:var(--co-icon-button-color, var(--co-semantic-on-secondary));border:1px solid var(--co-icon-button-border, var(--co-semantic-border-subtle))}.co-icon-button--ghost{background:transparent;color:var(--co-icon-button-color, var(--co-semantic-text-default));border:none}.co-icon-button--ghost:hover:not(:disabled){background:var(--co-semantic-surface-hover, rgba(0, 0, 0, 0.04))}.co-icon-button--rounded.co-icon-button--xl{width:80px;height:80px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--lg{width:64px;height:64px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--md{width:56px;height:56px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--sm{width:48px;height:48px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--xs{width:32px;height:32px;border-radius:var(--co-border-radius-full)}.co-icon-button--rounded.co-icon-button--xxs{width:24px;height:24px;border-radius:var(--co-border-radius-full)}.co-icon-button--square.co-icon-button--xl{width:80px;height:80px;border-radius:var(--co-border-radius-xl);}.co-icon-button--square.co-icon-button--lg{width:64px;height:64px;border-radius:var(--co-border-radius-lg);}.co-icon-button--square.co-icon-button--md{width:56px;height:56px;border-radius:var(--co-border-radius-lg);}.co-icon-button--square.co-icon-button--sm{width:48px;height:48px;border-radius:var(--co-border-radius-sm);}.co-icon-button--square.co-icon-button--xs{width:32px;height:32px;border-radius:var(--co-border-radius-xs);}.co-icon-button--square.co-icon-button--xxs{width:24px;height:24px;border-radius:var(--co-spacing-sm);}.co-icon-button--xl ::slotted(*){width:32px;height:32px}.co-icon-button--lg ::slotted(*){width:24px;height:24px}.co-icon-button--md ::slotted(*){width:20px;height:20px}.co-icon-button--sm ::slotted(*){width:18px;height:18px}.co-icon-button--xs ::slotted(*){width:16px;height:16px}.co-icon-button--xxs ::slotted(*){width:12px;height:12px}.co-icon-button--disabled,.co-icon-button:disabled{opacity:0.4;cursor:not-allowed;pointer-events:none}.co-icon-button:hover:not(:disabled){opacity:0.88}`;
|
|
6
6
|
|
|
7
7
|
const CoIconButton = class {
|
|
8
8
|
constructor(hostRef) {
|
|
@@ -29,10 +29,10 @@ const CoIconButton = class {
|
|
|
29
29
|
render() {
|
|
30
30
|
var _a;
|
|
31
31
|
const iconSizeMap = {
|
|
32
|
-
xl: 32, lg: 28, md: 24, sm: 20, xs: 16, xxs:
|
|
32
|
+
xl: 32, lg: 28, md: 24, sm: 20, xs: 16, xxs: 16,
|
|
33
33
|
};
|
|
34
34
|
const iconSize = (_a = iconSizeMap[this.size]) !== null && _a !== void 0 ? _a : 24;
|
|
35
|
-
return (index.h("button", { key: '
|
|
35
|
+
return (index.h("button", { key: 'd21f938003cb69f4747b94566a2054e4e2af4a04', class: {
|
|
36
36
|
'co-icon-button': true,
|
|
37
37
|
[`co-icon-button--${this.variant}`]: true,
|
|
38
38
|
[`co-icon-button--${this.shape}`]: true,
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-DoFnrUVH.js');
|
|
4
4
|
|
|
5
5
|
const coIconCss = () => `:host{display:inline-flex;align-items:center;justify-content:center;color:inherit;line-height:1;flex-shrink:0}span{display:contents}svg{display:block;width:100%;height:100%;fill:currentColor}`;
|
|
6
6
|
|
|
7
7
|
/** Module-level cache shared across all instances */
|
|
8
8
|
const iconCache = new Map();
|
|
9
9
|
const CDN_BASE = 'https://cdn.jsdelivr.net/npm/@phosphor-icons/core@2.1.1/assets';
|
|
10
|
+
function getBasePath() {
|
|
11
|
+
return globalThis.__cobaltIconBasePath || CDN_BASE;
|
|
12
|
+
}
|
|
10
13
|
/**
|
|
11
14
|
* File naming convention in @phosphor-icons/core:
|
|
12
15
|
* regular → "plus.svg"
|
|
@@ -20,7 +23,7 @@ async function loadSvg(name, weight) {
|
|
|
20
23
|
if (iconCache.has(key))
|
|
21
24
|
return iconCache.get(key);
|
|
22
25
|
const filename = toFilename(name, weight);
|
|
23
|
-
const url = `${
|
|
26
|
+
const url = `${getBasePath()}/${weight}/${filename}`;
|
|
24
27
|
try {
|
|
25
28
|
const res = await fetch(url);
|
|
26
29
|
if (!res.ok)
|
|
@@ -58,12 +61,12 @@ const CoIcon = class {
|
|
|
58
61
|
this.svgContent = await loadSvg(this.name, this.weight);
|
|
59
62
|
}
|
|
60
63
|
render() {
|
|
61
|
-
return (index.h(index.Host, { key: '
|
|
64
|
+
return (index.h(index.Host, { key: '0fad4d5acc013ca70b12384477cb5413615c23d2', "aria-hidden": "true", style: {
|
|
62
65
|
display: 'inline-flex',
|
|
63
66
|
width: `${this.size}px`,
|
|
64
67
|
height: `${this.size}px`,
|
|
65
68
|
flexShrink: '0',
|
|
66
|
-
} }, index.h("span", { key: '
|
|
69
|
+
} }, index.h("span", { key: '7e5199c496bb07aade0400b61415260f5fd2ee2a', part: "svg", innerHTML: this.svgContent })));
|
|
67
70
|
}
|
|
68
71
|
static get watchers() { return {
|
|
69
72
|
"name": [{
|