@dropi/ui-components 1.0.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/.gitignore +13 -0
- package/CONTRIBUTING.md +188 -0
- package/MIGRATION_STEPS.md +39 -0
- package/PUBLISH_CHECKLIST.md +97 -0
- package/QUICK_START.md +108 -0
- package/README.md +146 -0
- package/jest.config.ts +21 -0
- package/ng-package.json +8 -0
- package/package.json +66 -0
- package/project.json +48 -0
- package/publish.sh +113 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.html +12 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.scss +47 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.spec.ts +122 -0
- package/src/components-source/accordion/accordion-item/accordion-item.component.ts +42 -0
- package/src/components-source/accordion/accordion.component.html +3 -0
- package/src/components-source/accordion/accordion.component.scss +5 -0
- package/src/components-source/accordion/accordion.component.spec.ts +243 -0
- package/src/components-source/accordion/accordion.component.stories.ts +111 -0
- package/src/components-source/accordion/accordion.component.ts +43 -0
- package/src/components-source/alert/alert.component.html +28 -0
- package/src/components-source/alert/alert.component.scss +154 -0
- package/src/components-source/alert/alert.component.spec.ts +185 -0
- package/src/components-source/alert/alert.component.stories.ts +310 -0
- package/src/components-source/alert/alert.component.ts +203 -0
- package/src/components-source/alert-legacy/alert.component.html +21 -0
- package/src/components-source/alert-legacy/alert.component.scss +42 -0
- package/src/components-source/alert-legacy/alert.component.spec.ts +159 -0
- package/src/components-source/alert-legacy/alert.component.ts +33 -0
- package/src/components-source/alert-modal/alert-modal.component.html +124 -0
- package/src/components-source/alert-modal/alert-modal.component.scss +203 -0
- package/src/components-source/alert-modal/alert-modal.component.spec.ts +557 -0
- package/src/components-source/alert-modal/alert-modal.component.stories.ts +295 -0
- package/src/components-source/alert-modal/alert-modal.component.ts +294 -0
- package/src/components-source/alert-modal/services/template-alert-modal.service.ts +75 -0
- package/src/components-source/badge/badge.component.html +49 -0
- package/src/components-source/badge/badge.component.scss +57 -0
- package/src/components-source/badge/badge.component.spec.ts +181 -0
- package/src/components-source/badge/badge.component.ts +21 -0
- package/src/components-source/breadcrumb/breadcrumb.component.html +5 -0
- package/src/components-source/breadcrumb/breadcrumb.component.scss +46 -0
- package/src/components-source/breadcrumb/breadcrumb.component.spec.ts +279 -0
- package/src/components-source/breadcrumb/breadcrumb.component.ts +24 -0
- package/src/components-source/card-product/card-product.component.html +173 -0
- package/src/components-source/card-product/card-product.component.spec.ts +601 -0
- package/src/components-source/card-product/card-product.component.stories.ts +322 -0
- package/src/components-source/card-product/card-product.component.ts +1101 -0
- package/src/components-source/card-section/card-section.component.html +22 -0
- package/src/components-source/card-section/card-section.component.scss +14 -0
- package/src/components-source/card-section/card-section.component.spec.ts +333 -0
- package/src/components-source/card-section/card-section.component.stories.ts +141 -0
- package/src/components-source/card-section/card-section.component.ts +35 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.html +38 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.scss +147 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.spec.ts +555 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.stories.ts +157 -0
- package/src/components-source/checkbox-selection-list/checkbox-selection-list.component.ts +219 -0
- package/src/components-source/city-selector/city-selector.component.html +22 -0
- package/src/components-source/city-selector/city-selector.component.scss +1 -0
- package/src/components-source/city-selector/city-selector.component.spec.ts +278 -0
- package/src/components-source/city-selector/city-selector.component.stories.ts +200 -0
- package/src/components-source/city-selector/city-selector.component.ts +151 -0
- package/src/components-source/color-picker/color-picker.component.html +54 -0
- package/src/components-source/color-picker/color-picker.component.scss +203 -0
- package/src/components-source/color-picker/color-picker.component.spec.ts +148 -0
- package/src/components-source/color-picker/color-picker.component.stories.ts +70 -0
- package/src/components-source/color-picker/color-picker.component.ts +353 -0
- package/src/components-source/country-flags/country-flags.component.html +10 -0
- package/src/components-source/country-flags/country-flags.component.scss +34 -0
- package/src/components-source/country-flags/country-flags.component.spec.ts +78 -0
- package/src/components-source/country-flags/country-flags.component.ts +18 -0
- package/src/components-source/date-picker/date-picker.component.html +35 -0
- package/src/components-source/date-picker/date-picker.component.scss +388 -0
- package/src/components-source/date-picker/date-picker.component.spec.ts +510 -0
- package/src/components-source/date-picker/date-picker.component.stories.ts +444 -0
- package/src/components-source/date-picker/date-picker.component.ts +313 -0
- package/src/components-source/date-picker/date-picker.stories.spec.ts +150 -0
- package/src/components-source/date-picker-range/date-picker-range.component.html +45 -0
- package/src/components-source/date-picker-range/date-picker-range.component.scss +229 -0
- package/src/components-source/date-picker-range/date-picker-range.component.spec.ts +555 -0
- package/src/components-source/date-picker-range/date-picker-range.component.ts +254 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.html +17 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.scss +58 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.spec.ts +403 -0
- package/src/components-source/dropi-avatars/dropi-avatars.component.ts +24 -0
- package/src/components-source/dropi-badge/dropi-badge.component.html +12 -0
- package/src/components-source/dropi-badge/dropi-badge.component.scss +50 -0
- package/src/components-source/dropi-badge/dropi-badge.component.spec.ts +108 -0
- package/src/components-source/dropi-badge/dropi-badge.component.stories.ts +140 -0
- package/src/components-source/dropi-badge/dropi-badge.component.ts +39 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.html +67 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.scss +46 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.spec.ts +170 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.stories.ts +203 -0
- package/src/components-source/dropi-banner-external/dropi-banner-external.component.ts +204 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.html +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.scss +65 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.spec.ts +125 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.component.ts +38 -0
- package/src/components-source/dropi-breadcrumb/dropi-breadcrumb.stories.ts +133 -0
- package/src/components-source/dropi-button/dropi-button.component.html +37 -0
- package/src/components-source/dropi-button/dropi-button.component.scss +266 -0
- package/src/components-source/dropi-button/dropi-button.component.spec.ts +264 -0
- package/src/components-source/dropi-button/dropi-button.component.stories.ts +221 -0
- package/src/components-source/dropi-button/dropi-button.component.ts +82 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.html +24 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.scss +85 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.spec.ts +157 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.stories.ts +209 -0
- package/src/components-source/dropi-card-checkbox/dropi-card-checkbox.component.ts +41 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.html +57 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.scss +156 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.spec.ts +224 -0
- package/src/components-source/dropi-carousel/dropi-carousel.component.ts +266 -0
- package/src/components-source/dropi-carousel/dropi-carousel.stories.ts +365 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.css +39 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.html +18 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.spec.ts +155 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.stories.ts +101 -0
- package/src/components-source/dropi-checkbox/dropi-checkbox.component.ts +25 -0
- package/src/components-source/dropi-chips/dropi-chips.component.html +10 -0
- package/src/components-source/dropi-chips/dropi-chips.component.scss +54 -0
- package/src/components-source/dropi-chips/dropi-chips.component.spec.ts +356 -0
- package/src/components-source/dropi-chips/dropi-chips.component.stories.ts +275 -0
- package/src/components-source/dropi-chips/dropi-chips.component.ts +100 -0
- package/src/components-source/dropi-country-selector/countries.data.ts +239 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.html +59 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.scss +126 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.spec.ts +244 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.stories.ts +117 -0
- package/src/components-source/dropi-country-selector/dropi-country-selector.component.ts +179 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.html +23 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.scss +88 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.spec.ts +84 -0
- package/src/components-source/dropi-drawer/dropi-drawer.component.ts +90 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.html +30 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.scss +58 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.spec.ts +213 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.stories.ts +143 -0
- package/src/components-source/dropi-dropdown/dropi-dropdown.component.ts +53 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.html +23 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.scss +21 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.spec.ts +240 -0
- package/src/components-source/dropi-favorite-button/dropi-favorite-button.component.ts +31 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.html +154 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.scss +118 -0
- package/src/components-source/dropi-file-upload/card-view/card-view.component.ts +72 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.coment.stories.ts +179 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.html +111 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.scss +90 -0
- package/src/components-source/dropi-file-upload/drop-zone/drop-zone.component.ts +172 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.html +42 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.scss +31 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.spec.ts +398 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.stories.ts +139 -0
- package/src/components-source/dropi-file-upload/dropi-file-upload.component.ts +329 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.html +51 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.scss +60 -0
- package/src/components-source/dropi-file-upload/file-list/file-list.component.ts +84 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.html +77 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.scss +85 -0
- package/src/components-source/dropi-file-upload/grid-view/grid-view.component.ts +35 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.html +38 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.scss +59 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.spec.ts +214 -0
- package/src/components-source/dropi-ilustration-icon/dropi-ilustration-icon.component.ts +65 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.html +54 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.scss +210 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.spec.ts +145 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.component.ts +76 -0
- package/src/components-source/dropi-image-overlay/dropi-image-overlay.stories.ts +267 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.html +17 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.scss +82 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.spec.ts +152 -0
- package/src/components-source/dropi-languages-selector/dropi-languages-selector.component.ts +41 -0
- package/src/components-source/dropi-logo/dropi-logo.component.html +3 -0
- package/src/components-source/dropi-logo/dropi-logo.component.scss +20 -0
- package/src/components-source/dropi-logo/dropi-logo.component.spec.ts +274 -0
- package/src/components-source/dropi-logo/dropi-logo.component.ts +24 -0
- package/src/components-source/dropi-modal/dropi-modal-stack.service.ts +75 -0
- package/src/components-source/dropi-modal/dropi-modal.component.html +55 -0
- package/src/components-source/dropi-modal/dropi-modal.component.scss +274 -0
- package/src/components-source/dropi-modal/dropi-modal.component.spec.ts +46 -0
- package/src/components-source/dropi-modal/dropi-modal.component.stories.ts +392 -0
- package/src/components-source/dropi-modal/dropi-modal.component.ts +392 -0
- package/src/components-source/dropi-modal/p-template.directive.ts +11 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.html +41 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.scss +227 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.spec.ts +110 -0
- package/src/components-source/dropi-navbar/dropi-navbar.component.ts +52 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.html +64 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.scss +43 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.spec.ts +285 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.stories.ts +345 -0
- package/src/components-source/dropi-paginator/dropi-paginator.component.ts +85 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.html +93 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.scss +224 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.spec.ts +376 -0
- package/src/components-source/dropi-phone-input/dropi-phone-input.component.ts +203 -0
- package/src/components-source/dropi-phone-input/numeric-input.directive.ts +17 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.html +8 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.scss +33 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.spec.ts +225 -0
- package/src/components-source/dropi-radio-button/dropi-radio-button.component.ts +48 -0
- package/src/components-source/dropi-search/dropi-search.component.html +124 -0
- package/src/components-source/dropi-search/dropi-search.component.scss +116 -0
- package/src/components-source/dropi-search/dropi-search.component.spec.ts +483 -0
- package/src/components-source/dropi-search/dropi-search.component.stories.ts +267 -0
- package/src/components-source/dropi-search/dropi-search.component.ts +230 -0
- package/src/components-source/dropi-select/dropi-select.component.html +158 -0
- package/src/components-source/dropi-select/dropi-select.component.scss +275 -0
- package/src/components-source/dropi-select/dropi-select.component.spec.ts +386 -0
- package/src/components-source/dropi-select/dropi-select.component.stories.ts +686 -0
- package/src/components-source/dropi-select/dropi-select.component.ts +465 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.html +10 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.scss +28 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.spec.ts +273 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.stories.ts +145 -0
- package/src/components-source/dropi-skeleton/dropi-skeleton.component.ts +30 -0
- package/src/components-source/dropi-steps/dropi-steps.component.html +29 -0
- package/src/components-source/dropi-steps/dropi-steps.component.scss +110 -0
- package/src/components-source/dropi-steps/dropi-steps.component.spec.ts +228 -0
- package/src/components-source/dropi-steps/dropi-steps.component.stories.ts +231 -0
- package/src/components-source/dropi-steps/dropi-steps.component.ts +98 -0
- package/src/components-source/dropi-switch/dropi-switch.component.html +4 -0
- package/src/components-source/dropi-switch/dropi-switch.component.scss +50 -0
- package/src/components-source/dropi-switch/dropi-switch.component.spec.ts +105 -0
- package/src/components-source/dropi-switch/dropi-switch.component.stories.ts +106 -0
- package/src/components-source/dropi-switch/dropi-switch.component.ts +22 -0
- package/src/components-source/dropi-table/dropi-table.component.html +395 -0
- package/src/components-source/dropi-table/dropi-table.component.scss +506 -0
- package/src/components-source/dropi-table/dropi-table.component.spec.ts +578 -0
- package/src/components-source/dropi-table/dropi-table.component.stories.ts +313 -0
- package/src/components-source/dropi-table/dropi-table.component.ts +580 -0
- package/src/components-source/dropi-tag/dropi-tag.component.html +17 -0
- package/src/components-source/dropi-tag/dropi-tag.component.scss +50 -0
- package/src/components-source/dropi-tag/dropi-tag.component.spec.ts +267 -0
- package/src/components-source/dropi-tag/dropi-tag.component.stories.ts +290 -0
- package/src/components-source/dropi-tag/dropi-tag.component.ts +92 -0
- package/src/components-source/dropi-text-area/droip-text-area.component.stories.ts +138 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.html +63 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.scss +106 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.spec.ts +507 -0
- package/src/components-source/dropi-text-area/dropi-text-area.component.ts +80 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.html +70 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.scss +250 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.spec.ts +423 -0
- package/src/components-source/dropi-tooltip/dropi-tooltip.component.ts +153 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.html +20 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.scss +63 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.spec.ts +121 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.component.ts +43 -0
- package/src/components-source/dropi-youtube-lazy-video/dropi-youtube-lazy-video.stories.ts +125 -0
- package/src/components-source/empty-state/empty-state.component.html +30 -0
- package/src/components-source/empty-state/empty-state.component.scss +76 -0
- package/src/components-source/empty-state/empty-state.component.spec.ts +244 -0
- package/src/components-source/empty-state/empty-state.component.stories.ts +198 -0
- package/src/components-source/empty-state/empty-state.component.ts +34 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.html +81 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.scss +86 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.spec.ts +27 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.stories.ts +149 -0
- package/src/components-source/file-upload-progress-bar/file-upload-progress-bar.component.ts +89 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.scss +32 -0
- package/src/components-source/foundations/dropi-border-radius-demo/dropi-border-radius-demo.component.ts +17 -0
- package/src/components-source/foundations/foundations.component.html +183 -0
- package/src/components-source/foundations/foundations.component.scss +31 -0
- package/src/components-source/foundations/foundations.component.ts +26 -0
- package/src/components-source/icon/icon-names.const.ts +270 -0
- package/src/components-source/icon/icon.component.html +3 -0
- package/src/components-source/icon/icon.component.scss +4 -0
- package/src/components-source/icon/icon.component.spec.ts +304 -0
- package/src/components-source/icon/icon.component.ts +53 -0
- package/src/components-source/index.ts +89 -0
- package/src/components-source/input/input.component.html +97 -0
- package/src/components-source/input/input.component.scss +149 -0
- package/src/components-source/input/input.component.spec.ts +243 -0
- package/src/components-source/input/input.component.stories.ts +269 -0
- package/src/components-source/input/input.component.ts +119 -0
- package/src/components-source/lottie-loader/lottie-loader.component.html +16 -0
- package/src/components-source/lottie-loader/lottie-loader.component.scss +32 -0
- package/src/components-source/lottie-loader/lottie-loader.component.spec.ts +103 -0
- package/src/components-source/lottie-loader/lottie-loader.component.ts +20 -0
- package/src/components-source/otp-send-code/mock-otp-services.ts +214 -0
- package/src/components-source/otp-send-code/otp-send-code.component.html +151 -0
- package/src/components-source/otp-send-code/otp-send-code.component.scss +156 -0
- package/src/components-source/otp-send-code/otp-send-code.component.spec.ts +419 -0
- package/src/components-source/otp-send-code/otp-send-code.component.stories.ts +190 -0
- package/src/components-source/otp-send-code/otp-send-code.component.ts +659 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.html +107 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.scss +280 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.spec.ts +243 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.stories.ts +313 -0
- package/src/components-source/radio-selection-list/radio-selection-list.component.ts +143 -0
- package/src/components-source/read-more/read-more.component.html +14 -0
- package/src/components-source/read-more/read-more.component.scss +16 -0
- package/src/components-source/read-more/read-more.component.spec.ts +272 -0
- package/src/components-source/read-more/read-more.component.stories.ts +131 -0
- package/src/components-source/read-more/read-more.component.ts +88 -0
- package/src/components-source/sidebar/sidebar.component.html +42 -0
- package/src/components-source/sidebar/sidebar.component.scss +70 -0
- package/src/components-source/sidebar/sidebar.component.spec.ts +354 -0
- package/src/components-source/sidebar/sidebar.component.stories.ts +145 -0
- package/src/components-source/sidebar/sidebar.component.ts +105 -0
- package/src/components-source/simple-stepper/simple-stepper.component.html +17 -0
- package/src/components-source/simple-stepper/simple-stepper.component.scss +117 -0
- package/src/components-source/simple-stepper/simple-stepper.component.spec.ts +348 -0
- package/src/components-source/simple-stepper/simple-stepper.component.stories.ts +104 -0
- package/src/components-source/simple-stepper/simple-stepper.component.ts +69 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.html +192 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.scss +15 -0
- package/src/components-source/storybook-doc-components/avatars-storybook/avatars-storybook.component.ts +17 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.html +22 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/border-radius-storybook/border-radius-storybook.component.ts +54 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.css +81 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.html +143 -0
- package/src/components-source/storybook-doc-components/breakpoints-and-grids-storybook/breakpoints-and-grids-storybook.component.ts +97 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.css +10 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.html +63 -0
- package/src/components-source/storybook-doc-components/colors-storybook/colors-storybook.component.ts +542 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.html +132 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.scss +15 -0
- package/src/components-source/storybook-doc-components/dropi-modal/dropi-modal.component.ts +67 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.html +156 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.scss +13 -0
- package/src/components-source/storybook-doc-components/dropi-toast/dropi-toast.component.ts +55 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.html +99 -0
- package/src/components-source/storybook-doc-components/flags-storybook/flags-storybook.component.ts +19 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.css +82 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.html +111 -0
- package/src/components-source/storybook-doc-components/icons-storybook/icons-storybook.component.ts +196 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-foundations.component.ts +19 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/logo-storybook/logo-storybook.component.html +104 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.css +0 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.html +218 -0
- package/src/components-source/storybook-doc-components/lustration-storybook/lustration-storybook.component.ts +20 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.html +21 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/shadow-storybook/shadow-storybook.component.ts +66 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.html +33 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.scss +0 -0
- package/src/components-source/storybook-doc-components/spacing-storybook/spacing-storybook.component.ts +37 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.html +74 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.scss +103 -0
- package/src/components-source/storybook-doc-components/story-page/story-page.component.ts +424 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.html +35 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.scss +64 -0
- package/src/components-source/storybook-doc-components/template-breakpoint-storybook/template-breakpoint-storybook.component.ts +71 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.html +44 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.scss +270 -0
- package/src/components-source/storybook-doc-components/tillte-table-documentation/tillte-table-documentation.component.ts +153 -0
- package/src/components-source/tabs/tabs.component.html +26 -0
- package/src/components-source/tabs/tabs.component.scss +62 -0
- package/src/components-source/tabs/tabs.component.spec.ts +212 -0
- package/src/components-source/tabs/tabs.component.stories.ts +203 -0
- package/src/components-source/tabs/tabs.component.ts +138 -0
- package/src/components-source/tag-type-product/tag-type-product.component.html +1 -0
- package/src/components-source/tag-type-product/tag-type-product.component.scss +10 -0
- package/src/components-source/tag-type-product/tag-type-product.component.spec.ts +38 -0
- package/src/components-source/tag-type-product/tag-type-product.component.ts +9 -0
- package/src/components-source/toast/toast.component.html +37 -0
- package/src/components-source/toast/toast.component.scss +142 -0
- package/src/components-source/toast/toast.component.spec.ts +368 -0
- package/src/components-source/toast/toast.component.ts +59 -0
- package/src/components-source/toast/toast.stories.ts +69 -0
- package/src/components-source/tooltip/tooltip.component.html +46 -0
- package/src/components-source/tooltip/tooltip.component.scss +44 -0
- package/src/components-source/tooltip/tooltip.component.spec.ts +327 -0
- package/src/components-source/tooltip/tooltip.component.ts +24 -0
- package/src/components-source/ui-dropi.module.ts +125 -0
- package/src/components-source/ui-inventory.json +1138 -0
- package/src/components-source/vertical-steps/vertical-steps.component.html +35 -0
- package/src/components-source/vertical-steps/vertical-steps.component.scss +143 -0
- package/src/components-source/vertical-steps/vertical-steps.component.spec.ts +121 -0
- package/src/components-source/vertical-steps/vertical-steps.component.stories.ts +216 -0
- package/src/components-source/vertical-steps/vertical-steps.component.ts +151 -0
- package/src/index.ts +31 -0
- package/src/lib/bootstrap.ts +28 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.html +1 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.scss +0 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.spec.ts +21 -0
- package/src/lib/dropi-ui-elements/dropi-ui-elements.component.ts +9 -0
- package/src/lib/elements-registry.ts +66 -0
- package/src/lib/elements.module.ts +22 -0
- package/src/styles.scss +152 -0
- package/src/test-setup.ts +6 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +12 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { ColorPickerComponent } from './color-picker.component';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
describe('ColorPickerComponent', () => {
|
|
6
|
+
let component: ColorPickerComponent;
|
|
7
|
+
let fixture: ComponentFixture<ColorPickerComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
imports: [ColorPickerComponent, FormsModule],
|
|
12
|
+
}).compileComponents();
|
|
13
|
+
|
|
14
|
+
fixture = TestBed.createComponent(ColorPickerComponent);
|
|
15
|
+
component = fixture.componentInstance;
|
|
16
|
+
// No llamamos detectChanges porque requiere canvas reales en ngAfterViewInit
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Verifica que el componente se crea correctamente con valores por defecto
|
|
21
|
+
*/
|
|
22
|
+
it('should create with default values', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
expect(component.currentColor).toBe('#ffffff');
|
|
25
|
+
expect(component.position).toBe('right');
|
|
26
|
+
expect(component.showEdit).toBe(false);
|
|
27
|
+
expect(component.opacity).toBe(100);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Verifica la conversión de HSV a RGB
|
|
32
|
+
*/
|
|
33
|
+
describe('Color conversions', () => {
|
|
34
|
+
it('should convert HSV to RGB correctly for red', () => {
|
|
35
|
+
const red = component.hsvToRgb(0, 100, 100);
|
|
36
|
+
expect(red).toEqual({ r: 255, g: 0, b: 0 });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should convert HSV to RGB correctly for green', () => {
|
|
40
|
+
const green = component.hsvToRgb(120, 100, 100);
|
|
41
|
+
expect(green).toEqual({ r: 0, g: 255, b: 0 });
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('should convert HSV to RGB correctly for blue', () => {
|
|
45
|
+
const blue = component.hsvToRgb(240, 100, 100);
|
|
46
|
+
expect(blue).toEqual({ r: 0, g: 0, b: 255 });
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should convert HSV to RGB correctly for white', () => {
|
|
50
|
+
const white = component.hsvToRgb(0, 0, 100);
|
|
51
|
+
expect(white).toEqual({ r: 255, g: 255, b: 255 });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should convert HSV to RGB correctly for black', () => {
|
|
55
|
+
const black = component.hsvToRgb(0, 0, 0);
|
|
56
|
+
expect(black).toEqual({ r: 0, g: 0, b: 0 });
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should convert RGB to HEX correctly for red', () => {
|
|
60
|
+
const red = component.rgbToHex(255, 0, 0, 100);
|
|
61
|
+
expect(red).toBe('#ff0000ff');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should convert RGB to HEX correctly for green with transparency', () => {
|
|
65
|
+
const greenTransparent = component.rgbToHex(0, 255, 0, 50);
|
|
66
|
+
// 50% de 255 = 127.5, puede redondearse a 127 (0x7f) o 128 (0x80)
|
|
67
|
+
expect(['#00ff007f', '#00ff0080']).toContain(greenTransparent);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should convert RGB to HEX correctly for white', () => {
|
|
71
|
+
const white = component.rgbToHex(255, 255, 255, 100);
|
|
72
|
+
expect(white).toBe('#ffffffff');
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('should convert RGB to HSV correctly for red', () => {
|
|
76
|
+
const red = component.rgbToHsv(255, 0, 0);
|
|
77
|
+
expect(red.h).toBe(0);
|
|
78
|
+
expect(red.s).toBe(100);
|
|
79
|
+
expect(red.v).toBe(100);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should convert RGB to HSV correctly for white', () => {
|
|
83
|
+
const white = component.rgbToHsv(255, 255, 255);
|
|
84
|
+
expect(white.h).toBe(0);
|
|
85
|
+
expect(white.s).toBe(0);
|
|
86
|
+
expect(white.v).toBe(100);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('should convert RGB to HSV correctly for black', () => {
|
|
90
|
+
const black = component.rgbToHsv(0, 0, 0);
|
|
91
|
+
expect(black.h).toBe(0);
|
|
92
|
+
expect(black.s).toBe(0);
|
|
93
|
+
expect(black.v).toBe(0);
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Verifica la actualización de color y emisión de eventos
|
|
99
|
+
*/
|
|
100
|
+
describe('Color updates', () => {
|
|
101
|
+
it('should toggle showEdit state', () => {
|
|
102
|
+
expect(component.showEdit).toBe(false);
|
|
103
|
+
component.showEdit = true;
|
|
104
|
+
expect(component.showEdit).toBe(true);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should update currentColor when assigned', () => {
|
|
108
|
+
component.currentColor = '#ff0000ff';
|
|
109
|
+
expect(component.currentColor).toBe('#ff0000ff');
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Verifica el manejo de entrada hexadecimal
|
|
115
|
+
*/
|
|
116
|
+
describe('Hex input handling', () => {
|
|
117
|
+
// Test removido porque onHexInputChange requiere canvas
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Verifica los inputs del componente
|
|
122
|
+
*/
|
|
123
|
+
describe('Component inputs', () => {
|
|
124
|
+
it('should accept currentColor input', () => {
|
|
125
|
+
component.currentColor = '#00ff00ff';
|
|
126
|
+
expect(component.currentColor).toBe('#00ff00ff');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should accept position input', () => {
|
|
130
|
+
component.position = 'top';
|
|
131
|
+
expect(component.position).toBe('top');
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Verifica los valores de opacidad
|
|
137
|
+
*/
|
|
138
|
+
describe('Opacity handling', () => {
|
|
139
|
+
it('should have default opacity of 100', () => {
|
|
140
|
+
expect(component.opacity).toBe(100);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should allow setting opacity', () => {
|
|
144
|
+
component.opacity = 50;
|
|
145
|
+
expect(component.opacity).toBe(50);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview ColorPicker component stories for Storybook
|
|
3
|
+
* @description A color selection component with multiple positioning options
|
|
4
|
+
*/
|
|
5
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
6
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
7
|
+
import { ColorPickerComponent } from './color-picker.component';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<ColorPickerComponent> = {
|
|
10
|
+
title: 'UI Dropi/Color Picker',
|
|
11
|
+
component: ColorPickerComponent,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
parameters: {
|
|
14
|
+
layout: 'centered',
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: `
|
|
18
|
+
# Color Picker Component
|
|
19
|
+
|
|
20
|
+
A color selection component with configurable positioning.
|
|
21
|
+
|
|
22
|
+
## Key Features
|
|
23
|
+
- **Positioning**: Top, bottom, left, right popup positions
|
|
24
|
+
- **Hex support**: Works with hexadecimal color values
|
|
25
|
+
- **Event emission**: Emits color changes in real-time
|
|
26
|
+
`,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
decorators: [
|
|
31
|
+
moduleMetadata({
|
|
32
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
argTypes: {
|
|
37
|
+
position: {
|
|
38
|
+
control: { type: 'select' },
|
|
39
|
+
options: ['top', 'bottom', 'left', 'right'],
|
|
40
|
+
description: 'Position where the color selector will render when clicking the input',
|
|
41
|
+
},
|
|
42
|
+
currentColor: {
|
|
43
|
+
control: 'color',
|
|
44
|
+
description: 'Initially selected color (hexadecimal)',
|
|
45
|
+
},
|
|
46
|
+
colorChange: {
|
|
47
|
+
action: 'onChange',
|
|
48
|
+
description: 'Event emitted when color changes',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<ColorPickerComponent>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Default color picker with right-positioned popup
|
|
58
|
+
*/
|
|
59
|
+
export const Default: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
position: 'right',
|
|
62
|
+
currentColor: '#e30b1aff',
|
|
63
|
+
},
|
|
64
|
+
parameters: {
|
|
65
|
+
design: {
|
|
66
|
+
type: 'figma',
|
|
67
|
+
url: '',
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
};
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
ElementRef,
|
|
4
|
+
ViewChild,
|
|
5
|
+
Output,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
HostListener,
|
|
8
|
+
Input,
|
|
9
|
+
SimpleChanges,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { FormsModule } from '@angular/forms';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'app-color-picker',
|
|
16
|
+
standalone: true,
|
|
17
|
+
imports: [CommonModule, FormsModule],
|
|
18
|
+
templateUrl: './color-picker.component.html',
|
|
19
|
+
styleUrls: ['./color-picker.component.scss'],
|
|
20
|
+
})
|
|
21
|
+
export class ColorPickerComponent {
|
|
22
|
+
@ViewChild('colorCanvas') private colorCanvas!: ElementRef<HTMLCanvasElement>;
|
|
23
|
+
@ViewChild('hueCanvas') private hueCanvas!: ElementRef<HTMLCanvasElement>;
|
|
24
|
+
@ViewChild('opacityCanvas') private opacityCanvas!: ElementRef<HTMLCanvasElement>;
|
|
25
|
+
@ViewChild('colorPicker') private colorPicker!: ElementRef;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Indica el color (hex) por defecto que debe mostrarse.
|
|
29
|
+
*
|
|
30
|
+
* Valor por defecto: `#ffffff`.
|
|
31
|
+
*
|
|
32
|
+
* @type {string}
|
|
33
|
+
*/
|
|
34
|
+
@Input() public currentColor: string = '#ffffff';
|
|
35
|
+
/**
|
|
36
|
+
* Indica la posicion del selector de color dentro del componente.
|
|
37
|
+
*
|
|
38
|
+
* Valor por defecto: `right`.
|
|
39
|
+
*
|
|
40
|
+
* @type {'left' | 'right' | 'top' | 'bottom'}
|
|
41
|
+
*/
|
|
42
|
+
@Input() public position: 'top' | 'bottom' | 'left' | 'right' = 'right';
|
|
43
|
+
/**
|
|
44
|
+
* Evento que emite el color seleccionado en formato hex.
|
|
45
|
+
*
|
|
46
|
+
* @type {EventEmitter<string>}
|
|
47
|
+
*/
|
|
48
|
+
@Output() public colorChange = new EventEmitter<string>();
|
|
49
|
+
|
|
50
|
+
public color: string = '';
|
|
51
|
+
public hue: number = 0;
|
|
52
|
+
public saturation: number = 0;
|
|
53
|
+
public value: number = 0;
|
|
54
|
+
public opacity: number = 100;
|
|
55
|
+
private isDragging: boolean = false;
|
|
56
|
+
private isHueDragging: boolean = false;
|
|
57
|
+
private isOpacityDragging: boolean = false;
|
|
58
|
+
public showEdit: boolean = false;
|
|
59
|
+
|
|
60
|
+
ngAfterViewInit() {
|
|
61
|
+
this.drawHueCanvas();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@HostListener('document:mousemove', ['$event'])
|
|
65
|
+
onMouseMove(event: MouseEvent): void {
|
|
66
|
+
if (this.isDragging) {
|
|
67
|
+
this.updateColorFromPosition(event);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (this.isHueDragging) {
|
|
71
|
+
this.updateHueFromPosition(event);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (this.isOpacityDragging) {
|
|
76
|
+
this.updateOpacityFromPosition(event);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@HostListener('document:mouseup')
|
|
82
|
+
onMouseUp(): void {
|
|
83
|
+
this.isDragging = false;
|
|
84
|
+
this.isHueDragging = false;
|
|
85
|
+
this.isOpacityDragging = false;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
drawColorCanvas(): void {
|
|
89
|
+
const canvas = this.colorCanvas.nativeElement;
|
|
90
|
+
const ctx = canvas.getContext('2d')!;
|
|
91
|
+
const width = canvas.width;
|
|
92
|
+
const height = canvas.height;
|
|
93
|
+
|
|
94
|
+
// Gradiente de saturación (eje X)
|
|
95
|
+
const saturationGradient = ctx.createLinearGradient(0, 0, width, 0);
|
|
96
|
+
saturationGradient.addColorStop(0, '#FFFFFF');
|
|
97
|
+
saturationGradient.addColorStop(1, `hsl(${this.hue}, 100%, 50%)`);
|
|
98
|
+
|
|
99
|
+
// Gradiente de valor (eje Y)
|
|
100
|
+
const valueGradient = ctx.createLinearGradient(0, 0, 0, height);
|
|
101
|
+
valueGradient.addColorStop(0, 'rgba(0, 0, 0, 0)');
|
|
102
|
+
valueGradient.addColorStop(1, '#000000');
|
|
103
|
+
|
|
104
|
+
ctx.fillStyle = saturationGradient;
|
|
105
|
+
ctx.fillRect(0, 0, width, height);
|
|
106
|
+
ctx.fillStyle = valueGradient;
|
|
107
|
+
ctx.fillRect(0, 0, width, height);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@HostListener('document:click', ['$event'])
|
|
111
|
+
handleClickOutside(event: MouseEvent) {
|
|
112
|
+
const clickedInside = this.colorPicker?.nativeElement.contains(event.target);
|
|
113
|
+
if (!clickedInside && this.showEdit) {
|
|
114
|
+
this.showEdit = false;
|
|
115
|
+
this.currentColor = this.color;
|
|
116
|
+
this.colorChange.emit(this.color);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
drawHueCanvas(): void {
|
|
121
|
+
const canvas = this.hueCanvas.nativeElement;
|
|
122
|
+
const ctx = canvas.getContext('2d')!;
|
|
123
|
+
const width = canvas.width;
|
|
124
|
+
const height = canvas.height;
|
|
125
|
+
|
|
126
|
+
const hueGradient = ctx.createLinearGradient(0, 0, width, 0);
|
|
127
|
+
|
|
128
|
+
for (let i = 0; i <= 360; i += 60) {
|
|
129
|
+
hueGradient.addColorStop(i / 360, `hsl(${i}, 100%, 50%)`);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
ctx.fillStyle = hueGradient;
|
|
133
|
+
|
|
134
|
+
ctx.fillRect(0, 0, width, height);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
drawOpacityCanvas(): void {
|
|
138
|
+
const canvas = this.opacityCanvas.nativeElement;
|
|
139
|
+
const ctx = canvas.getContext('2d')!;
|
|
140
|
+
const width = canvas.width;
|
|
141
|
+
const height = canvas.height;
|
|
142
|
+
|
|
143
|
+
// Limpiar el canvas
|
|
144
|
+
ctx.clearRect(0, 0, width, height);
|
|
145
|
+
|
|
146
|
+
ctx.fillStyle = '#FFFFFF';
|
|
147
|
+
ctx.fillRect(0, 0, width, height);
|
|
148
|
+
|
|
149
|
+
// Obtener el color actual sin opacidad
|
|
150
|
+
const rgb = this.hsvToRgb(this.hue, this.saturation, this.value);
|
|
151
|
+
|
|
152
|
+
// Crear gradiente de opacidad
|
|
153
|
+
const opacityGradient = ctx.createLinearGradient(0, 0, width, 0);
|
|
154
|
+
opacityGradient.addColorStop(0, `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0)`);
|
|
155
|
+
opacityGradient.addColorStop(1, `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1)`);
|
|
156
|
+
|
|
157
|
+
// Dibujar el gradiente
|
|
158
|
+
ctx.fillStyle = opacityGradient;
|
|
159
|
+
ctx.fillRect(0, 0, width, height);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
updateColor(): void {
|
|
163
|
+
// Convertir HSV a RGB
|
|
164
|
+
const rgb = this.hsvToRgb(this.hue, this.saturation, this.value);
|
|
165
|
+
const hex = this.rgbToHex(rgb.r, rgb.g, rgb.b, this.opacity);
|
|
166
|
+
// Color a emitir
|
|
167
|
+
this.color = hex;
|
|
168
|
+
// Redibujar los canvas
|
|
169
|
+
this.drawColorCanvas();
|
|
170
|
+
this.drawOpacityCanvas();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
hsvToRgb(h: number, s: number, v: number): { r: number; g: number; b: number } {
|
|
174
|
+
s /= 100;
|
|
175
|
+
v /= 100;
|
|
176
|
+
|
|
177
|
+
const c = v * s;
|
|
178
|
+
const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
|
|
179
|
+
const m = v - c;
|
|
180
|
+
|
|
181
|
+
let r = 0,
|
|
182
|
+
g = 0,
|
|
183
|
+
b = 0;
|
|
184
|
+
|
|
185
|
+
if (h >= 0 && h < 60) {
|
|
186
|
+
r = c;
|
|
187
|
+
g = x;
|
|
188
|
+
b = 0;
|
|
189
|
+
} else if (h >= 60 && h < 120) {
|
|
190
|
+
r = x;
|
|
191
|
+
g = c;
|
|
192
|
+
b = 0;
|
|
193
|
+
} else if (h >= 120 && h < 180) {
|
|
194
|
+
r = 0;
|
|
195
|
+
g = c;
|
|
196
|
+
b = x;
|
|
197
|
+
} else if (h >= 180 && h < 240) {
|
|
198
|
+
r = 0;
|
|
199
|
+
g = x;
|
|
200
|
+
b = c;
|
|
201
|
+
} else if (h >= 240 && h < 300) {
|
|
202
|
+
r = x;
|
|
203
|
+
g = 0;
|
|
204
|
+
b = c;
|
|
205
|
+
} else if (h >= 300 && h < 361) {
|
|
206
|
+
r = c;
|
|
207
|
+
g = 0;
|
|
208
|
+
b = x;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
r: Math.round((r + m) * 255),
|
|
213
|
+
g: Math.round((g + m) * 255),
|
|
214
|
+
b: Math.round((b + m) * 255),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
rgbToHex(red: number, green: number, black: number, opacity = 1) {
|
|
219
|
+
const toHex = (val) => {
|
|
220
|
+
const hex = Math.round(val).toString(16);
|
|
221
|
+
return hex.padStart(2, '0');
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const rHex = toHex(red);
|
|
225
|
+
const gHex = toHex(green);
|
|
226
|
+
const bHex = toHex(black);
|
|
227
|
+
const alpha = Math.round((opacity / 100) * 255);
|
|
228
|
+
const aHex = toHex(alpha);
|
|
229
|
+
|
|
230
|
+
return `#${rHex}${gHex}${bHex}${aHex}`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
onHexInputChange(): void {
|
|
234
|
+
if (/^#?[0-9A-F]{6}([0-9A-F]{2})?$/i.test(this.color)) {
|
|
235
|
+
if (!this.color.startsWith('#')) {
|
|
236
|
+
this.color = '#' + this.color;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const hex = this.color.substring(1);
|
|
240
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
241
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
242
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
243
|
+
const a = hex.length === 8 ? parseInt(hex.substring(6, 8), 16) / 255 : 1;
|
|
244
|
+
|
|
245
|
+
const hsv = this.rgbToHsv(r, g, b, a);
|
|
246
|
+
this.hue = hsv.h;
|
|
247
|
+
this.saturation = hsv.s;
|
|
248
|
+
this.value = hsv.v;
|
|
249
|
+
this.opacity = a * 100;
|
|
250
|
+
|
|
251
|
+
this.drawColorCanvas();
|
|
252
|
+
this.drawOpacityCanvas();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
rgbToHsv(
|
|
257
|
+
r: number,
|
|
258
|
+
g: number,
|
|
259
|
+
b: number,
|
|
260
|
+
a: number = 1,
|
|
261
|
+
): { h: number; s: number; v: number; a: number } {
|
|
262
|
+
r /= 255;
|
|
263
|
+
g /= 255;
|
|
264
|
+
b /= 255;
|
|
265
|
+
|
|
266
|
+
const max = Math.max(r, g, b);
|
|
267
|
+
const min = Math.min(r, g, b);
|
|
268
|
+
const delta = max - min;
|
|
269
|
+
|
|
270
|
+
let h = 0;
|
|
271
|
+
if (delta !== 0) {
|
|
272
|
+
if (max === r) h = 60 * (((g - b) / delta) % 6);
|
|
273
|
+
else if (max === g) h = 60 * ((b - r) / delta + 2);
|
|
274
|
+
else if (max === b) h = 60 * ((r - g) / delta + 4);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (h < 0) h += 360;
|
|
278
|
+
|
|
279
|
+
const s = max === 0 ? 0 : (delta / max) * 100;
|
|
280
|
+
const v = max * 100;
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
h: Math.round(h),
|
|
284
|
+
s: Math.round(s),
|
|
285
|
+
v: Math.round(v),
|
|
286
|
+
a: parseFloat(a.toFixed(3)),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
getCanvasPosition(canvas: HTMLCanvasElement, event: MouseEvent): { x: number; y: number } {
|
|
291
|
+
const rect = canvas.getBoundingClientRect();
|
|
292
|
+
const scaleX = canvas.width / rect.width;
|
|
293
|
+
const scaleY = canvas.height / rect.height;
|
|
294
|
+
|
|
295
|
+
return {
|
|
296
|
+
x: (event.clientX - rect.left) * scaleX,
|
|
297
|
+
y: (event.clientY - rect.top) * scaleY,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
onColorMouseDown(event: MouseEvent): void {
|
|
302
|
+
this.isDragging = true;
|
|
303
|
+
this.updateColorFromPosition(event);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
onHueMouseDown(event: MouseEvent): void {
|
|
307
|
+
this.isHueDragging = true;
|
|
308
|
+
this.updateHueFromPosition(event);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
onOpacityMouseDown(event: MouseEvent): void {
|
|
312
|
+
this.isOpacityDragging = true;
|
|
313
|
+
this.updateOpacityFromPosition(event);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
updateColorFromPosition(event: MouseEvent): void {
|
|
317
|
+
const canvas = this.colorCanvas.nativeElement;
|
|
318
|
+
const pos = this.getCanvasPosition(canvas, event);
|
|
319
|
+
|
|
320
|
+
// Coordenadas dentro de canvas
|
|
321
|
+
const x = Math.max(0, Math.min(pos.x, canvas.width));
|
|
322
|
+
const y = Math.max(0, Math.min(pos.y, canvas.height));
|
|
323
|
+
|
|
324
|
+
this.saturation = Math.round((x / canvas.width) * 100);
|
|
325
|
+
this.value = 100 - Math.round((y / canvas.height) * 100);
|
|
326
|
+
this.updateColor();
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
updateHueFromPosition(event: MouseEvent): void {
|
|
330
|
+
const canvas = this.hueCanvas.nativeElement;
|
|
331
|
+
const pos = this.getCanvasPosition(canvas, event);
|
|
332
|
+
const x = Math.max(0, Math.min(pos.x, canvas.width));
|
|
333
|
+
this.hue = Math.round((x / canvas.width) * 360);
|
|
334
|
+
this.drawColorCanvas();
|
|
335
|
+
this.updateColor();
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
updateOpacityFromPosition(event: MouseEvent): void {
|
|
339
|
+
const canvas = this.opacityCanvas.nativeElement;
|
|
340
|
+
const pos = this.getCanvasPosition(canvas, event);
|
|
341
|
+
const x = Math.max(0, Math.min(pos.x, canvas.width));
|
|
342
|
+
|
|
343
|
+
this.opacity = Math.round((x / canvas.width) * 100);
|
|
344
|
+
this.updateColor();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
showEditor() {
|
|
348
|
+
this.showEdit = !this.showEdit;
|
|
349
|
+
this.color = this.currentColor;
|
|
350
|
+
if (!this.showEdit) return;
|
|
351
|
+
this.onHexInputChange();
|
|
352
|
+
}
|
|
353
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.flag {
|
|
2
|
+
max-width: 40px;
|
|
3
|
+
max-height: 40px;
|
|
4
|
+
margin: 0;
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: center;
|
|
8
|
+
img {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
object-fit: none;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
::ng-deep {
|
|
15
|
+
.circle {
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
.rectangle {
|
|
20
|
+
border-radius: 8px;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
max-width: 32px !important;
|
|
23
|
+
max-height: 24px !important;
|
|
24
|
+
img {
|
|
25
|
+
object-fit: cover !important;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.flag img:not([style*='width']):not([style*='height']) {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
object-fit: none;
|
|
34
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { CountryFlagsComponent } from './country-flags.component';
|
|
3
|
+
|
|
4
|
+
describe('CountryFlagsComponent', () => {
|
|
5
|
+
let component: CountryFlagsComponent;
|
|
6
|
+
let fixture: ComponentFixture<CountryFlagsComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [CountryFlagsComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(CountryFlagsComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('Inicialización del componente', () => {
|
|
19
|
+
it('should create', () => {
|
|
20
|
+
expect(component).toBeTruthy();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should have undefined country by default', () => {
|
|
24
|
+
expect(component.country).toBeUndefined();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should have undefined style by default', () => {
|
|
28
|
+
expect(component.style).toBeUndefined();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('Propiedades de entrada', () => {
|
|
33
|
+
it('should accept country input', () => {
|
|
34
|
+
component.country = 'colombia';
|
|
35
|
+
expect(component.country).toBe('colombia');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should accept different country values', () => {
|
|
39
|
+
const countries = ['colombia', 'mexico', 'chile', 'peru', 'ecuador'];
|
|
40
|
+
countries.forEach((country) => {
|
|
41
|
+
component.country = country;
|
|
42
|
+
expect(component.country).toBe(country);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should accept style input', () => {
|
|
47
|
+
component.style = 'circle';
|
|
48
|
+
expect(component.style).toBe('circle');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('should accept different style values', () => {
|
|
52
|
+
const styles = ['circle', 'rectangle', 'square'];
|
|
53
|
+
styles.forEach((style) => {
|
|
54
|
+
component.style = style;
|
|
55
|
+
expect(component.style).toBe(style);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe('Renderizado', () => {
|
|
61
|
+
it('should render the component template', () => {
|
|
62
|
+
const compiled = fixture.nativeElement as HTMLElement;
|
|
63
|
+
expect(compiled).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should update when country changes', () => {
|
|
67
|
+
component.country = 'mexico';
|
|
68
|
+
fixture.detectChanges();
|
|
69
|
+
expect(component.country).toBe('mexico');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should update when style changes', () => {
|
|
73
|
+
component.style = 'rectangle';
|
|
74
|
+
fixture.detectChanges();
|
|
75
|
+
expect(component.style).toBe('rectangle');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
});
|