@forgeroute/ui 0.5.16 → 0.5.17
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/fesm2022/forgeroute-ui-action-bar.mjs +190 -0
- package/fesm2022/forgeroute-ui-action-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-address-input.mjs +1164 -0
- package/fesm2022/forgeroute-ui-address-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-alert.mjs +223 -0
- package/fesm2022/forgeroute-ui-alert.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-avatar.mjs +320 -0
- package/fesm2022/forgeroute-ui-avatar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-badge.mjs +158 -0
- package/fesm2022/forgeroute-ui-badge.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-bar-row.mjs +255 -0
- package/fesm2022/forgeroute-ui-bar-row.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-boards.mjs +2201 -0
- package/fesm2022/forgeroute-ui-boards.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-bulk-eligible.mjs +172 -0
- package/fesm2022/forgeroute-ui-bulk-eligible.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-business-hours.mjs +771 -0
- package/fesm2022/forgeroute-ui-business-hours.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-calendar.mjs +2006 -0
- package/fesm2022/forgeroute-ui-calendar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-card-list-item.mjs +556 -0
- package/fesm2022/forgeroute-ui-card-list-item.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-charts.mjs +1 -1
- package/fesm2022/forgeroute-ui-charts.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-checkbox.mjs +815 -0
- package/fesm2022/forgeroute-ui-checkbox.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-chip.mjs +379 -0
- package/fesm2022/forgeroute-ui-chip.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-color-input.mjs +492 -0
- package/fesm2022/forgeroute-ui-color-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-column-filter.mjs +645 -0
- package/fesm2022/forgeroute-ui-column-filter.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-columns.mjs +351 -0
- package/fesm2022/forgeroute-ui-columns.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-combobox.mjs +772 -0
- package/fesm2022/forgeroute-ui-combobox.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-confirm.mjs +48 -0
- package/fesm2022/forgeroute-ui-confirm.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-contact-picker.mjs +865 -0
- package/fesm2022/forgeroute-ui-contact-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-conversations.mjs +3627 -0
- package/fesm2022/forgeroute-ui-conversations.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-copy-field.mjs +378 -0
- package/fesm2022/forgeroute-ui-copy-field.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-data-table-core.mjs +6150 -0
- package/fesm2022/forgeroute-ui-data-table-core.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-date-input.mjs +384 -0
- package/fesm2022/forgeroute-ui-date-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-date-range-picker.mjs +453 -0
- package/fesm2022/forgeroute-ui-date-range-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-datetime-input.mjs +375 -0
- package/fesm2022/forgeroute-ui-datetime-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-detail-card.mjs +655 -0
- package/fesm2022/forgeroute-ui-detail-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-discount-selector.mjs +259 -0
- package/fesm2022/forgeroute-ui-discount-selector.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-divider.mjs +111 -0
- package/fesm2022/forgeroute-ui-divider.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-dropdown.mjs +550 -0
- package/fesm2022/forgeroute-ui-dropdown.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-editor.mjs +4545 -0
- package/fesm2022/forgeroute-ui-editor.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-empty-state.mjs +231 -0
- package/fesm2022/forgeroute-ui-empty-state.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-error-state.mjs +195 -0
- package/fesm2022/forgeroute-ui-error-state.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-error.mjs +93 -0
- package/fesm2022/forgeroute-ui-error.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-fade.mjs +117 -0
- package/fesm2022/forgeroute-ui-fade.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-file-input.mjs +999 -0
- package/fesm2022/forgeroute-ui-file-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-fixed-footer.mjs +115 -0
- package/fesm2022/forgeroute-ui-fixed-footer.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form-row.mjs +126 -0
- package/fesm2022/forgeroute-ui-form-row.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form-section.mjs +93 -0
- package/fesm2022/forgeroute-ui-form-section.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-form.mjs +139 -0
- package/fesm2022/forgeroute-ui-form.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-hint.mjs +47 -0
- package/fesm2022/forgeroute-ui-hint.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-icon-picker.mjs +424 -0
- package/fesm2022/forgeroute-ui-icon-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-icon.mjs +311 -0
- package/fesm2022/forgeroute-ui-icon.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-image-preview.mjs +237 -0
- package/fesm2022/forgeroute-ui-image-preview.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-keypad.mjs +278 -0
- package/fesm2022/forgeroute-ui-keypad.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-kpi-card.mjs +490 -0
- package/fesm2022/forgeroute-ui-kpi-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-language-switcher.mjs +134 -0
- package/fesm2022/forgeroute-ui-language-switcher.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-layout.mjs +18 -0
- package/fesm2022/forgeroute-ui-layout.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-list-item.mjs +620 -0
- package/fesm2022/forgeroute-ui-list-item.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-list.mjs +866 -0
- package/fesm2022/forgeroute-ui-list.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-live-region.mjs +118 -0
- package/fesm2022/forgeroute-ui-live-region.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-map.mjs +5 -1
- package/fesm2022/forgeroute-ui-map.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-maps.mjs +2 -1
- package/fesm2022/forgeroute-ui-maps.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-media.mjs +4615 -0
- package/fesm2022/forgeroute-ui-media.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-messaging.mjs +20 -1
- package/fesm2022/forgeroute-ui-messaging.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-more-menu.mjs +418 -0
- package/fesm2022/forgeroute-ui-more-menu.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-multi-select.mjs +532 -0
- package/fesm2022/forgeroute-ui-multi-select.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-notes.mjs +768 -0
- package/fesm2022/forgeroute-ui-notes.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-notification-bell.mjs +587 -0
- package/fesm2022/forgeroute-ui-notification-bell.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-offline-banner.mjs +156 -0
- package/fesm2022/forgeroute-ui-offline-banner.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-option-card.mjs +379 -0
- package/fesm2022/forgeroute-ui-option-card.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-page.mjs +317 -0
- package/fesm2022/forgeroute-ui-page.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pagination.mjs +225 -0
- package/fesm2022/forgeroute-ui-pagination.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-panel-info-list.mjs +422 -0
- package/fesm2022/forgeroute-ui-panel-info-list.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-password-requirements.mjs +237 -0
- package/fesm2022/forgeroute-ui-password-requirements.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-payments.mjs +6243 -0
- package/fesm2022/forgeroute-ui-payments.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pdf.mjs +9 -1
- package/fesm2022/forgeroute-ui-pdf.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-phone-number-picker.mjs +840 -0
- package/fesm2022/forgeroute-ui-phone-number-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-pill-tabs.mjs +546 -0
- package/fesm2022/forgeroute-ui-pill-tabs.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-print.mjs +76 -0
- package/fesm2022/forgeroute-ui-print.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-progress-bar.mjs +252 -0
- package/fesm2022/forgeroute-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-progress-ring.mjs +277 -0
- package/fesm2022/forgeroute-ui-progress-ring.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs +301 -0
- package/fesm2022/forgeroute-ui-quick-filter-tabs.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-quickbooks.mjs +18 -1
- package/fesm2022/forgeroute-ui-quickbooks.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-radio-matrix.mjs +471 -0
- package/fesm2022/forgeroute-ui-radio-matrix.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-radio.mjs +911 -0
- package/fesm2022/forgeroute-ui-radio.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-read-only-mode.mjs +15 -0
- package/fesm2022/forgeroute-ui-read-only-mode.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-readonly-fieldset.mjs +146 -0
- package/fesm2022/forgeroute-ui-readonly-fieldset.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs +249 -0
- package/fesm2022/forgeroute-ui-reminder-alerts.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-search-input.mjs +373 -0
- package/fesm2022/forgeroute-ui-search-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-section-header.mjs +296 -0
- package/fesm2022/forgeroute-ui-section-header.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-select.mjs +498 -0
- package/fesm2022/forgeroute-ui-select.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-setup.mjs +4649 -0
- package/fesm2022/forgeroute-ui-setup.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-share-menu.mjs +461 -0
- package/fesm2022/forgeroute-ui-share-menu.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-shell.mjs +981 -0
- package/fesm2022/forgeroute-ui-shell.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-show.mjs +129 -0
- package/fesm2022/forgeroute-ui-show.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-sidebar-layout.mjs +355 -0
- package/fesm2022/forgeroute-ui-sidebar-layout.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-skeleton.mjs +152 -0
- package/fesm2022/forgeroute-ui-skeleton.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-skip-link.mjs +129 -0
- package/fesm2022/forgeroute-ui-skip-link.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-snackbar.mjs +200 -0
- package/fesm2022/forgeroute-ui-snackbar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-square.mjs +15 -1
- package/fesm2022/forgeroute-ui-square.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-stack.mjs +233 -0
- package/fesm2022/forgeroute-ui-stack.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stacked-bar.mjs +200 -0
- package/fesm2022/forgeroute-ui-stacked-bar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stacking-plan.mjs +365 -0
- package/fesm2022/forgeroute-ui-stacking-plan.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-star-rating.mjs +498 -0
- package/fesm2022/forgeroute-ui-star-rating.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-star.mjs +184 -0
- package/fesm2022/forgeroute-ui-star.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stepper.mjs +615 -0
- package/fesm2022/forgeroute-ui-stepper.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-stripe.mjs +14 -1
- package/fesm2022/forgeroute-ui-stripe.mjs.map +1 -1
- package/fesm2022/forgeroute-ui-swatch-picker.mjs +416 -0
- package/fesm2022/forgeroute-ui-swatch-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-table-toolbar.mjs +770 -0
- package/fesm2022/forgeroute-ui-table-toolbar.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-table-types.mjs +277 -0
- package/fesm2022/forgeroute-ui-table-types.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text-input.mjs +1003 -0
- package/fesm2022/forgeroute-ui-text-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text-template-picker.mjs +356 -0
- package/fesm2022/forgeroute-ui-text-template-picker.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-text.mjs +195 -0
- package/fesm2022/forgeroute-ui-text.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-textarea-input.mjs +542 -0
- package/fesm2022/forgeroute-ui-textarea-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-time-input.mjs +401 -0
- package/fesm2022/forgeroute-ui-time-input.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-timeline.mjs +549 -0
- package/fesm2022/forgeroute-ui-timeline.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toast.mjs +507 -0
- package/fesm2022/forgeroute-ui-toast.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toggle-badge.mjs +177 -0
- package/fesm2022/forgeroute-ui-toggle-badge.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-toggle.mjs +275 -0
- package/fesm2022/forgeroute-ui-toggle.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-tooltip.mjs +155 -0
- package/fesm2022/forgeroute-ui-tooltip.mjs.map +1 -0
- package/fesm2022/forgeroute-ui-utils.mjs +1071 -0
- package/fesm2022/forgeroute-ui-utils.mjs.map +1 -0
- package/fesm2022/forgeroute-ui.mjs +105 -70663
- package/package.json +417 -1
- package/types/forgeroute-ui-action-bar.d.ts +74 -0
- package/types/forgeroute-ui-address-input.d.ts +354 -0
- package/types/forgeroute-ui-alert.d.ts +89 -0
- package/types/forgeroute-ui-avatar.d.ts +85 -0
- package/types/forgeroute-ui-badge.d.ts +45 -0
- package/types/forgeroute-ui-bar-row.d.ts +90 -0
- package/types/forgeroute-ui-boards.d.ts +575 -0
- package/types/forgeroute-ui-bulk-eligible.d.ts +53 -0
- package/types/forgeroute-ui-business-hours.d.ts +191 -0
- package/types/forgeroute-ui-calendar.d.ts +544 -0
- package/types/forgeroute-ui-card-list-item.d.ts +186 -0
- package/types/forgeroute-ui-charts.d.ts +1 -1
- package/types/forgeroute-ui-checkbox.d.ts +270 -0
- package/types/forgeroute-ui-chip.d.ts +125 -0
- package/types/forgeroute-ui-color-input.d.ts +160 -0
- package/types/forgeroute-ui-column-filter.d.ts +130 -0
- package/types/forgeroute-ui-columns.d.ts +150 -0
- package/types/forgeroute-ui-combobox.d.ts +252 -0
- package/types/forgeroute-ui-confirm.d.ts +34 -0
- package/types/forgeroute-ui-contact-picker.d.ts +173 -0
- package/types/forgeroute-ui-conversations.d.ts +993 -0
- package/types/forgeroute-ui-copy-field.d.ts +122 -0
- package/types/forgeroute-ui-data-table-core.d.ts +1221 -0
- package/types/forgeroute-ui-date-input.d.ts +101 -0
- package/types/forgeroute-ui-date-range-picker.d.ts +109 -0
- package/types/forgeroute-ui-datetime-input.d.ts +97 -0
- package/types/forgeroute-ui-detail-card.d.ts +252 -0
- package/types/forgeroute-ui-discount-selector.d.ts +57 -0
- package/types/forgeroute-ui-divider.d.ts +40 -0
- package/types/forgeroute-ui-dropdown.d.ts +156 -0
- package/types/forgeroute-ui-editor.d.ts +873 -0
- package/types/forgeroute-ui-empty-state.d.ts +29 -0
- package/types/forgeroute-ui-error-state.d.ts +38 -0
- package/types/forgeroute-ui-error.d.ts +29 -0
- package/types/forgeroute-ui-fade.d.ts +39 -0
- package/types/forgeroute-ui-file-input.d.ts +337 -0
- package/types/forgeroute-ui-fixed-footer.d.ts +53 -0
- package/types/forgeroute-ui-form-row.d.ts +30 -0
- package/types/forgeroute-ui-form-section.d.ts +18 -0
- package/types/forgeroute-ui-form.d.ts +68 -0
- package/types/forgeroute-ui-hint.d.ts +10 -0
- package/types/forgeroute-ui-icon-picker.d.ts +122 -0
- package/types/forgeroute-ui-icon.d.ts +95 -0
- package/types/forgeroute-ui-image-preview.d.ts +88 -0
- package/types/forgeroute-ui-keypad.d.ts +73 -0
- package/types/forgeroute-ui-kpi-card.d.ts +161 -0
- package/types/forgeroute-ui-language-switcher.d.ts +41 -0
- package/types/forgeroute-ui-layout.d.ts +13 -0
- package/types/forgeroute-ui-list-item.d.ts +253 -0
- package/types/forgeroute-ui-list.d.ts +282 -0
- package/types/forgeroute-ui-live-region.d.ts +49 -0
- package/types/forgeroute-ui-map.d.ts +1 -1
- package/types/forgeroute-ui-maps.d.ts +1 -1
- package/types/forgeroute-ui-media.d.ts +1221 -0
- package/types/forgeroute-ui-messaging.d.ts +6 -1
- package/types/forgeroute-ui-more-menu.d.ts +91 -0
- package/types/forgeroute-ui-multi-select.d.ts +119 -0
- package/types/forgeroute-ui-notes.d.ts +172 -0
- package/types/forgeroute-ui-notification-bell.d.ts +135 -0
- package/types/forgeroute-ui-offline-banner.d.ts +44 -0
- package/types/forgeroute-ui-option-card.d.ts +106 -0
- package/types/forgeroute-ui-page.d.ts +115 -0
- package/types/forgeroute-ui-pagination.d.ts +55 -0
- package/types/forgeroute-ui-panel-info-list.d.ts +147 -0
- package/types/forgeroute-ui-password-requirements.d.ts +89 -0
- package/types/forgeroute-ui-payments.d.ts +1818 -0
- package/types/forgeroute-ui-pdf.d.ts +1 -1
- package/types/forgeroute-ui-phone-number-picker.d.ts +199 -0
- package/types/forgeroute-ui-pill-tabs.d.ts +208 -0
- package/types/forgeroute-ui-print.d.ts +40 -0
- package/types/forgeroute-ui-progress-bar.d.ts +88 -0
- package/types/forgeroute-ui-progress-ring.d.ts +102 -0
- package/types/forgeroute-ui-quick-filter-tabs.d.ts +51 -0
- package/types/forgeroute-ui-quickbooks.d.ts +4 -1
- package/types/forgeroute-ui-radio-matrix.d.ts +131 -0
- package/types/forgeroute-ui-radio.d.ts +311 -0
- package/types/forgeroute-ui-read-only-mode.d.ts +26 -0
- package/types/forgeroute-ui-readonly-fieldset.d.ts +62 -0
- package/types/forgeroute-ui-reminder-alerts.d.ts +71 -0
- package/types/forgeroute-ui-search-input.d.ts +93 -0
- package/types/forgeroute-ui-section-header.d.ts +149 -0
- package/types/forgeroute-ui-select.d.ts +183 -0
- package/types/forgeroute-ui-setup.d.ts +775 -0
- package/types/forgeroute-ui-share-menu.d.ts +99 -0
- package/types/forgeroute-ui-shell.d.ts +173 -0
- package/types/forgeroute-ui-show.d.ts +40 -0
- package/types/forgeroute-ui-sidebar-layout.d.ts +161 -0
- package/types/forgeroute-ui-skeleton.d.ts +51 -0
- package/types/forgeroute-ui-skip-link.d.ts +51 -0
- package/types/forgeroute-ui-snackbar.d.ts +50 -0
- package/types/forgeroute-ui-square.d.ts +3 -1
- package/types/forgeroute-ui-stack.d.ts +99 -0
- package/types/forgeroute-ui-stacked-bar.d.ts +84 -0
- package/types/forgeroute-ui-stacking-plan.d.ts +116 -0
- package/types/forgeroute-ui-star-rating.d.ts +151 -0
- package/types/forgeroute-ui-star.d.ts +46 -0
- package/types/forgeroute-ui-stepper.d.ts +273 -0
- package/types/forgeroute-ui-stripe.d.ts +3 -1
- package/types/forgeroute-ui-swatch-picker.d.ts +118 -0
- package/types/forgeroute-ui-table-toolbar.d.ts +116 -0
- package/types/forgeroute-ui-table-types.d.ts +624 -0
- package/types/forgeroute-ui-text-input.d.ts +359 -0
- package/types/forgeroute-ui-text-template-picker.d.ts +100 -0
- package/types/forgeroute-ui-text.d.ts +76 -0
- package/types/forgeroute-ui-textarea-input.d.ts +174 -0
- package/types/forgeroute-ui-time-input.d.ts +105 -0
- package/types/forgeroute-ui-timeline.d.ts +196 -0
- package/types/forgeroute-ui-toast.d.ts +131 -0
- package/types/forgeroute-ui-toggle-badge.d.ts +64 -0
- package/types/forgeroute-ui-toggle.d.ts +92 -0
- package/types/forgeroute-ui-tooltip.d.ts +36 -0
- package/types/forgeroute-ui-utils.d.ts +210 -0
- package/types/forgeroute-ui.d.ts +106 -19539
- package/fesm2022/forgeroute-ui.mjs.map +0 -1
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input, output, signal } from "@angular/core";
|
|
3
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
4
|
+
import { UiLabelsService } from "@forgeroute/ui/core";
|
|
5
|
+
const BG_PALETTE = [
|
|
6
|
+
"#dbeafe",
|
|
7
|
+
"#dcfce7",
|
|
8
|
+
"#fce7f3",
|
|
9
|
+
"#ccfbf1",
|
|
10
|
+
"#ffedd5",
|
|
11
|
+
"#bfdbfe",
|
|
12
|
+
"#d1fae5",
|
|
13
|
+
"#fef3c7",
|
|
14
|
+
"#fdf4ff",
|
|
15
|
+
"#cffafe"
|
|
16
|
+
];
|
|
17
|
+
const COLOR_PALETTE = [
|
|
18
|
+
"#1e40af",
|
|
19
|
+
"#166534",
|
|
20
|
+
"#be185d",
|
|
21
|
+
"#115e59",
|
|
22
|
+
"#9a3412",
|
|
23
|
+
"#1e3a8a",
|
|
24
|
+
"#065f46",
|
|
25
|
+
"#92400e",
|
|
26
|
+
"#a21caf",
|
|
27
|
+
"#155e75"
|
|
28
|
+
];
|
|
29
|
+
function colorIndex(str) {
|
|
30
|
+
let h = 0;
|
|
31
|
+
for (let i = 0; i < str.length; i++) h = h * 31 + str.charCodeAt(i) & 65535;
|
|
32
|
+
return Math.abs(h) % BG_PALETTE.length;
|
|
33
|
+
}
|
|
34
|
+
var AvatarComponent = class AvatarComponent {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.labels = inject(UiLabelsService);
|
|
37
|
+
this.initials = input.required(...ngDevMode ? [{ debugName: "initials" }] : /* istanbul ignore next */ []);
|
|
38
|
+
this.name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
39
|
+
this.size = input(32, ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
40
|
+
this.imageUrl = input(void 0, ...ngDevMode ? [{ debugName: "imageUrl" }] : /* istanbul ignore next */ []);
|
|
41
|
+
this.editable = input(false, ...ngDevMode ? [{ debugName: "editable" }] : /* istanbul ignore next */ []);
|
|
42
|
+
this.editLabelInput = input(null, {
|
|
43
|
+
...ngDevMode ? { debugName: "editLabelInput" } : /* istanbul ignore next */ {},
|
|
44
|
+
alias: "editLabel"
|
|
45
|
+
});
|
|
46
|
+
this.editLabel = computed(() => this.editLabelInput() ?? this.labels.t("avatar.editLabel"), ...ngDevMode ? [{ debugName: "editLabel" }] : /* istanbul ignore next */ []);
|
|
47
|
+
this.busy = input(false, ...ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []);
|
|
48
|
+
this.editClick = output();
|
|
49
|
+
this.imageError = output();
|
|
50
|
+
this.failedUrl = signal(null, ...ngDevMode ? [{ debugName: "failedUrl" }] : /* istanbul ignore next */ []);
|
|
51
|
+
this.showImage = computed(() => {
|
|
52
|
+
const url = this.imageUrl();
|
|
53
|
+
return !!url && this.failedUrl() !== url;
|
|
54
|
+
}, ...ngDevMode ? [{ debugName: "showImage" }] : /* istanbul ignore next */ []);
|
|
55
|
+
this.badgeSize = computed(() => Math.max(18, Math.round(this.size() * .3)), ...ngDevMode ? [{ debugName: "badgeSize" }] : /* istanbul ignore next */ []);
|
|
56
|
+
this.bg = computed(() => BG_PALETTE[colorIndex(this.initials())], ...ngDevMode ? [{ debugName: "bg" }] : /* istanbul ignore next */ []);
|
|
57
|
+
this.color = computed(() => COLOR_PALETTE[colorIndex(this.initials())], ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
58
|
+
}
|
|
59
|
+
onImageError() {
|
|
60
|
+
this.failedUrl.set(this.imageUrl() ?? null);
|
|
61
|
+
this.imageError.emit();
|
|
62
|
+
}
|
|
63
|
+
onEdit() {
|
|
64
|
+
if (this.busy()) return;
|
|
65
|
+
this.editClick.emit();
|
|
66
|
+
}
|
|
67
|
+
onKey(event) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
this.onEdit();
|
|
70
|
+
}
|
|
71
|
+
static {
|
|
72
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
73
|
+
minVersion: "12.0.0",
|
|
74
|
+
version: "22.2.2",
|
|
75
|
+
ngImport: i0,
|
|
76
|
+
type: AvatarComponent,
|
|
77
|
+
deps: [],
|
|
78
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
static {
|
|
82
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
83
|
+
minVersion: "17.0.0",
|
|
84
|
+
version: "22.2.2",
|
|
85
|
+
type: AvatarComponent,
|
|
86
|
+
isStandalone: true,
|
|
87
|
+
selector: "ui-avatar",
|
|
88
|
+
inputs: {
|
|
89
|
+
initials: {
|
|
90
|
+
classPropertyName: "initials",
|
|
91
|
+
publicName: "initials",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: true,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
},
|
|
96
|
+
name: {
|
|
97
|
+
classPropertyName: "name",
|
|
98
|
+
publicName: "name",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: false,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
},
|
|
103
|
+
size: {
|
|
104
|
+
classPropertyName: "size",
|
|
105
|
+
publicName: "size",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
},
|
|
110
|
+
imageUrl: {
|
|
111
|
+
classPropertyName: "imageUrl",
|
|
112
|
+
publicName: "imageUrl",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: false,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
117
|
+
editable: {
|
|
118
|
+
classPropertyName: "editable",
|
|
119
|
+
publicName: "editable",
|
|
120
|
+
isSignal: true,
|
|
121
|
+
isRequired: false,
|
|
122
|
+
transformFunction: null
|
|
123
|
+
},
|
|
124
|
+
editLabelInput: {
|
|
125
|
+
classPropertyName: "editLabelInput",
|
|
126
|
+
publicName: "editLabel",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
},
|
|
131
|
+
busy: {
|
|
132
|
+
classPropertyName: "busy",
|
|
133
|
+
publicName: "busy",
|
|
134
|
+
isSignal: true,
|
|
135
|
+
isRequired: false,
|
|
136
|
+
transformFunction: null
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
outputs: {
|
|
140
|
+
editClick: "editClick",
|
|
141
|
+
imageError: "imageError"
|
|
142
|
+
},
|
|
143
|
+
ngImport: i0,
|
|
144
|
+
template: `
|
|
145
|
+
@if (editable()) {
|
|
146
|
+
<span class="av-edit" role="button" [attr.tabindex]="busy() ? -1 : 0" [attr.aria-label]="editLabel()" [attr.title]="editLabel()"
|
|
147
|
+
[attr.aria-busy]="busy() ? 'true' : null" [attr.aria-disabled]="busy() ? 'true' : null" [class.av-busy]="busy()"
|
|
148
|
+
[style.width.px]="size()" [style.height.px]="size()"
|
|
149
|
+
(click)="onEdit()" (keydown.enter)="onKey($event)" (keydown.space)="onKey($event)">
|
|
150
|
+
<ng-container [ngTemplateOutlet]="face" />
|
|
151
|
+
<span class="av-badge" aria-hidden="true" [style.width.px]="badgeSize()" [style.height.px]="badgeSize()">
|
|
152
|
+
@if (busy()) {
|
|
153
|
+
<span class="av-spinner" [style.width.px]="badgeSize() * 0.6" [style.height.px]="badgeSize() * 0.6"></span>
|
|
154
|
+
} @else {
|
|
155
|
+
<svg [attr.width]="badgeSize() * 0.6" [attr.height]="badgeSize() * 0.6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
|
|
156
|
+
}
|
|
157
|
+
</span>
|
|
158
|
+
</span>
|
|
159
|
+
} @else {
|
|
160
|
+
<ng-container [ngTemplateOutlet]="face" />
|
|
161
|
+
}
|
|
162
|
+
<ng-template #face>
|
|
163
|
+
@if (showImage()) {
|
|
164
|
+
<img class="avatar avatar-img" [src]="imageUrl()" [attr.alt]="editable() ? '' : (name() || initials())"
|
|
165
|
+
[style.width.px]="size()" [style.height.px]="size()" (error)="onImageError()" />
|
|
166
|
+
} @else {
|
|
167
|
+
<span
|
|
168
|
+
class="avatar"
|
|
169
|
+
[attr.role]="editable() ? null : 'img'"
|
|
170
|
+
[attr.aria-hidden]="editable() ? 'true' : null"
|
|
171
|
+
[style.width.px]="size()"
|
|
172
|
+
[style.height.px]="size()"
|
|
173
|
+
[style.font-size.px]="size() * 0.38"
|
|
174
|
+
[style.background]="bg()"
|
|
175
|
+
[style.color]="color()"
|
|
176
|
+
[attr.aria-label]="editable() ? null : (name() || initials())">
|
|
177
|
+
{{ initials() }}
|
|
178
|
+
</span>
|
|
179
|
+
}
|
|
180
|
+
</ng-template>
|
|
181
|
+
`,
|
|
182
|
+
isInline: true,
|
|
183
|
+
styles: [":host{display:inline-flex;flex-shrink:0}.avatar{border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;text-transform:uppercase;letter-spacing:.02em;-webkit-user-select:none;user-select:none;flex-shrink:0}.avatar-img{display:block;object-fit:cover}.av-edit{position:relative;display:inline-flex;flex-shrink:0;border-radius:50%;cursor:pointer}.av-edit:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.av-edit.av-busy{cursor:progress}.av-edit.av-busy .avatar{opacity:.55}.av-badge{position:absolute;right:-2px;bottom:-2px;box-sizing:border-box;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#fff;color:#475569;border:1px solid #cbd5e1;box-shadow:0 1px 2px #0f172a1f}@media(hover:hover){.av-edit:hover:not(.av-busy) .av-badge{color:#0f172a;border-color:#94a3b8}}.av-spinner{display:block;box-sizing:border-box;border:2px solid rgba(100,116,139,.3);border-top-color:currentColor;border-radius:50%;animation:av-spin .6s linear infinite}@keyframes av-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.av-spinner{animation-duration:2s}}@media(pointer:coarse){.av-edit:after{content:\"\";position:absolute;inset:-6px}}\n"],
|
|
184
|
+
dependencies: [{
|
|
185
|
+
kind: "directive",
|
|
186
|
+
type: NgTemplateOutlet,
|
|
187
|
+
selector: "[ngTemplateOutlet]",
|
|
188
|
+
inputs: [
|
|
189
|
+
"ngTemplateOutletContext",
|
|
190
|
+
"ngTemplateOutlet",
|
|
191
|
+
"ngTemplateOutletInjector"
|
|
192
|
+
]
|
|
193
|
+
}],
|
|
194
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
199
|
+
minVersion: "12.0.0",
|
|
200
|
+
version: "22.2.2",
|
|
201
|
+
ngImport: i0,
|
|
202
|
+
type: AvatarComponent,
|
|
203
|
+
decorators: [{
|
|
204
|
+
type: Component,
|
|
205
|
+
args: [{
|
|
206
|
+
selector: "ui-avatar",
|
|
207
|
+
standalone: true,
|
|
208
|
+
imports: [NgTemplateOutlet],
|
|
209
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
210
|
+
template: `
|
|
211
|
+
@if (editable()) {
|
|
212
|
+
<span class="av-edit" role="button" [attr.tabindex]="busy() ? -1 : 0" [attr.aria-label]="editLabel()" [attr.title]="editLabel()"
|
|
213
|
+
[attr.aria-busy]="busy() ? 'true' : null" [attr.aria-disabled]="busy() ? 'true' : null" [class.av-busy]="busy()"
|
|
214
|
+
[style.width.px]="size()" [style.height.px]="size()"
|
|
215
|
+
(click)="onEdit()" (keydown.enter)="onKey($event)" (keydown.space)="onKey($event)">
|
|
216
|
+
<ng-container [ngTemplateOutlet]="face" />
|
|
217
|
+
<span class="av-badge" aria-hidden="true" [style.width.px]="badgeSize()" [style.height.px]="badgeSize()">
|
|
218
|
+
@if (busy()) {
|
|
219
|
+
<span class="av-spinner" [style.width.px]="badgeSize() * 0.6" [style.height.px]="badgeSize() * 0.6"></span>
|
|
220
|
+
} @else {
|
|
221
|
+
<svg [attr.width]="badgeSize() * 0.6" [attr.height]="badgeSize() * 0.6" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false"><path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"/><circle cx="12" cy="13" r="4"/></svg>
|
|
222
|
+
}
|
|
223
|
+
</span>
|
|
224
|
+
</span>
|
|
225
|
+
} @else {
|
|
226
|
+
<ng-container [ngTemplateOutlet]="face" />
|
|
227
|
+
}
|
|
228
|
+
<ng-template #face>
|
|
229
|
+
@if (showImage()) {
|
|
230
|
+
<img class="avatar avatar-img" [src]="imageUrl()" [attr.alt]="editable() ? '' : (name() || initials())"
|
|
231
|
+
[style.width.px]="size()" [style.height.px]="size()" (error)="onImageError()" />
|
|
232
|
+
} @else {
|
|
233
|
+
<span
|
|
234
|
+
class="avatar"
|
|
235
|
+
[attr.role]="editable() ? null : 'img'"
|
|
236
|
+
[attr.aria-hidden]="editable() ? 'true' : null"
|
|
237
|
+
[style.width.px]="size()"
|
|
238
|
+
[style.height.px]="size()"
|
|
239
|
+
[style.font-size.px]="size() * 0.38"
|
|
240
|
+
[style.background]="bg()"
|
|
241
|
+
[style.color]="color()"
|
|
242
|
+
[attr.aria-label]="editable() ? null : (name() || initials())">
|
|
243
|
+
{{ initials() }}
|
|
244
|
+
</span>
|
|
245
|
+
}
|
|
246
|
+
</ng-template>
|
|
247
|
+
`,
|
|
248
|
+
styles: [":host{display:inline-flex;flex-shrink:0}.avatar{border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;text-transform:uppercase;letter-spacing:.02em;-webkit-user-select:none;user-select:none;flex-shrink:0}.avatar-img{display:block;object-fit:cover}.av-edit{position:relative;display:inline-flex;flex-shrink:0;border-radius:50%;cursor:pointer}.av-edit:focus-visible{outline:2px solid #2563eb;outline-offset:2px}.av-edit.av-busy{cursor:progress}.av-edit.av-busy .avatar{opacity:.55}.av-badge{position:absolute;right:-2px;bottom:-2px;box-sizing:border-box;border-radius:50%;display:flex;align-items:center;justify-content:center;background:#fff;color:#475569;border:1px solid #cbd5e1;box-shadow:0 1px 2px #0f172a1f}@media(hover:hover){.av-edit:hover:not(.av-busy) .av-badge{color:#0f172a;border-color:#94a3b8}}.av-spinner{display:block;box-sizing:border-box;border:2px solid rgba(100,116,139,.3);border-top-color:currentColor;border-radius:50%;animation:av-spin .6s linear infinite}@keyframes av-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.av-spinner{animation-duration:2s}}@media(pointer:coarse){.av-edit:after{content:\"\";position:absolute;inset:-6px}}\n"]
|
|
249
|
+
}]
|
|
250
|
+
}],
|
|
251
|
+
propDecorators: {
|
|
252
|
+
initials: [{
|
|
253
|
+
type: i0.Input,
|
|
254
|
+
args: [{
|
|
255
|
+
isSignal: true,
|
|
256
|
+
alias: "initials",
|
|
257
|
+
required: true
|
|
258
|
+
}]
|
|
259
|
+
}],
|
|
260
|
+
name: [{
|
|
261
|
+
type: i0.Input,
|
|
262
|
+
args: [{
|
|
263
|
+
isSignal: true,
|
|
264
|
+
alias: "name",
|
|
265
|
+
required: false
|
|
266
|
+
}]
|
|
267
|
+
}],
|
|
268
|
+
size: [{
|
|
269
|
+
type: i0.Input,
|
|
270
|
+
args: [{
|
|
271
|
+
isSignal: true,
|
|
272
|
+
alias: "size",
|
|
273
|
+
required: false
|
|
274
|
+
}]
|
|
275
|
+
}],
|
|
276
|
+
imageUrl: [{
|
|
277
|
+
type: i0.Input,
|
|
278
|
+
args: [{
|
|
279
|
+
isSignal: true,
|
|
280
|
+
alias: "imageUrl",
|
|
281
|
+
required: false
|
|
282
|
+
}]
|
|
283
|
+
}],
|
|
284
|
+
editable: [{
|
|
285
|
+
type: i0.Input,
|
|
286
|
+
args: [{
|
|
287
|
+
isSignal: true,
|
|
288
|
+
alias: "editable",
|
|
289
|
+
required: false
|
|
290
|
+
}]
|
|
291
|
+
}],
|
|
292
|
+
editLabelInput: [{
|
|
293
|
+
type: i0.Input,
|
|
294
|
+
args: [{
|
|
295
|
+
isSignal: true,
|
|
296
|
+
alias: "editLabel",
|
|
297
|
+
required: false
|
|
298
|
+
}]
|
|
299
|
+
}],
|
|
300
|
+
busy: [{
|
|
301
|
+
type: i0.Input,
|
|
302
|
+
args: [{
|
|
303
|
+
isSignal: true,
|
|
304
|
+
alias: "busy",
|
|
305
|
+
required: false
|
|
306
|
+
}]
|
|
307
|
+
}],
|
|
308
|
+
editClick: [{
|
|
309
|
+
type: i0.Output,
|
|
310
|
+
args: ["editClick"]
|
|
311
|
+
}],
|
|
312
|
+
imageError: [{
|
|
313
|
+
type: i0.Output,
|
|
314
|
+
args: ["imageError"]
|
|
315
|
+
}]
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
export { AvatarComponent };
|
|
319
|
+
|
|
320
|
+
//# sourceMappingURL=forgeroute-ui-avatar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-avatar.mjs","names":[],"sources":["../../../projects/forgeroute-ui/avatar/src/lib/avatar/avatar.component.ts"],"sourcesContent":["import { Component, input, output, computed, signal, ChangeDetectionStrategy, inject } from '@angular/core';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { UiLabelsService } from '@forgeroute/ui/core';\n\nconst BG_PALETTE = [\n '#dbeafe', '#dcfce7', '#fce7f3', '#ccfbf1', '#ffedd5',\n '#bfdbfe', '#d1fae5', '#fef3c7', '#fdf4ff', '#cffafe',\n];\nconst COLOR_PALETTE = [\n '#1e40af', '#166534', '#be185d', '#115e59', '#9a3412',\n '#1e3a8a', '#065f46', '#92400e', '#a21caf', '#155e75',\n];\n\nfunction colorIndex(str: string): number {\n let h = 0;\n for (let i = 0; i < str.length; i++) h = (h * 31 + str.charCodeAt(i)) & 0xffff;\n return Math.abs(h) % BG_PALETTE.length;\n}\n\n/**\n * Round avatar: initials on a colour derived from them (default), or a photo when `imageUrl` is set. The photo falls back to the\n * initials by itself when it fails to load (and tries again when `imageUrl` changes).\n *\n * <ui-avatar initials=\"JS\" name=\"Jane Smith\" [size]=\"72\" [imageUrl]=\"photoUrl()\" />\n *\n * Editable (a profile picture the user can change): `[editable]=\"true\"` makes the avatar a keyboard button (role=\"button\",\n * tabindex 0, Enter / Space / click) that emits `editClick` — the host opens its file picker and uploads — with a small camera\n * badge in the corner. `editLabel` is its name for assistive tech and tooltip (default \"Change photo\"). `[busy]=\"true\"` while the\n * upload runs: spinner in the badge, the photo is dimmed, `aria-busy` is set and clicks / keys do nothing.\n *\n * <ui-avatar initials=\"JS\" name=\"Jane Smith\" [size]=\"72\" [imageUrl]=\"photoUrl()\" [editable]=\"canEdit()\" [busy]=\"uploading()\" (editClick)=\"picker.open()\" />\n *\n * Without `imageUrl` and `editable` nothing changes from the plain initials avatar.\n */\n@Component({\n selector: 'ui-avatar',\n standalone: true,\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (editable()) {\n <span class=\"av-edit\" role=\"button\" [attr.tabindex]=\"busy() ? -1 : 0\" [attr.aria-label]=\"editLabel()\" [attr.title]=\"editLabel()\"\n [attr.aria-busy]=\"busy() ? 'true' : null\" [attr.aria-disabled]=\"busy() ? 'true' : null\" [class.av-busy]=\"busy()\"\n [style.width.px]=\"size()\" [style.height.px]=\"size()\"\n (click)=\"onEdit()\" (keydown.enter)=\"onKey($event)\" (keydown.space)=\"onKey($event)\">\n <ng-container [ngTemplateOutlet]=\"face\" />\n <span class=\"av-badge\" aria-hidden=\"true\" [style.width.px]=\"badgeSize()\" [style.height.px]=\"badgeSize()\">\n @if (busy()) {\n <span class=\"av-spinner\" [style.width.px]=\"badgeSize() * 0.6\" [style.height.px]=\"badgeSize() * 0.6\"></span>\n } @else {\n <svg [attr.width]=\"badgeSize() * 0.6\" [attr.height]=\"badgeSize() * 0.6\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" focusable=\"false\"><path d=\"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z\"/><circle cx=\"12\" cy=\"13\" r=\"4\"/></svg>\n }\n </span>\n </span>\n } @else {\n <ng-container [ngTemplateOutlet]=\"face\" />\n }\n <ng-template #face>\n @if (showImage()) {\n <img class=\"avatar avatar-img\" [src]=\"imageUrl()\" [attr.alt]=\"editable() ? '' : (name() || initials())\"\n [style.width.px]=\"size()\" [style.height.px]=\"size()\" (error)=\"onImageError()\" />\n } @else {\n <span\n class=\"avatar\"\n [attr.role]=\"editable() ? null : 'img'\"\n [attr.aria-hidden]=\"editable() ? 'true' : null\"\n [style.width.px]=\"size()\"\n [style.height.px]=\"size()\"\n [style.font-size.px]=\"size() * 0.38\"\n [style.background]=\"bg()\"\n [style.color]=\"color()\"\n [attr.aria-label]=\"editable() ? null : (name() || initials())\">\n {{ initials() }}\n </span>\n }\n </ng-template>\n `,\n styles: [`\n :host { display: inline-flex; flex-shrink: 0; }\n .avatar {\n border-radius: 50%; display: flex; align-items: center;\n justify-content: center; font-weight: 600;\n text-transform: uppercase; letter-spacing: 0.02em;\n -webkit-user-select: none; user-select: none; flex-shrink: 0;\n }\n .avatar-img { display: block; object-fit: cover; }\n .av-edit { position: relative; display: inline-flex; flex-shrink: 0; border-radius: 50%; cursor: pointer; }\n .av-edit:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }\n .av-edit.av-busy { cursor: progress; }\n .av-edit.av-busy .avatar { opacity: 0.55; }\n .av-badge {\n position: absolute; right: -2px; bottom: -2px; box-sizing: border-box; border-radius: 50%;\n display: flex; align-items: center; justify-content: center;\n background: #fff; color: #475569; border: 1px solid #cbd5e1; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);\n }\n @media (hover: hover) { .av-edit:hover:not(.av-busy) .av-badge { color: #0f172a; border-color: #94a3b8; } }\n .av-spinner {\n display: block; box-sizing: border-box; border: 2px solid rgba(100, 116, 139, 0.3); border-top-color: currentColor;\n border-radius: 50%; animation: av-spin 0.6s linear infinite;\n }\n @keyframes av-spin { to { transform: rotate(360deg); } }\n @media (prefers-reduced-motion: reduce) { .av-spinner { animation-duration: 2s; } }\n /* 44px hit area for fingers when the avatar is smaller */\n @media (pointer: coarse) { .av-edit::after { content: ''; position: absolute; inset: -6px; } }\n `],\n})\nexport class AvatarComponent {\n protected readonly labels = inject(UiLabelsService);\n readonly initials = input.required<string>();\n readonly name = input('');\n readonly size = input(32);\n /** Photo URL. Empty / null = initials. A photo that fails to load falls back to the initials until the URL changes. */\n readonly imageUrl = input<string | null | undefined>(undefined);\n /** true = the avatar is a button that emits `editClick` (change the photo), with a camera badge. Default false: unchanged. */\n readonly editable = input(false);\n /** Name of the editable avatar for assistive tech and the tooltip. */\n readonly editLabelInput = input<string | null>(null, { alias: 'editLabel' });\n readonly editLabel = computed(() => this.editLabelInput() ?? this.labels.t('avatar.editLabel'));\n /** The host is uploading: spinner badge, dimmed photo, aria-busy, no clicks. */\n readonly busy = input(false);\n /** Fires on click / Enter / Space of an editable avatar (not while busy). */\n readonly editClick = output<void>();\n /** Fires when the photo could not be loaded (the initials are shown instead). */\n readonly imageError = output<void>();\n\n private readonly failedUrl = signal<string | null>(null);\n\n protected readonly showImage = computed(() => {\n const url = this.imageUrl();\n return !!url && this.failedUrl() !== url;\n });\n protected readonly badgeSize = computed(() => Math.max(18, Math.round(this.size() * 0.3)));\n protected readonly bg = computed(() => BG_PALETTE[colorIndex(this.initials())]);\n protected readonly color = computed(() => COLOR_PALETTE[colorIndex(this.initials())]);\n\n protected onImageError(): void {\n this.failedUrl.set(this.imageUrl() ?? null);\n this.imageError.emit();\n }\n\n protected onEdit(): void {\n if (this.busy()) return;\n this.editClick.emit();\n }\n\n protected onKey(event: Event): void {\n event.preventDefault(); // Space would scroll the page\n this.onEdit();\n }\n}\n"],"mappings":";;;;AAIA,MAAM,aAAa;CACjB;CAAW;CAAW;CAAW;CAAW;CAC5C;CAAW;CAAW;CAAW;CAAW;AAC7C;AACD,MAAM,gBAAgB;CACpB;CAAW;CAAW;CAAW;CAAW;CAC5C;CAAW;CAAW;CAAW;CAAW;AAC7C;AAED,SAAS,WAAW,KAAW;CAC7B,IAAI,IAAI;CACR,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK,IAAK,IAAI,KAAK,IAAI,WAAW,CAAC,IAAK;CACxE,OAAO,KAAK,IAAI,CAAC,IAAI,WAAW;AAClC;AAyFA,IAAa,kBAAb,MAAa,gBAAe;CAxE5B,cAAA;EAyEqB,KAAA,SAAS,OAAO,eAAe;EACzC,KAAA,WAAW,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA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KAAA,YAAA;KAAA,mBAAA;IAAA;GAAA;GAAA,SAAA;IAAA,WAAA;IAAA,YAAA;GAAA;GAAA,UAAA;GAAA,UAnEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCT,UAAA;GAAA,QAAA,CAAA,msCAAA;GAAA,cAAA,CAAA;IAAA,MAAA;IAAA,MAvCS;IAAgB,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;IAAA;GAAA,CAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAqEf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAxE3B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAW,YACT;GAAI,SACP,CAAC,gBAAgB;GAAC,iBACV,wBAAwB;GAAM,UACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCT,QAAA,CAAA,msCAAA;EAAA,CAAA"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from "@angular/core";
|
|
3
|
+
import { UiLabelsService } from "@forgeroute/ui/core";
|
|
4
|
+
import { BADGE_VARIANT_STYLES, autoVariant, semanticBadgeVariant } from "@forgeroute/ui/table-types";
|
|
5
|
+
const HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
6
|
+
const BADGE_INK_DARK = "#0f172a";
|
|
7
|
+
const BADGE_INK_LIGHT = "#ffffff";
|
|
8
|
+
function normalizeBadgeColor(value) {
|
|
9
|
+
const raw = (value ?? "").trim();
|
|
10
|
+
if (!HEX.test(raw)) return null;
|
|
11
|
+
const hex = raw.slice(1).toLowerCase();
|
|
12
|
+
return "#" + (hex.length === 3 ? hex.split("").map((c) => c + c).join("") : hex);
|
|
13
|
+
}
|
|
14
|
+
function channel(v) {
|
|
15
|
+
const s = v / 255;
|
|
16
|
+
return s <= .03928 ? s / 12.92 : Math.pow((s + .055) / 1.055, 2.4);
|
|
17
|
+
}
|
|
18
|
+
function relativeLuminance(hex) {
|
|
19
|
+
const n = parseInt(hex.slice(1), 16);
|
|
20
|
+
return .2126 * channel(n >> 16 & 255) + .7152 * channel(n >> 8 & 255) + .0722 * channel(n & 255);
|
|
21
|
+
}
|
|
22
|
+
function contrastRatio(a, b) {
|
|
23
|
+
const la = relativeLuminance(a), lb = relativeLuminance(b);
|
|
24
|
+
const [hi, lo] = la >= lb ? [la, lb] : [lb, la];
|
|
25
|
+
return (hi + .05) / (lo + .05);
|
|
26
|
+
}
|
|
27
|
+
function readableInk(background) {
|
|
28
|
+
return contrastRatio(background, "#0f172a") >= contrastRatio(background, "#ffffff") ? BADGE_INK_DARK : BADGE_INK_LIGHT;
|
|
29
|
+
}
|
|
30
|
+
function customBadgeStyles(value) {
|
|
31
|
+
const bg = normalizeBadgeColor(value);
|
|
32
|
+
return bg ? {
|
|
33
|
+
bg,
|
|
34
|
+
color: readableInk(bg)
|
|
35
|
+
} : null;
|
|
36
|
+
}
|
|
37
|
+
var BadgeComponent = class BadgeComponent {
|
|
38
|
+
constructor() {
|
|
39
|
+
this.labels = inject(UiLabelsService);
|
|
40
|
+
this.label = input.required(...ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []);
|
|
41
|
+
this.variant = input(null, ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
42
|
+
this.color = input(null, ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
|
|
43
|
+
this.resolvedVariant = computed(() => {
|
|
44
|
+
if (this.variant()) return this.variant();
|
|
45
|
+
return semanticBadgeVariant(this.label(), this.labels.locale()) ?? autoVariant(this.label());
|
|
46
|
+
}, ...ngDevMode ? [{ debugName: "resolvedVariant" }] : /* istanbul ignore next */ []);
|
|
47
|
+
this.customStyles = computed(() => customBadgeStyles(this.color()), ...ngDevMode ? [{ debugName: "customStyles" }] : /* istanbul ignore next */ []);
|
|
48
|
+
this.styles = computed(() => this.customStyles() ?? BADGE_VARIANT_STYLES[this.resolvedVariant()] ?? BADGE_VARIANT_STYLES["gray"], ...ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []);
|
|
49
|
+
}
|
|
50
|
+
static {
|
|
51
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
52
|
+
minVersion: "12.0.0",
|
|
53
|
+
version: "22.2.2",
|
|
54
|
+
ngImport: i0,
|
|
55
|
+
type: BadgeComponent,
|
|
56
|
+
deps: [],
|
|
57
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
static {
|
|
61
|
+
this.ɵcmp = i0.ɵɵngDeclareComponent({
|
|
62
|
+
minVersion: "17.1.0",
|
|
63
|
+
version: "22.2.2",
|
|
64
|
+
type: BadgeComponent,
|
|
65
|
+
isStandalone: true,
|
|
66
|
+
selector: "ui-badge",
|
|
67
|
+
inputs: {
|
|
68
|
+
label: {
|
|
69
|
+
classPropertyName: "label",
|
|
70
|
+
publicName: "label",
|
|
71
|
+
isSignal: true,
|
|
72
|
+
isRequired: true,
|
|
73
|
+
transformFunction: null
|
|
74
|
+
},
|
|
75
|
+
variant: {
|
|
76
|
+
classPropertyName: "variant",
|
|
77
|
+
publicName: "variant",
|
|
78
|
+
isSignal: true,
|
|
79
|
+
isRequired: false,
|
|
80
|
+
transformFunction: null
|
|
81
|
+
},
|
|
82
|
+
color: {
|
|
83
|
+
classPropertyName: "color",
|
|
84
|
+
publicName: "color",
|
|
85
|
+
isSignal: true,
|
|
86
|
+
isRequired: false,
|
|
87
|
+
transformFunction: null
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
ngImport: i0,
|
|
91
|
+
template: `
|
|
92
|
+
<span
|
|
93
|
+
class="badge"
|
|
94
|
+
[class.badge-gray]="!customStyles() && resolvedVariant() === 'gray'"
|
|
95
|
+
[style.background]="styles().bg"
|
|
96
|
+
[style.color]="styles().color">
|
|
97
|
+
{{ label() }}
|
|
98
|
+
</span>
|
|
99
|
+
`,
|
|
100
|
+
isInline: true,
|
|
101
|
+
styles: [":host{display:inline-flex}.badge{display:inline-flex;align-items:center;padding:2px 10px;border-radius:999px;font-size:.75rem;font-weight:600;white-space:nowrap;line-height:1.5;border:1px solid transparent}.badge-gray{border-color:#cbd5e1}\n"],
|
|
102
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
107
|
+
minVersion: "12.0.0",
|
|
108
|
+
version: "22.2.2",
|
|
109
|
+
ngImport: i0,
|
|
110
|
+
type: BadgeComponent,
|
|
111
|
+
decorators: [{
|
|
112
|
+
type: Component,
|
|
113
|
+
args: [{
|
|
114
|
+
selector: "ui-badge",
|
|
115
|
+
standalone: true,
|
|
116
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
117
|
+
template: `
|
|
118
|
+
<span
|
|
119
|
+
class="badge"
|
|
120
|
+
[class.badge-gray]="!customStyles() && resolvedVariant() === 'gray'"
|
|
121
|
+
[style.background]="styles().bg"
|
|
122
|
+
[style.color]="styles().color">
|
|
123
|
+
{{ label() }}
|
|
124
|
+
</span>
|
|
125
|
+
`,
|
|
126
|
+
styles: [":host{display:inline-flex}.badge{display:inline-flex;align-items:center;padding:2px 10px;border-radius:999px;font-size:.75rem;font-weight:600;white-space:nowrap;line-height:1.5;border:1px solid transparent}.badge-gray{border-color:#cbd5e1}\n"]
|
|
127
|
+
}]
|
|
128
|
+
}],
|
|
129
|
+
propDecorators: {
|
|
130
|
+
label: [{
|
|
131
|
+
type: i0.Input,
|
|
132
|
+
args: [{
|
|
133
|
+
isSignal: true,
|
|
134
|
+
alias: "label",
|
|
135
|
+
required: true
|
|
136
|
+
}]
|
|
137
|
+
}],
|
|
138
|
+
variant: [{
|
|
139
|
+
type: i0.Input,
|
|
140
|
+
args: [{
|
|
141
|
+
isSignal: true,
|
|
142
|
+
alias: "variant",
|
|
143
|
+
required: false
|
|
144
|
+
}]
|
|
145
|
+
}],
|
|
146
|
+
color: [{
|
|
147
|
+
type: i0.Input,
|
|
148
|
+
args: [{
|
|
149
|
+
isSignal: true,
|
|
150
|
+
alias: "color",
|
|
151
|
+
required: false
|
|
152
|
+
}]
|
|
153
|
+
}]
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
export { BadgeComponent };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=forgeroute-ui-badge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forgeroute-ui-badge.mjs","names":[],"sources":["../../../projects/forgeroute-ui/badge/src/lib/badge/badge-color.ts","../../../projects/forgeroute-ui/badge/src/lib/badge/badge.component.ts"],"sourcesContent":["/**\n * Custom badge colours: a user-chosen hex colour (e.g. the colour picked for a tag) becomes the badge background and the\n * text takes whichever of two dark / white inks reads better on it (WCAG relative-luminance contrast).\n */\n\nconst HEX = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;\n\n/** The ink colours tried on a custom background. */\nexport const BADGE_INK_DARK = '#0f172a';\nexport const BADGE_INK_LIGHT = '#ffffff';\n\n/** `#rgb` / `#rrggbb` (any case, surrounding spaces ignored) -> `#rrggbb` lower-case, or null for anything else (never injected into a style). */\nexport function normalizeBadgeColor(value: string | null | undefined): string | null {\n const raw = (value ?? '').trim();\n if (!HEX.test(raw)) return null;\n const hex = raw.slice(1).toLowerCase();\n return '#' + (hex.length === 3 ? hex.split('').map(c => c + c).join('') : hex);\n}\n\nfunction channel(v: number): number {\n const s = v / 255;\n return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);\n}\n\n/** WCAG relative luminance of a `#rrggbb` colour (0 black .. 1 white). */\nexport function relativeLuminance(hex: string): number {\n const n = parseInt(hex.slice(1), 16);\n return 0.2126 * channel((n >> 16) & 255) + 0.7152 * channel((n >> 8) & 255) + 0.0722 * channel(n & 255);\n}\n\n/** WCAG contrast ratio between two `#rrggbb` colours (1 .. 21). */\nexport function contrastRatio(a: string, b: string): number {\n const la = relativeLuminance(a), lb = relativeLuminance(b);\n const [hi, lo] = la >= lb ? [la, lb] : [lb, la];\n return (hi + 0.05) / (lo + 0.05);\n}\n\n/** The ink (dark or white) with the higher contrast on [background] (`#rrggbb`). */\nexport function readableInk(background: string): string {\n return contrastRatio(background, BADGE_INK_DARK) >= contrastRatio(background, BADGE_INK_LIGHT) ? BADGE_INK_DARK : BADGE_INK_LIGHT;\n}\n\n/** Background + ink for a custom colour, or null when [value] is not a valid hex colour. */\nexport function customBadgeStyles(value: string | null | undefined): { bg: string; color: string } | null {\n const bg = normalizeBadgeColor(value);\n return bg ? { bg, color: readableInk(bg) } : null;\n}\n","import { Component, input, computed, inject, ChangeDetectionStrategy } from '@angular/core';\nimport { UiLabelsService } from '@forgeroute/ui/core';\nimport { BadgeVariant, BADGE_VARIANT_STYLES, autoVariant, semanticBadgeVariant } from '@forgeroute/ui/table-types';\nimport { customBadgeStyles } from './badge-color';\n\n@Component({\n selector: 'ui-badge',\n standalone: true,\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <span\n class=\"badge\"\n [class.badge-gray]=\"!customStyles() && resolvedVariant() === 'gray'\"\n [style.background]=\"styles().bg\"\n [style.color]=\"styles().color\">\n {{ label() }}\n </span>\n `,\n styles: [`\n :host { display: inline-flex; }\n .badge {\n display: inline-flex; align-items: center; padding: 2px 10px;\n border-radius: 999px; font-size: 0.75rem; font-weight: 600;\n white-space: nowrap; line-height: 1.5;\n border: 1px solid transparent;\n }\n .badge-gray { border-color: #cbd5e1; }\n `],\n})\nexport class BadgeComponent {\n private readonly labels = inject(UiLabelsService);\n readonly label = input.required<string>();\n /**\n * When omitted:\n * 1. Check SEMANTIC_BADGE_MAP (e.g. 'Active' → green always)\n * 2. Fall back to auto-color based on the label string\n */\n readonly variant = input<BadgeVariant | null>(null);\n /**\n * A custom hex colour (`#rgb` or `#rrggbb`), e.g. the colour a user picked for a tag. It becomes the background and the text is\n * dark or white, whichever reads better (WCAG contrast). It wins over `variant`; anything that is not a valid hex colour is\n * ignored (the variant / automatic colour applies). Omit it and nothing changes.\n */\n readonly color = input<string | null>(null);\n\n protected readonly resolvedVariant = computed<BadgeVariant>(() => {\n if (this.variant()) return this.variant()!;\n return semanticBadgeVariant(this.label(), this.labels.locale()) ?? autoVariant(this.label());\n });\n\n protected readonly customStyles = computed(() => customBadgeStyles(this.color()));\n\n protected readonly styles = computed(() =>\n this.customStyles() ?? BADGE_VARIANT_STYLES[this.resolvedVariant()] ?? BADGE_VARIANT_STYLES['gray'],\n );\n}\n"],"mappings":";;;;AAKA,MAAM,MAAM;AAGZ,MAAa,iBAAiB;AAC9B,MAAa,kBAAkB;AAG/B,SAAgB,oBAAoB,OAAgC;CAClE,MAAM,OAAO,SAAS,GAAA,CAAI,KAAI;CAC9B,IAAI,CAAC,IAAI,KAAK,GAAG,GAAG,OAAO;CAC3B,MAAM,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,YAAW;CACpC,OAAO,OAAO,IAAI,WAAW,IAAI,IAAI,MAAM,EAAE,CAAC,CAAC,KAAI,MAAK,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI;AAC5E;AAEA,SAAS,QAAQ,GAAS;CACxB,MAAM,IAAI,IAAI;CACd,OAAO,KAAK,SAAU,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAS,OAAO,GAAG;AACrE;AAGA,SAAgB,kBAAkB,KAAW;CAC3C,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,GAAG,EAAE;CACnC,OAAO,QAAS,QAAS,KAAK,KAAM,GAAG,IAAI,QAAS,QAAS,KAAK,IAAK,GAAG,IAAI,QAAS,QAAQ,IAAI,GAAG;AACxG;AAGA,SAAgB,cAAc,GAAW,GAAS;CAChD,MAAM,KAAK,kBAAkB,CAAC,GAAG,KAAK,k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