@cloudfrogger/goodui 0.0.60 → 0.0.63
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 +247 -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 +140 -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 +19 -0
- package/ai/guides/design-tokens.md +10 -0
- package/ai/guides/layout.md +19 -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 +320 -0
- package/angular/projects/goodui/src/lib/alert.ts +60 -0
- package/angular/projects/goodui/src/lib/app-layout.ts +84 -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 +403 -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/fesm2022/cloudfrogger-goodui.mjs +32 -18
- package/fesm2022/cloudfrogger-goodui.mjs.map +1 -1
- 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 +23 -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 +51 -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 +89 -0
- package/guides/components/typography.md +155 -0
- package/guides/components/world-map.md +72 -0
- package/guides/contributing/design-to-code.md +265 -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 +81 -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
- package/types/cloudfrogger-goodui.d.ts +2 -2
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, ElementRef, computed, effect, forwardRef, input, model, output, signal, viewChild } from '@angular/core';
|
|
2
|
+
import { AbstractControl, ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms';
|
|
3
|
+
import { LucideDynamicIcon } from '@lucide/angular';
|
|
4
|
+
import { GoodButtonIcon } from './models';
|
|
5
|
+
import { GOOD_COMPOSITE_REQUIRED_CONTROL } from './required-control';
|
|
6
|
+
|
|
7
|
+
export type GoodPinInputSize = 'small' | 'default' | 'large';
|
|
8
|
+
export type GoodPinInputAppearance = 'brand' | 'mono';
|
|
9
|
+
|
|
10
|
+
const DEFAULT_CHARACTERS = '0-9,a-z,A-Z';
|
|
11
|
+
let nextPinInputId = 0;
|
|
12
|
+
|
|
13
|
+
/** Comma-separated characters and inclusive ranges, e.g. "0-9,A-F,@". */
|
|
14
|
+
export function goodPinAllowedCharacters(specification: string): ReadonlySet<string> {
|
|
15
|
+
const characters = new Set<string>();
|
|
16
|
+
for (const part of specification.split(',')) {
|
|
17
|
+
const sequence = Array.from(part.trim());
|
|
18
|
+
if (sequence.length === 3 && sequence[1] === '-') {
|
|
19
|
+
const start = sequence[0].codePointAt(0)!;
|
|
20
|
+
const end = sequence[2].codePointAt(0)!;
|
|
21
|
+
if (end >= start && end - start < 1024) {
|
|
22
|
+
for (let code = start; code <= end; code++) characters.add(String.fromCodePoint(code));
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
for (const character of sequence) characters.add(character);
|
|
27
|
+
}
|
|
28
|
+
return characters;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function filterPin(value: string, allowed: ReadonlySet<string>, length: number): string {
|
|
32
|
+
return Array.from(value).filter(character => allowed.has(character)).slice(0, length).join('');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Component({
|
|
36
|
+
selector: 'good-pin-input',
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [LucideDynamicIcon],
|
|
39
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
40
|
+
host: { class: 'good-pin-input' },
|
|
41
|
+
providers: [
|
|
42
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodPinInputComponent), multi: true },
|
|
43
|
+
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => GoodPinInputComponent), multi: true },
|
|
44
|
+
{ provide: GOOD_COMPOSITE_REQUIRED_CONTROL, useExisting: forwardRef(() => GoodPinInputComponent) },
|
|
45
|
+
],
|
|
46
|
+
template: `
|
|
47
|
+
@if (showLabel()) {
|
|
48
|
+
<label class="good-pin-label" [for]="fieldId()">{{ label() }}
|
|
49
|
+
@if (effectiveRequired()) { <span class="good-required-mark" aria-hidden="true">*</span><span class="good-sr-only"> required</span> }
|
|
50
|
+
</label>
|
|
51
|
+
}
|
|
52
|
+
<div class="good-pin-control" [attr.data-size]="size()" [attr.data-appearance]="appearance()"
|
|
53
|
+
[attr.data-disabled]="isDisabled()" [attr.data-focused]="focused()">
|
|
54
|
+
<input #nativeInput class="good-pin-native" [id]="fieldId()" [name]="name()" [value]="value()"
|
|
55
|
+
[type]="masked() ? 'password' : 'text'" [attr.inputmode]="inputMode()" [autocomplete]="autocomplete()"
|
|
56
|
+
autocapitalize="off" autocorrect="off" [spellcheck]="false"
|
|
57
|
+
[disabled]="isDisabled()" [required]="effectiveRequired()"
|
|
58
|
+
[attr.aria-label]="label()" [attr.aria-describedby]="describedBy() || null"
|
|
59
|
+
[attr.aria-invalid]="invalid() ? 'true' : null"
|
|
60
|
+
(input)="onInput($event)" (focus)="onFocus()" (blur)="onBlur()" (click)="onSelectionChange()"
|
|
61
|
+
(keyup)="onSelectionChange()" (select)="onSelectionChange()" />
|
|
62
|
+
<div class="good-pin-viewport">
|
|
63
|
+
<div class="good-pin-row" aria-hidden="true">
|
|
64
|
+
@for (position of positions(); track position) {
|
|
65
|
+
<span class="good-pin-slot" [attr.data-active]="focused() && activeIndex() === position && !isDisabled()"
|
|
66
|
+
[attr.data-filled]="position < characters().length" (click)="focusSlot(position)">
|
|
67
|
+
@if (characters()[position]; as character) {
|
|
68
|
+
{{ masked() ? '*' : character }}
|
|
69
|
+
} @else if (placeholderIcon(); as icon) {
|
|
70
|
+
<svg class="good-pin-placeholder-icon" [lucideIcon]="icon" [size]="iconSize()"></svg>
|
|
71
|
+
} @else if (placeholderCharacter(position); as hint) {
|
|
72
|
+
<span class="good-pin-placeholder">{{ hint }}</span>
|
|
73
|
+
}
|
|
74
|
+
</span>
|
|
75
|
+
}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
})
|
|
81
|
+
export class GoodPinInputComponent implements ControlValueAccessor, Validator {
|
|
82
|
+
readonly value = model('');
|
|
83
|
+
readonly length = input(6);
|
|
84
|
+
readonly allowedCharacters = input(DEFAULT_CHARACTERS);
|
|
85
|
+
readonly masked = input(false);
|
|
86
|
+
readonly placeholder = input('');
|
|
87
|
+
readonly placeholderIcon = input<GoodButtonIcon>();
|
|
88
|
+
readonly size = input<GoodPinInputSize>('default');
|
|
89
|
+
readonly appearance = input<GoodPinInputAppearance>('brand');
|
|
90
|
+
readonly disabled = input(false);
|
|
91
|
+
readonly required = input(false);
|
|
92
|
+
readonly label = input('PIN code');
|
|
93
|
+
readonly showLabel = input(false);
|
|
94
|
+
readonly name = input('');
|
|
95
|
+
readonly inputId = input('');
|
|
96
|
+
readonly describedBy = input('');
|
|
97
|
+
readonly autocomplete = input('one-time-code');
|
|
98
|
+
readonly completed = output<string>();
|
|
99
|
+
readonly fieldRequired = signal(false);
|
|
100
|
+
readonly focused = signal(false);
|
|
101
|
+
readonly activeIndex = signal(0);
|
|
102
|
+
private readonly formDisabled = signal(false);
|
|
103
|
+
private readonly nativeInput = viewChild<ElementRef<HTMLInputElement>>('nativeInput');
|
|
104
|
+
private readonly generatedId = `good-pin-${++nextPinInputId}`;
|
|
105
|
+
private onChange: (value: string) => void = () => {};
|
|
106
|
+
private onTouched: () => void = () => {};
|
|
107
|
+
private onValidatorChange: () => void = () => {};
|
|
108
|
+
|
|
109
|
+
readonly fieldId = computed(() => this.inputId() || this.generatedId);
|
|
110
|
+
readonly count = computed(() => Number.isFinite(this.length()) ? Math.max(1, Math.min(64, Math.floor(this.length()))) : 6);
|
|
111
|
+
readonly positions = computed(() => Array.from({ length: this.count() }, (_, index) => index));
|
|
112
|
+
readonly allowed = computed(() => goodPinAllowedCharacters(this.allowedCharacters()));
|
|
113
|
+
readonly characters = computed(() => Array.from(this.value()));
|
|
114
|
+
readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
115
|
+
readonly effectiveRequired = computed(() => this.required() || this.fieldRequired());
|
|
116
|
+
readonly invalid = computed(() => !this.isDisabled() && (this.effectiveRequired() || this.characters().length > 0) && this.characters().length !== this.count());
|
|
117
|
+
readonly inputMode = computed(() => this.allowed().size > 0 && [...this.allowed()].every(character => /^[0-9]$/.test(character)) ? 'numeric' : 'text');
|
|
118
|
+
readonly iconSize = computed(() => ({ small: 14, default: 16, large: 20 })[this.size()]);
|
|
119
|
+
|
|
120
|
+
constructor() {
|
|
121
|
+
effect(() => {
|
|
122
|
+
const normalized = filterPin(this.value(), this.allowed(), this.count());
|
|
123
|
+
if (normalized !== this.value()) {
|
|
124
|
+
this.value.set(normalized);
|
|
125
|
+
this.onChange(normalized);
|
|
126
|
+
}
|
|
127
|
+
this.effectiveRequired();
|
|
128
|
+
this.isDisabled();
|
|
129
|
+
this.onValidatorChange();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
placeholderCharacter(position: number): string {
|
|
134
|
+
const hint = Array.from(this.placeholder());
|
|
135
|
+
return hint.length === 1 ? hint[0] : hint[position] ?? '';
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
focusSlot(position: number): void {
|
|
139
|
+
if (this.isDisabled()) return;
|
|
140
|
+
const input = this.nativeInput()?.nativeElement;
|
|
141
|
+
if (!input) return;
|
|
142
|
+
input.focus();
|
|
143
|
+
const caret = Math.min(position, this.characters().length);
|
|
144
|
+
input.setSelectionRange(caret, caret);
|
|
145
|
+
this.activeIndex.set(Math.min(caret, this.count() - 1));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
onInput(event: Event): void {
|
|
149
|
+
const input = event.target as HTMLInputElement;
|
|
150
|
+
const caret = input.selectionStart ?? input.value.length;
|
|
151
|
+
const next = filterPin(input.value, this.allowed(), this.count());
|
|
152
|
+
const nextCaret = Array.from(filterPin(input.value.slice(0, caret), this.allowed(), this.count())).length;
|
|
153
|
+
const previous = this.value();
|
|
154
|
+
input.value = next;
|
|
155
|
+
input.setSelectionRange(nextCaret, nextCaret);
|
|
156
|
+
this.activeIndex.set(Math.min(nextCaret, this.count() - 1));
|
|
157
|
+
if (next === previous) return;
|
|
158
|
+
this.value.set(next);
|
|
159
|
+
this.onChange(next);
|
|
160
|
+
if (Array.from(next).length === this.count()) this.completed.emit(next);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onFocus(): void {
|
|
164
|
+
this.focused.set(true);
|
|
165
|
+
this.onSelectionChange();
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
onSelectionChange(): void {
|
|
169
|
+
const caret = this.nativeInput()?.nativeElement.selectionStart ?? this.characters().length;
|
|
170
|
+
this.activeIndex.set(Math.min(caret, this.count() - 1));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
onBlur(): void {
|
|
174
|
+
this.focused.set(false);
|
|
175
|
+
this.onTouched();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
setFieldRequired(required: boolean): void { this.fieldRequired.set(required); }
|
|
179
|
+
validate(control: AbstractControl): ValidationErrors | null {
|
|
180
|
+
if (this.isDisabled()) return null;
|
|
181
|
+
const value = String(control.value ?? '');
|
|
182
|
+
if (!value) return this.effectiveRequired() ? { required: true } : null;
|
|
183
|
+
if (value !== filterPin(value, this.allowed(), this.count()) || Array.from(value).length !== this.count()) {
|
|
184
|
+
return { pinCode: { requiredLength: this.count(), actualLength: Array.from(value).length } };
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
registerOnValidatorChange(fn: () => void): void { this.onValidatorChange = fn; }
|
|
189
|
+
writeValue(value: unknown): void { this.value.set(filterPin(value == null ? '' : String(value), this.allowed(), this.count())); }
|
|
190
|
+
registerOnChange(fn: (value: string) => void): void { this.onChange = fn; }
|
|
191
|
+
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
|
|
192
|
+
setDisabledState(disabled: boolean): void { this.formDisabled.set(disabled); }
|
|
193
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, computed, effect, input, signal } from '@angular/core';
|
|
2
|
+
import { GOOD_MARKER_COLORS, GoodMarkerColor } from './marker-colors';
|
|
3
|
+
|
|
4
|
+
export type GoodProgressMode = 'determinate' | 'indeterminate' | 'timed';
|
|
5
|
+
export type GoodProgressAppearance = 'solid' | 'segmented';
|
|
6
|
+
export type GoodProgressSize = 'small' | 'default' | 'large';
|
|
7
|
+
export type GoodProgressColor = 'brand' | 'accent' | 'secondary' | 'destructive' | 'warning' | 'success' | 'info' | 'text' | GoodMarkerColor;
|
|
8
|
+
|
|
9
|
+
export const GOOD_PROGRESS_COLORS: readonly GoodProgressColor[] = [
|
|
10
|
+
'brand', 'accent', 'secondary', 'destructive', 'warning', 'success', 'info', 'text', ...GOOD_MARKER_COLORS,
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const namedColors = new Set<string>(GOOD_PROGRESS_COLORS);
|
|
14
|
+
let nextProgressId = 0;
|
|
15
|
+
|
|
16
|
+
function validCustomColor(value: string): boolean {
|
|
17
|
+
if (!value || /[;{}<>]/.test(value)) return false;
|
|
18
|
+
if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') return CSS.supports('color', value);
|
|
19
|
+
return /^(?:#(?:[\da-f]{3}|[\da-f]{4}|[\da-f]{6}|[\da-f]{8})|(?:rgb|rgba|hsl|hsla)\([\d.%\s,/+-]+\)|var\(--[\w-]+\))$/i.test(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Component({
|
|
23
|
+
selector: 'good-progress',
|
|
24
|
+
standalone: true,
|
|
25
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
26
|
+
host: {
|
|
27
|
+
class: 'good-progress',
|
|
28
|
+
'[attr.data-mode]': 'mode()',
|
|
29
|
+
'[attr.data-appearance]': 'appearance()',
|
|
30
|
+
'[attr.data-size]': 'size()',
|
|
31
|
+
'[attr.data-color]': 'colorName()',
|
|
32
|
+
'[style.--good-progress-fill-color]': 'customColor()',
|
|
33
|
+
},
|
|
34
|
+
template: `
|
|
35
|
+
@if (title() || (showPercent() && mode() !== 'indeterminate')) {
|
|
36
|
+
<div class="good-progress-label">
|
|
37
|
+
@if (title()) { <span class="good-progress-title" [id]="titleId">{{ title() }}</span> }
|
|
38
|
+
@if (showPercent() && mode() !== 'indeterminate') { <span class="good-progress-value">{{ roundedValue() }}%</span> }
|
|
39
|
+
</div>
|
|
40
|
+
}
|
|
41
|
+
<div class="good-progress-track" role="progressbar" aria-valuemin="0" aria-valuemax="100"
|
|
42
|
+
[attr.aria-label]="title() ? null : ariaLabel()"
|
|
43
|
+
[attr.aria-labelledby]="title() ? titleId : null"
|
|
44
|
+
[attr.aria-valuenow]="mode() === 'indeterminate' ? null : roundedValue()"
|
|
45
|
+
[attr.aria-valuetext]="mode() === 'indeterminate' ? 'In progress' : null">
|
|
46
|
+
<span class="good-progress-fill" [style.width.%]="mode() === 'indeterminate' ? null : currentValue()" aria-hidden="true"></span>
|
|
47
|
+
</div>
|
|
48
|
+
`,
|
|
49
|
+
})
|
|
50
|
+
export class GoodProgressComponent {
|
|
51
|
+
readonly mode = input<GoodProgressMode>('determinate');
|
|
52
|
+
readonly appearance = input<GoodProgressAppearance>('solid');
|
|
53
|
+
readonly size = input<GoodProgressSize>('default');
|
|
54
|
+
readonly value = input(0);
|
|
55
|
+
readonly durationMs = input(5000);
|
|
56
|
+
readonly loop = input(true);
|
|
57
|
+
readonly title = input('');
|
|
58
|
+
readonly showPercent = input(false);
|
|
59
|
+
/** Use a GoodUI color name, or a CSS color such as rgb(44 130 202) or #2c82ca. */
|
|
60
|
+
readonly color = input<GoodProgressColor | string>('brand');
|
|
61
|
+
readonly ariaLabel = input('Progress');
|
|
62
|
+
|
|
63
|
+
readonly titleId = `good-progress-title-${++nextProgressId}`;
|
|
64
|
+
readonly timedValue = signal(0);
|
|
65
|
+
readonly colorName = computed(() => {
|
|
66
|
+
const name = this.color().trim();
|
|
67
|
+
return namedColors.has(name) ? name : validCustomColor(name) ? 'custom' : 'brand';
|
|
68
|
+
});
|
|
69
|
+
readonly customColor = computed(() => this.colorName() === 'custom' ? this.color().trim() : null);
|
|
70
|
+
readonly currentValue = computed(() => {
|
|
71
|
+
const value = this.mode() === 'timed' ? this.timedValue() : this.value();
|
|
72
|
+
return Number.isFinite(value) ? Math.min(100, Math.max(0, value)) : 0;
|
|
73
|
+
});
|
|
74
|
+
readonly roundedValue = computed(() => Math.round(this.currentValue()));
|
|
75
|
+
|
|
76
|
+
constructor() {
|
|
77
|
+
effect(onCleanup => {
|
|
78
|
+
if (this.mode() !== 'timed' || typeof requestAnimationFrame !== 'function') return;
|
|
79
|
+
const duration = Number.isFinite(this.durationMs()) ? Math.max(250, this.durationMs()) : 5000;
|
|
80
|
+
const loop = this.loop();
|
|
81
|
+
const start = performance.now();
|
|
82
|
+
this.timedValue.set(0);
|
|
83
|
+
let frame = 0;
|
|
84
|
+
const advance = (time: number): void => {
|
|
85
|
+
const elapsed = Math.max(0, (time - start) / duration);
|
|
86
|
+
this.timedValue.set((loop ? elapsed % 1 : Math.min(elapsed, 1)) * 100);
|
|
87
|
+
if (loop || elapsed < 1) frame = requestAnimationFrame(advance);
|
|
88
|
+
};
|
|
89
|
+
frame = requestAnimationFrame(advance);
|
|
90
|
+
onCleanup(() => cancelAnimationFrame(frame));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EnvironmentProviders, makeEnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { GOODUI_OPTIONS, GoodUIOptions } from './goodui-config';
|
|
3
|
+
import { GoodNotificationCenter } from './notification-center';
|
|
4
|
+
import { GoodThemeService } from './theme';
|
|
5
|
+
import { GoodCalendarService } from './calendar-service';
|
|
6
|
+
|
|
7
|
+
/** Register GoodUI's application services and their shared options at bootstrap. */
|
|
8
|
+
export function provideGoodUI(options: GoodUIOptions = {}): EnvironmentProviders {
|
|
9
|
+
return makeEnvironmentProviders([
|
|
10
|
+
{ provide: GOODUI_OPTIONS, useValue: options },
|
|
11
|
+
GoodNotificationCenter,
|
|
12
|
+
GoodThemeService,
|
|
13
|
+
GoodCalendarService,
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
|
|
4
|
+
export type GoodRadioSize = 'small' | 'default' | 'large';
|
|
5
|
+
export type GoodRadioAppearance = 'brand' | 'mono';
|
|
6
|
+
|
|
7
|
+
export interface GoodRadioOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let nextRadioGroupId = 0;
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'good-radio-group',
|
|
18
|
+
standalone: true,
|
|
19
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
20
|
+
providers: [
|
|
21
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => GoodRadioGroupComponent), multi: true },
|
|
22
|
+
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => GoodRadioGroupComponent), multi: true },
|
|
23
|
+
],
|
|
24
|
+
host: { class: 'good-radio-group' },
|
|
25
|
+
template: `
|
|
26
|
+
<fieldset class="good-radio-fieldset" [disabled]="isDisabled()" [attr.data-size]="size()"
|
|
27
|
+
[attr.data-appearance]="appearance()" [attr.data-orientation]="orientation()"
|
|
28
|
+
[attr.aria-describedby]="describedBy() || null" [attr.aria-labelledby]="labelledBy() || null">
|
|
29
|
+
<legend class="good-radio-legend" [class.good-radio-visually-hidden]="!showLabel() || !!labelledBy()">{{ label() }}@if (effectiveRequired()) { <span class="good-required-mark" aria-hidden="true">*</span><span class="good-sr-only"> required</span> }</legend>
|
|
30
|
+
<div class="good-radio-options">
|
|
31
|
+
@for (option of options(); track option.value) {
|
|
32
|
+
<label class="good-radio-option" [attr.data-disabled]="option.disabled ? 'true' : null">
|
|
33
|
+
<input class="good-radio-input" type="radio" [name]="groupName()" [value]="option.value"
|
|
34
|
+
[checked]="value() === option.value" [disabled]="option.disabled || isDisabled()"
|
|
35
|
+
[required]="effectiveRequired()" (change)="select(option.value)" (blur)="onBlur()" />
|
|
36
|
+
<span class="good-radio-indicator" aria-hidden="true"><span class="good-radio-dot"></span></span>
|
|
37
|
+
<span class="good-radio-copy"><span class="good-radio-option-label">{{ option.label }}</span>
|
|
38
|
+
@if (option.description) { <span class="good-radio-description">{{ option.description }}</span> }
|
|
39
|
+
</span>
|
|
40
|
+
</label>
|
|
41
|
+
}
|
|
42
|
+
</div>
|
|
43
|
+
</fieldset>
|
|
44
|
+
`,
|
|
45
|
+
})
|
|
46
|
+
export class GoodRadioGroupComponent implements ControlValueAccessor, Validator {
|
|
47
|
+
readonly options = input.required<readonly GoodRadioOption[]>();
|
|
48
|
+
readonly label = input.required<string>();
|
|
49
|
+
readonly showLabel = input(true);
|
|
50
|
+
readonly value = model<string | null>(null);
|
|
51
|
+
readonly size = input<GoodRadioSize>('default');
|
|
52
|
+
readonly appearance = input<GoodRadioAppearance>('brand');
|
|
53
|
+
readonly orientation = input<'vertical' | 'horizontal'>('vertical');
|
|
54
|
+
readonly disabled = input(false);
|
|
55
|
+
readonly required = input(false);
|
|
56
|
+
readonly fieldRequired = signal(false);
|
|
57
|
+
readonly effectiveRequired = computed(() => this.required() || this.fieldRequired());
|
|
58
|
+
readonly name = input('');
|
|
59
|
+
readonly labelledBy = input('');
|
|
60
|
+
readonly describedBy = input('');
|
|
61
|
+
private readonly defaultName = `good-radio-group-${++nextRadioGroupId}`;
|
|
62
|
+
private readonly formDisabled = signal(false);
|
|
63
|
+
readonly isDisabled = computed(() => this.disabled() || this.formDisabled());
|
|
64
|
+
readonly groupName = computed(() => this.name() || this.defaultName);
|
|
65
|
+
private onChange: (value: string | null) => void = () => {};
|
|
66
|
+
private onTouched: () => void = () => {};
|
|
67
|
+
private onValidatorChange: () => void = () => {};
|
|
68
|
+
|
|
69
|
+
constructor() {
|
|
70
|
+
effect(() => {
|
|
71
|
+
this.effectiveRequired();
|
|
72
|
+
this.isDisabled();
|
|
73
|
+
this.onValidatorChange();
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
setFieldRequired(required: boolean): void { this.fieldRequired.set(required); }
|
|
78
|
+
validate(control: AbstractControl): ValidationErrors | null {
|
|
79
|
+
return this.effectiveRequired() && !this.isDisabled() ? Validators.required(control) : null;
|
|
80
|
+
}
|
|
81
|
+
registerOnValidatorChange(fn: () => void): void { this.onValidatorChange = fn; }
|
|
82
|
+
|
|
83
|
+
select(value: string): void {
|
|
84
|
+
if (this.isDisabled() || this.options().find(option => option.value === value)?.disabled) return;
|
|
85
|
+
this.value.set(value);
|
|
86
|
+
this.onChange(value);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
onBlur(): void { this.onTouched(); }
|
|
90
|
+
writeValue(value: unknown): void { this.value.set(typeof value === 'string' ? value : null); }
|
|
91
|
+
registerOnChange(fn: (value: string | null) => void): void { this.onChange = fn; }
|
|
92
|
+
registerOnTouched(fn: () => void): void { this.onTouched = fn; }
|
|
93
|
+
setDisabledState(disabled: boolean): void { this.formDisabled.set(disabled); }
|
|
94
|
+
}
|