@cloudfrogger/goodui 0.0.59 → 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,251 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, OnDestroy,
|
|
3
|
+
computed, contentChildren, effect, forwardRef, inject, input, model, output, signal, viewChild,
|
|
4
|
+
} from '@angular/core';
|
|
5
|
+
import { LucideChevronLeft, LucideChevronRight, LucideDynamicIcon } from '@lucide/angular';
|
|
6
|
+
import { GoodBadgeColor, GoodBadgeComponent } from './badge';
|
|
7
|
+
import { GoodButtonIcon } from './models';
|
|
8
|
+
|
|
9
|
+
let nextTabId = 0;
|
|
10
|
+
let nextTabsId = 0;
|
|
11
|
+
|
|
12
|
+
export interface GoodTabActivation {
|
|
13
|
+
id: string;
|
|
14
|
+
previousId: string | null;
|
|
15
|
+
source: 'pointer' | 'keyboard';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@Component({
|
|
19
|
+
selector: 'good-tab',
|
|
20
|
+
standalone: true,
|
|
21
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
22
|
+
template: `<ng-content />`,
|
|
23
|
+
host: {
|
|
24
|
+
class: 'good-tab-panel',
|
|
25
|
+
role: 'tabpanel',
|
|
26
|
+
'[attr.id]': 'panelDomId',
|
|
27
|
+
'[attr.aria-labelledby]': 'tabDomId',
|
|
28
|
+
'[attr.hidden]': 'isActive() ? null : ""',
|
|
29
|
+
'[attr.tabindex]': 'isActive() ? 0 : -1',
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
export class GoodTabComponent {
|
|
33
|
+
private readonly owner = inject(forwardRef(() => GoodTabsComponent), { optional: true });
|
|
34
|
+
readonly value = input('');
|
|
35
|
+
readonly label = input('');
|
|
36
|
+
readonly icon = input<GoodButtonIcon>();
|
|
37
|
+
readonly badge = input<string | number | null>(null);
|
|
38
|
+
readonly badgeColor = input<GoodBadgeColor>('primary');
|
|
39
|
+
readonly selected = input(false);
|
|
40
|
+
readonly disabled = input(false);
|
|
41
|
+
readonly panelDomId = `good-tab-panel-${++nextTabId}`;
|
|
42
|
+
readonly tabDomId = `${this.panelDomId}-trigger`;
|
|
43
|
+
readonly isActive = computed(() => this.owner?.activeTab() === this);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Component({
|
|
47
|
+
selector: 'good-tabs',
|
|
48
|
+
standalone: true,
|
|
49
|
+
imports: [LucideDynamicIcon, GoodBadgeComponent],
|
|
50
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
51
|
+
host: { class: 'good-tabs' },
|
|
52
|
+
template: `
|
|
53
|
+
<div class="good-tabs-bar">
|
|
54
|
+
@if (overflow()) {
|
|
55
|
+
<button type="button" class="good-tabs-scroll-button" aria-label="Scroll tabs left"
|
|
56
|
+
[attr.aria-controls]="tablistId" [disabled]="!canScrollLeft()" (click)="scrollTabs(-1)">
|
|
57
|
+
<svg [lucideIcon]="chevronLeft" [size]="16" aria-hidden="true"></svg>
|
|
58
|
+
</button>
|
|
59
|
+
}
|
|
60
|
+
<div #tablist class="good-tabs-list" role="tablist" aria-orientation="horizontal"
|
|
61
|
+
[id]="tablistId" [attr.aria-label]="ariaLabel()" [attr.data-dragging]="dragging() ? 'true' : null"
|
|
62
|
+
(scroll)="measure()" (pointerdown)="onPointerDown($event)"
|
|
63
|
+
(pointermove)="onPointerMove($event)" (pointerup)="onPointerUp($event)"
|
|
64
|
+
(pointercancel)="onPointerCancel($event)">
|
|
65
|
+
@for (tab of readyTabs(); track tab.panelDomId) {
|
|
66
|
+
<button type="button" class="good-tabs-trigger" role="tab"
|
|
67
|
+
[id]="tab.tabDomId" [attr.aria-controls]="tab.panelDomId"
|
|
68
|
+
[attr.aria-selected]="activeTab() === tab" [tabIndex]="activeTab() === tab ? 0 : -1"
|
|
69
|
+
[disabled]="tab.disabled()" (click)="onTabClick($event, tab)" (keydown)="onTabKeydown($event, tab)">
|
|
70
|
+
@if (tab.icon(); as icon) { <svg class="good-tabs-icon" [lucideIcon]="icon" [size]="16" aria-hidden="true"></svg> }
|
|
71
|
+
<span class="good-tabs-label">{{ tab.label() }}</span>
|
|
72
|
+
@if (tab.badge() !== null) {
|
|
73
|
+
<good-badge [label]="badgeLabel(tab)" [color]="tab.badgeColor()" variant="light" size="small" />
|
|
74
|
+
}
|
|
75
|
+
</button>
|
|
76
|
+
}
|
|
77
|
+
</div>
|
|
78
|
+
@if (overflow()) {
|
|
79
|
+
<button type="button" class="good-tabs-scroll-button" aria-label="Scroll tabs right"
|
|
80
|
+
[attr.aria-controls]="tablistId" [disabled]="!canScrollRight()" (click)="scrollTabs(1)">
|
|
81
|
+
<svg [lucideIcon]="chevronRight" [size]="16" aria-hidden="true"></svg>
|
|
82
|
+
</button>
|
|
83
|
+
}
|
|
84
|
+
</div>
|
|
85
|
+
<div class="good-tabs-content"><ng-content select="good-tab" /></div>
|
|
86
|
+
`,
|
|
87
|
+
})
|
|
88
|
+
export class GoodTabsComponent implements AfterViewInit, OnDestroy {
|
|
89
|
+
private readonly tablist = viewChild<ElementRef<HTMLElement>>('tablist');
|
|
90
|
+
private resizeObserver?: ResizeObserver;
|
|
91
|
+
private mutationObserver?: MutationObserver;
|
|
92
|
+
private dragPointerId: number | null = null;
|
|
93
|
+
private dragStartX = 0;
|
|
94
|
+
private dragStartScrollLeft = 0;
|
|
95
|
+
private suppressClick = false;
|
|
96
|
+
private clickResetTimer?: ReturnType<typeof setTimeout>;
|
|
97
|
+
|
|
98
|
+
readonly tabs = contentChildren(GoodTabComponent);
|
|
99
|
+
readonly readyTabs = computed(() => this.tabs().filter(tab => !!tab.value()));
|
|
100
|
+
readonly activeId = model<string | null>(null);
|
|
101
|
+
readonly ariaLabel = input('Tabs');
|
|
102
|
+
readonly tabActivated = output<GoodTabActivation>();
|
|
103
|
+
readonly overflow = signal(false);
|
|
104
|
+
readonly canScrollLeft = signal(false);
|
|
105
|
+
readonly canScrollRight = signal(false);
|
|
106
|
+
readonly dragging = signal(false);
|
|
107
|
+
readonly tablistId = `good-tabs-list-${++nextTabsId}`;
|
|
108
|
+
readonly chevronLeft = LucideChevronLeft;
|
|
109
|
+
readonly chevronRight = LucideChevronRight;
|
|
110
|
+
readonly activeTab = computed(() => {
|
|
111
|
+
const available = this.readyTabs().filter(tab => !tab.disabled());
|
|
112
|
+
return available.find(tab => tab.value() === this.activeId())
|
|
113
|
+
?? available.find(tab => tab.selected())
|
|
114
|
+
?? available[0]
|
|
115
|
+
?? null;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
constructor() {
|
|
119
|
+
effect(() => {
|
|
120
|
+
const tab = this.activeTab();
|
|
121
|
+
if (tab && this.activeId() !== tab.value()) this.activeId.set(tab.value());
|
|
122
|
+
});
|
|
123
|
+
effect(() => {
|
|
124
|
+
const tab = this.activeTab();
|
|
125
|
+
if (tab && typeof requestAnimationFrame !== 'undefined') {
|
|
126
|
+
requestAnimationFrame(() => this.scrollActiveIntoView(tab));
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
ngAfterViewInit(): void {
|
|
132
|
+
const element = this.tablist()?.nativeElement;
|
|
133
|
+
if (!element) return;
|
|
134
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
135
|
+
this.resizeObserver = new ResizeObserver(() => this.measure());
|
|
136
|
+
this.resizeObserver.observe(element);
|
|
137
|
+
}
|
|
138
|
+
if (typeof MutationObserver !== 'undefined') {
|
|
139
|
+
this.mutationObserver = new MutationObserver(() => this.measure());
|
|
140
|
+
this.mutationObserver.observe(element, { childList: true, characterData: true, subtree: true });
|
|
141
|
+
}
|
|
142
|
+
queueMicrotask(() => this.measure());
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
ngOnDestroy(): void {
|
|
146
|
+
this.resizeObserver?.disconnect();
|
|
147
|
+
this.mutationObserver?.disconnect();
|
|
148
|
+
if (this.clickResetTimer) clearTimeout(this.clickResetTimer);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
badgeLabel(tab: GoodTabComponent): string { return String(tab.badge() ?? ''); }
|
|
152
|
+
|
|
153
|
+
onTabClick(event: MouseEvent, tab: GoodTabComponent): void {
|
|
154
|
+
if (this.suppressClick) {
|
|
155
|
+
event.preventDefault();
|
|
156
|
+
event.stopPropagation();
|
|
157
|
+
this.suppressClick = false;
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
this.activate(tab, 'pointer');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onPointerDown(event: PointerEvent): void {
|
|
164
|
+
if (!this.overflow() || event.pointerType === 'touch' || event.button !== 0) return;
|
|
165
|
+
const list = this.tablist()?.nativeElement;
|
|
166
|
+
if (!list) return;
|
|
167
|
+
this.dragPointerId = event.pointerId;
|
|
168
|
+
this.dragStartX = event.clientX;
|
|
169
|
+
this.dragStartScrollLeft = list.scrollLeft;
|
|
170
|
+
this.suppressClick = false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onPointerMove(event: PointerEvent): void {
|
|
174
|
+
if (event.pointerId !== this.dragPointerId) return;
|
|
175
|
+
const list = this.tablist()?.nativeElement;
|
|
176
|
+
if (!list) return;
|
|
177
|
+
const distance = event.clientX - this.dragStartX;
|
|
178
|
+
if (!this.dragging() && Math.abs(distance) < 6) return;
|
|
179
|
+
if (!this.dragging()) {
|
|
180
|
+
this.dragging.set(true);
|
|
181
|
+
list.setPointerCapture?.(event.pointerId);
|
|
182
|
+
}
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
list.scrollLeft = this.dragStartScrollLeft - distance;
|
|
185
|
+
this.measure();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
onPointerUp(event: PointerEvent): void {
|
|
189
|
+
if (event.pointerId !== this.dragPointerId) return;
|
|
190
|
+
const list = this.tablist()?.nativeElement;
|
|
191
|
+
if (this.dragging()) {
|
|
192
|
+
this.suppressClick = true;
|
|
193
|
+
this.clickResetTimer = setTimeout(() => { this.suppressClick = false; }, 0);
|
|
194
|
+
if (list?.hasPointerCapture?.(event.pointerId)) list.releasePointerCapture(event.pointerId);
|
|
195
|
+
}
|
|
196
|
+
this.dragPointerId = null;
|
|
197
|
+
this.dragging.set(false);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
onPointerCancel(event: PointerEvent): void {
|
|
201
|
+
if (event.pointerId !== this.dragPointerId) return;
|
|
202
|
+
this.dragPointerId = null;
|
|
203
|
+
this.dragging.set(false);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
activate(tab: GoodTabComponent, source: GoodTabActivation['source']): void {
|
|
207
|
+
if (tab.disabled()) return;
|
|
208
|
+
const previousId = this.activeTab()?.value() ?? null;
|
|
209
|
+
if (previousId !== tab.value()) this.activeId.set(tab.value());
|
|
210
|
+
this.tabActivated.emit({ id: tab.value(), previousId, source });
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
onTabKeydown(event: KeyboardEvent, tab: GoodTabComponent): void {
|
|
214
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
|
215
|
+
const available = this.readyTabs().filter(item => !item.disabled());
|
|
216
|
+
if (!available.length) return;
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
const current = available.indexOf(tab);
|
|
219
|
+
const next = event.key === 'Home' ? available[0] : event.key === 'End' ? available.at(-1)!
|
|
220
|
+
: available[(current + (event.key === 'ArrowRight' ? 1 : -1) + available.length) % available.length];
|
|
221
|
+
this.activate(next, 'keyboard');
|
|
222
|
+
this.tablist()?.nativeElement.querySelector<HTMLElement>(`#${next.tabDomId}`)?.focus();
|
|
223
|
+
this.scrollActiveIntoView(next);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
scrollTabs(direction: -1 | 1): void {
|
|
227
|
+
const element = this.tablist()?.nativeElement;
|
|
228
|
+
if (!element) return;
|
|
229
|
+
element.scrollBy({ left: direction * Math.max(120, element.clientWidth * .7), behavior: 'smooth' });
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
measure(): void {
|
|
233
|
+
const element = this.tablist()?.nativeElement;
|
|
234
|
+
if (!element) return;
|
|
235
|
+
const overflow = element.scrollWidth > element.clientWidth + 1;
|
|
236
|
+
this.overflow.set(overflow);
|
|
237
|
+
this.canScrollLeft.set(overflow && element.scrollLeft > 1);
|
|
238
|
+
this.canScrollRight.set(overflow && element.scrollLeft + element.clientWidth < element.scrollWidth - 1);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
private scrollActiveIntoView(tab: GoodTabComponent): void {
|
|
242
|
+
const list = this.tablist()?.nativeElement;
|
|
243
|
+
const trigger = list?.querySelector<HTMLElement>(`#${tab.tabDomId}`);
|
|
244
|
+
if (!list || !trigger) return;
|
|
245
|
+
const listBounds = list.getBoundingClientRect();
|
|
246
|
+
const triggerBounds = trigger.getBoundingClientRect();
|
|
247
|
+
if (triggerBounds.left < listBounds.left) list.scrollBy({ left: triggerBounds.left - listBounds.left - 8, behavior: 'smooth' });
|
|
248
|
+
else if (triggerBounds.right > listBounds.right) list.scrollBy({ left: triggerBounds.right - listBounds.right + 8, behavior: 'smooth' });
|
|
249
|
+
this.measure();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, effect, forwardRef, input, model, signal } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator, Validators } from '@angular/forms';
|
|
3
|
+
import { GoodInputSize } from './input';
|
|
4
|
+
import { GOOD_COMPOSITE_REQUIRED_CONTROL } from './required-control';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'good-textarea',
|
|
8
|
+
standalone: true,
|
|
9
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
10
|
+
host: { class: 'good-textarea' },
|
|
11
|
+
providers: [
|
|
12
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodTextareaComponent), multi: true },
|
|
13
|
+
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => GoodTextareaComponent), multi: true },
|
|
14
|
+
{ provide: GOOD_COMPOSITE_REQUIRED_CONTROL, useExisting: forwardRef(() => GoodTextareaComponent) },
|
|
15
|
+
],
|
|
16
|
+
template: `
|
|
17
|
+
<label class="good-textarea-field" [attr.data-size]="size()" [attr.data-status]="status()"
|
|
18
|
+
[attr.data-resizable]="resizable()">
|
|
19
|
+
@if (showLabel()) {
|
|
20
|
+
<span class="good-textarea-label">{{ label() }}@if (effectiveRequired()) {
|
|
21
|
+
<span class="good-required-mark" aria-hidden="true">*</span><span class="good-sr-only"> required</span>
|
|
22
|
+
}</span>
|
|
23
|
+
}
|
|
24
|
+
<textarea class="good-textarea-native" [value]="value()" [placeholder]="placeholder()"
|
|
25
|
+
[disabled]="isDisabled()" [readOnly]="readonly()" [required]="effectiveRequired()"
|
|
26
|
+
[attr.rows]="effectiveRows()" [name]="name()" [id]="inputId() || null"
|
|
27
|
+
[attr.aria-label]="label()" [attr.aria-invalid]="error() ? 'true' : null"
|
|
28
|
+
[attr.aria-describedby]="describedBy() || null" [attr.autocomplete]="autocomplete() || null"
|
|
29
|
+
(input)="onInput($event)" (blur)="onBlur()"></textarea>
|
|
30
|
+
</label>
|
|
31
|
+
`,
|
|
32
|
+
})
|
|
33
|
+
export class GoodTextareaComponent implements ControlValueAccessor, Validator {
|
|
34
|
+
readonly label = input.required<string>();
|
|
35
|
+
readonly showLabel = input(false);
|
|
36
|
+
readonly size = input<GoodInputSize>('default');
|
|
37
|
+
readonly value = model('');
|
|
38
|
+
readonly placeholder = input('');
|
|
39
|
+
readonly rows = input(4);
|
|
40
|
+
readonly effectiveRows = computed(() => Number.isFinite(this.rows()) ? Math.max(1, Math.trunc(this.rows())) : 4);
|
|
41
|
+
readonly resizable = input(false);
|
|
42
|
+
readonly disabled = input(false);
|
|
43
|
+
readonly readonly = input(false);
|
|
44
|
+
readonly error = input(false);
|
|
45
|
+
readonly required = input(false);
|
|
46
|
+
readonly name = input('');
|
|
47
|
+
readonly inputId = input('');
|
|
48
|
+
readonly describedBy = input('');
|
|
49
|
+
readonly autocomplete = input('');
|
|
50
|
+
readonly fieldRequired = signal(false);
|
|
51
|
+
readonly effectiveRequired = computed(() => this.required() || this.fieldRequired());
|
|
52
|
+
private readonly formDisabled = signal(false);
|
|
53
|
+
readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
54
|
+
readonly status = computed(() => this.isDisabled() ? 'disabled' : this.error() ? 'error' : this.readonly() ? 'readonly' : 'default');
|
|
55
|
+
private onChange: (value: string) => void = () => {};
|
|
56
|
+
private onTouched: () => void = () => {};
|
|
57
|
+
private onValidatorChange: () => void = () => {};
|
|
58
|
+
|
|
59
|
+
constructor() {
|
|
60
|
+
effect(() => {
|
|
61
|
+
this.effectiveRequired();
|
|
62
|
+
this.isDisabled();
|
|
63
|
+
this.readonly();
|
|
64
|
+
this.onValidatorChange();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
setFieldRequired(required: boolean): void { this.fieldRequired.set(required); }
|
|
69
|
+
validate(control: AbstractControl): ValidationErrors | null {
|
|
70
|
+
return this.effectiveRequired() && !this.isDisabled() && !this.readonly() ? Validators.required(control) : null;
|
|
71
|
+
}
|
|
72
|
+
registerOnValidatorChange(fn: () => void): void { this.onValidatorChange = fn; }
|
|
73
|
+
onInput(event: Event): void {
|
|
74
|
+
const next = (event.target as HTMLTextAreaElement).value;
|
|
75
|
+
this.value.set(next);
|
|
76
|
+
this.onChange(next);
|
|
77
|
+
}
|
|
78
|
+
onBlur(): void { this.onTouched(); }
|
|
79
|
+
writeValue(value: unknown): void { this.value.set(value == null ? '' : String(value)); }
|
|
80
|
+
registerOnChange(fn: (value: string) => void): void { this.onChange = fn; }
|
|
81
|
+
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
|
|
82
|
+
setDisabledState(disabled: boolean): void { this.formDisabled.set(disabled); }
|
|
83
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import { Injectable, inject, signal } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
export type GoodTheme = 'light' | 'dark';
|
|
5
|
+
export type GoodThemePreference = GoodTheme | 'system';
|
|
6
|
+
|
|
7
|
+
@Injectable({ providedIn: 'root' })
|
|
8
|
+
export class GoodThemeService {
|
|
9
|
+
private readonly document = inject(DOCUMENT);
|
|
10
|
+
readonly theme = signal<GoodTheme>('light');
|
|
11
|
+
readonly preference = signal<GoodThemePreference>('system');
|
|
12
|
+
private readonly media = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
13
|
+
|
|
14
|
+
constructor() {
|
|
15
|
+
const stored = this.document.cookie.split(';').map(part => part.trim())
|
|
16
|
+
.find(part => part.startsWith('goodui-theme='))?.slice('goodui-theme='.length);
|
|
17
|
+
this.setTheme(stored === 'light' || stored === 'dark' ? stored : 'system', false);
|
|
18
|
+
this.media?.addEventListener('change', () => {
|
|
19
|
+
if (this.preference() === 'system') this.applyTheme();
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setTheme(preference: GoodThemePreference, persist = true): void {
|
|
24
|
+
this.preference.set(preference);
|
|
25
|
+
this.applyTheme();
|
|
26
|
+
if (persist) {
|
|
27
|
+
const secure = this.document.defaultView?.location.protocol === 'https:' ? '; Secure' : '';
|
|
28
|
+
this.document.cookie = preference === 'system'
|
|
29
|
+
? `goodui-theme=; Path=/; Max-Age=0; SameSite=Lax${secure}`
|
|
30
|
+
: `goodui-theme=${preference}; Path=/; Max-Age=31536000; SameSite=Lax${secure}`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
cycle(): void {
|
|
35
|
+
const next: Record<GoodThemePreference, GoodThemePreference> = { light: 'system', system: 'dark', dark: 'light' };
|
|
36
|
+
this.setTheme(next[this.preference()]);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
toggle(): void {
|
|
40
|
+
this.setTheme(this.theme() === 'light' ? 'dark' : 'light');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private applyTheme(): void {
|
|
44
|
+
const preference = this.preference();
|
|
45
|
+
const resolved: GoodTheme = preference === 'system' ? (this.media?.matches ? 'dark' : 'light') : preference;
|
|
46
|
+
this.theme.set(resolved);
|
|
47
|
+
this.document.documentElement.setAttribute('data-theme', resolved);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { AfterViewInit, ChangeDetectionStrategy, Component, DestroyRef, ElementRef, PLATFORM_ID, booleanAttribute, computed, contentChildren, inject, input, signal } from '@angular/core';
|
|
2
|
+
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
+
import {
|
|
4
|
+
LucideCheck, LucideClipboardList, LucideDynamicIcon, LucideFileText,
|
|
5
|
+
LucideHouse, LucideMapPin, LucidePackageCheck, LucideShieldCheck, LucideTruck,
|
|
6
|
+
} from '@lucide/angular';
|
|
7
|
+
import type { GoodButtonIcon } from './models';
|
|
8
|
+
|
|
9
|
+
export type GoodTimelineOrientation = 'auto' | 'horizontal' | 'vertical';
|
|
10
|
+
export type GoodTimelineAppearance = 'simple' | 'detailed' | 'illustrated' | 'sections';
|
|
11
|
+
export type GoodTimelineTone = 'brand' | 'secondary' | 'mono';
|
|
12
|
+
export type GoodTimelineSize = 'small' | 'default' | 'large';
|
|
13
|
+
export type GoodTimelineMarker = 'number' | 'icon' | 'dot';
|
|
14
|
+
export type GoodTimelineColor = 'brand' | 'accent' | 'success' | 'warning' | 'info' | 'destructive' | 'neutral' | 'violet';
|
|
15
|
+
export type GoodTimelineState = 'completed' | 'current' | 'upcoming' | 'error' | 'deactivated';
|
|
16
|
+
export type GoodTimelineIconName = 'check' | 'clipboard-list' | 'file-text' | 'house' | 'map-pin' | 'package-check' | 'shield-check' | 'truck';
|
|
17
|
+
export type GoodTimelineSectionState = 'completed' | 'attention' | 'current' | 'upcoming' | 'optional';
|
|
18
|
+
|
|
19
|
+
const iconNames: Record<GoodTimelineIconName, GoodButtonIcon> = {
|
|
20
|
+
check: LucideCheck,
|
|
21
|
+
'clipboard-list': LucideClipboardList,
|
|
22
|
+
'file-text': LucideFileText,
|
|
23
|
+
house: LucideHouse,
|
|
24
|
+
'map-pin': LucideMapPin,
|
|
25
|
+
'package-check': LucidePackageCheck,
|
|
26
|
+
'shield-check': LucideShieldCheck,
|
|
27
|
+
truck: LucideTruck,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export interface GoodTimelineStep {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
eyebrow?: string;
|
|
35
|
+
/** Optional text on the connector from this step to the next one. */
|
|
36
|
+
transitionLabel?: string;
|
|
37
|
+
/** Lucide icon data or component. Used in icon markers and illustrated steps. */
|
|
38
|
+
icon?: GoodButtonIcon;
|
|
39
|
+
/** A built-in Lucide icon name for templates that do not need a TypeScript icon import. */
|
|
40
|
+
iconName?: GoodTimelineIconName;
|
|
41
|
+
/** Optional graphic for illustrated steps. Supply trusted application assets. */
|
|
42
|
+
imageSrc?: string;
|
|
43
|
+
/** Empty when the image is decorative because the title names the step. */
|
|
44
|
+
imageAlt?: string;
|
|
45
|
+
color?: GoodTimelineColor;
|
|
46
|
+
marker?: GoodTimelineMarker;
|
|
47
|
+
/** In illustrated timelines, place the first or last visual on the process line instead of its progress marker. */
|
|
48
|
+
endpoint?: 'start' | 'end';
|
|
49
|
+
/** Keep the step visible but muted and out of the active process path. */
|
|
50
|
+
deactivated?: boolean;
|
|
51
|
+
/** Override the state derived from currentIndex for exceptional steps. */
|
|
52
|
+
state?: GoodTimelineState;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Declarative step definition. The parent timeline owns its visible layout and semantics. */
|
|
56
|
+
@Component({
|
|
57
|
+
selector: 'good-timeline-step',
|
|
58
|
+
standalone: true,
|
|
59
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
60
|
+
host: { class: 'good-timeline-definition', '[attr.aria-hidden]': 'true' },
|
|
61
|
+
template: '',
|
|
62
|
+
})
|
|
63
|
+
export class GoodTimelineStepComponent {
|
|
64
|
+
readonly id = input.required<string>();
|
|
65
|
+
readonly title = input.required<string>();
|
|
66
|
+
readonly description = input('');
|
|
67
|
+
readonly eyebrow = input('');
|
|
68
|
+
readonly transitionLabel = input('');
|
|
69
|
+
readonly icon = input<GoodButtonIcon>();
|
|
70
|
+
readonly iconName = input<GoodTimelineIconName>();
|
|
71
|
+
readonly imageSrc = input('');
|
|
72
|
+
readonly imageAlt = input('');
|
|
73
|
+
readonly color = input<GoodTimelineColor>();
|
|
74
|
+
readonly marker = input<GoodTimelineMarker>();
|
|
75
|
+
readonly endpoint = input<'start' | 'end'>();
|
|
76
|
+
readonly deactivated = input(false, { transform: booleanAttribute });
|
|
77
|
+
readonly state = input<GoodTimelineState>();
|
|
78
|
+
|
|
79
|
+
asStep(): GoodTimelineStep {
|
|
80
|
+
return {
|
|
81
|
+
id: this.id(), title: this.title(), description: this.description(), eyebrow: this.eyebrow(),
|
|
82
|
+
transitionLabel: this.transitionLabel(), icon: this.icon(), iconName: this.iconName(),
|
|
83
|
+
imageSrc: this.imageSrc(), imageAlt: this.imageAlt(), color: this.color(), marker: this.marker(), endpoint: this.endpoint(),
|
|
84
|
+
deactivated: this.deactivated(), state: this.state(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@Component({
|
|
90
|
+
selector: 'good-timeline',
|
|
91
|
+
standalone: true,
|
|
92
|
+
imports: [LucideDynamicIcon],
|
|
93
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
94
|
+
host: {
|
|
95
|
+
class: 'good-timeline',
|
|
96
|
+
'[attr.data-orientation]': 'orientation()',
|
|
97
|
+
'[attr.data-appearance]': 'appearance()',
|
|
98
|
+
'[attr.data-tone]': 'tone()',
|
|
99
|
+
'[attr.data-marker]': 'marker()',
|
|
100
|
+
'[attr.data-size]': 'size()',
|
|
101
|
+
'[attr.data-deactivated]': 'deactivated()',
|
|
102
|
+
'[attr.data-color]': 'color()',
|
|
103
|
+
'[attr.data-completed-color]': 'completedColor() ?? null',
|
|
104
|
+
},
|
|
105
|
+
template: `
|
|
106
|
+
@if (appearance() === 'sections') {
|
|
107
|
+
<div class="good-timeline-sections" role="list" [attr.aria-label]="ariaLabel()">
|
|
108
|
+
<ng-content select="good-timeline-section" />
|
|
109
|
+
</div>
|
|
110
|
+
} @else {
|
|
111
|
+
<ol class="good-timeline-list" [attr.aria-label]="ariaLabel()">
|
|
112
|
+
@for (step of renderedSteps(); track step.id; let index = $index; let last = $last) {
|
|
113
|
+
<li class="good-timeline-step" [attr.data-state]="stateOf(step, index)"
|
|
114
|
+
[attr.data-color]="colorFor(step, index)" [attr.data-custom-color]="step.color || (stateOf(step, index) === 'completed' && completedColor()) ? 'true' : null"
|
|
115
|
+
[attr.data-endpoint]="isEndpoint(step, index, last) ? step.endpoint : null"
|
|
116
|
+
[attr.aria-current]="stateOf(step, index) === 'current' ? 'step' : null">
|
|
117
|
+
@if (appearance() === 'illustrated') {
|
|
118
|
+
<div class="good-timeline-visual" [attr.aria-hidden]="step.imageAlt ? null : 'true'">
|
|
119
|
+
@if (step.imageSrc) { <img [src]="step.imageSrc" [alt]="step.imageAlt ?? ''" /> }
|
|
120
|
+
@else if (iconFor(step); as icon) { <svg [lucideIcon]="icon" [size]="visualIconSize(step, index, last)"></svg> }
|
|
121
|
+
@else { <span>{{ index + 1 }}</span> }
|
|
122
|
+
</div>
|
|
123
|
+
}
|
|
124
|
+
<span class="good-timeline-marker" aria-hidden="true">
|
|
125
|
+
@if (markerFor(step) === 'number') { {{ index + 1 }} }
|
|
126
|
+
@else if (markerFor(step) === 'icon') {
|
|
127
|
+
@if (iconFor(step); as icon) { <svg [lucideIcon]="icon" [size]="markerIconSize()"></svg> }
|
|
128
|
+
@else { <span class="good-timeline-dot"></span> }
|
|
129
|
+
}
|
|
130
|
+
@else { <span class="good-timeline-dot"></span> }
|
|
131
|
+
</span>
|
|
132
|
+
<div class="good-timeline-content">
|
|
133
|
+
@if (step.eyebrow) { <span class="good-timeline-eyebrow">{{ step.eyebrow }}</span> }
|
|
134
|
+
<span class="good-timeline-title">{{ step.title }}</span>
|
|
135
|
+
@if (stateOf(step, index) === 'deactivated') { <span class="good-timeline-sr-only">Deactivated</span> }
|
|
136
|
+
@if (step.description) { <span class="good-timeline-description">{{ step.description }}</span> }
|
|
137
|
+
</div>
|
|
138
|
+
@if (!last) {
|
|
139
|
+
<span class="good-timeline-connector" [attr.data-completed]="stateOf(step, index) === 'completed'" aria-hidden="true">
|
|
140
|
+
@if (step.transitionLabel) { <span class="good-timeline-transition">{{ step.transitionLabel }}</span> }
|
|
141
|
+
</span>
|
|
142
|
+
}
|
|
143
|
+
</li>
|
|
144
|
+
}
|
|
145
|
+
</ol>
|
|
146
|
+
<ng-content select="good-timeline-step" />
|
|
147
|
+
}
|
|
148
|
+
`,
|
|
149
|
+
})
|
|
150
|
+
export class GoodTimelineComponent {
|
|
151
|
+
readonly steps = input<readonly GoodTimelineStep[] | null>(null);
|
|
152
|
+
readonly stepDefinitions = contentChildren(GoodTimelineStepComponent);
|
|
153
|
+
readonly renderedSteps = computed(() => this.steps() ?? this.stepDefinitions().map(step => step.asStep()));
|
|
154
|
+
readonly currentIndex = input(0);
|
|
155
|
+
readonly orientation = input<GoodTimelineOrientation>('auto');
|
|
156
|
+
readonly appearance = input<GoodTimelineAppearance>('simple');
|
|
157
|
+
readonly tone = input<GoodTimelineTone>('brand');
|
|
158
|
+
readonly marker = input<GoodTimelineMarker>('number');
|
|
159
|
+
readonly size = input<GoodTimelineSize>('default');
|
|
160
|
+
readonly deactivated = input(false, { transform: booleanAttribute });
|
|
161
|
+
readonly color = input<GoodTimelineColor>('brand');
|
|
162
|
+
readonly completedColor = input<GoodTimelineColor>();
|
|
163
|
+
readonly ariaLabel = input('Timeline');
|
|
164
|
+
|
|
165
|
+
readonly safeCurrentIndex = computed(() => Math.max(0, Math.min(this.renderedSteps().length, Math.trunc(this.currentIndex()) || 0)));
|
|
166
|
+
|
|
167
|
+
iconFor(step: GoodTimelineStep): GoodButtonIcon | null {
|
|
168
|
+
return step.icon ?? (step.iconName ? iconNames[step.iconName] : null);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
markerFor(step: GoodTimelineStep): GoodTimelineMarker { return step.marker ?? this.marker(); }
|
|
172
|
+
isEndpoint(step: GoodTimelineStep, index: number, last: boolean): boolean {
|
|
173
|
+
return this.appearance() === 'illustrated' && ((index === 0 && step.endpoint === 'start') || (last && step.endpoint === 'end'));
|
|
174
|
+
}
|
|
175
|
+
colorFor(step: GoodTimelineStep, index: number): GoodTimelineColor {
|
|
176
|
+
return step.color ?? (this.stateOf(step, index) === 'completed' ? this.completedColor() ?? this.color() : this.color());
|
|
177
|
+
}
|
|
178
|
+
visualIconSize(step: GoodTimelineStep, index: number, last: boolean): number {
|
|
179
|
+
if (this.isEndpoint(step, index, last)) return this.size() === 'small' ? 20 : this.size() === 'large' ? 30 : 26;
|
|
180
|
+
return this.size() === 'small' ? 22 : this.size() === 'large' ? 34 : 28;
|
|
181
|
+
}
|
|
182
|
+
markerIconSize(): number { return this.size() === 'small' ? 15 : this.size() === 'large' ? 22 : 18; }
|
|
183
|
+
|
|
184
|
+
stateOf(step: GoodTimelineStep, index: number): GoodTimelineState {
|
|
185
|
+
if (this.deactivated() || step.deactivated) return 'deactivated';
|
|
186
|
+
return step.state ?? (index < this.safeCurrentIndex() ? 'completed' : index === this.safeCurrentIndex() ? 'current' : 'upcoming');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** A full-width process section with a sticky heading and arbitrary projected content. */
|
|
191
|
+
@Component({
|
|
192
|
+
selector: 'good-timeline-section',
|
|
193
|
+
standalone: true,
|
|
194
|
+
imports: [LucideCheck],
|
|
195
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
196
|
+
host: {
|
|
197
|
+
class: 'good-timeline-section',
|
|
198
|
+
role: 'listitem',
|
|
199
|
+
'[attr.data-state]': 'state()',
|
|
200
|
+
'[attr.data-stuck]': 'stuck()',
|
|
201
|
+
},
|
|
202
|
+
template: `
|
|
203
|
+
<section [attr.aria-labelledby]="headingId()">
|
|
204
|
+
<header class="good-timeline-section-heading">
|
|
205
|
+
<span class="good-timeline-section-marker" aria-hidden="true">
|
|
206
|
+
@if (state() === 'completed') { <svg lucideCheck [size]="16"></svg> }
|
|
207
|
+
@else if (state() === 'attention') { <span>!</span> }
|
|
208
|
+
</span>
|
|
209
|
+
@switch (headingLevel()) {
|
|
210
|
+
@case (3) { <h3 [id]="headingId()">{{ title() }}</h3> }
|
|
211
|
+
@case (4) { <h4 [id]="headingId()">{{ title() }}</h4> }
|
|
212
|
+
@default { <h2 [id]="headingId()">{{ title() }}</h2> }
|
|
213
|
+
}
|
|
214
|
+
<span class="good-timeline-sr-only">{{ stateLabel() }}</span>
|
|
215
|
+
</header>
|
|
216
|
+
<div class="good-timeline-section-body"><ng-content /></div>
|
|
217
|
+
</section>
|
|
218
|
+
`,
|
|
219
|
+
})
|
|
220
|
+
export class GoodTimelineSectionComponent implements AfterViewInit {
|
|
221
|
+
private static nextId = 0;
|
|
222
|
+
private readonly hostElement = inject<ElementRef<HTMLElement>>(ElementRef);
|
|
223
|
+
private readonly destroyRef = inject(DestroyRef);
|
|
224
|
+
private readonly platformId = inject(PLATFORM_ID);
|
|
225
|
+
readonly title = input.required<string>();
|
|
226
|
+
readonly state = input<GoodTimelineSectionState>('upcoming');
|
|
227
|
+
readonly headingLevel = input<2 | 3 | 4>(2);
|
|
228
|
+
readonly headingId = input(`good-timeline-section-${++GoodTimelineSectionComponent.nextId}`);
|
|
229
|
+
readonly stuck = signal(false);
|
|
230
|
+
readonly stateLabel = computed(() => ({
|
|
231
|
+
completed: 'Completed', attention: 'Needs attention', current: 'Current',
|
|
232
|
+
upcoming: 'Upcoming', optional: 'Optional',
|
|
233
|
+
})[this.state()]);
|
|
234
|
+
|
|
235
|
+
ngAfterViewInit(): void {
|
|
236
|
+
if (!isPlatformBrowser(this.platformId)) return;
|
|
237
|
+
const host = this.hostElement.nativeElement;
|
|
238
|
+
let scrollParent: HTMLElement | null = host.parentElement;
|
|
239
|
+
while (scrollParent && !/(auto|scroll)/.test(getComputedStyle(scrollParent).overflowY)) scrollParent = scrollParent.parentElement;
|
|
240
|
+
const scrollTarget: HTMLElement | Window = scrollParent ?? window;
|
|
241
|
+
let frame = 0;
|
|
242
|
+
const update = () => {
|
|
243
|
+
frame = 0;
|
|
244
|
+
const top = scrollParent?.getBoundingClientRect().top ?? 0;
|
|
245
|
+
this.stuck.set(host.getBoundingClientRect().top < top - 1);
|
|
246
|
+
};
|
|
247
|
+
const onScroll = () => { if (!frame) frame = requestAnimationFrame(update); };
|
|
248
|
+
scrollTarget.addEventListener('scroll', onScroll, { passive: true });
|
|
249
|
+
update();
|
|
250
|
+
this.destroyRef.onDestroy(() => { scrollTarget.removeEventListener('scroll', onScroll); if (frame) cancelAnimationFrame(frame); });
|
|
251
|
+
}
|
|
252
|
+
}
|