@cloudfrogger/goodui 0.0.60 → 0.0.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/ai/README.md +47 -0
- package/ai/case-studies/index.md +10 -0
- package/ai/case-studies/vpshoster.md +18 -0
- package/ai/case-studies/webmailer.md +21 -0
- package/ai/catalog/README.md +7 -0
- package/ai/catalog/component.schema.json +289 -0
- package/ai/catalog/components/div-goodDetailRow.json +33 -0
- package/ai/catalog/components/form-goodForm.json +84 -0
- package/ai/catalog/components/good-action-bar.json +83 -0
- package/ai/catalog/components/good-action-group.json +143 -0
- package/ai/catalog/components/good-action-menu.json +121 -0
- package/ai/catalog/components/good-alert.json +184 -0
- package/ai/catalog/components/good-app-layout.json +245 -0
- package/ai/catalog/components/good-assistant-body.json +43 -0
- package/ai/catalog/components/good-assistant-footer.json +43 -0
- package/ai/catalog/components/good-assistant-header.json +43 -0
- package/ai/catalog/components/good-assistant-main.json +61 -0
- package/ai/catalog/components/good-assistant-mobile.json +43 -0
- package/ai/catalog/components/good-assistant-panel.json +131 -0
- package/ai/catalog/components/good-avatar-menu-item.json +82 -0
- package/ai/catalog/components/good-avatar-menu.json +83 -0
- package/ai/catalog/components/good-badge.json +180 -0
- package/ai/catalog/components/good-bar-chart.json +118 -0
- package/ai/catalog/components/good-brand-icon.json +71 -0
- package/ai/catalog/components/good-breadcrumbs.json +102 -0
- package/ai/catalog/components/good-button.json +192 -0
- package/ai/catalog/components/good-calendar.json +430 -0
- package/ai/catalog/components/good-card-footer.json +63 -0
- package/ai/catalog/components/good-card-header.json +100 -0
- package/ai/catalog/components/good-card.json +57 -0
- package/ai/catalog/components/good-chart-axis.json +168 -0
- package/ai/catalog/components/good-chart-bar.json +89 -0
- package/ai/catalog/components/good-chart-histogram.json +78 -0
- package/ai/catalog/components/good-chart-line.json +89 -0
- package/ai/catalog/components/good-chart-scatter.json +87 -0
- package/ai/catalog/components/good-checkbox.json +171 -0
- package/ai/catalog/components/good-citation.json +62 -0
- package/ai/catalog/components/good-code-block.json +116 -0
- package/ai/catalog/components/good-color-controls.json +58 -0
- package/ai/catalog/components/good-color-picker.json +141 -0
- package/ai/catalog/components/good-column.json +53 -0
- package/ai/catalog/components/good-columns.json +77 -0
- package/ai/catalog/components/good-date-input.json +386 -0
- package/ai/catalog/components/good-detail-list.json +43 -0
- package/ai/catalog/components/good-dropdown.json +259 -0
- package/ai/catalog/components/good-error-page.json +133 -0
- package/ai/catalog/components/good-error-text.json +43 -0
- package/ai/catalog/components/good-expandable.json +159 -0
- package/ai/catalog/components/good-eyebrow.json +61 -0
- package/ai/catalog/components/good-field-label.json +62 -0
- package/ai/catalog/components/good-form-field.json +67 -0
- package/ai/catalog/components/good-form-row.json +70 -0
- package/ai/catalog/components/good-group.json +150 -0
- package/ai/catalog/components/good-heading-group.json +45 -0
- package/ai/catalog/components/good-heading.json +69 -0
- package/ai/catalog/components/good-hint.json +43 -0
- package/ai/catalog/components/good-histogram.json +103 -0
- package/ai/catalog/components/good-icon.json +97 -0
- package/ai/catalog/components/good-image-input.json +190 -0
- package/ai/catalog/components/good-image-preview.json +97 -0
- package/ai/catalog/components/good-inline-image.json +131 -0
- package/ai/catalog/components/good-input-phone.json +226 -0
- package/ai/catalog/components/good-input.json +350 -0
- package/ai/catalog/components/good-line-chart.json +94 -0
- package/ai/catalog/components/good-link.json +147 -0
- package/ai/catalog/components/good-listbox.json +248 -0
- package/ai/catalog/components/good-main-menu.json +138 -0
- package/ai/catalog/components/good-main-view.json +179 -0
- package/ai/catalog/components/good-map-color-scale.json +163 -0
- package/ai/catalog/components/good-map-overlay.json +136 -0
- package/ai/catalog/components/good-modal-footer.json +63 -0
- package/ai/catalog/components/good-modal-header.json +73 -0
- package/ai/catalog/components/good-modal.json +131 -0
- package/ai/catalog/components/good-month-calendar.json +170 -0
- package/ai/catalog/components/good-notification-host.json +46 -0
- package/ai/catalog/components/good-notifications.json +72 -0
- package/ai/catalog/components/good-number-input.json +180 -0
- package/ai/catalog/components/good-paragraph.json +47 -0
- package/ai/catalog/components/good-pdf-preview.json +153 -0
- package/ai/catalog/components/good-pin-input.json +211 -0
- package/ai/catalog/components/good-progress.json +158 -0
- package/ai/catalog/components/good-prose.json +43 -0
- package/ai/catalog/components/good-radio-group.json +181 -0
- package/ai/catalog/components/good-range-slider.json +285 -0
- package/ai/catalog/components/good-rating.json +160 -0
- package/ai/catalog/components/good-resizable-pane.json +61 -0
- package/ai/catalog/components/good-resizable.json +185 -0
- package/ai/catalog/components/good-rich-text-editor.json +164 -0
- package/ai/catalog/components/good-scatter-chart.json +94 -0
- package/ai/catalog/components/good-search.json +60 -0
- package/ai/catalog/components/good-section.json +43 -0
- package/ai/catalog/components/good-select-country.json +205 -0
- package/ai/catalog/components/good-select-font.json +111 -0
- package/ai/catalog/components/good-select.json +217 -0
- package/ai/catalog/components/good-separator.json +59 -0
- package/ai/catalog/components/good-settings.json +60 -0
- package/ai/catalog/components/good-sidebar-container.json +112 -0
- package/ai/catalog/components/good-sidebar-item.json +210 -0
- package/ai/catalog/components/good-sidebar-menu-container.json +80 -0
- package/ai/catalog/components/good-sidebar-submenu-group.json +98 -0
- package/ai/catalog/components/good-sidebar-submenu-item.json +113 -0
- package/ai/catalog/components/good-signature-pad.json +115 -0
- package/ai/catalog/components/good-sparkline.json +188 -0
- package/ai/catalog/components/good-status-icon.json +425 -0
- package/ai/catalog/components/good-subheading.json +67 -0
- package/ai/catalog/components/good-subnav.json +132 -0
- package/ai/catalog/components/good-summary.json +43 -0
- package/ai/catalog/components/good-switch.json +167 -0
- package/ai/catalog/components/good-tab.json +129 -0
- package/ai/catalog/components/good-table.json +294 -0
- package/ai/catalog/components/good-tabs.json +90 -0
- package/ai/catalog/components/good-textarea.json +194 -0
- package/ai/catalog/components/good-theme-toggle.json +57 -0
- package/ai/catalog/components/good-timeline-section.json +105 -0
- package/ai/catalog/components/good-timeline-step.json +248 -0
- package/ai/catalog/components/good-timeline.json +302 -0
- package/ai/catalog/components/good-topbar-dropdown-item.json +115 -0
- package/ai/catalog/components/good-topbar-dropdown-menu.json +85 -0
- package/ai/catalog/components/good-topbar-menu-container.json +96 -0
- package/ai/catalog/components/good-topbar-menu-item.json +99 -0
- package/ai/catalog/components/good-topbar-submenu.json +77 -0
- package/ai/catalog/components/good-topbar.json +259 -0
- package/ai/catalog/components/good-world-map.json +145 -0
- package/ai/catalog/components/goodCardActions.json +33 -0
- package/ai/catalog/components/goodDropdownFooter.json +33 -0
- package/ai/catalog/components/goodDropdownHeader.json +33 -0
- package/ai/catalog/components/goodExpandableHeader.json +33 -0
- package/ai/catalog/components/ng-template-goodListboxItem.json +33 -0
- package/ai/catalog/components/ng-template-goodTableCell.json +43 -0
- package/ai/catalog/index.json +1484 -0
- package/ai/catalog/index.schema.json +13 -0
- package/ai/examples/angular.json +26 -0
- package/ai/examples/edit-form.html +13 -0
- package/ai/examples/edit-form.ts +18 -0
- package/ai/examples/index.html +1 -0
- package/ai/examples/login.html +11 -0
- package/ai/examples/login.ts +14 -0
- package/ai/examples/main.ts +25 -0
- package/ai/examples/settings.html +10 -0
- package/ai/examples/settings.ts +13 -0
- package/ai/examples/table-view.html +3 -0
- package/ai/examples/table-view.ts +21 -0
- package/ai/examples/tsconfig.json +27 -0
- package/ai/guides/common-mistakes.md +9 -0
- package/ai/guides/component-discovery.md +17 -0
- package/ai/guides/design-tokens.md +10 -0
- package/ai/guides/layout.md +17 -0
- package/ai/guides/page-patterns.md +39 -0
- package/ai/install.mjs +25 -0
- package/ai/manifest.json +6 -0
- package/ai/skill/goodui/SKILL.md +27 -0
- package/angular/projects/goodui/package.json +28 -0
- package/angular/projects/goodui/src/action-bar.css +20 -0
- package/angular/projects/goodui/src/assistant-panel.css +38 -0
- package/angular/projects/goodui/src/calendar.css +161 -0
- package/angular/projects/goodui/src/chart.css +35 -0
- package/angular/projects/goodui/src/color-picker.css +40 -0
- package/angular/projects/goodui/src/error-page.css +24 -0
- package/angular/projects/goodui/src/lib/action-bar.ts +161 -0
- package/angular/projects/goodui/src/lib/action-group.ts +31 -0
- package/angular/projects/goodui/src/lib/action-menu.ts +81 -0
- package/angular/projects/goodui/src/lib/actions.ts +318 -0
- package/angular/projects/goodui/src/lib/alert.ts +60 -0
- package/angular/projects/goodui/src/lib/app-layout.ts +79 -0
- package/angular/projects/goodui/src/lib/assistant-panel.ts +133 -0
- package/angular/projects/goodui/src/lib/badge.ts +47 -0
- package/angular/projects/goodui/src/lib/bar-chart.html +80 -0
- package/angular/projects/goodui/src/lib/bar-chart.ts +233 -0
- package/angular/projects/goodui/src/lib/breadcrumbs.ts +81 -0
- package/angular/projects/goodui/src/lib/button.ts +38 -0
- package/angular/projects/goodui/src/lib/calendar-layout.ts +68 -0
- package/angular/projects/goodui/src/lib/calendar-service.ts +144 -0
- package/angular/projects/goodui/src/lib/calendar-working-hours.ts +65 -0
- package/angular/projects/goodui/src/lib/calendar.html +200 -0
- package/angular/projects/goodui/src/lib/calendar.ts +471 -0
- package/angular/projects/goodui/src/lib/card.ts +64 -0
- package/angular/projects/goodui/src/lib/chart-colors.ts +22 -0
- package/angular/projects/goodui/src/lib/chart-data.ts +269 -0
- package/angular/projects/goodui/src/lib/checkbox.ts +87 -0
- package/angular/projects/goodui/src/lib/code-block.ts +147 -0
- package/angular/projects/goodui/src/lib/color-controls.ts +107 -0
- package/angular/projects/goodui/src/lib/color-picker.ts +142 -0
- package/angular/projects/goodui/src/lib/color-utils.ts +69 -0
- package/angular/projects/goodui/src/lib/country-data.ts +16 -0
- package/angular/projects/goodui/src/lib/date-input.ts +542 -0
- package/angular/projects/goodui/src/lib/dropdown.ts +309 -0
- package/angular/projects/goodui/src/lib/error-page.ts +46 -0
- package/angular/projects/goodui/src/lib/expandable.ts +64 -0
- package/angular/projects/goodui/src/lib/form.ts +12 -0
- package/angular/projects/goodui/src/lib/goodui-config.ts +16 -0
- package/angular/projects/goodui/src/lib/group.ts +45 -0
- package/angular/projects/goodui/src/lib/histogram.html +52 -0
- package/angular/projects/goodui/src/lib/histogram.ts +146 -0
- package/angular/projects/goodui/src/lib/icon.ts +44 -0
- package/angular/projects/goodui/src/lib/image-input.ts +154 -0
- package/angular/projects/goodui/src/lib/image-preview.ts +26 -0
- package/angular/projects/goodui/src/lib/input-phone.ts +305 -0
- package/angular/projects/goodui/src/lib/input.ts +143 -0
- package/angular/projects/goodui/src/lib/line-chart.html +53 -0
- package/angular/projects/goodui/src/lib/line-chart.ts +193 -0
- package/angular/projects/goodui/src/lib/link.ts +46 -0
- package/angular/projects/goodui/src/lib/listbox.ts +254 -0
- package/angular/projects/goodui/src/lib/main-view.ts +39 -0
- package/angular/projects/goodui/src/lib/marker-colors.ts +7 -0
- package/angular/projects/goodui/src/lib/modal.ts +199 -0
- package/angular/projects/goodui/src/lib/models.ts +115 -0
- package/angular/projects/goodui/src/lib/month-calendar.ts +289 -0
- package/angular/projects/goodui/src/lib/notification-center.ts +170 -0
- package/angular/projects/goodui/src/lib/notification-host.ts +86 -0
- package/angular/projects/goodui/src/lib/number-input.ts +180 -0
- package/angular/projects/goodui/src/lib/pdf-preview.ts +242 -0
- package/angular/projects/goodui/src/lib/pdf-worker.generated.ts +2 -0
- package/angular/projects/goodui/src/lib/pin-input.ts +193 -0
- package/angular/projects/goodui/src/lib/progress.ts +93 -0
- package/angular/projects/goodui/src/lib/provide-goodui.ts +15 -0
- package/angular/projects/goodui/src/lib/radio-group.ts +94 -0
- package/angular/projects/goodui/src/lib/range-slider.ts +313 -0
- package/angular/projects/goodui/src/lib/rating.ts +90 -0
- package/angular/projects/goodui/src/lib/required-control.ts +4 -0
- package/angular/projects/goodui/src/lib/resizable.ts +168 -0
- package/angular/projects/goodui/src/lib/rich-text-command.ts +111 -0
- package/angular/projects/goodui/src/lib/rich-text-editor.html +193 -0
- package/angular/projects/goodui/src/lib/rich-text-editor.ts +864 -0
- package/angular/projects/goodui/src/lib/rich-text-sanitize.ts +99 -0
- package/angular/projects/goodui/src/lib/scatter-chart.html +48 -0
- package/angular/projects/goodui/src/lib/scatter-chart.ts +150 -0
- package/angular/projects/goodui/src/lib/select-country.ts +104 -0
- package/angular/projects/goodui/src/lib/select-font.ts +189 -0
- package/angular/projects/goodui/src/lib/select.ts +336 -0
- package/angular/projects/goodui/src/lib/sidebar.ts +232 -0
- package/angular/projects/goodui/src/lib/signature-pad.ts +238 -0
- package/angular/projects/goodui/src/lib/sparkline.html +15 -0
- package/angular/projects/goodui/src/lib/sparkline.ts +106 -0
- package/angular/projects/goodui/src/lib/status-icon.ts +79 -0
- package/angular/projects/goodui/src/lib/subnav.ts +156 -0
- package/angular/projects/goodui/src/lib/switch.ts +54 -0
- package/angular/projects/goodui/src/lib/table.ts +538 -0
- package/angular/projects/goodui/src/lib/tabs.ts +251 -0
- package/angular/projects/goodui/src/lib/textarea.ts +83 -0
- package/angular/projects/goodui/src/lib/theme.ts +49 -0
- package/angular/projects/goodui/src/lib/timeline.ts +252 -0
- package/angular/projects/goodui/src/lib/topbar.ts +402 -0
- package/angular/projects/goodui/src/lib/typography.ts +250 -0
- package/angular/projects/goodui/src/lib/world-map-data.ts +3 -0
- package/angular/projects/goodui/src/lib/world-map.html +73 -0
- package/angular/projects/goodui/src/lib/world-map.ts +391 -0
- package/angular/projects/goodui/src/month-calendar.css +47 -0
- package/angular/projects/goodui/src/pdf-preview.css +25 -0
- package/angular/projects/goodui/src/progress.css +38 -0
- package/angular/projects/goodui/src/public-api.ts +74 -0
- package/angular/projects/goodui/src/range-slider.css +54 -0
- package/angular/projects/goodui/src/resizable.css +32 -0
- package/angular/projects/goodui/src/rich-text-editor.css +33 -0
- package/angular/projects/goodui/src/select-font.css +16 -0
- package/angular/projects/goodui/src/signature-pad.css +14 -0
- package/angular/projects/goodui/src/styles.css +1105 -0
- package/angular/projects/goodui/src/timeline.css +138 -0
- package/angular/projects/goodui/src/tokens.generated.css +754 -0
- package/design/component-map.json +2233 -0
- package/design-tokens/penpot.tokens.json +3339 -0
- package/design.md +452 -0
- package/guides/README.md +17 -0
- package/guides/components/action-bar.md +43 -0
- package/guides/components/action-group.md +43 -0
- package/guides/components/action-menu.md +22 -0
- package/guides/components/alert.md +28 -0
- package/guides/components/assistant-panel.md +50 -0
- package/guides/components/avatar-menu.md +34 -0
- package/guides/components/badge.md +39 -0
- package/guides/components/bar-chart.md +40 -0
- package/guides/components/breadcrumbs.md +37 -0
- package/guides/components/button.md +40 -0
- package/guides/components/calendar.md +166 -0
- package/guides/components/card.md +62 -0
- package/guides/components/chart-axis.md +5 -0
- package/guides/components/chart-bar.md +5 -0
- package/guides/components/chart-data.md +58 -0
- package/guides/components/chart-histogram.md +16 -0
- package/guides/components/chart-line.md +5 -0
- package/guides/components/chart-scatter.md +14 -0
- package/guides/components/checkbox.md +36 -0
- package/guides/components/code-block.md +35 -0
- package/guides/components/color-controls.md +22 -0
- package/guides/components/column.md +5 -0
- package/guides/components/columns.md +13 -0
- package/guides/components/date-input.md +62 -0
- package/guides/components/detail-list.md +25 -0
- package/guides/components/dropdown.md +48 -0
- package/guides/components/error-page.md +31 -0
- package/guides/components/expandable.md +36 -0
- package/guides/components/form.md +49 -0
- package/guides/components/group.md +41 -0
- package/guides/components/histogram.md +45 -0
- package/guides/components/icon.md +13 -0
- package/guides/components/image-input.md +34 -0
- package/guides/components/input-phone.md +45 -0
- package/guides/components/input.md +59 -0
- package/guides/components/line-chart.md +37 -0
- package/guides/components/link.md +31 -0
- package/guides/components/listbox.md +109 -0
- package/guides/components/main-menu.md +11 -0
- package/guides/components/main-view.md +21 -0
- package/guides/components/modal.md +58 -0
- package/guides/components/month-calendar.md +88 -0
- package/guides/components/notifications.md +76 -0
- package/guides/components/number-input.md +21 -0
- package/guides/components/pdf-preview.md +38 -0
- package/guides/components/pin-input.md +37 -0
- package/guides/components/progress.md +41 -0
- package/guides/components/radio-group.md +41 -0
- package/guides/components/range-slider.md +42 -0
- package/guides/components/rating.md +39 -0
- package/guides/components/resizable-pane.md +3 -0
- package/guides/components/resizable.md +75 -0
- package/guides/components/rich-text-editor.md +113 -0
- package/guides/components/scatter-chart.md +43 -0
- package/guides/components/search.md +9 -0
- package/guides/components/select-font.md +16 -0
- package/guides/components/select.md +65 -0
- package/guides/components/settings.md +11 -0
- package/guides/components/sidebar.md +47 -0
- package/guides/components/signature-pad.md +45 -0
- package/guides/components/sparkline.md +31 -0
- package/guides/components/status-icon.md +32 -0
- package/guides/components/submenus.md +30 -0
- package/guides/components/subnav.md +54 -0
- package/guides/components/switch.md +48 -0
- package/guides/components/table.md +256 -0
- package/guides/components/tabs.md +46 -0
- package/guides/components/textarea.md +44 -0
- package/guides/components/theme-toggle.md +33 -0
- package/guides/components/timeline-section.md +7 -0
- package/guides/components/timeline-step.md +12 -0
- package/guides/components/timeline.md +179 -0
- package/guides/components/topbar.md +83 -0
- package/guides/components/typography.md +155 -0
- package/guides/components/world-map.md +72 -0
- package/guides/contributing/design-to-code.md +261 -0
- package/guides/deployment/drone.md +77 -0
- package/guides/examples/user-registration.md +11 -0
- package/guides/foundations/naming.md +7 -0
- package/guides/foundations/tokens.md +203 -0
- package/guides/intro.md +80 -0
- package/guides/layout/app-layout.md +64 -0
- package/guides/layout/layout-rules.md +16 -0
- package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.html +22 -0
- package/homepage/src/app/examples/calendar-workspace/calendar-workspace-page.ts +111 -0
- package/homepage/src/app/examples/calendar-workspace/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.html +166 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/billing-page.ts +134 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/cloudhoster-store.ts +92 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.html +93 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/create-database-page.ts +115 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.html +202 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/database-detail-page.ts +143 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.html +70 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/databases-page.ts +44 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/home-page.html +70 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/home-page.ts +32 -0
- package/homepage/src/app/examples/case-studies/cloudhoster/source-code.generated.ts +12 -0
- package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.html +208 -0
- package/homepage/src/app/examples/case-studies/vpshoster/create-server-page.ts +214 -0
- package/homepage/src/app/examples/case-studies/vpshoster/overview-page.html +35 -0
- package/homepage/src/app/examples/case-studies/vpshoster/overview-page.ts +17 -0
- package/homepage/src/app/examples/case-studies/vpshoster/servers-page.html +111 -0
- package/homepage/src/app/examples/case-studies/vpshoster/servers-page.ts +206 -0
- package/homepage/src/app/examples/case-studies/vpshoster/source-code.generated.ts +6 -0
- package/homepage/src/app/examples/case-studies/vpshoster/vps-store.ts +92 -0
- package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.html +35 -0
- package/homepage/src/app/examples/case-studies/webmailer/webmailer-page.ts +17 -0
- package/homepage/src/app/examples/error-pages/error-pages-example-page.html +27 -0
- package/homepage/src/app/examples/error-pages/error-pages-example-page.ts +34 -0
- package/homepage/src/app/examples/error-pages/not-found-page.html +8 -0
- package/homepage/src/app/examples/error-pages/not-found-page.ts +19 -0
- package/homepage/src/app/examples/error-pages/server-error-page.html +8 -0
- package/homepage/src/app/examples/error-pages/server-error-page.ts +20 -0
- package/homepage/src/app/examples/error-pages/source-code.generated.ts +7 -0
- package/homepage/src/app/examples/mail-compose/mail-compose-page.html +25 -0
- package/homepage/src/app/examples/mail-compose/mail-compose-page.ts +28 -0
- package/homepage/src/app/examples/mail-workspace/mail-workspace-page.html +59 -0
- package/homepage/src/app/examples/mail-workspace/mail-workspace-page.ts +128 -0
- package/homepage/src/app/examples/mail-workspace/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/notifications/notifications-page.html +51 -0
- package/homepage/src/app/examples/notifications/notifications-page.ts +133 -0
- package/homepage/src/app/examples/notifications/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/pdf-reader/pdf-reader-page.html +27 -0
- package/homepage/src/app/examples/pdf-reader/pdf-reader-page.ts +39 -0
- package/homepage/src/app/examples/pdf-reader/source-code.generated.ts +3 -0
- package/homepage/src/app/examples/user-registration/source-code.generated.ts +5 -0
- package/homepage/src/app/examples/user-registration/user-registration-example-page.html +11 -0
- package/homepage/src/app/examples/user-registration/user-registration-example-page.ts +21 -0
- package/homepage/src/app/examples/user-registration/user-registration-form.html +116 -0
- package/homepage/src/app/examples/user-registration/user-registration-form.ts +93 -0
- package/homepage/src/app/examples/user-registration/user-registration-page.html +11 -0
- package/homepage/src/app/examples/user-registration/user-registration-page.ts +23 -0
- package/package.json +2 -2
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, computed, contentChildren, effect, input, signal, viewChild } from '@angular/core';
|
|
2
|
+
import { LucideChartLine, LucideTable2 } from '@lucide/angular';
|
|
3
|
+
import { GoodButtonComponent } from './button';
|
|
4
|
+
import { GoodCardActionsDirective, GoodCardComponent, GoodCardHeaderComponent } from './card';
|
|
5
|
+
import { GoodTableColumn, GoodTableComponent } from './table';
|
|
6
|
+
import { resolveChartColor } from './chart-colors';
|
|
7
|
+
import {
|
|
8
|
+
GoodChartAggregation, GoodChartAxisDefinition, GoodChartAxisType, GoodChartDataSource,
|
|
9
|
+
GoodChartLineDefinition, GoodChartTimeGroup, GoodResolvedChartLine, resolveChartLines,
|
|
10
|
+
} from './chart-data';
|
|
11
|
+
|
|
12
|
+
@Component({ selector: 'good-chart-axis', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
host: { style: 'display:none' }, template: '' })
|
|
14
|
+
export class GoodChartAxisComponent {
|
|
15
|
+
readonly position = input.required<'x' | 'y'>();
|
|
16
|
+
readonly type = input<GoodChartAxisType>('number');
|
|
17
|
+
readonly label = input('');
|
|
18
|
+
readonly min = input<number | string | Date | null>(null);
|
|
19
|
+
readonly max = input<number | string | Date | null>(null);
|
|
20
|
+
readonly ticks = input(5);
|
|
21
|
+
readonly precision = input<number | null>(null);
|
|
22
|
+
readonly groupBy = input<GoodChartTimeGroup | null>(null);
|
|
23
|
+
readonly aggregate = input<GoodChartAggregation>('none');
|
|
24
|
+
|
|
25
|
+
definition(): GoodChartAxisDefinition {
|
|
26
|
+
return { type: this.type(), label: this.label(), min: this.min(), max: this.max(), ticks: this.ticks(),
|
|
27
|
+
precision: this.precision() ?? undefined, groupBy: this.groupBy(), aggregate: this.aggregate() };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Component({ selector: 'good-chart-line', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
32
|
+
host: { style: 'display:none' }, template: '' })
|
|
33
|
+
export class GoodChartLineComponent {
|
|
34
|
+
readonly source = input.required<string>();
|
|
35
|
+
readonly xKey = input<string | undefined>(undefined);
|
|
36
|
+
readonly yKey = input.required<string>();
|
|
37
|
+
readonly label = input('');
|
|
38
|
+
/** A GoodUI color name or a hex color. The palette is used by default. */
|
|
39
|
+
readonly color = input('');
|
|
40
|
+
|
|
41
|
+
definition(): GoodChartLineDefinition {
|
|
42
|
+
return { source: this.source(), xKey: this.xKey(), yKey: this.yKey(), label: this.label(), color: this.color() };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface RenderedLine extends GoodResolvedChartLine { colorValue: string; path: string; dots: readonly { x: number; y: number }[] }
|
|
47
|
+
|
|
48
|
+
@Component({
|
|
49
|
+
selector: 'good-line-chart', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
imports: [GoodButtonComponent, GoodCardComponent, GoodCardHeaderComponent, GoodCardActionsDirective, GoodTableComponent],
|
|
51
|
+
host: { class: 'good-line-chart' },
|
|
52
|
+
templateUrl: './line-chart.html',
|
|
53
|
+
})
|
|
54
|
+
export class GoodLineChartComponent {
|
|
55
|
+
readonly title = input.required<string>();
|
|
56
|
+
readonly ariaLabel = input('');
|
|
57
|
+
readonly sources = input.required<readonly GoodChartDataSource[]>();
|
|
58
|
+
readonly colors = input<readonly string[]>([]);
|
|
59
|
+
readonly showDataToggle = input(false);
|
|
60
|
+
readonly tableIcon = LucideTable2;
|
|
61
|
+
readonly chartIcon = LucideChartLine;
|
|
62
|
+
readonly axes = contentChildren(GoodChartAxisComponent);
|
|
63
|
+
readonly lineDefinitions = contentChildren(GoodChartLineComponent);
|
|
64
|
+
readonly plotElement = viewChild<ElementRef<HTMLElement>>('plot');
|
|
65
|
+
readonly dataVisible = signal(false);
|
|
66
|
+
readonly width = signal(700);
|
|
67
|
+
private readonly observePlot = effect(onCleanup => {
|
|
68
|
+
const element = this.plotElement()?.nativeElement;
|
|
69
|
+
if (!element || typeof ResizeObserver === 'undefined') return;
|
|
70
|
+
const observer = new ResizeObserver(entries => this.width.set(Math.max(280, Math.round(entries[0].contentRect.width))));
|
|
71
|
+
observer.observe(element);
|
|
72
|
+
onCleanup(() => observer.disconnect());
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
readonly xAxis = computed<GoodChartAxisDefinition>(() => this.axes().find(axis => axis.position() === 'x')?.definition() ?? { type: 'category' });
|
|
76
|
+
readonly yAxis = computed<GoodChartAxisDefinition>(() => this.axes().find(axis => axis.position() === 'y')?.definition() ?? { type: 'number' });
|
|
77
|
+
readonly resolved = computed(() => resolveChartLines(this.sources(), this.lineDefinitions().map(line => line.definition()), this.xAxis()));
|
|
78
|
+
readonly height = 300;
|
|
79
|
+
readonly left = 55;
|
|
80
|
+
readonly top = 16;
|
|
81
|
+
readonly bottom = 47;
|
|
82
|
+
readonly right = 18;
|
|
83
|
+
readonly plotWidth = computed(() => Math.max(100, this.width() - this.left - this.right));
|
|
84
|
+
readonly plotHeight = this.height - this.top - this.bottom;
|
|
85
|
+
|
|
86
|
+
readonly categories = computed(() => {
|
|
87
|
+
const ordered = new Set<string>();
|
|
88
|
+
for (const line of this.resolved().lines) for (const point of line.points) ordered.add(String(point.x));
|
|
89
|
+
return [...ordered];
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
readonly xDomain = computed<[number, number]>(() => {
|
|
93
|
+
const values = this.resolved().lines.flatMap(line => line.points.map(point => Number(point.x))).filter(Number.isFinite);
|
|
94
|
+
const axis = this.xAxis();
|
|
95
|
+
const bound = (value: number | string | Date | null | undefined): number | null => {
|
|
96
|
+
if (value == null) return null;
|
|
97
|
+
const n = axis.type === 'time' ? new Date(value).getTime() : Number(value);
|
|
98
|
+
return Number.isFinite(n) ? n : null;
|
|
99
|
+
};
|
|
100
|
+
const min = bound(axis.min) ?? Math.min(...values);
|
|
101
|
+
const max = bound(axis.max) ?? Math.max(...values);
|
|
102
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return [0, 1];
|
|
103
|
+
return min === max ? [min - 1, max + 1] : [min, max];
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
readonly yDomain = computed<[number, number]>(() => {
|
|
107
|
+
const values = this.resolved().lines.flatMap(line => line.points.map(point => point.y));
|
|
108
|
+
const axis = this.yAxis();
|
|
109
|
+
const requestedMin = typeof axis.min === 'number' && Number.isFinite(axis.min) ? axis.min : null;
|
|
110
|
+
const requestedMax = typeof axis.max === 'number' && Number.isFinite(axis.max) ? axis.max : null;
|
|
111
|
+
const rawMin = values.length ? Math.min(...values) : 0;
|
|
112
|
+
const rawMax = values.length ? Math.max(...values) : 1;
|
|
113
|
+
const padding = Math.max(1, (rawMax - rawMin) * .08);
|
|
114
|
+
const min = requestedMin ?? rawMin - padding;
|
|
115
|
+
const max = requestedMax ?? rawMax + padding;
|
|
116
|
+
return min < max ? [min, max] : [min - 1, min + 1];
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
readonly yTicks = computed(() => {
|
|
120
|
+
const [min, max] = this.yDomain();
|
|
121
|
+
const count = Math.max(2, Math.min(10, Math.round(this.yAxis().ticks ?? 5)));
|
|
122
|
+
return Array.from({ length: count }, (_, index) => {
|
|
123
|
+
const value = min + (max - min) * index / (count - 1);
|
|
124
|
+
return { y: this.yPosition(value), label: this.formatNumber(value, this.yAxis().precision) };
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
readonly xTicks = computed(() => {
|
|
129
|
+
const axis = this.xAxis();
|
|
130
|
+
const maxLabels = Math.max(2, Math.floor(this.plotWidth() / 58));
|
|
131
|
+
if (axis.type === 'category') {
|
|
132
|
+
const values = this.categories();
|
|
133
|
+
const step = Math.max(1, Math.ceil(values.length / maxLabels));
|
|
134
|
+
return values.map((value, index) => ({ x: this.xPosition(value), label: value,
|
|
135
|
+
visible: index % step === 0 || (index === values.length - 1 && (index - 1) % step !== 0) }));
|
|
136
|
+
}
|
|
137
|
+
const [min, max] = this.xDomain();
|
|
138
|
+
const count = Math.max(2, Math.min(maxLabels, Math.round(axis.ticks ?? 5)));
|
|
139
|
+
return Array.from({ length: count }, (_, index) => {
|
|
140
|
+
const value = min + (max - min) * index / (count - 1);
|
|
141
|
+
const label = axis.type === 'time' ? this.formatTime(value) : this.formatNumber(value, axis.precision);
|
|
142
|
+
return { x: this.xPosition(value), label, visible: true };
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
readonly renderedLines = computed<readonly RenderedLine[]>(() => this.resolved().lines.map((line, index) => {
|
|
147
|
+
const dots = line.points.map(point => ({ x: this.xPosition(point.x), y: this.yPosition(point.y) }))
|
|
148
|
+
.filter(point => Number.isFinite(point.x) && Number.isFinite(point.y));
|
|
149
|
+
return { ...line, colorValue: resolveChartColor(line.color, this.colors(), index),
|
|
150
|
+
path: dots.map((point, pointIndex) => `${pointIndex ? 'L' : 'M'}${point.x.toFixed(2)},${point.y.toFixed(2)}`).join(' '), dots };
|
|
151
|
+
}));
|
|
152
|
+
|
|
153
|
+
readonly tableRows = computed(() => {
|
|
154
|
+
const xValues = this.xAxis().type === 'category' ? this.categories() :
|
|
155
|
+
[...new Set(this.resolved().lines.flatMap(line => line.points.map(point => Number(point.x))))].sort((a, b) => a - b);
|
|
156
|
+
return xValues.map(x => {
|
|
157
|
+
const row: Record<string, string | number> = { x: this.xAxis().type === 'time' ? this.formatTime(Number(x)) : String(x) };
|
|
158
|
+
this.resolved().lines.forEach((line, index) => {
|
|
159
|
+
row[`line${index}`] = line.points.find(point => point.x === x)?.y ?? '—';
|
|
160
|
+
});
|
|
161
|
+
return row;
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
readonly tableColumns = computed<GoodTableColumn<Record<string, string | number>>[]>(() => [
|
|
166
|
+
{ accessorKey: 'x', header: this.xAxis().label || 'X' },
|
|
167
|
+
...this.resolved().lines.map((line, index) => ({ accessorKey: `line${index}`, header: line.label, meta: { align: 'end' as const } })),
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
xPosition(value: string | number): number {
|
|
171
|
+
if (this.xAxis().type === 'category') {
|
|
172
|
+
const index = this.categories().indexOf(String(value));
|
|
173
|
+
return this.left + (this.categories().length < 2 ? this.plotWidth() / 2 : index * this.plotWidth() / (this.categories().length - 1));
|
|
174
|
+
}
|
|
175
|
+
const [min, max] = this.xDomain();
|
|
176
|
+
return this.left + (Number(value) - min) * this.plotWidth() / (max - min);
|
|
177
|
+
}
|
|
178
|
+
yPosition(value: number): number {
|
|
179
|
+
const [min, max] = this.yDomain();
|
|
180
|
+
return this.top + (max - value) * this.plotHeight / (max - min);
|
|
181
|
+
}
|
|
182
|
+
formatNumber(value: number, precision: number | undefined): string {
|
|
183
|
+
const digits = precision == null ? (Number.isInteger(value) ? 0 : 1) : Math.max(0, Math.min(4, Math.round(precision)));
|
|
184
|
+
return new Intl.NumberFormat('en-US', { maximumFractionDigits: digits, minimumFractionDigits: digits }).format(value);
|
|
185
|
+
}
|
|
186
|
+
formatTime(time: number): string {
|
|
187
|
+
const group = this.xAxis().groupBy;
|
|
188
|
+
const options: Intl.DateTimeFormatOptions = group === 'year' ? { year: 'numeric', timeZone: 'UTC' } :
|
|
189
|
+
group === 'month' ? { month: 'short', year: '2-digit', timeZone: 'UTC' } :
|
|
190
|
+
{ month: 'short', day: 'numeric', timeZone: 'UTC' };
|
|
191
|
+
return new Intl.DateTimeFormat('en-US', options).format(time);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, inject, input } from '@angular/core';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
export type GoodLinkAppearance = 'brand' | 'mono';
|
|
6
|
+
export type GoodLinkUnderline = 'hover' | 'always';
|
|
7
|
+
export type GoodLinkDecoration = 'solid' | 'dashed' | 'dotted';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'good-link',
|
|
11
|
+
standalone: true,
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
host: { class: 'good-link' },
|
|
14
|
+
template: `
|
|
15
|
+
<a class="good-link-control" [attr.href]="destinationHref()" (click)="onClick($event)"
|
|
16
|
+
[attr.target]="disabled() || route() ? null : target()" [attr.rel]="effectiveRel() || null"
|
|
17
|
+
[attr.role]="disabled() || (!href() && !route()) ? 'link' : null"
|
|
18
|
+
[attr.aria-disabled]="disabled() || (!href() && !route()) ? 'true' : null"
|
|
19
|
+
[attr.tabindex]="disabled() || (!href() && !route()) ? -1 : null"
|
|
20
|
+
[attr.data-appearance]="appearance()" [attr.data-underline]="underline()"
|
|
21
|
+
[attr.data-decoration]="decoration()"><ng-content /></a>
|
|
22
|
+
`,
|
|
23
|
+
})
|
|
24
|
+
export class GoodLinkComponent {
|
|
25
|
+
private readonly router = inject(Router);
|
|
26
|
+
private readonly location = inject(Location);
|
|
27
|
+
readonly href = input('');
|
|
28
|
+
readonly route = input('');
|
|
29
|
+
readonly target = input<'_self' | '_blank'>('_self');
|
|
30
|
+
readonly rel = input('');
|
|
31
|
+
readonly appearance = input<GoodLinkAppearance>('brand');
|
|
32
|
+
readonly underline = input<GoodLinkUnderline>('hover');
|
|
33
|
+
readonly decoration = input<GoodLinkDecoration>('solid');
|
|
34
|
+
readonly disabled = input(false);
|
|
35
|
+
readonly effectiveRel = computed(() => this.target() === '_blank' ? `noopener noreferrer ${this.rel()}`.trim() : this.rel());
|
|
36
|
+
readonly destinationHref = computed(() => {
|
|
37
|
+
if (this.disabled()) return null;
|
|
38
|
+
return this.route() ? this.location.prepareExternalUrl(this.router.serializeUrl(this.router.createUrlTree([this.route()]))) : this.href() || null;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
onClick(event: MouseEvent): void {
|
|
42
|
+
if (this.disabled() || !this.route() || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
43
|
+
event.preventDefault();
|
|
44
|
+
void this.router.navigateByUrl(this.route());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
+
import {
|
|
4
|
+
ChangeDetectionStrategy, Component, Directive, ElementRef, TemplateRef,
|
|
5
|
+
booleanAttribute, computed, contentChild, forwardRef, inject, input, model, output, signal, viewChild,
|
|
6
|
+
} from '@angular/core';
|
|
7
|
+
import { LucideDynamicIcon, LucideSearch } from '@lucide/angular';
|
|
8
|
+
import { GoodButtonIcon } from './models';
|
|
9
|
+
|
|
10
|
+
export interface GoodListboxItem {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
icon?: GoodButtonIcon;
|
|
15
|
+
iconSrc?: string;
|
|
16
|
+
tags?: readonly string[];
|
|
17
|
+
searchTerms?: readonly string[];
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GoodListboxGroup {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
items: readonly GoodListboxItem[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type GoodListboxSelectionMode = 'none' | 'single' | 'multiple';
|
|
28
|
+
export type GoodListboxAppearance = 'highlight' | 'checkbox';
|
|
29
|
+
export interface GoodListboxItemSelectionChange {
|
|
30
|
+
item: GoodListboxItem;
|
|
31
|
+
selected: boolean;
|
|
32
|
+
selectedIds: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface GoodListboxItemContext {
|
|
36
|
+
$implicit: GoodListboxItem;
|
|
37
|
+
selected: boolean;
|
|
38
|
+
active: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Directive({ selector: 'ng-template[goodListboxItem]', standalone: true })
|
|
42
|
+
export class GoodListboxItemDirective {
|
|
43
|
+
readonly template = inject<TemplateRef<GoodListboxItemContext>>(TemplateRef);
|
|
44
|
+
static ngTemplateContextGuard(_directive: GoodListboxItemDirective, context: unknown): context is GoodListboxItemContext {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let nextListboxId = 0;
|
|
50
|
+
|
|
51
|
+
@Component({
|
|
52
|
+
selector: 'good-listbox',
|
|
53
|
+
standalone: true,
|
|
54
|
+
imports: [NgTemplateOutlet, LucideDynamicIcon],
|
|
55
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
56
|
+
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodListboxComponent), multi: true }],
|
|
57
|
+
host: { class: 'good-listbox', '[attr.data-disabled]': 'isDisabled()', '[attr.data-bordered]': 'bordered()', '[attr.data-compact]': 'compact()', '(focusout)': 'onFocusOut($event)' },
|
|
58
|
+
template: `
|
|
59
|
+
@if (showLabel()) { <div class="good-listbox-label" [id]="labelId">{{ label() }}</div> }
|
|
60
|
+
<div class="good-listbox-frame" [attr.data-appearance]="appearance()">
|
|
61
|
+
@if (searchable()) {
|
|
62
|
+
<div class="good-listbox-search">
|
|
63
|
+
@if (searchIconSrc()) { <img [src]="searchIconSrc()" alt="" aria-hidden="true" /> }
|
|
64
|
+
@else { <svg [lucideIcon]="searchIcon()" [size]="16" aria-hidden="true"></svg> }
|
|
65
|
+
<input type="search" [value]="query()" [placeholder]="searchPlaceholder()"
|
|
66
|
+
[attr.aria-label]="'Search ' + label()" [attr.aria-controls]="listId"
|
|
67
|
+
[disabled]="isDisabled()" (input)="onSearch($event)" (keydown)="onSearchKeydown($event)" />
|
|
68
|
+
</div>
|
|
69
|
+
}
|
|
70
|
+
<div #list class="good-listbox-list" [attr.role]="selectionMode() === 'none' ? 'list' : 'listbox'" [id]="listId"
|
|
71
|
+
[attr.aria-label]="showLabel() ? null : label()"
|
|
72
|
+
[attr.aria-labelledby]="showLabel() ? labelId : null"
|
|
73
|
+
[attr.aria-multiselectable]="selectionMode() === 'multiple' ? 'true' : null"
|
|
74
|
+
[attr.aria-activedescendant]="selectionMode() === 'none' ? null : activeOptionId()"
|
|
75
|
+
[attr.aria-disabled]="isDisabled()" [attr.tabindex]="selectionMode() === 'none' || isDisabled() ? -1 : 0"
|
|
76
|
+
[style.max-height.px]="maxHeight()" (keydown)="onListKeydown($event)">
|
|
77
|
+
@for (group of filteredGroups(); track group.id) {
|
|
78
|
+
<div class="good-listbox-group" role="group" [attr.aria-label]="group.label || null">
|
|
79
|
+
@if (group.label) { <div class="good-listbox-group-label" aria-hidden="true">{{ group.label }}</div> }
|
|
80
|
+
<div class="good-listbox-group-items" [class.good-listbox-group-items-named]="!!group.label">
|
|
81
|
+
@for (item of group.items; track item.id) {
|
|
82
|
+
@if (selectionMode() === 'none') {
|
|
83
|
+
<div role="listitem">
|
|
84
|
+
<button type="button" class="good-listbox-option" [id]="optionId(item.id)"
|
|
85
|
+
[attr.aria-label]="item.label" [disabled]="isDisabled() || item.disabled"
|
|
86
|
+
(click)="activate(item)">
|
|
87
|
+
<ng-container [ngTemplateOutlet]="rowContent" [ngTemplateOutletContext]="{ $implicit: item }" />
|
|
88
|
+
</button>
|
|
89
|
+
</div>
|
|
90
|
+
} @else {
|
|
91
|
+
<div class="good-listbox-option" role="option" [id]="optionId(item.id)"
|
|
92
|
+
[attr.aria-label]="item.label" [attr.aria-selected]="isSelected(item.id)"
|
|
93
|
+
[attr.aria-disabled]="item.disabled ? 'true' : null"
|
|
94
|
+
[attr.data-selected]="isSelected(item.id)" [attr.data-active]="activeId() === item.id"
|
|
95
|
+
(pointerenter)="setActive(item)" (click)="activate(item)">
|
|
96
|
+
<ng-container [ngTemplateOutlet]="rowContent" [ngTemplateOutletContext]="{ $implicit: item }" />
|
|
97
|
+
</div>
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
} @empty { <div class="good-listbox-empty" role="status">{{ emptyMessage() }}</div> }
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<ng-template #rowContent let-item>
|
|
106
|
+
@if (appearance() === 'checkbox' && selectionMode() !== 'none') {
|
|
107
|
+
<span class="good-listbox-checkbox" [attr.data-checked]="isSelected(item.id)" aria-hidden="true">
|
|
108
|
+
@if (isSelected(item.id)) { <span class="good-listbox-checkmark"></span> }
|
|
109
|
+
</span>
|
|
110
|
+
}
|
|
111
|
+
@if (itemTemplate(); as custom) {
|
|
112
|
+
<ng-container [ngTemplateOutlet]="custom.template" [ngTemplateOutletContext]="itemContext(item)" />
|
|
113
|
+
} @else {
|
|
114
|
+
@if (item.icon; as icon) { <svg class="good-listbox-icon" [lucideIcon]="icon" [size]="18" aria-hidden="true"></svg> }
|
|
115
|
+
@else if (item.iconSrc; as source) { <img class="good-listbox-icon" [src]="source" alt="" /> }
|
|
116
|
+
<span class="good-listbox-copy">
|
|
117
|
+
<span class="good-listbox-item-label">{{ item.label }}</span>
|
|
118
|
+
@if (item.description) { <span class="good-listbox-description">{{ item.description }}</span> }
|
|
119
|
+
</span>
|
|
120
|
+
@if (item.tags?.length) {
|
|
121
|
+
<span class="good-listbox-tags" aria-hidden="true">
|
|
122
|
+
@for (tag of item.tags; track tag) { <span class="good-listbox-tag">{{ tag }}</span> }
|
|
123
|
+
</span>
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</ng-template>
|
|
127
|
+
`,
|
|
128
|
+
})
|
|
129
|
+
export class GoodListboxComponent implements ControlValueAccessor {
|
|
130
|
+
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
|
|
131
|
+
private readonly list = viewChild<ElementRef<HTMLElement>>('list');
|
|
132
|
+
private readonly formDisabled = signal(false);
|
|
133
|
+
private onChange: (ids: readonly string[]) => void = () => {};
|
|
134
|
+
private onTouched: () => void = () => {};
|
|
135
|
+
|
|
136
|
+
readonly items = input<readonly GoodListboxItem[]>([]);
|
|
137
|
+
readonly groups = input<readonly GoodListboxGroup[]>([]);
|
|
138
|
+
readonly selectedIds = model<readonly string[]>([]);
|
|
139
|
+
readonly selectionMode = input<GoodListboxSelectionMode>('none');
|
|
140
|
+
readonly appearance = input<GoodListboxAppearance>('highlight');
|
|
141
|
+
readonly bordered = input(true);
|
|
142
|
+
readonly compact = input(false, { transform: booleanAttribute });
|
|
143
|
+
readonly label = input('Items');
|
|
144
|
+
readonly showLabel = input(false);
|
|
145
|
+
readonly searchable = input(false);
|
|
146
|
+
readonly searchPlaceholder = input('Search items');
|
|
147
|
+
readonly searchIcon = input<GoodButtonIcon>(LucideSearch);
|
|
148
|
+
readonly searchIconSrc = input('');
|
|
149
|
+
readonly emptyMessage = input('No items found');
|
|
150
|
+
readonly disabled = input(false);
|
|
151
|
+
readonly maxHeight = input(320);
|
|
152
|
+
readonly itemActivated = output<GoodListboxItem>();
|
|
153
|
+
readonly itemSelectionChange = output<GoodListboxItemSelectionChange>();
|
|
154
|
+
readonly selectionChange = output<readonly string[]>();
|
|
155
|
+
readonly itemTemplate = contentChild(GoodListboxItemDirective);
|
|
156
|
+
readonly query = signal('');
|
|
157
|
+
readonly activeId = signal<string | null>(null);
|
|
158
|
+
readonly listId = `good-listbox-${++nextListboxId}`;
|
|
159
|
+
readonly labelId = `${this.listId}-label`;
|
|
160
|
+
readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
161
|
+
readonly allGroups = computed<readonly GoodListboxGroup[]>(() => [
|
|
162
|
+
...(this.items().length ? [{ id: '__items', label: '', items: this.items() }] : []),
|
|
163
|
+
...this.groups(),
|
|
164
|
+
]);
|
|
165
|
+
readonly filteredGroups = computed(() => {
|
|
166
|
+
const query = this.query().trim().toLocaleLowerCase();
|
|
167
|
+
if (!query) return this.allGroups().filter(group => group.items.length);
|
|
168
|
+
return this.allGroups().map(group => ({
|
|
169
|
+
...group,
|
|
170
|
+
items: group.items.filter(item =>
|
|
171
|
+
group.label.toLocaleLowerCase().includes(query) ||
|
|
172
|
+
[item.label, item.description, ...(item.tags ?? []), ...(item.searchTerms ?? [])]
|
|
173
|
+
.some(value => value?.toLocaleLowerCase().includes(query))),
|
|
174
|
+
})).filter(group => group.items.length);
|
|
175
|
+
});
|
|
176
|
+
readonly visibleItems = computed(() => this.filteredGroups().flatMap(group => group.items));
|
|
177
|
+
readonly activeOptionId = computed(() => this.activeId() && this.visibleItems().some(item => item.id === this.activeId() && !item.disabled)
|
|
178
|
+
? this.optionId(this.activeId()!) : null);
|
|
179
|
+
|
|
180
|
+
writeValue(value: readonly string[] | null): void { this.selectedIds.set(Array.isArray(value) ? [...value] : []); }
|
|
181
|
+
registerOnChange(fn: (ids: readonly string[]) => void): void { this.onChange = fn; }
|
|
182
|
+
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
|
|
183
|
+
setDisabledState(value: boolean): void { this.formDisabled.set(value); }
|
|
184
|
+
isSelected(id: string): boolean { return this.selectionMode() !== 'none' && this.selectedIds().includes(id); }
|
|
185
|
+
optionId(id: string): string { return `${this.listId}-option-${encodeURIComponent(id)}`; }
|
|
186
|
+
itemContext(item: GoodListboxItem): GoodListboxItemContext {
|
|
187
|
+
return { $implicit: item, selected: this.isSelected(item.id), active: this.activeId() === item.id };
|
|
188
|
+
}
|
|
189
|
+
setActive(item: GoodListboxItem): void { if (!this.isDisabled() && !item.disabled) this.activeId.set(item.id); }
|
|
190
|
+
activate(item: GoodListboxItem): void {
|
|
191
|
+
if (this.isDisabled() || item.disabled) return;
|
|
192
|
+
this.activeId.set(item.id);
|
|
193
|
+
this.itemActivated.emit(item);
|
|
194
|
+
if (this.selectionMode() === 'none') { this.onTouched(); return; }
|
|
195
|
+
const selected = this.isSelected(item.id);
|
|
196
|
+
const next = this.selectionMode() === 'multiple'
|
|
197
|
+
? selected ? this.selectedIds().filter(id => id !== item.id) : [...this.selectedIds(), item.id]
|
|
198
|
+
: [item.id];
|
|
199
|
+
if (selected && this.selectionMode() === 'single') return;
|
|
200
|
+
this.selectedIds.set(next);
|
|
201
|
+
this.onChange(next);
|
|
202
|
+
this.selectionChange.emit(next);
|
|
203
|
+
this.itemSelectionChange.emit({ item, selected: !selected, selectedIds: next });
|
|
204
|
+
this.onTouched();
|
|
205
|
+
}
|
|
206
|
+
onSearch(event: Event): void {
|
|
207
|
+
this.query.set((event.target as HTMLInputElement).value);
|
|
208
|
+
this.activeId.set(this.visibleItems().find(item => !item.disabled)?.id ?? null);
|
|
209
|
+
}
|
|
210
|
+
onSearchKeydown(event: KeyboardEvent): void {
|
|
211
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
212
|
+
event.preventDefault();
|
|
213
|
+
if (this.selectionMode() === 'none') {
|
|
214
|
+
const available = this.visibleItems().filter(item => !item.disabled && !this.isDisabled());
|
|
215
|
+
const target = event.key === 'ArrowDown' ? available[0] : available.at(-1);
|
|
216
|
+
if (target) this.host.nativeElement.ownerDocument.getElementById(this.optionId(target.id))?.focus();
|
|
217
|
+
} else {
|
|
218
|
+
this.moveActive(event.key === 'ArrowDown' ? 1 : -1);
|
|
219
|
+
this.list()?.nativeElement.focus();
|
|
220
|
+
}
|
|
221
|
+
} else if (event.key === 'Escape' && this.query()) {
|
|
222
|
+
event.preventDefault();
|
|
223
|
+
this.query.set('');
|
|
224
|
+
(event.target as HTMLInputElement).value = '';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
onListKeydown(event: KeyboardEvent): void {
|
|
228
|
+
if (this.isDisabled() || this.selectionMode() === 'none') return;
|
|
229
|
+
if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
this.moveActive(event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1 : event.key === 'Home' ? 'first' : 'last');
|
|
232
|
+
} else if (event.key === 'Enter' || event.key === ' ') {
|
|
233
|
+
event.preventDefault();
|
|
234
|
+
const item = this.visibleItems().find(option => option.id === this.activeId())
|
|
235
|
+
?? this.visibleItems().find(option => !option.disabled);
|
|
236
|
+
if (item) this.activate(item);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
onFocusOut(event: FocusEvent): void {
|
|
240
|
+
if (event.relatedTarget && this.host.nativeElement.contains(event.relatedTarget as Node)) return;
|
|
241
|
+
this.onTouched();
|
|
242
|
+
}
|
|
243
|
+
private moveActive(direction: 1 | -1 | 'first' | 'last'): void {
|
|
244
|
+
const available = this.visibleItems().filter(item => !item.disabled);
|
|
245
|
+
if (!available.length) { this.activeId.set(null); return; }
|
|
246
|
+
const current = available.findIndex(item => item.id === this.activeId());
|
|
247
|
+
const next = direction === 'first' ? 0 : direction === 'last' ? available.length - 1
|
|
248
|
+
: current < 0 ? direction === 1 ? 0 : available.length - 1
|
|
249
|
+
: (current + direction + available.length) % available.length;
|
|
250
|
+
this.activeId.set(available[next].id);
|
|
251
|
+
this.host.nativeElement.ownerDocument.getElementById(this.optionId(available[next].id))
|
|
252
|
+
?.scrollIntoView?.({ block: 'nearest' });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
|
2
|
+
import { GoodSubnavComponent } from './subnav';
|
|
3
|
+
import { GoodEyebrowComponent, GoodEyebrowAppearance, GoodHeadingComponent, GoodHeadingGroupComponent, GoodSummaryComponent } from './typography';
|
|
4
|
+
import { GoodSubnavAction, GoodSubnavItem } from './models';
|
|
5
|
+
|
|
6
|
+
export type GoodMainViewLayout = 'page' | 'fill';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'good-main-view',
|
|
10
|
+
standalone: true,
|
|
11
|
+
imports: [GoodSubnavComponent, GoodHeadingGroupComponent, GoodEyebrowComponent, GoodHeadingComponent, GoodSummaryComponent],
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
template: `
|
|
14
|
+
@if (subnavItems().length) { <good-subnav [items]="subnavItems()" [actions]="subnavActions()" [ariaLabel]="subnavLabel()" /> }
|
|
15
|
+
@if (eyebrow() || title() || description()) {
|
|
16
|
+
<header class="good-main-view-heading">
|
|
17
|
+
<good-heading-group>
|
|
18
|
+
@if (eyebrow()) { <good-eyebrow [appearance]="eyebrowAppearance()">{{ eyebrow() }}</good-eyebrow> }
|
|
19
|
+
@if (title()) { <good-heading>{{ title() }}</good-heading> }
|
|
20
|
+
@if (description()) { <good-summary>{{ description() }}</good-summary> }
|
|
21
|
+
</good-heading-group>
|
|
22
|
+
<div class="good-main-view-actions"><ng-content select="[good-main-view-actions]" /></div>
|
|
23
|
+
</header>
|
|
24
|
+
}
|
|
25
|
+
<ng-content select="[goodMainViewToolbar]" />
|
|
26
|
+
<div class="good-main-view-content"><ng-content /></div>
|
|
27
|
+
`,
|
|
28
|
+
host: { class: 'good-main-view', '[attr.data-layout]': 'layout()' },
|
|
29
|
+
})
|
|
30
|
+
export class GoodMainViewComponent {
|
|
31
|
+
readonly layout = input<GoodMainViewLayout>('page');
|
|
32
|
+
readonly subnavItems = input<readonly GoodSubnavItem[]>([]);
|
|
33
|
+
readonly subnavActions = input<readonly GoodSubnavAction[]>([]);
|
|
34
|
+
readonly subnavLabel = input('Subnav');
|
|
35
|
+
readonly title = input('');
|
|
36
|
+
readonly description = input('');
|
|
37
|
+
readonly eyebrow = input('');
|
|
38
|
+
readonly eyebrowAppearance = input<GoodEyebrowAppearance>('brand');
|
|
39
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Category colors for markers and domain highlights, independent of status and brand colors. */
|
|
2
|
+
export const GOOD_MARKER_COLORS = [
|
|
3
|
+
'sky', 'blue', 'indigo', 'violet', 'purple', 'fuchsia', 'pink', 'rose',
|
|
4
|
+
'red', 'orange', 'amber', 'yellow', 'lime', 'green', 'teal', 'cyan',
|
|
5
|
+
] as const;
|
|
6
|
+
|
|
7
|
+
export type GoodMarkerColor = (typeof GOOD_MARKER_COLORS)[number];
|