@alepha/ui 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -12
- package/dist/components/account/account-connections.js +5 -5
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.js +4 -4
- package/dist/components/account/account-header.d.ts.map +1 -1
- package/dist/components/account/account-header.js +3 -1
- package/dist/components/account/account-header.js.map +1 -1
- package/dist/components/account/account-keys.js +7 -7
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-layout.d.ts.map +1 -1
- package/dist/components/account/account-layout.js +7 -4
- package/dist/components/account/account-layout.js.map +1 -1
- package/dist/components/account/account-password-dialog.js +3 -3
- package/dist/components/account/account-profile.js +8 -8
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router-options.d.ts.map +1 -1
- package/dist/components/account/account-router-options.js.map +1 -1
- package/dist/components/account/account-router-page.d.ts.map +1 -1
- package/dist/components/account/account-router-page.js.map +1 -1
- package/dist/components/account/account-router.d.ts +3 -2
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +4 -3
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/account/account-security.d.ts.map +1 -1
- package/dist/components/account/account-security.js +6 -6
- package/dist/components/account/account-security.js.map +1 -1
- package/dist/components/account/account-sessions.d.ts.map +1 -1
- package/dist/components/account/account-sessions.js +19 -6
- package/dist/components/account/account-sessions.js.map +1 -1
- package/dist/components/admin/admin-analytics-query-panel.d.ts +1 -1
- package/dist/components/admin/admin-analytics-query-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics-query-panel.js +5 -5
- package/dist/components/admin/admin-analytics-query-panel.js.map +1 -1
- package/dist/components/admin/admin-analytics-results.d.ts +1 -1
- package/dist/components/admin/admin-analytics-results.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics-results.js +2 -2
- package/dist/components/admin/admin-analytics-results.js.map +1 -1
- package/dist/components/admin/admin-analytics.d.ts +1 -1
- package/dist/components/admin/admin-analytics.d.ts.map +1 -1
- package/dist/components/admin/admin-analytics.js +3 -3
- package/dist/components/admin/admin-analytics.js.map +1 -1
- package/dist/components/admin/admin-audits.d.ts +1 -1
- package/dist/components/admin/admin-audits.d.ts.map +1 -1
- package/dist/components/admin/admin-audits.js +4 -4
- package/dist/components/admin/admin-audits.js.map +1 -1
- package/dist/components/admin/admin-dashboard-card.d.ts +42 -0
- package/dist/components/admin/admin-dashboard-card.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard-card.js +0 -0
- package/dist/components/admin/admin-dashboard-count-card.d.ts +34 -0
- package/dist/components/admin/admin-dashboard-count-card.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard-count-card.js +42 -0
- package/dist/components/admin/admin-dashboard-count-card.js.map +1 -0
- package/dist/components/admin/admin-dashboard.d.ts +20 -0
- package/dist/components/admin/admin-dashboard.d.ts.map +1 -0
- package/dist/components/admin/admin-dashboard.js +32 -0
- package/dist/components/admin/admin-dashboard.js.map +1 -0
- package/dist/components/admin/admin-files.d.ts +1 -1
- package/dist/components/admin/admin-files.d.ts.map +1 -1
- package/dist/components/admin/admin-files.js +3 -3
- package/dist/components/admin/admin-files.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts +2 -2
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +16 -31
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.d.ts +2 -2
- package/dist/components/admin/admin-jobs-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.js +2 -2
- package/dist/components/admin/admin-jobs-status-badge.js.map +1 -1
- package/dist/components/admin/admin-jobs.d.ts +1 -1
- package/dist/components/admin/admin-jobs.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs.js +5 -5
- package/dist/components/admin/admin-jobs.js.map +1 -1
- package/dist/components/admin/admin-keys-token-dialog.js +3 -3
- package/dist/components/admin/admin-keys-token-dialog.js.map +1 -1
- package/dist/components/admin/admin-keys.d.ts +1 -1
- package/dist/components/admin/admin-keys.d.ts.map +1 -1
- package/dist/components/admin/admin-keys.js +4 -4
- package/dist/components/admin/admin-keys.js.map +1 -1
- package/dist/components/admin/admin-layout.d.ts.map +1 -1
- package/dist/components/admin/admin-layout.js +1 -3
- package/dist/components/admin/admin-layout.js.map +1 -1
- package/dist/components/admin/admin-notifications.d.ts +1 -1
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +3 -3
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-parameters.d.ts +1 -1
- package/dist/components/admin/admin-parameters.d.ts.map +1 -1
- package/dist/components/admin/admin-parameters.js +10 -10
- package/dist/components/admin/admin-parameters.js.map +1 -1
- package/dist/components/admin/admin-payments.d.ts +1 -1
- package/dist/components/admin/admin-payments.d.ts.map +1 -1
- package/dist/components/admin/admin-payments.js +3 -3
- package/dist/components/admin/admin-payments.js.map +1 -1
- package/dist/components/admin/admin-router-options.d.ts +13 -10
- package/dist/components/admin/admin-router-options.d.ts.map +1 -1
- package/dist/components/admin/admin-router-options.js.map +1 -1
- package/dist/components/admin/admin-router-page.d.ts +7 -5
- package/dist/components/admin/admin-router-page.d.ts.map +1 -1
- package/dist/components/admin/admin-router-page.js +7 -5
- package/dist/components/admin/admin-router-page.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +72 -27
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +103 -40
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +12 -4
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts +2 -2
- package/dist/components/admin/admin-user-detail-audits-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-audits-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts +4 -3
- package/dist/components/admin/admin-user-detail-identity-aside.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-identity-aside.js +13 -69
- package/dist/components/admin/admin-user-detail-identity-aside.js.map +1 -1
- package/dist/components/admin/admin-user-detail-overview-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-overview-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-password-dialog.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-password-dialog.js.map +1 -1
- package/dist/components/admin/admin-user-detail-profile-policy.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-profile-policy.js.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.js +2 -2
- package/dist/components/admin/admin-user-detail-security-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts +2 -2
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail.js +68 -111
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts +6 -1
- package/dist/components/admin/admin-users-roles-picker.d.ts.map +1 -1
- package/dist/components/admin/admin-users-roles-picker.js +11 -8
- package/dist/components/admin/admin-users-roles-picker.js.map +1 -1
- package/dist/components/admin/admin-users.d.ts.map +1 -1
- package/dist/components/admin/admin-users.js +9 -12
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts +2 -2
- package/dist/components/admin/admin-workflows-execution-sheet.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-execution-sheet.js +10 -10
- package/dist/components/admin/admin-workflows-execution-sheet.js.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts +2 -2
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +20 -44
- package/dist/components/admin/admin-workflows-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts +2 -2
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.js +2 -2
- package/dist/components/admin/admin-workflows-status-badge.js.map +1 -1
- package/dist/components/admin/admin-workflows.d.ts +1 -1
- package/dist/components/admin/admin-workflows.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows.js +5 -5
- package/dist/components/admin/admin-workflows.js.map +1 -1
- package/dist/components/admin/diff-lines.js +1 -1
- package/dist/components/admin/diff-lines.js.map +1 -1
- package/dist/components/admin/parameter-diff-dialog.d.ts.map +1 -1
- package/dist/components/admin/parameter-diff-dialog.js +1 -1
- package/dist/components/admin/parameter-diff-dialog.js.map +1 -1
- package/dist/components/admin/parameter-history-item.d.ts.map +1 -1
- package/dist/components/admin/parameter-history-item.js +4 -4
- package/dist/components/admin/parameter-history-item.js.map +1 -1
- package/dist/components/admin/parameter-json-dialog.js +1 -1
- package/dist/components/admin/parameter-save-dialog.js +2 -2
- package/dist/components/admin/use-confirmed-action.js +1 -1
- package/dist/components/alepha-table/alepha-table.d.ts +103 -8
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +128 -26
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/alepha-table/paginate-local.d.ts +43 -0
- package/dist/components/alepha-table/paginate-local.d.ts.map +1 -0
- package/dist/components/alepha-table/paginate-local.js +84 -0
- package/dist/components/alepha-table/paginate-local.js.map +1 -0
- package/dist/components/app-actions/app-actions.js +1 -1
- package/dist/components/app-shell/app-shell.d.ts +10 -1
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/app-shell.js +27 -20
- package/dist/components/app-shell/app-shell.js.map +1 -1
- package/dist/components/auth/auth-login.d.ts +1 -1
- package/dist/components/auth/auth-login.d.ts.map +1 -1
- package/dist/components/auth/auth-login.js +7 -18
- package/dist/components/auth/auth-login.js.map +1 -1
- package/dist/components/auth/auth-register.d.ts +1 -1
- package/dist/components/auth/auth-register.d.ts.map +1 -1
- package/dist/components/auth/auth-register.js +20 -21
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auth/auth-reset-password.d.ts +1 -1
- package/dist/components/auth/auth-reset-password.d.ts.map +1 -1
- package/dist/components/auth/auth-reset-password.js +16 -13
- package/dist/components/auth/auth-reset-password.js.map +1 -1
- package/dist/components/auth/auth-router.d.ts +3 -3
- package/dist/components/auth/auth-router.d.ts.map +1 -1
- package/dist/components/auth/auth-router.js +3 -3
- package/dist/components/auth/auth-router.js.map +1 -1
- package/dist/components/auth/auth-verify-email.d.ts +1 -1
- package/dist/components/auth/auth-verify-email.d.ts.map +1 -1
- package/dist/components/auth/auth-verify-email.js +8 -8
- package/dist/components/auth/auth-verify-email.js.map +1 -1
- package/dist/components/auth/safe-redirect.d.ts +9 -0
- package/dist/components/auth/safe-redirect.d.ts.map +1 -0
- package/dist/components/auth/safe-redirect.js +19 -0
- package/dist/components/auth/safe-redirect.js.map +1 -0
- package/dist/components/auto-form/auto-form.d.ts.map +1 -1
- package/dist/components/auto-form/auto-form.js +32 -32
- package/dist/components/auto-form/auto-form.js.map +1 -1
- package/dist/components/brand-icon/brand-icon.d.ts +1 -1
- package/dist/components/brand-icon/brand-icon.d.ts.map +1 -1
- package/dist/components/brand-icon/brand-icon.js +2 -2
- package/dist/components/brand-icon/brand-icon.js.map +1 -1
- package/dist/components/button-dark/button-dark.d.ts +1 -1
- package/dist/components/button-dark/button-dark.d.ts.map +1 -1
- package/dist/components/button-dark/button-dark.js +2 -2
- package/dist/components/button-dark/button-dark.js.map +1 -1
- package/dist/components/button-language/button-language.d.ts +1 -1
- package/dist/components/button-language/button-language.d.ts.map +1 -1
- package/dist/components/button-language/button-language.js +2 -2
- package/dist/components/button-language/button-language.js.map +1 -1
- package/dist/components/button-theme/button-theme.d.ts +1 -1
- package/dist/components/button-theme/button-theme.d.ts.map +1 -1
- package/dist/components/button-theme/button-theme.js +3 -3
- package/dist/components/button-theme/button-theme.js.map +1 -1
- package/dist/components/button-user/button-user.d.ts +2 -20
- package/dist/components/button-user/button-user.d.ts.map +1 -1
- package/dist/components/button-user/button-user.js +3 -3
- package/dist/components/button-user/button-user.js.map +1 -1
- package/dist/components/captcha/turnstile-widget.d.ts +2 -2
- package/dist/components/captcha/turnstile-widget.d.ts.map +1 -1
- package/dist/components/captcha/turnstile-widget.js +5 -4
- package/dist/components/captcha/turnstile-widget.js.map +1 -1
- package/dist/components/control/control.d.ts +1 -1
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +8 -11
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.d.ts +1 -1
- package/dist/components/control-array/control-array.d.ts.map +1 -1
- package/dist/components/control-array/control-array.js +23 -16
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-base/field-i18n.d.ts +5 -3
- package/dist/components/control-base/field-i18n.d.ts.map +1 -1
- package/dist/components/control-base/field-i18n.js +4 -2
- package/dist/components/control-base/field-i18n.js.map +1 -1
- package/dist/components/control-base/form-field.d.ts +7 -7
- package/dist/components/control-base/form-field.d.ts.map +1 -1
- package/dist/components/control-base/form-field.js +10 -10
- package/dist/components/control-base/form-field.js.map +1 -1
- package/dist/components/control-base/icon-hint.d.ts +1 -1
- package/dist/components/control-base/icon-hint.d.ts.map +1 -1
- package/dist/components/control-base/icon-hint.js.map +1 -1
- package/dist/components/control-date/control-date.d.ts +1 -1
- package/dist/components/control-date/control-date.d.ts.map +1 -1
- package/dist/components/control-date/control-date.js +23 -7
- package/dist/components/control-date/control-date.js.map +1 -1
- package/dist/components/control-number/control-number.d.ts +2 -2
- package/dist/components/control-number/control-number.d.ts.map +1 -1
- package/dist/components/control-number/control-number.js +3 -3
- package/dist/components/control-number/control-number.js.map +1 -1
- package/dist/components/control-object/control-object.d.ts +4 -2
- package/dist/components/control-object/control-object.d.ts.map +1 -1
- package/dist/components/control-object/control-object.js +8 -8
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-password/control-password.js +2 -3
- package/dist/components/control-password/control-password.js.map +1 -1
- package/dist/components/control-select/control-select.d.ts +2 -2
- package/dist/components/control-select/control-select.d.ts.map +1 -1
- package/dist/components/control-select/control-select.js +17 -17
- package/dist/components/control-select/control-select.js.map +1 -1
- package/dist/components/control-upload/control-upload.d.ts +1 -1
- package/dist/components/control-upload/control-upload.d.ts.map +1 -1
- package/dist/components/control-upload/control-upload.js +11 -11
- package/dist/components/control-upload/control-upload.js.map +1 -1
- package/dist/components/detail/detail-aside.d.ts +58 -0
- package/dist/components/detail/detail-aside.d.ts.map +1 -0
- package/dist/components/detail/detail-aside.js +95 -0
- package/dist/components/detail/detail-aside.js.map +1 -0
- package/dist/components/detail/detail-layout.d.ts +90 -0
- package/dist/components/detail/detail-layout.d.ts.map +1 -0
- package/dist/components/detail/detail-layout.js +102 -0
- package/dist/components/detail/detail-layout.js.map +1 -0
- package/dist/components/detail/use-detail-tab.d.ts +15 -0
- package/dist/components/detail/use-detail-tab.d.ts.map +1 -0
- package/dist/components/detail/use-detail-tab.js +37 -0
- package/dist/components/detail/use-detail-tab.js.map +1 -0
- package/dist/components/file-image/file-image.d.ts.map +1 -1
- package/dist/components/file-image/file-image.js.map +1 -1
- package/dist/components/language-toggle/language-toggle.d.ts +1 -1
- package/dist/components/language-toggle/language-toggle.d.ts.map +1 -1
- package/dist/components/language-toggle/language-toggle.js +2 -2
- package/dist/components/language-toggle/language-toggle.js.map +1 -1
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.d.ts +28 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.js +25 -0
- package/dist/components/markdown-view/diagram/DiagramErrorBoundary.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts +44 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js +98 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.d.ts +14 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js +45 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts +19 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js +69 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts +23 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js +34 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts +17 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js +63 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js.map +1 -0
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts +30 -0
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/MermaidFence.js +30 -0
- package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -0
- package/dist/components/markdown-view/diagram/flowchartParser.d.ts +18 -0
- package/dist/components/markdown-view/diagram/flowchartParser.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/flowchartParser.js +370 -0
- package/dist/components/markdown-view/diagram/flowchartParser.js.map +1 -0
- package/dist/components/markdown-view/diagram/graphModel.d.ts +67 -0
- package/dist/components/markdown-view/diagram/graphModel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/graphModel.js +0 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.d.ts +109 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.js +185 -0
- package/dist/components/markdown-view/diagram/layoutFlowchart.js.map +1 -0
- package/dist/components/markdown-view/diagram/textMetrics.d.ts +63 -0
- package/dist/components/markdown-view/diagram/textMetrics.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/textMetrics.js +228 -0
- package/dist/components/markdown-view/diagram/textMetrics.js.map +1 -0
- package/dist/components/markdown-view/markdown-view.d.ts +32 -0
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +85 -9
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/nav-shell/nav-shell.d.ts +1 -1
- package/dist/components/nav-shell/nav-shell.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-shell.js +1 -1
- package/dist/components/nav-shell/nav-shell.js.map +1 -1
- package/dist/components/nav-shell/spotlight.d.ts.map +1 -1
- package/dist/components/nav-shell/spotlight.js.map +1 -1
- package/dist/components/nav-shell/use-nav-breadcrumbs.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-breadcrumbs.js.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.d.ts +15 -5
- package/dist/components/nav-shell/use-nav-entries.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.js +1 -1
- package/dist/components/nav-shell/use-nav-entries.js.map +1 -1
- package/dist/components/nav-shell/use-nav-tree.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-tree.js.map +1 -1
- package/dist/components/settings/settings-card-edge.d.ts +25 -0
- package/dist/components/settings/settings-card-edge.d.ts.map +1 -0
- package/dist/components/settings/settings-card-edge.js +29 -0
- package/dist/components/settings/settings-card-edge.js.map +1 -0
- package/dist/components/settings/settings-danger-section.d.ts.map +1 -1
- package/dist/components/settings/settings-danger-section.js +2 -1
- package/dist/components/settings/settings-danger-section.js.map +1 -1
- package/dist/components/settings/settings-layout.d.ts.map +1 -1
- package/dist/components/settings/settings-layout.js +1 -1
- package/dist/components/settings/settings-layout.js.map +1 -1
- package/dist/components/settings/settings-nav.d.ts.map +1 -1
- package/dist/components/settings/settings-nav.js +3 -3
- package/dist/components/settings/settings-nav.js.map +1 -1
- package/dist/components/settings/settings-row.js +2 -2
- package/dist/components/settings/settings-row.js.map +1 -1
- package/dist/components/settings/settings-section.d.ts.map +1 -1
- package/dist/components/settings/settings-section.js +3 -2
- package/dist/components/settings/settings-section.js.map +1 -1
- package/dist/components/ui/accordion.js +3 -3
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +5 -5
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.js +2 -2
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/avatar.js +5 -5
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/badge.d.ts +13 -2
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js +51 -12
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/breadcrumb.js +3 -3
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button-group.js +2 -2
- package/dist/components/ui/button-group.js.map +1 -1
- package/dist/components/ui/button.js +2 -2
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/calendar.js +8 -8
- package/dist/components/ui/calendar.js.map +1 -1
- package/dist/components/ui/card.js +3 -3
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +20 -10
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/chart.js +7 -6
- package/dist/components/ui/chart.js.map +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox.js +8 -8
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +6 -6
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.js +8 -8
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.js +4 -4
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.js +4 -4
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.js +9 -9
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/empty.js +2 -2
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/hover-card.js +1 -1
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group.js +3 -3
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input-otp.js +3 -3
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/item.js +3 -3
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/kbd.js +1 -1
- package/dist/components/ui/kbd.js.map +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.js +9 -9
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.js +7 -7
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.js +1 -1
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.js +3 -3
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/radio-group.js +2 -2
- package/dist/components/ui/radio-group.js.map +1 -1
- package/dist/components/ui/resizable.js +2 -2
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.js +2 -2
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +1 -1
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select.js +8 -8
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.js +1 -1
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/sheet.js +3 -3
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.js +17 -17
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/skeleton.js +1 -1
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/slider.js +2 -2
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/switch.js +2 -2
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +5 -5
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.js +2 -2
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +13 -7
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.js +2 -2
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +10 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +13 -3
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/components/use-dialog/use-dialog.d.ts +2 -2
- package/dist/components/use-dialog/use-dialog.d.ts.map +1 -1
- package/dist/components/use-dialog/use-dialog.js +10 -6
- package/dist/components/use-dialog/use-dialog.js.map +1 -1
- package/dist/components/use-toast/use-toast.d.ts +9 -3
- package/dist/components/use-toast/use-toast.d.ts.map +1 -1
- package/dist/components/use-toast/use-toast.js +23 -22
- package/dist/components/use-toast/use-toast.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +10 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/hooks/use-mobile.js +19 -12
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts +3 -3
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +13 -8
- package/dist/lib/i18n-fr.js.map +1 -1
- package/dist/styles.css +5 -5
- package/package.json +46 -45
- package/src/components/account/__tests__/account-router.spec.ts +4 -2
- package/src/components/account/account-connections.tsx +1 -1
- package/src/components/account/account-header.tsx +6 -1
- package/src/components/account/account-keys.tsx +1 -1
- package/src/components/account/account-layout.tsx +8 -1
- package/src/components/account/account-profile.tsx +3 -3
- package/src/components/account/account-router-options.tsx +1 -0
- package/src/components/account/account-router-page.tsx +1 -0
- package/src/components/account/account-router.tsx +4 -2
- package/src/components/account/account-security.tsx +1 -0
- package/src/components/account/account-sessions.tsx +21 -4
- package/src/components/admin/__tests__/admin-keys-token-dialog.browser.spec.tsx +1 -0
- package/src/components/admin/__tests__/admin-layout.browser.spec.tsx +2 -1
- package/src/components/admin/__tests__/admin-router-page.spec.ts +2 -1
- package/src/components/admin/__tests__/admin-router.spec.ts +57 -1
- package/src/components/admin/__tests__/admin-user-cell.browser.spec.tsx +1 -0
- package/src/components/admin/__tests__/admin-user-detail.spec.ts +1 -0
- package/src/components/admin/admin-analytics-query-panel.tsx +4 -3
- package/src/components/admin/admin-analytics-results.tsx +2 -2
- package/src/components/admin/admin-analytics.tsx +3 -3
- package/src/components/admin/admin-audits.tsx +3 -3
- package/src/components/admin/admin-dashboard-card.tsx +45 -0
- package/src/components/admin/admin-dashboard-count-card.tsx +89 -0
- package/src/components/admin/admin-dashboard.tsx +60 -0
- package/src/components/admin/admin-files.tsx +2 -2
- package/src/components/admin/admin-jobs-executions-panel.tsx +19 -12
- package/src/components/admin/admin-jobs-status-badge.tsx +2 -2
- package/src/components/admin/admin-jobs.tsx +4 -4
- package/src/components/admin/admin-keys-token-dialog.tsx +2 -2
- package/src/components/admin/admin-keys.tsx +2 -2
- package/src/components/admin/admin-layout.tsx +1 -2
- package/src/components/admin/admin-notifications.tsx +2 -2
- package/src/components/admin/admin-parameters.tsx +16 -9
- package/src/components/admin/admin-payments.tsx +2 -2
- package/src/components/admin/admin-router-options.tsx +14 -10
- package/src/components/admin/admin-router-page.tsx +8 -5
- package/src/components/admin/admin-router.tsx +112 -40
- package/src/components/admin/admin-sessions.tsx +13 -2
- package/src/components/admin/admin-user-detail-audits-tab.tsx +5 -2
- package/src/components/admin/admin-user-detail-identity-aside.tsx +16 -93
- package/src/components/admin/admin-user-detail-overview-tab.tsx +1 -0
- package/src/components/admin/admin-user-detail-password-dialog.tsx +1 -0
- package/src/components/admin/admin-user-detail-profile-policy.spec.ts +1 -0
- package/src/components/admin/admin-user-detail-profile-policy.ts +1 -0
- package/src/components/admin/admin-user-detail-security-tab.tsx +1 -0
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +5 -2
- package/src/components/admin/admin-user-detail.tsx +49 -87
- package/src/components/admin/admin-users-roles-picker.tsx +22 -15
- package/src/components/admin/admin-users.tsx +8 -14
- package/src/components/admin/admin-workflows-execution-sheet.tsx +18 -10
- package/src/components/admin/admin-workflows-executions-panel.tsx +24 -17
- package/src/components/admin/admin-workflows-status-badge.tsx +4 -2
- package/src/components/admin/admin-workflows.tsx +6 -4
- package/src/components/admin/diff-lines.spec.ts +1 -0
- package/src/components/admin/diff-lines.ts +1 -1
- package/src/components/admin/parameter-diff-dialog.tsx +3 -2
- package/src/components/admin/parameter-history-item.tsx +6 -5
- package/src/components/alepha-table/__tests__/alepha-table-static.browser.spec.tsx +190 -0
- package/src/components/alepha-table/__tests__/paginate-local.spec.ts +286 -0
- package/src/components/alepha-table/__tests__/use-table-selection.browser.spec.tsx +1 -0
- package/src/components/alepha-table/alepha-table.tsx +362 -79
- package/src/components/alepha-table/paginate-local.ts +174 -0
- package/src/components/app-actions/__tests__/app-actions.browser.spec.tsx +1 -0
- package/src/components/app-shell/app-shell.tsx +42 -19
- package/src/components/auth/__tests__/auth-router.spec.ts +2 -1
- package/src/components/auth/auth-login.tsx +5 -16
- package/src/components/auth/auth-register.tsx +26 -25
- package/src/components/auth/auth-reset-password.tsx +24 -17
- package/src/components/auth/auth-router.tsx +4 -3
- package/src/components/auth/auth-verify-email.tsx +7 -7
- package/src/components/auth/safe-redirect.ts +14 -0
- package/src/components/auto-form/__tests__/auto-form-settings-card.browser.spec.tsx +1 -0
- package/src/components/auto-form/auto-form.tsx +60 -39
- package/src/components/brand-icon/brand-icon.tsx +2 -2
- package/src/components/button-dark/button-dark.tsx +2 -2
- package/src/components/button-language/button-language.tsx +2 -2
- package/src/components/button-theme/button-theme.tsx +2 -2
- package/src/components/button-user/button-user.tsx +4 -4
- package/src/components/captcha/turnstile-widget.tsx +6 -5
- package/src/components/control/control.tsx +6 -6
- package/src/components/control-array/control-array.tsx +28 -15
- package/src/components/control-base/__tests__/form-field-a11y.browser.spec.tsx +1 -0
- package/src/components/control-base/field-i18n.ts +5 -3
- package/src/components/control-base/form-field.tsx +13 -13
- package/src/components/control-base/icon-hint.tsx +1 -1
- package/src/components/control-date/control-date.tsx +29 -6
- package/src/components/control-number/control-number.tsx +3 -3
- package/src/components/control-object/control-object.tsx +11 -8
- package/src/components/control-password/control-password.tsx +2 -2
- package/src/components/control-select/__tests__/control-select-clear-label.browser.spec.tsx +1 -0
- package/src/components/control-select/__tests__/control-select-deselect.browser.spec.tsx +1 -0
- package/src/components/control-select/__tests__/control-select-searchable.browser.spec.tsx +1 -0
- package/src/components/control-select/control-select.tsx +32 -18
- package/src/components/control-upload/control-upload.tsx +16 -10
- package/src/components/detail/__tests__/detail-aside.browser.spec.tsx +135 -0
- package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +151 -0
- package/src/components/detail/detail-aside.tsx +198 -0
- package/src/components/detail/detail-layout.tsx +181 -0
- package/src/components/detail/use-detail-tab.tsx +41 -0
- package/src/components/file-image/file-image.tsx +4 -2
- package/src/components/language-toggle/language-toggle.tsx +2 -2
- package/src/components/markdown-view/__tests__/markdown-view-mermaid.browser.spec.tsx +148 -0
- package/src/components/markdown-view/__tests__/markdown-view-raw-html.browser.spec.tsx +1 -0
- package/src/components/markdown-view/diagram/DiagramErrorBoundary.tsx +42 -0
- package/src/components/markdown-view/diagram/FlowchartDiagram.tsx +136 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramCluster.tsx +59 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramEdge.tsx +95 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramLabel.tsx +58 -0
- package/src/components/markdown-view/diagram/FlowchartDiagramNode.tsx +78 -0
- package/src/components/markdown-view/diagram/MermaidFence.tsx +46 -0
- package/src/components/markdown-view/diagram/__tests__/flowchart-diagram.browser.spec.tsx +210 -0
- package/src/components/markdown-view/diagram/flowchartParser.spec.ts +379 -0
- package/src/components/markdown-view/diagram/flowchartParser.ts +475 -0
- package/src/components/markdown-view/diagram/graphModel.ts +72 -0
- package/src/components/markdown-view/diagram/layoutFlowchart.spec.ts +235 -0
- package/src/components/markdown-view/diagram/layoutFlowchart.ts +324 -0
- package/src/components/markdown-view/diagram/textMetrics.spec.ts +128 -0
- package/src/components/markdown-view/diagram/textMetrics.ts +296 -0
- package/src/components/markdown-view/markdown-view.tsx +128 -9
- package/src/components/nav-shell/__tests__/nav-tree-util.spec.ts +1 -0
- package/src/components/nav-shell/nav-shell.tsx +6 -3
- package/src/components/nav-shell/spotlight.tsx +2 -1
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +1 -0
- package/src/components/nav-shell/use-nav-entries.ts +16 -5
- package/src/components/nav-shell/use-nav-tree.ts +1 -0
- package/src/components/settings/__tests__/settings-nav.browser.spec.tsx +1 -0
- package/src/components/settings/__tests__/settings-section.browser.spec.tsx +1 -0
- package/src/components/settings/settings-card-edge.ts +24 -0
- package/src/components/settings/settings-danger-section.tsx +7 -1
- package/src/components/settings/settings-layout.tsx +16 -1
- package/src/components/settings/settings-nav.tsx +12 -3
- package/src/components/settings/settings-row.tsx +2 -2
- package/src/components/settings/settings-section.tsx +2 -1
- package/src/components/ui/accordion.tsx +3 -3
- package/src/components/ui/alert-dialog.tsx +5 -5
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/avatar.tsx +5 -5
- package/src/components/ui/badge.tsx +48 -2
- package/src/components/ui/breadcrumb.tsx +3 -3
- package/src/components/ui/button-group.tsx +2 -2
- package/src/components/ui/button.tsx +2 -2
- package/src/components/ui/calendar.tsx +8 -8
- package/src/components/ui/card.tsx +3 -3
- package/src/components/ui/carousel.tsx +30 -13
- package/src/components/ui/chart.tsx +18 -6
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +8 -9
- package/src/components/ui/command.tsx +6 -7
- package/src/components/ui/context-menu.tsx +8 -8
- package/src/components/ui/dialog.tsx +4 -4
- package/src/components/ui/drawer.tsx +4 -4
- package/src/components/ui/dropdown-menu.tsx +9 -9
- package/src/components/ui/empty.tsx +2 -2
- package/src/components/ui/hover-card.tsx +1 -1
- package/src/components/ui/input-group.tsx +6 -3
- package/src/components/ui/input-otp.tsx +3 -3
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/item.tsx +3 -3
- package/src/components/ui/kbd.tsx +1 -1
- package/src/components/ui/label.tsx +3 -0
- package/src/components/ui/menubar.tsx +9 -9
- package/src/components/ui/navigation-menu.tsx +7 -7
- package/src/components/ui/pagination.tsx +0 -1
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/progress.tsx +3 -3
- package/src/components/ui/radio-group.tsx +2 -2
- package/src/components/ui/resizable.tsx +2 -2
- package/src/components/ui/scroll-area.tsx +2 -2
- package/src/components/ui/segmented.tsx +8 -3
- package/src/components/ui/select.tsx +8 -8
- package/src/components/ui/separator.tsx +1 -1
- package/src/components/ui/sheet.tsx +3 -3
- package/src/components/ui/sidebar.tsx +20 -20
- package/src/components/ui/skeleton.tsx +1 -1
- package/src/components/ui/slider.tsx +2 -2
- package/src/components/ui/switch.tsx +2 -2
- package/src/components/ui/table.tsx +10 -5
- package/src/components/ui/tabs.tsx +3 -3
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/toggle-group.tsx +9 -4
- package/src/components/ui/toggle.tsx +2 -2
- package/src/components/ui/tooltip.tsx +13 -3
- package/src/components/use-dialog/use-dialog.tsx +19 -6
- package/src/components/use-toast/__tests__/use-toast.browser.spec.tsx +19 -0
- package/src/components/use-toast/use-toast.tsx +38 -26
- package/src/hooks/use-mobile.ts +27 -14
- package/src/lib/__tests__/i18n-fr.spec.ts +5 -1
- package/src/lib/i18n-fr.ts +18 -10
- package/src/styles.css +5 -5
|
@@ -8,7 +8,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
* color and read on both light and dark surfaces. Google uses its official
|
|
9
9
|
* multicolor mark. Unknown providers fall back to a `currentColor` globe.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
const BrandIcon = (props) => {
|
|
12
12
|
const { provider, className, ...rest } = props;
|
|
13
13
|
const cls = cn("size-4 shrink-0", className);
|
|
14
14
|
switch (provider) {
|
|
@@ -77,7 +77,7 @@ function BrandIcon(props) {
|
|
|
77
77
|
]
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
//#endregion
|
|
82
82
|
export { BrandIcon };
|
|
83
83
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brand-icon.js","names":[],"sources":["../../../src/components/brand-icon/brand-icon.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport type { SVGProps } from \"react\";\n\nexport interface BrandIconProps extends SVGProps<SVGSVGElement> {\n /**\n * Auth provider key (e.g. `\"google\"`, `\"apple\"`, `\"github\"`). Known brands\n * render their logo; anything else falls back to a generic globe so new\n * providers still show something sensible.\n */\n provider: string;\n}\n\n/**\n * Theme-friendly auth-provider logo. GitHub and Apple are monochrome marks\n * drawn with `fill=\"currentColor\"`, so they inherit the surrounding text\n * color and read on both light and dark surfaces. Google uses its official\n * multicolor mark. Unknown providers fall back to a `currentColor` globe.\n */\nexport
|
|
1
|
+
{"version":3,"file":"brand-icon.js","names":[],"sources":["../../../src/components/brand-icon/brand-icon.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport type { SVGProps } from \"react\";\n\nexport interface BrandIconProps extends SVGProps<SVGSVGElement> {\n /**\n * Auth provider key (e.g. `\"google\"`, `\"apple\"`, `\"github\"`). Known brands\n * render their logo; anything else falls back to a generic globe so new\n * providers still show something sensible.\n */\n provider: string;\n}\n\n/**\n * Theme-friendly auth-provider logo. GitHub and Apple are monochrome marks\n * drawn with `fill=\"currentColor\"`, so they inherit the surrounding text\n * color and read on both light and dark surfaces. Google uses its official\n * multicolor mark. Unknown providers fall back to a `currentColor` globe.\n */\nexport const BrandIcon = (props: BrandIconProps) => {\n const { provider, className, ...rest } = props;\n const cls = cn(\"size-4 shrink-0\", className);\n\n switch (provider) {\n case \"google\":\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={cls}\n role=\"img\"\n aria-label=\"Google\"\n {...rest}\n >\n <path\n fill=\"#4285F4\"\n d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"\n />\n <path\n fill=\"#34A853\"\n d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"\n />\n <path\n fill=\"#FBBC05\"\n d=\"M5.84 14.1c-.22-.66-.35-1.36-.35-2.1s.13-1.44.35-2.1V7.06H2.18A11 11 0 0 0 1 12c0 1.77.43 3.45 1.18 4.94l3.66-2.84z\"\n />\n <path\n fill=\"#EA4335\"\n d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.06l3.66 2.84C6.71 7.3 9.14 5.38 12 5.38z\"\n />\n </svg>\n );\n\n case \"apple\":\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={cls}\n fill=\"currentColor\"\n role=\"img\"\n aria-label=\"Apple\"\n {...rest}\n >\n <path d=\"M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.51 4.09l-.02-.01M12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z\" />\n </svg>\n );\n\n case \"github\":\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={cls}\n fill=\"currentColor\"\n role=\"img\"\n aria-label=\"GitHub\"\n {...rest}\n >\n <path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23a11.5 11.5 0 0 1 3-.405c1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />\n </svg>\n );\n\n default:\n return (\n <svg\n viewBox=\"0 0 24 24\"\n className={cls}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n role=\"img\"\n aria-label={provider}\n {...rest}\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M2 12h20\" />\n <path d=\"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z\" />\n </svg>\n );\n }\n};\n"],"mappings":";;;;;;;;;;AAsBA,MAAa,aAAa,UAA0B;CAClD,MAAM,EAAE,UAAU,WAAW,GAAG,SAAS;CACzC,MAAM,MAAM,GAAG,mBAAmB,SAAS;CAE3C,QAAQ,UAAR;EACE,KAAK,UACH,OACE,qBAAC,OAAD;GACE,SAAQ;GACR,WAAW;GACX,MAAK;GACL,cAAW;GACX,GAAI;GALN,UAAA;IAOE,oBAAC,QAAD;KACE,MAAK;KACL,GAAE;IACH,CAAA;IACD,oBAAC,QAAD;KACE,MAAK;KACL,GAAE;IACH,CAAA;IACD,oBAAC,QAAD;KACE,MAAK;KACL,GAAE;IACH,CAAA;IACD,oBAAC,QAAD;KACE,MAAK;KACL,GAAE;IACH,CAAA;GACE;;EAGT,KAAK,SACH,OACE,oBAAC,OAAD;GACE,SAAQ;GACR,WAAW;GACX,MAAK;GACL,MAAK;GACL,cAAW;GACX,GAAI;GAEJ,UAAA,oBAAC,QAAD,EAAM,GAAE,sUAAuU,CAAA;EAC5U,CAAA;EAGT,KAAK,UACH,OACE,oBAAC,OAAD;GACE,SAAQ;GACR,WAAW;GACX,MAAK;GACL,MAAK;GACL,cAAW;GACX,GAAI;GAEJ,UAAA,oBAAC,QAAD,EAAM,GAAE,ysBAA0sB,CAAA;EAC/sB,CAAA;EAGT,SACE,OACE,qBAAC,OAAD;GACE,SAAQ;GACR,WAAW;GACX,MAAK;GACL,QAAO;GACP,aAAa;GACb,eAAc;GACd,gBAAe;GACf,MAAK;GACL,cAAY;GACZ,GAAI;GAVN,UAAA;IAYE,oBAAC,UAAD;KAAQ,IAAG;KAAK,IAAG;KAAK,GAAE;IAAM,CAAA;IAChC,oBAAC,QAAD,EAAM,GAAE,WAAY,CAAA;IACpB,oBAAC,QAAD,EAAM,GAAE,6FAA8F,CAAA;GACnG;;CAEX;AACF"}
|
|
@@ -21,5 +21,5 @@ export interface ButtonDarkProps {
|
|
|
21
21
|
* three-state `light → dark → system` cycle with `withSystem`.
|
|
22
22
|
* Reads/writes the persisted UI cookie via `useColorMode()`.
|
|
23
23
|
*/
|
|
24
|
-
export declare
|
|
24
|
+
export declare const ButtonDark: (props: ButtonDarkProps) => React.JSX.Element;
|
|
25
25
|
//# sourceMappingURL=button-dark.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-dark.d.ts","sourceRoot":"","sources":["../../../src/components/button-dark/button-dark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAcD;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"button-dark.d.ts","sourceRoot":"","sources":["../../../src/components/button-dark/button-dark.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAc/B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAcD;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAAW,eAAe,sBA4BhD,CAAC"}
|
|
@@ -20,7 +20,7 @@ const NEXT = {
|
|
|
20
20
|
* three-state `light → dark → system` cycle with `withSystem`.
|
|
21
21
|
* Reads/writes the persisted UI cookie via `useColorMode()`.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
const ButtonDark = (props) => {
|
|
24
24
|
const { mode, resolved, setMode } = useColorMode();
|
|
25
25
|
const onClick = () => {
|
|
26
26
|
if (props.withSystem) setMode(NEXT[mode]);
|
|
@@ -37,7 +37,7 @@ function ButtonDark(props) {
|
|
|
37
37
|
}),
|
|
38
38
|
children: ICON[iconKey]
|
|
39
39
|
}), /* @__PURE__ */ jsx(TooltipContent, { children: label })] });
|
|
40
|
-
}
|
|
40
|
+
};
|
|
41
41
|
//#endregion
|
|
42
42
|
export { ButtonDark };
|
|
43
43
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-dark.js","names":[],"sources":["../../../src/components/button-dark/button-dark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\nconst ICON: Record<\"light\" | \"dark\" | \"system\", ReactNode> = {\n light: <Sun className=\"size-4\" />,\n dark: <Moon className=\"size-4\" />,\n system: <Monitor className=\"size-4\" />,\n};\n\nconst NEXT: Record<\"light\" | \"dark\" | \"system\", \"light\" | \"dark\" | \"system\"> = {\n light: \"dark\",\n dark: \"system\",\n system: \"light\",\n};\n\n/**\n * Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the\n * three-state `light → dark → system` cycle with `withSystem`.\n * Reads/writes the persisted UI cookie via `useColorMode()`.\n */\nexport
|
|
1
|
+
{"version":3,"file":"button-dark.js","names":[],"sources":["../../../src/components/button-dark/button-dark.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useColorMode } from \"alepha/react/ui\";\nimport { Monitor, Moon, Sun } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonDarkProps {\n /**\n * Optional aria-label override. Defaults to `\"Toggle color mode\"`.\n */\n label?: string;\n /**\n * When `true`, the button cycles through three states `light → dark →\n * system`. By default the button toggles strictly between `light` and\n * `dark` using the resolved mode as the starting point.\n */\n withSystem?: boolean;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\nconst ICON: Record<\"light\" | \"dark\" | \"system\", ReactNode> = {\n light: <Sun className=\"size-4\" />,\n dark: <Moon className=\"size-4\" />,\n system: <Monitor className=\"size-4\" />,\n};\n\nconst NEXT: Record<\"light\" | \"dark\" | \"system\", \"light\" | \"dark\" | \"system\"> = {\n light: \"dark\",\n dark: \"system\",\n system: \"light\",\n};\n\n/**\n * Color-mode toggle. Default is a two-state Sun ↔ Moon flip; opt into the\n * three-state `light → dark → system` cycle with `withSystem`.\n * Reads/writes the persisted UI cookie via `useColorMode()`.\n */\nexport const ButtonDark = (props: ButtonDarkProps) => {\n const { mode, resolved, setMode } = useColorMode();\n const onClick = () => {\n if (props.withSystem) {\n setMode(NEXT[mode]);\n } else {\n setMode(resolved === \"dark\" ? \"light\" : \"dark\");\n }\n };\n const iconKey = props.withSystem ? mode : resolved;\n const label = props.label ?? \"Toggle color mode\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n onClick={onClick}\n />\n }\n >\n {ICON[iconKey]}\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;;AAgCA,MAAM,OAAuD;CAC3D,OAAO,oBAAC,KAAD,EAAK,WAAU,SAAU,CAAA;CAChC,MAAM,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA;CAChC,QAAQ,oBAAC,SAAD,EAAS,WAAU,SAAU,CAAA;AACvC;AAEA,MAAM,OAAyE;CAC7E,OAAO;CACP,MAAM;CACN,QAAQ;AACV;;;;;;AAOA,MAAa,cAAc,UAA2B;CACpD,MAAM,EAAE,MAAM,UAAU,YAAY,aAAa;CACjD,MAAM,gBAAgB;EACpB,IAAI,MAAM,YACR,QAAQ,KAAK,KAAK;OAElB,QAAQ,aAAa,SAAS,UAAU,MAAM;CAElD;CACA,MAAM,UAAU,MAAM,aAAa,OAAO;CAC1C,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;GACH;EACV,CAAA;EAGF,UAAA,KAAK;CACQ,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA;AAEb"}
|
|
@@ -20,5 +20,5 @@ export interface ButtonLanguageProps {
|
|
|
20
20
|
*
|
|
21
21
|
* Renders nothing when only one language is registered.
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare const ButtonLanguage: (props: ButtonLanguageProps) => React.JSX.Element | null;
|
|
24
24
|
//# sourceMappingURL=button-language.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-language.d.ts","sourceRoot":"","sources":["../../../src/components/button-language/button-language.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,
|
|
1
|
+
{"version":3,"file":"button-language.d.ts","sourceRoot":"","sources":["../../../src/components/button-language/button-language.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAmB/B,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,UAAW,mBAAmB,6BAwDxD,CAAC"}
|
|
@@ -16,7 +16,7 @@ import { useI18n } from "alepha/react/i18n";
|
|
|
16
16
|
*
|
|
17
17
|
* Renders nothing when only one language is registered.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
const ButtonLanguage = (props) => {
|
|
20
20
|
const i18n = useI18n();
|
|
21
21
|
const languages = i18n.languages;
|
|
22
22
|
if (languages.length <= 1) return null;
|
|
@@ -43,7 +43,7 @@ function ButtonLanguage(props) {
|
|
|
43
43
|
}, code);
|
|
44
44
|
})
|
|
45
45
|
})] });
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
47
|
//#endregion
|
|
48
48
|
export { ButtonLanguage };
|
|
49
49
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-language.js","names":[],"sources":["../../../src/components/button-language/button-language.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Languages } from \"lucide-react\";\n\nexport interface ButtonLanguageProps {\n /**\n * Optional aria-label override. Defaults to `\"Switch language\"`.\n */\n label?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Dropdown listing every language registered via `$dictionary`. Switches the\n * active locale via `useI18n().setLang(code)`.\n *\n * Labels come from translation keys `language.<code>` (e.g. `language.en`,\n * `language.fr`). If the key is missing, the raw code is shown — so adding a\n * new language to the picker is a one-line `tr` entry per dictionary.\n *\n * Renders nothing when only one language is registered.\n */\nexport
|
|
1
|
+
{"version":3,"file":"button-language.js","names":[],"sources":["../../../src/components/button-language/button-language.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useI18n } from \"alepha/react/i18n\";\nimport { Languages } from \"lucide-react\";\n\nexport interface ButtonLanguageProps {\n /**\n * Optional aria-label override. Defaults to `\"Switch language\"`.\n */\n label?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Dropdown listing every language registered via `$dictionary`. Switches the\n * active locale via `useI18n().setLang(code)`.\n *\n * Labels come from translation keys `language.<code>` (e.g. `language.en`,\n * `language.fr`). If the key is missing, the raw code is shown — so adding a\n * new language to the picker is a one-line `tr` entry per dictionary.\n *\n * Renders nothing when only one language is registered.\n */\nexport const ButtonLanguage = (props: ButtonLanguageProps) => {\n const i18n = useI18n();\n const languages = i18n.languages;\n\n if (languages.length <= 1) {\n return null;\n }\n\n const label = props.label ?? \"Switch language\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Languages className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\">\n {languages.map((code) => {\n const translated = i18n.tr(`language.${code}` as never);\n const label = translated === `language.${code}` ? code : translated;\n return (\n <DropdownMenuCheckboxItem\n key={code}\n checked={i18n.lang === code}\n /*\n * Checkbox items keep the menu open by default, which is right when\n * you are ticking several things and wrong here: a language is a\n * single choice, and the menu stayed hanging over the page after\n * you made it. Closing on click also means the ticked state is\n * something you see on reopening rather than a leftover panel.\n */\n closeOnClick\n onCheckedChange={() => {\n void i18n.setLang(code);\n }}\n >\n {label}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,MAAa,kBAAkB,UAA+B;CAC5D,MAAM,OAAO,QAAQ;CACrB,MAAM,YAAY,KAAK;CAEvB,IAAI,UAAU,UAAU,GACtB,OAAO;CAGT,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA;CACjB,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EACxB,UAAA,UAAU,KAAK,SAAS;GACvB,MAAM,aAAa,KAAK,GAAG,YAAY,MAAe;GACtD,MAAM,QAAQ,eAAe,YAAY,SAAS,OAAO;GACzD,OACE,oBAAC,0BAAD;IAEE,SAAS,KAAK,SAAS;IAQvB,cAAA;IACA,uBAAuB;KACrB,KAAU,QAAQ,IAAI;IACxB;IAEC,UAAA;GACuB,GAfnB,IAemB;EAE9B,CAAC;CACkB,CAAA,CACT,EAAA,CAAA;AAElB"}
|
|
@@ -29,5 +29,5 @@ export interface ButtonThemeProps {
|
|
|
29
29
|
* `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect
|
|
30
30
|
* when the list has 0 or 1 entries.
|
|
31
31
|
*/
|
|
32
|
-
export declare
|
|
32
|
+
export declare const ButtonTheme: (props: ButtonThemeProps) => React.JSX.Element | null;
|
|
33
33
|
//# sourceMappingURL=button-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../src/components/button-theme/button-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0B/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,
|
|
1
|
+
{"version":3,"file":"button-theme.d.ts","sourceRoot":"","sources":["../../../src/components/button-theme/button-theme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0B/B,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,UAAW,gBAAgB,6BAwElD,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { Button } from "../ui/button.js";
|
|
|
3
3
|
import { Tooltip, TooltipContent, TooltipTrigger } from "../ui/tooltip.js";
|
|
4
4
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "../ui/dropdown-menu.js";
|
|
5
5
|
import { useEffect } from "react";
|
|
6
|
-
import { useStore } from "alepha/react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { Check, Palette } from "lucide-react";
|
|
8
|
+
import { useStore } from "alepha/react";
|
|
9
9
|
import { uiThemeListAtom, useTheme } from "alepha/react/ui";
|
|
10
10
|
//#region src/components/button-theme/button-theme.tsx
|
|
11
11
|
const FONT_LINK_ID = "alepha-theme-fonts";
|
|
@@ -24,7 +24,7 @@ const FONT_LINK_ID = "alepha-theme-fonts";
|
|
|
24
24
|
* `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect
|
|
25
25
|
* when the list has 0 or 1 entries.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
const ButtonTheme = (props) => {
|
|
28
28
|
const { theme, setTheme } = useTheme();
|
|
29
29
|
const [list] = useStore(uiThemeListAtom);
|
|
30
30
|
const themes = list ?? [];
|
|
@@ -74,7 +74,7 @@ function ButtonTheme(props) {
|
|
|
74
74
|
}, t.id))
|
|
75
75
|
] })
|
|
76
76
|
})] });
|
|
77
|
-
}
|
|
77
|
+
};
|
|
78
78
|
const ThemeSwatch = (props) => {
|
|
79
79
|
return /* @__PURE__ */ jsx("div", {
|
|
80
80
|
className: "border-border grid size-6 shrink-0 grid-cols-2 grid-rows-2 gap-px overflow-hidden rounded-sm border bg-white p-px",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-theme.js","names":[],"sources":["../../../src/components/button-theme/button-theme.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useStore } from \"alepha/react\";\nimport { uiThemeListAtom, useTheme } from \"alepha/react/ui\";\nimport { Check, Palette } from \"lucide-react\";\nimport { useEffect } from \"react\";\n\nconst FONT_LINK_ID = \"alepha-theme-fonts\";\n\nexport interface ButtonThemeProps {\n /**\n * Optional aria-label override. Defaults to `\"Pick theme\"`.\n */\n label?: string;\n /**\n * Optional dropdown header. Defaults to `\"Themes\"`.\n */\n heading?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Theme picker reading the available list from `uiThemeListAtom` and the\n * selected id from `useTheme()`. Apps register their themes once at boot:\n *\n * ```ts\n * alepha.store.set(uiThemeListAtom, [\n * { id: \"default\", label: \"Default\" },\n * { id: \"claude\", label: \"Claude\", swatch: [...], fontHref: \"https://...\" },\n * ]);\n * ```\n *\n * Selecting a theme with a `fontHref` lazily injects a single `<link>` into\n * `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect\n * when the list has 0 or 1 entries.\n */\nexport
|
|
1
|
+
{"version":3,"file":"button-theme.js","names":[],"sources":["../../../src/components/button-theme/button-theme.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { cn } from \"@alepha/ui/lib/utils\";\nimport { useStore } from \"alepha/react\";\nimport { uiThemeListAtom, useTheme } from \"alepha/react/ui\";\nimport { Check, Palette } from \"lucide-react\";\nimport { useEffect } from \"react\";\n\nconst FONT_LINK_ID = \"alepha-theme-fonts\";\n\nexport interface ButtonThemeProps {\n /**\n * Optional aria-label override. Defaults to `\"Pick theme\"`.\n */\n label?: string;\n /**\n * Optional dropdown header. Defaults to `\"Themes\"`.\n */\n heading?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Theme picker reading the available list from `uiThemeListAtom` and the\n * selected id from `useTheme()`. Apps register their themes once at boot:\n *\n * ```ts\n * alepha.store.set(uiThemeListAtom, [\n * { id: \"default\", label: \"Default\" },\n * { id: \"claude\", label: \"Claude\", swatch: [...], fontHref: \"https://...\" },\n * ]);\n * ```\n *\n * Selecting a theme with a `fontHref` lazily injects a single `<link>` into\n * `<head>` (id `alepha-theme-fonts`); switching themes swaps it. No effect\n * when the list has 0 or 1 entries.\n */\nexport const ButtonTheme = (props: ButtonThemeProps) => {\n const { theme, setTheme } = useTheme();\n const [list] = useStore(uiThemeListAtom);\n const themes = list ?? [];\n\n useEffect(() => {\n if (typeof document === \"undefined\") return;\n const def = themes.find((t) => t.id === theme) ?? themes[0];\n const existing = document.getElementById(FONT_LINK_ID);\n if (!def?.fontHref) {\n existing?.remove();\n return;\n }\n if (existing && existing.getAttribute(\"href\") === def.fontHref) {\n return;\n }\n existing?.remove();\n const link = document.createElement(\"link\");\n link.id = FONT_LINK_ID;\n link.rel = \"stylesheet\";\n link.href = def.fontHref;\n document.head.appendChild(link);\n }, [theme, themes]);\n\n if (themes.length <= 1) {\n return null;\n }\n\n const label = props.label ?? \"Pick theme\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={label}\n />\n }\n />\n }\n >\n <Palette className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n <DropdownMenuGroup>\n <DropdownMenuLabel>{props.heading ?? \"Themes\"}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n {themes.map((t) => (\n <button\n key={t.id}\n type=\"button\"\n onClick={() => setTheme(t.id)}\n className={cn(\n \"hover:bg-accent flex w-full items-center gap-2.5 rounded-sm px-2 py-1.5 text-sm\",\n theme === t.id && \"bg-accent\",\n )}\n >\n {t.swatch && <ThemeSwatch colors={t.swatch} />}\n <span className=\"flex-1 text-left\">{t.label}</span>\n {theme === t.id && <Check className=\"size-3.5\" />}\n </button>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface ThemeSwatchProps {\n colors: string[];\n}\n\nconst ThemeSwatch = (props: ThemeSwatchProps) => {\n return (\n <div className=\"border-border grid size-6 shrink-0 grid-cols-2 grid-rows-2 gap-px overflow-hidden rounded-sm border bg-white p-px\">\n {props.colors.slice(0, 4).map((c, i) => (\n <span\n key={i}\n className=\"block rounded-[1px]\"\n style={{ background: c }}\n />\n ))}\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,eAAe;;;;;;;;;;;;;;;;AAiCrB,MAAa,eAAe,UAA4B;CACtD,MAAM,EAAE,OAAO,aAAa,SAAS;CACrC,MAAM,CAAC,QAAQ,SAAS,eAAe;CACvC,MAAM,SAAS,QAAQ,CAAC;CAExB,gBAAgB;EACd,IAAI,OAAO,aAAa,aAAa;EACrC,MAAM,MAAM,OAAO,MAAM,MAAM,EAAE,OAAO,KAAK,KAAK,OAAO;EACzD,MAAM,WAAW,SAAS,eAAe,YAAY;EACrD,IAAI,CAAC,KAAK,UAAU;GAClB,UAAU,OAAO;GACjB;EACF;EACA,IAAI,YAAY,SAAS,aAAa,MAAM,MAAM,IAAI,UACpD;EAEF,UAAU,OAAO;EACjB,MAAM,OAAO,SAAS,cAAc,MAAM;EAC1C,KAAK,KAAK;EACV,KAAK,MAAM;EACX,KAAK,OAAO,IAAI;EAChB,SAAS,KAAK,YAAY,IAAI;CAChC,GAAG,CAAC,OAAO,MAAM,CAAC;CAElB,IAAI,OAAO,UAAU,GACnB,OAAO;CAGT,MAAM,QAAQ,MAAM,SAAS;CAC7B,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,SAAD,EAAS,WAAU,SAAU,CAAA;CACf,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,MAAsB,CAAA,CAChC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EAAM,WAAU;EACzC,UAAA,qBAAC,mBAAD,EAAA,UAAA;GACE,oBAAC,mBAAD,EAAA,UAAoB,MAAM,WAAW,SAA4B,CAAA;GACjE,oBAAC,uBAAD,CAAwB,CAAA;GACvB,OAAO,KAAK,MACX,qBAAC,UAAD;IAEE,MAAK;IACL,eAAe,SAAS,EAAE,EAAE;IAC5B,WAAW,GACT,mFACA,UAAU,EAAE,MAAM,WACpB;IAPF,UAAA;KASG,EAAE,UAAU,oBAAC,aAAD,EAAa,QAAQ,EAAE,OAAS,CAAA;KAC7C,oBAAC,QAAD;MAAM,WAAU;MAAoB,UAAA,EAAE;KAAY,CAAA;KACjD,UAAU,EAAE,MAAM,oBAAC,OAAD,EAAO,WAAU,WAAY,CAAA;IAC1C;GAXD,GAAA,EAAE,EAWD,CACT;EACgB,EAAA,CAAA;CACA,CAAA,CACT,EAAA,CAAA;AAElB;AAMA,MAAM,eAAe,UAA4B;CAC/C,OACE,oBAAC,OAAD;EAAK,WAAU;EACZ,UAAA,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,MAChC,oBAAC,QAAD;GAEE,WAAU;GACV,OAAO,EAAE,YAAY,EAAE;EACxB,GAHM,CAGN,CACF;CACE,CAAA;AAET"}
|
|
@@ -3,8 +3,8 @@ import type { ReactNode } from "react";
|
|
|
3
3
|
export interface ButtonUserProps {
|
|
4
4
|
/**
|
|
5
5
|
* Custom menu items rendered between the email header and the logout
|
|
6
|
-
* footer. When omitted, a default menu is rendered: email + admin
|
|
7
|
-
* permitted) + logout. When provided, the consumer is responsible for the
|
|
6
|
+
* footer. When omitted, a default menu is rendered: email + account + admin
|
|
7
|
+
* (when permitted) + logout. When provided, the consumer is responsible for the
|
|
8
8
|
* full layout — use `ButtonUser.Email`, `ButtonUser.AdminMenuItem`,
|
|
9
9
|
* `ButtonUser.LogoutMenuItem` as building blocks.
|
|
10
10
|
*/
|
|
@@ -36,24 +36,6 @@ export interface ButtonUserProps {
|
|
|
36
36
|
*/
|
|
37
37
|
variant?: "ghost" | "outline";
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Account button: shows a sign-in icon when logged out, a user icon with a
|
|
41
|
-
* dropdown menu when logged in. Reads auth state via `useAuth()`.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* // Default menu
|
|
45
|
-
* <ButtonUser onSignIn={() => router.push("login")} onAdminClick={() => router.push("admin")} />
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* // Custom menu
|
|
49
|
-
* <ButtonUser onSignIn={() => router.push("login")}>
|
|
50
|
-
* <ButtonUser.Email />
|
|
51
|
-
* <ButtonUser.AdminMenuItem onClick={() => router.push("admin")} />
|
|
52
|
-
* <DropdownMenuItem onClick={() => router.push("me")}>Profile</DropdownMenuItem>
|
|
53
|
-
* <DropdownMenuSeparator />
|
|
54
|
-
* <ButtonUser.LogoutMenuItem />
|
|
55
|
-
* </ButtonUser>
|
|
56
|
-
*/
|
|
57
39
|
export declare function ButtonUser(props: ButtonUserProps): React.JSX.Element;
|
|
58
40
|
export declare namespace ButtonUser {
|
|
59
41
|
export { Email };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-user.d.ts","sourceRoot":"","sources":["../../../src/components/button-user/button-user.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoB/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;
|
|
1
|
+
{"version":3,"file":"button-user.d.ts","sourceRoot":"","sources":["../../../src/components/button-user/button-user.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoB/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;mCAoB0B,KAAK,EAAE,eAAe;;;;;;;AA4EjD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,KAAK,UAAW,oBAAoB,6BAazC,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,QAAA,MAAM,aAAa,UAAW,4BAA4B,6BA4BzD,CAAC;AAEF,MAAM,WAAW,8BAA8B;IAC7C;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,eAAe,UAAW,8BAA8B,6BA8B7D,CAAC;AAEF,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,cAAc,UAAW,6BAA6B,sBAQ3D,CAAC"}
|
|
@@ -4,8 +4,8 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSepara
|
|
|
4
4
|
import "react";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { CircleUser, LogIn, LogOut, Shield, User } from "lucide-react";
|
|
7
|
-
import { Link as Link$1, useRouter } from "alepha/react/router";
|
|
8
7
|
import { useAuth } from "alepha/react/auth";
|
|
8
|
+
import { Link as Link$1, useRouter } from "alepha/react/router";
|
|
9
9
|
//#region src/components/button-user/button-user.tsx
|
|
10
10
|
/**
|
|
11
11
|
* Account button: shows a sign-in icon when logged out, a user icon with a
|
|
@@ -25,7 +25,7 @@ import { useAuth } from "alepha/react/auth";
|
|
|
25
25
|
* <ButtonUser.LogoutMenuItem />
|
|
26
26
|
* </ButtonUser>
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
const ButtonUser = (props) => {
|
|
29
29
|
if (!useAuth().user) {
|
|
30
30
|
const signInLabel = props.signInLabel ?? "Sign in";
|
|
31
31
|
return /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
@@ -52,7 +52,7 @@ function ButtonUser(props) {
|
|
|
52
52
|
className: "w-56",
|
|
53
53
|
children: props.children ?? /* @__PURE__ */ jsx(DefaultMenu, { onAdminClick: props.onAdminClick })
|
|
54
54
|
})] });
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
const DefaultMenu = (props) => {
|
|
57
57
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
58
58
|
/* @__PURE__ */ jsx(Email, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button-user.js","names":["Link"],"sources":["../../../src/components/button-user/button-user.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { CircleUser, LogIn, LogOut, Shield, User } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonUserProps {\n /**\n * Custom menu items rendered between the email header and the logout\n * footer. When omitted, a default menu is rendered: email + admin (when\n * permitted) + logout. When provided, the consumer is responsible for the\n * full layout — use `ButtonUser.Email`, `ButtonUser.AdminMenuItem`,\n * `ButtonUser.LogoutMenuItem` as building blocks.\n */\n children?: ReactNode;\n /**\n * Called when the user clicks the sign-in icon (logged-out state). When\n * absent, the icon button is disabled.\n */\n onSignIn?: () => void;\n /**\n * Called when the user clicks the default \"Admin Panel\" menu item. Has no\n * effect when `children` are provided. When absent, the admin item is\n * hidden even if the user has the permission.\n */\n onAdminClick?: () => void;\n /**\n * Aria-label and tooltip text for the logged-out (sign-in) state.\n * Defaults to `\"Sign in\"`.\n */\n signInLabel?: string;\n /**\n * Aria-label and tooltip text for the logged-in (account menu) state.\n * Defaults to `\"Account menu\"`.\n */\n menuLabel?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Account button: shows a sign-in icon when logged out, a user icon with a\n * dropdown menu when logged in. Reads auth state via `useAuth()`.\n *\n * @example\n * // Default menu\n * <ButtonUser onSignIn={() => router.push(\"login\")} onAdminClick={() => router.push(\"admin\")} />\n *\n * @example\n * // Custom menu\n * <ButtonUser onSignIn={() => router.push(\"login\")}>\n * <ButtonUser.Email />\n * <ButtonUser.AdminMenuItem onClick={() => router.push(\"admin\")} />\n * <DropdownMenuItem onClick={() => router.push(\"me\")}>Profile</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <ButtonUser.LogoutMenuItem />\n * </ButtonUser>\n */\nexport function ButtonUser(props: ButtonUserProps) {\n const auth = useAuth();\n\n if (!auth.user) {\n const signInLabel = props.signInLabel ?? \"Sign in\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={signInLabel}\n disabled={!props.onSignIn}\n onClick={props.onSignIn}\n />\n }\n >\n <LogIn className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{signInLabel}</TooltipContent>\n </Tooltip>\n );\n }\n\n const menuLabel = props.menuLabel ?? \"Account menu\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={menuLabel}\n />\n }\n />\n }\n >\n <User className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{menuLabel}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n {props.children ?? <DefaultMenu onAdminClick={props.onAdminClick} />}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface DefaultMenuProps {\n onAdminClick?: () => void;\n}\n\nconst DefaultMenu = (props: DefaultMenuProps) => {\n return (\n <>\n <Email />\n {/*\n Account first, admin second: the account page is where every signed-in\n user has something to do, and the admin panel is a destination a\n minority of them can even see. Keep the two in this order everywhere\n the pair is composed (see `AppActions`) so the menu does not reshuffle\n between surfaces.\n */}\n <AccountMenuItem />\n {props.onAdminClick && <AdminMenuItem onClick={props.onAdminClick} />}\n <DropdownMenuSeparator />\n <LogoutMenuItem />\n </>\n );\n};\n\nexport interface ButtonUserEmailProps {\n /**\n * Optional fallback when the user has no email. Defaults to username, then id.\n */\n fallback?: string;\n}\n\nconst Email = (props: ButtonUserEmailProps) => {\n const auth = useAuth();\n const user = auth.user as\n | { email?: string; username?: string; id?: string }\n | undefined;\n if (!user) return null;\n const text = user.email ?? user.username ?? props.fallback ?? user.id ?? null;\n if (!text) return null;\n return (\n <div className=\"text-muted-foreground truncate px-2 py-1.5 text-xs\">\n {text}\n </div>\n );\n};\n\nexport interface ButtonUserAdminMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"admin\"`, which is what `AdminRouter`\n * registers. Prefer this over {@link onClick}: it is what makes the item a\n * real anchor.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, so the entry loses\n * ⌘-click, middle-click and \"open in new tab\" — see {@link AccountMenuItem}.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"Admin Panel\"`.\n */\n label?: string;\n /**\n * Permission name checked via `useAuth().has(...)`. Defaults to\n * `\"admin:ui\"`. The item is hidden when the check returns false.\n */\n permission?: string;\n}\n\nconst AdminMenuItem = (props: ButtonUserAdminMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const permission = props.permission ?? \"admin:ui\";\n if (!auth.has(permission)) return null;\n\n const label = (\n <>\n <Shield className=\"size-4\" />\n {props.label ?? \"Admin Panel\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n const routeName = props.routeName ?? \"admin\";\n // Same \"is the module actually mounted\" question `AccountMenuItem` asks. An\n // unregistered name would resolve to a literal `/admin`-shaped string and\n // give the user a link to a 404.\n if (!router.pages?.some((page: any) => page.name === routeName)) return null;\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserAccountMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"account\"`, which is what\n * `AccountRouter` registers — set it only if you mounted the account area\n * under a different name.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, giving up everything\n * an anchor provides.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"User Account\"`.\n */\n label?: string;\n}\n\n/**\n * Link to the signed-in user's own account area.\n *\n * ⚠️ **It owns its destination, unlike {@link ButtonUser.AdminMenuItem}.**\n * That asymmetry is deliberate. Every caller that hard-coded this navigation\n * got it wrong the moment the account area moved — `router.push(\"me\")` kept\n * compiling after the `me` route ceased to exist, because `router.push` falls\n * back to a plain `string` overload, and threw only when someone clicked it.\n * Defaulting to the route `AccountRouter` actually registers removes the whole\n * class of bug; `onClick` stays available for an application that mounted the\n * area itself under another name.\n *\n * **It hides itself when no `account` route is registered**, so an application\n * that never mounts `AccountRouter` gets no dead entry — the same \"is the\n * module actually there\" question the router's own `can` gates answer, asked\n * the only way a menu item can ask it.\n *\n * ⚠️ **It renders an `<a href>`, not a click handler**, because it is a\n * destination rather than an action. `DropdownMenuItem` is a Base UI\n * `Menu.Item`, which defaults to a `div` — correct for Logout, wrong here: a\n * div navigating from `onClick` cannot be ⌘-clicked, middle-clicked or opened\n * in a new tab, shows no target on hover, and offers no \"copy link address\".\n * `render` swaps the element while Base UI keeps `role=\"menuitem\"` and its\n * keyboard handling, so the menu semantics are unchanged.\n */\nconst AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n\n if (!auth.user) {\n return null;\n }\n\n const label = (\n <>\n <CircleUser className=\"size-4\" />\n {props.label ?? \"User Account\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n // No account area mounted → no entry, rather than one that 404s on click.\n const routeName = props.routeName ?? \"account\";\n if (!router.pages?.some((page: any) => page.name === routeName)) {\n return null;\n }\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserLogoutMenuItemProps {\n /**\n * Item label. Defaults to `\"Logout\"`.\n */\n label?: string;\n}\n\nconst LogoutMenuItem = (props: ButtonUserLogoutMenuItemProps) => {\n const auth = useAuth();\n return (\n <DropdownMenuItem onClick={() => auth.logout()}>\n <LogOut className=\"size-4\" />\n {props.label ?? \"Logout\"}\n </DropdownMenuItem>\n );\n};\n\nButtonUser.Email = Email;\nButtonUser.AdminMenuItem = AdminMenuItem;\nButtonUser.AccountMenuItem = AccountMenuItem;\nButtonUser.LogoutMenuItem = LogoutMenuItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,SAAgB,WAAW,OAAwB;CAGjD,IAAI,CAFS,QAEL,CAAC,CAAC,MAAM;EACd,MAAM,cAAc,MAAM,eAAe;EACzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;GACE,QACE,oBAAC,QAAD;IACE,SAAS,MAAM,WAAW;IAC1B,MAAK;IACL,cAAY;IACZ,UAAU,CAAC,MAAM;IACjB,SAAS,MAAM;GAChB,CAAA;GAGH,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;EACb,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,YAA4B,CAAA,CACtC,EAAA,CAAA;CAEb;CAEA,MAAM,YAAY,MAAM,aAAa;CACrC,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAA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.tsx"],"sourcesContent":["import * as React from \"react\";\n\nvoid React;\n\nimport { Button } from \"@alepha/ui/components/ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"@alepha/ui/components/ui/dropdown-menu\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"@alepha/ui/components/ui/tooltip\";\nimport { useAuth } from \"alepha/react/auth\";\nimport { Link, useRouter } from \"alepha/react/router\";\nimport { CircleUser, LogIn, LogOut, Shield, User } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface ButtonUserProps {\n /**\n * Custom menu items rendered between the email header and the logout\n * footer. When omitted, a default menu is rendered: email + account + admin\n * (when permitted) + logout. When provided, the consumer is responsible for the\n * full layout — use `ButtonUser.Email`, `ButtonUser.AdminMenuItem`,\n * `ButtonUser.LogoutMenuItem` as building blocks.\n */\n children?: ReactNode;\n /**\n * Called when the user clicks the sign-in icon (logged-out state). When\n * absent, the icon button is disabled.\n */\n onSignIn?: () => void;\n /**\n * Called when the user clicks the default \"Admin Panel\" menu item. Has no\n * effect when `children` are provided. When absent, the admin item is\n * hidden even if the user has the permission.\n */\n onAdminClick?: () => void;\n /**\n * Aria-label and tooltip text for the logged-out (sign-in) state.\n * Defaults to `\"Sign in\"`.\n */\n signInLabel?: string;\n /**\n * Aria-label and tooltip text for the logged-in (account menu) state.\n * Defaults to `\"Account menu\"`.\n */\n menuLabel?: string;\n /**\n * Visual variant. Defaults to `\"ghost\"` (minimal). Pass `\"outline\"` for a\n * bordered toolbar look.\n */\n variant?: \"ghost\" | \"outline\";\n}\n\n/**\n * Account button: shows a sign-in icon when logged out, a user icon with a\n * dropdown menu when logged in. Reads auth state via `useAuth()`.\n *\n * @example\n * // Default menu\n * <ButtonUser onSignIn={() => router.push(\"login\")} onAdminClick={() => router.push(\"admin\")} />\n *\n * @example\n * // Custom menu\n * <ButtonUser onSignIn={() => router.push(\"login\")}>\n * <ButtonUser.Email />\n * <ButtonUser.AdminMenuItem onClick={() => router.push(\"admin\")} />\n * <DropdownMenuItem onClick={() => router.push(\"me\")}>Profile</DropdownMenuItem>\n * <DropdownMenuSeparator />\n * <ButtonUser.LogoutMenuItem />\n * </ButtonUser>\n */\nexport const ButtonUser = (props: ButtonUserProps) => {\n const auth = useAuth();\n\n if (!auth.user) {\n const signInLabel = props.signInLabel ?? \"Sign in\";\n return (\n <Tooltip>\n <TooltipTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={signInLabel}\n disabled={!props.onSignIn}\n onClick={props.onSignIn}\n />\n }\n >\n <LogIn className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{signInLabel}</TooltipContent>\n </Tooltip>\n );\n }\n\n const menuLabel = props.menuLabel ?? \"Account menu\";\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger\n render={\n <DropdownMenuTrigger\n render={\n <Button\n variant={props.variant ?? \"ghost\"}\n size=\"icon\"\n aria-label={menuLabel}\n />\n }\n />\n }\n >\n <User className=\"size-4\" />\n </TooltipTrigger>\n <TooltipContent>{menuLabel}</TooltipContent>\n </Tooltip>\n <DropdownMenuContent align=\"end\" className=\"w-56\">\n {props.children ?? <DefaultMenu onAdminClick={props.onAdminClick} />}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n\ninterface DefaultMenuProps {\n onAdminClick?: () => void;\n}\n\nconst DefaultMenu = (props: DefaultMenuProps) => {\n return (\n <>\n <Email />\n {/*\n Account first, admin second: the account page is where every signed-in\n user has something to do, and the admin panel is a destination a\n minority of them can even see. Keep the two in this order everywhere\n the pair is composed (see `AppActions`) so the menu does not reshuffle\n between surfaces.\n */}\n <AccountMenuItem />\n {props.onAdminClick && <AdminMenuItem onClick={props.onAdminClick} />}\n <DropdownMenuSeparator />\n <LogoutMenuItem />\n </>\n );\n};\n\nexport interface ButtonUserEmailProps {\n /**\n * Optional fallback when the user has no email. Defaults to username, then id.\n */\n fallback?: string;\n}\n\nconst Email = (props: ButtonUserEmailProps) => {\n const auth = useAuth();\n const user = auth.user as\n | { email?: string; username?: string; id?: string }\n | undefined;\n if (!user) return null;\n const text = user.email ?? user.username ?? props.fallback ?? user.id ?? null;\n if (!text) return null;\n return (\n <div className=\"text-muted-foreground truncate px-2 py-1.5 text-xs\">\n {text}\n </div>\n );\n};\n\nexport interface ButtonUserAdminMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"admin\"`, which is what `AdminRouter`\n * registers. Prefer this over {@link onClick}: it is what makes the item a\n * real anchor.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, so the entry loses\n * ⌘-click, middle-click and \"open in new tab\" — see {@link AccountMenuItem}.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"Admin Panel\"`.\n */\n label?: string;\n /**\n * Permission name checked via `useAuth().has(...)`. Defaults to\n * `\"admin:ui\"`. The item is hidden when the check returns false.\n */\n permission?: string;\n}\n\nconst AdminMenuItem = (props: ButtonUserAdminMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n const permission = props.permission ?? \"admin:ui\";\n if (!auth.has(permission)) return null;\n\n const label = (\n <>\n <Shield className=\"size-4\" />\n {props.label ?? \"Admin Panel\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n const routeName = props.routeName ?? \"admin\";\n // Same \"is the module actually mounted\" question `AccountMenuItem` asks. An\n // unregistered name would resolve to a literal `/admin`-shaped string and\n // give the user a link to a 404.\n if (!router.pages?.some((page: any) => page.name === routeName)) return null;\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserAccountMenuItemProps {\n /**\n * Route name to link to. Defaults to `\"account\"`, which is what\n * `AccountRouter` registers — set it only if you mounted the account area\n * under a different name.\n */\n routeName?: string;\n\n /**\n * Escape hatch for a destination no route name can express. Supplying it\n * turns the item back into a click handler on a `div`, giving up everything\n * an anchor provides.\n */\n onClick?: () => void;\n\n /**\n * Item label. Defaults to `\"User Account\"`.\n */\n label?: string;\n}\n\n/**\n * Link to the signed-in user's own account area.\n *\n * ⚠️ **It owns its destination, unlike {@link ButtonUser.AdminMenuItem}.**\n * That asymmetry is deliberate. Every caller that hard-coded this navigation\n * got it wrong the moment the account area moved — `router.push(\"me\")` kept\n * compiling after the `me` route ceased to exist, because `router.push` falls\n * back to a plain `string` overload, and threw only when someone clicked it.\n * Defaulting to the route `AccountRouter` actually registers removes the whole\n * class of bug; `onClick` stays available for an application that mounted the\n * area itself under another name.\n *\n * **It hides itself when no `account` route is registered**, so an application\n * that never mounts `AccountRouter` gets no dead entry — the same \"is the\n * module actually there\" question the router's own `can` gates answer, asked\n * the only way a menu item can ask it.\n *\n * ⚠️ **It renders an `<a href>`, not a click handler**, because it is a\n * destination rather than an action. `DropdownMenuItem` is a Base UI\n * `Menu.Item`, which defaults to a `div` — correct for Logout, wrong here: a\n * div navigating from `onClick` cannot be ⌘-clicked, middle-clicked or opened\n * in a new tab, shows no target on hover, and offers no \"copy link address\".\n * `render` swaps the element while Base UI keeps `role=\"menuitem\"` and its\n * keyboard handling, so the menu semantics are unchanged.\n */\nconst AccountMenuItem = (props: ButtonUserAccountMenuItemProps) => {\n const auth = useAuth();\n const router = useRouter<any>();\n\n if (!auth.user) {\n return null;\n }\n\n const label = (\n <>\n <CircleUser className=\"size-4\" />\n {props.label ?? \"User Account\"}\n </>\n );\n\n if (props.onClick) {\n return <DropdownMenuItem onClick={props.onClick}>{label}</DropdownMenuItem>;\n }\n\n // No account area mounted → no entry, rather than one that 404s on click.\n const routeName = props.routeName ?? \"account\";\n if (!router.pages?.some((page: any) => page.name === routeName)) {\n return null;\n }\n\n return (\n <DropdownMenuItem render={<Link href={router.path(routeName)} />}>\n {label}\n </DropdownMenuItem>\n );\n};\n\nexport interface ButtonUserLogoutMenuItemProps {\n /**\n * Item label. Defaults to `\"Logout\"`.\n */\n label?: string;\n}\n\nconst LogoutMenuItem = (props: ButtonUserLogoutMenuItemProps) => {\n const auth = useAuth();\n return (\n <DropdownMenuItem onClick={() => auth.logout()}>\n <LogOut className=\"size-4\" />\n {props.label ?? \"Logout\"}\n </DropdownMenuItem>\n );\n};\n\nButtonUser.Email = Email;\nButtonUser.AdminMenuItem = AdminMenuItem;\nButtonUser.AccountMenuItem = AccountMenuItem;\nButtonUser.LogoutMenuItem = LogoutMenuItem;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6EA,MAAa,cAAc,UAA2B;CAGpD,IAAI,CAFS,QAEL,CAAC,CAAC,MAAM;EACd,MAAM,cAAc,MAAM,eAAe;EACzC,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;GACE,QACE,oBAAC,QAAD;IACE,SAAS,MAAM,WAAW;IAC1B,MAAK;IACL,cAAY;IACZ,UAAU,CAAC,MAAM;IACjB,SAAS,MAAM;GAChB,CAAA;GAGH,UAAA,oBAAC,OAAD,EAAO,WAAU,SAAU,CAAA;EACb,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,YAA4B,CAAA,CACtC,EAAA,CAAA;CAEb;CAEA,MAAM,YAAY,MAAM,aAAa;CACrC,OACE,qBAAC,cAAD,EAAA,UAAA,CACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD;EACE,QACE,oBAAC,qBAAD,EACE,QACE,oBAAC,QAAD;GACE,SAAS,MAAM,WAAW;GAC1B,MAAK;GACL,cAAY;EACb,CAAA,EAEJ,CAAA;EAGH,UAAA,oBAAC,MAAD,EAAM,WAAU,SAAU,CAAA;CACZ,CAAA,GAChB,oBAAC,gBAAD,EAAA,UAAiB,UAA0B,CAAA,CACpC,EAAA,CAAA,GACT,oBAAC,qBAAD;EAAqB,OAAM;EAAM,WAAU;EACxC,UAAA,MAAM,YAAY,oBAAC,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;;;;AAgDA,MAAM,mBAAmB,UAA0C;CACjE,MAAM,OAAO,QAAQ;CACrB,MAAM,SAAS,UAAe;CAE9B,IAAI,CAAC,KAAK,MACR,OAAO;CAGT,MAAM,QACJ,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,YAAD,EAAY,WAAU,SAAU,CAAA,GAC/B,MAAM,SAAS,cAChB,EAAA,CAAA;CAGJ,IAAI,MAAM,SACR,OAAO,oBAAC,kBAAD;EAAkB,SAAS,MAAM;EAAU,UAAA;CAAwB,CAAA;CAI5E,MAAM,YAAY,MAAM,aAAa;CACrC,IAAI,CAAC,OAAO,OAAO,MAAM,SAAc,KAAK,SAAS,SAAS,GAC5D,OAAO;CAGT,OACE,oBAAC,kBAAD;EAAkB,QAAQ,oBAACA,QAAD,EAAM,MAAM,OAAO,KAAK,SAAS,EAAI,CAAA;EAC5D,UAAA;CACe,CAAA;AAEtB;AASA,MAAM,kBAAkB,UAAyC;CAC/D,MAAM,OAAO,QAAQ;CACrB,OACE,qBAAC,kBAAD;EAAkB,eAAe,KAAK,OAAO;EAA7C,UAAA,CACE,oBAAC,QAAD,EAAQ,WAAU,SAAU,CAAA,GAC3B,MAAM,SAAS,QACA;;AAEtB;AAEA,WAAW,QAAQ;AACnB,WAAW,gBAAgB;AAC3B,WAAW,kBAAkB;AAC7B,WAAW,iBAAiB"}
|
|
@@ -53,7 +53,7 @@ export interface TurnstileWidgetProps {
|
|
|
53
53
|
* // on submit failure: widget.current?.reset();
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
|
-
export declare
|
|
56
|
+
export declare const TurnstileWidget: (props: TurnstileWidgetProps & {
|
|
57
57
|
ref?: Ref<TurnstileWidgetHandle>;
|
|
58
|
-
})
|
|
58
|
+
}) => import("react").JSX.Element;
|
|
59
59
|
//# sourceMappingURL=turnstile-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnstile-widget.d.ts","sourceRoot":"","sources":["../../../src/components/captcha/turnstile-widget.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"turnstile-widget.d.ts","sourceRoot":"","sources":["../../../src/components/captcha/turnstile-widget.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,OAAO,CAAC;AAEzE;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,CAAC,EAAE;YACV,MAAM,EAAE,CACN,SAAS,EAAE,WAAW,EACtB,IAAI,EAAE;gBACJ,OAAO,EAAE,MAAM,CAAC;gBAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;gBAClC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;gBAC9B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;gBAChC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;aACnC,KACE,MAAM,CAAC;YACZ,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;YAClC,MAAM,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;SACpC,CAAC;KACH;CACF;AAsCD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,UACnB,oBAAoB,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAA;CAAE,gCAyDnE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useImperativeHandle, useRef } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { AlephaError } from "alepha";
|
|
3
4
|
//#region src/components/captcha/turnstile-widget.tsx
|
|
4
5
|
/**
|
|
5
6
|
* Cloudflare Turnstile loader — idempotent across remounts.
|
|
@@ -16,7 +17,7 @@ const loadTurnstile = () => {
|
|
|
16
17
|
existing.addEventListener("load", () => resolve());
|
|
17
18
|
existing.addEventListener("error", () => {
|
|
18
19
|
turnstileLoader = void 0;
|
|
19
|
-
reject(
|
|
20
|
+
reject(new AlephaError("Turnstile script failed to load"));
|
|
20
21
|
});
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
@@ -27,7 +28,7 @@ const loadTurnstile = () => {
|
|
|
27
28
|
s.onload = () => resolve();
|
|
28
29
|
s.onerror = () => {
|
|
29
30
|
turnstileLoader = void 0;
|
|
30
|
-
reject(
|
|
31
|
+
reject(new AlephaError("Turnstile script failed to load"));
|
|
31
32
|
};
|
|
32
33
|
document.head.appendChild(s);
|
|
33
34
|
});
|
|
@@ -47,7 +48,7 @@ const loadTurnstile = () => {
|
|
|
47
48
|
* // on submit failure: widget.current?.reset();
|
|
48
49
|
* ```
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
|
+
const TurnstileWidget = (props) => {
|
|
51
52
|
const containerRef = useRef(null);
|
|
52
53
|
const widgetIdRef = useRef(void 0);
|
|
53
54
|
const onTokenRef = useRef(props.onToken);
|
|
@@ -90,7 +91,7 @@ function TurnstileWidget(props) {
|
|
|
90
91
|
"data-testid": "captcha",
|
|
91
92
|
className: props.className
|
|
92
93
|
});
|
|
93
|
-
}
|
|
94
|
+
};
|
|
94
95
|
//#endregion
|
|
95
96
|
export { TurnstileWidget };
|
|
96
97
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turnstile-widget.js","names":[],"sources":["../../../src/components/captcha/turnstile-widget.tsx"],"sourcesContent":["import { type Ref, useEffect, useImperativeHandle, useRef } from \"react\";\n\n/**\n * Cloudflare Turnstile global, injected by the api.js script.\n */\ndeclare global {\n interface Window {\n turnstile?: {\n render: (\n container: HTMLElement,\n opts: {\n sitekey: string;\n callback: (token: string) => void;\n \"error-callback\"?: () => void;\n \"expired-callback\"?: () => void;\n theme?: \"light\" | \"dark\" | \"auto\";\n },\n ) => string;\n reset: (widgetId: string) => void;\n remove: (widgetId: string) => void;\n };\n }\n}\n\n/**\n * Cloudflare Turnstile loader — idempotent across remounts.\n * Resolves once the global `window.turnstile` is ready.\n */\nlet turnstileLoader: Promise<void> | undefined;\nconst loadTurnstile = (): Promise<void> => {\n if (turnstileLoader) return turnstileLoader;\n turnstileLoader = new Promise<void>((resolve, reject) => {\n if (typeof window === \"undefined\") return resolve();\n if (window.turnstile) return resolve();\n const existing = document.querySelector<HTMLScriptElement>(\n 'script[data-turnstile=\"1\"]',\n );\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => {\n turnstileLoader = undefined;\n reject(new
|
|
1
|
+
{"version":3,"file":"turnstile-widget.js","names":[],"sources":["../../../src/components/captcha/turnstile-widget.tsx"],"sourcesContent":["import { AlephaError } from \"alepha\";\nimport { type Ref, useEffect, useImperativeHandle, useRef } from \"react\";\n\n/**\n * Cloudflare Turnstile global, injected by the api.js script.\n */\ndeclare global {\n interface Window {\n turnstile?: {\n render: (\n container: HTMLElement,\n opts: {\n sitekey: string;\n callback: (token: string) => void;\n \"error-callback\"?: () => void;\n \"expired-callback\"?: () => void;\n theme?: \"light\" | \"dark\" | \"auto\";\n },\n ) => string;\n reset: (widgetId: string) => void;\n remove: (widgetId: string) => void;\n };\n }\n}\n\n/**\n * Cloudflare Turnstile loader — idempotent across remounts.\n * Resolves once the global `window.turnstile` is ready.\n */\nlet turnstileLoader: Promise<void> | undefined;\nconst loadTurnstile = (): Promise<void> => {\n if (turnstileLoader) return turnstileLoader;\n turnstileLoader = new Promise<void>((resolve, reject) => {\n if (typeof window === \"undefined\") return resolve();\n if (window.turnstile) return resolve();\n const existing = document.querySelector<HTMLScriptElement>(\n 'script[data-turnstile=\"1\"]',\n );\n if (existing) {\n existing.addEventListener(\"load\", () => resolve());\n existing.addEventListener(\"error\", () => {\n turnstileLoader = undefined;\n reject(new AlephaError(\"Turnstile script failed to load\"));\n });\n return;\n }\n const s = document.createElement(\"script\");\n s.src =\n \"https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit\";\n s.async = true;\n s.dataset.turnstile = \"1\";\n s.onload = () => resolve();\n s.onerror = () => {\n turnstileLoader = undefined;\n reject(new AlephaError(\"Turnstile script failed to load\"));\n };\n document.head.appendChild(s);\n });\n return turnstileLoader;\n};\n\nexport interface TurnstileWidgetHandle {\n /**\n * Force a fresh challenge (e.g. after a failed form submission — Turnstile\n * tokens are single-use). Emits `onToken(undefined)` until the user solves\n * the new challenge.\n */\n reset: () => void;\n}\n\nexport interface TurnstileWidgetProps {\n /**\n * Public Turnstile site key (from the realm config or a public endpoint —\n * never ship the secret key to the browser).\n */\n siteKey: string;\n /**\n * Called with the challenge token once solved, and with `undefined` when\n * the token expires, errors out, or the widget is reset. Read the latest\n * value from state at submit time; tokens are single-use.\n */\n onToken: (token: string | undefined) => void;\n className?: string;\n}\n\n/**\n * Cloudflare Turnstile captcha widget (explicit render, SPA-friendly).\n *\n * Loads the api.js script once per page, renders the challenge into a div,\n * and reports token state through `onToken`. Pair with the server-side\n * `CaptchaProvider.verify()` from `alepha/captcha`.\n *\n * ```tsx\n * const [token, setToken] = useState<string | undefined>();\n * const widget = useRef<TurnstileWidgetHandle>(null);\n * {siteKey && <TurnstileWidget ref={widget} siteKey={siteKey} onToken={setToken} />}\n * // on submit failure: widget.current?.reset();\n * ```\n */\nexport const TurnstileWidget = (\n props: TurnstileWidgetProps & { ref?: Ref<TurnstileWidgetHandle> },\n) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n const widgetIdRef = useRef<string | undefined>(undefined);\n // The render effect must not re-run when the parent passes a fresh\n // `onToken` arrow each render — route the latest callback through a ref.\n const onTokenRef = useRef(props.onToken);\n useEffect(() => {\n onTokenRef.current = props.onToken;\n }, [props.onToken]);\n\n useImperativeHandle(props.ref, () => ({\n reset: () => {\n const id = widgetIdRef.current;\n if (id && window.turnstile) {\n try {\n window.turnstile.reset(id);\n } catch {}\n }\n onTokenRef.current(undefined);\n },\n }));\n\n useEffect(() => {\n const el = containerRef.current;\n if (!el) return;\n onTokenRef.current(undefined);\n let disposed = false;\n loadTurnstile()\n .then(() => {\n if (disposed || !window.turnstile || !el) return;\n widgetIdRef.current = window.turnstile.render(el, {\n sitekey: props.siteKey,\n theme: document.documentElement.classList.contains(\"dark\")\n ? \"dark\"\n : \"light\",\n callback: (token) => onTokenRef.current(token),\n \"expired-callback\": () => onTokenRef.current(undefined),\n \"error-callback\": () => onTokenRef.current(undefined),\n });\n })\n .catch(() => onTokenRef.current(undefined));\n return () => {\n disposed = true;\n const id = widgetIdRef.current;\n if (id && window.turnstile) {\n try {\n window.turnstile.remove(id);\n } catch {}\n }\n widgetIdRef.current = undefined;\n };\n }, [props.siteKey]);\n\n return (\n <div ref={containerRef} data-testid=\"captcha\" className={props.className} />\n );\n};\n"],"mappings":";;;;;;;;AA6BA,IAAI;AACJ,MAAM,sBAAqC;CACzC,IAAI,iBAAiB,OAAO;CAC5B,kBAAkB,IAAI,SAAe,SAAS,WAAW;EACvD,IAAI,OAAO,WAAW,aAAa,OAAO,QAAQ;EAClD,IAAI,OAAO,WAAW,OAAO,QAAQ;EACrC,MAAM,WAAW,SAAS,cACxB,8BACF;EACA,IAAI,UAAU;GACZ,SAAS,iBAAiB,cAAc,QAAQ,CAAC;GACjD,SAAS,iBAAiB,eAAe;IACvC,kBAAkB,KAAA;IAClB,OAAO,IAAI,YAAY,iCAAiC,CAAC;GAC3D,CAAC;GACD;EACF;EACA,MAAM,IAAI,SAAS,cAAc,QAAQ;EACzC,EAAE,MACA;EACF,EAAE,QAAQ;EACV,EAAE,QAAQ,YAAY;EACtB,EAAE,eAAe,QAAQ;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M,OAAO,CAAC;CAElB,OACE,oBAAC,OAAD;EAAK,KAAK;EAAc,eAAY;EAAU,WAAW,MAAM;CAAY,CAAA;AAE/E"}
|
|
@@ -196,5 +196,5 @@ export interface ControlProps {
|
|
|
196
196
|
* `useForm`, evaluates `schema.$control` (object or function), merges the
|
|
197
197
|
* result with explicit props, and dispatches to the right sub-control.
|
|
198
198
|
*/
|
|
199
|
-
export declare
|
|
199
|
+
export declare const Control: (props: ControlProps) => ReactNode;
|
|
200
200
|
//# sourceMappingURL=control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7D,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,IAAI,C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,EAAE,CAAC;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACxD;;;OAGG;IACH,KAAK,CAAC,EACF,YAAY,EAAE,GACd,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,EAAE,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAClE;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,MAAM,CAAC,EACH,OAAO,GACP,IAAI,CACF,kBAAkB,EAClB,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CACpD,CAAC;CACP;AAED;;;;GAIG;AACH,
|
|
1
|
+
{"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../../src/components/control/control.tsx"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,8CAA8C,CAAC;AAKtD,OAAO,EAEL,KAAK,YAAY,EAClB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,qDAAqD,CAAC;AAO7D,OAAO,EACL,KAAK,cAAc,EAIpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,S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AAO,GACP,IAAI,CACF,kBAAkB,EAClB,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CACpD,CAAC;CACP;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,UAAW,YAAY,cAsZ1C,CAAC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { cn } from "../../lib/utils.js";
|
|
2
|
-
import {
|
|
2
|
+
import { Input } from "../ui/input.js";
|
|
3
3
|
import { FormField, formFieldAriaProps, useFormFieldAutoSave, useFormFieldLayout } from "../control-base/form-field.js";
|
|
4
|
+
import { ControlPassword } from "../control-password/control-password.js";
|
|
4
5
|
import { iconFor } from "../control-base/icon-hint.js";
|
|
5
|
-
import {
|
|
6
|
+
import { ControlArray } from "../control-array/control-array.js";
|
|
6
7
|
import { ControlDate } from "../control-date/control-date.js";
|
|
7
8
|
import { ControlNumber } from "../control-number/control-number.js";
|
|
8
9
|
import { ControlObject } from "../control-object/control-object.js";
|
|
9
|
-
import { ControlPassword } from "../control-password/control-password.js";
|
|
10
10
|
import { Textarea } from "../ui/textarea.js";
|
|
11
11
|
import { ControlSelect } from "../control-select/control-select.js";
|
|
12
12
|
import { ControlUpload } from "../control-upload/control-upload.js";
|
|
13
13
|
import { Switch } from "../ui/switch.js";
|
|
14
14
|
import { useEffect, useState } from "react";
|
|
15
|
-
import { useAlepha } from "alepha/react";
|
|
16
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
16
|
import { Check, X } from "lucide-react";
|
|
18
17
|
import { z } from "alepha";
|
|
19
|
-
import {
|
|
18
|
+
import { useAlepha } from "alepha/react";
|
|
20
19
|
import { resolveSchemaControl } from "alepha/react/ui";
|
|
20
|
+
import { parseField, useFieldValue, useFormState } from "alepha/react/form";
|
|
21
21
|
//#region src/components/control/control.tsx
|
|
22
22
|
/**
|
|
23
23
|
* Schema-driven form field renderer. Inspects the bound `InputField` from
|
|
24
24
|
* `useForm`, evaluates `schema.$control` (object or function), merges the
|
|
25
25
|
* result with explicit props, and dispatches to the right sub-control.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
const Control = (props) => {
|
|
28
28
|
const form = useFormState(props.input, ["error", "dirty"]);
|
|
29
29
|
const autoSaveEnabled = useFormFieldAutoSave();
|
|
30
30
|
const rowLayout = useFormFieldLayout() === "row";
|
|
@@ -178,7 +178,6 @@ function Control(props) {
|
|
|
178
178
|
disabled: merged.disabled,
|
|
179
179
|
maxLength: maxLength || void 0,
|
|
180
180
|
autoComplete: merged.autoComplete,
|
|
181
|
-
autoFocus: merged.autoFocus,
|
|
182
181
|
placeholder: merged.placeholder,
|
|
183
182
|
value: String(value ?? ""),
|
|
184
183
|
onChange: (e) => setValue(e.target.value)
|
|
@@ -194,7 +193,6 @@ function Control(props) {
|
|
|
194
193
|
required: meta.required,
|
|
195
194
|
disabled: merged.disabled,
|
|
196
195
|
autoComplete: merged.autoComplete,
|
|
197
|
-
autoFocus: merged.autoFocus,
|
|
198
196
|
inputProps: merged.inputProps,
|
|
199
197
|
icon: resolveIcon(merged.icon, "password"),
|
|
200
198
|
value: String(value ?? ""),
|
|
@@ -217,7 +215,7 @@ function Control(props) {
|
|
|
217
215
|
children: /* @__PURE__ */ jsxs("div", {
|
|
218
216
|
className: "relative",
|
|
219
217
|
children: [
|
|
220
|
-
Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2
|
|
218
|
+
Icon && /* @__PURE__ */ jsx(Icon, { className: "text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2" }),
|
|
221
219
|
/* @__PURE__ */ jsx(Input, {
|
|
222
220
|
...merged.inputProps,
|
|
223
221
|
...formFieldAriaProps({
|
|
@@ -231,7 +229,6 @@ function Control(props) {
|
|
|
231
229
|
type: htmlType,
|
|
232
230
|
disabled: merged.disabled,
|
|
233
231
|
autoComplete,
|
|
234
|
-
autoFocus: merged.autoFocus,
|
|
235
232
|
placeholder: merged.placeholder,
|
|
236
233
|
value: String(value ?? ""),
|
|
237
234
|
minLength: meta.constraints.minLength,
|
|
@@ -257,7 +254,7 @@ function Control(props) {
|
|
|
257
254
|
]
|
|
258
255
|
})
|
|
259
256
|
}));
|
|
260
|
-
}
|
|
257
|
+
};
|
|
261
258
|
const useDynamicControlRefresh = (input) => {
|
|
262
259
|
const alepha = useAlepha();
|
|
263
260
|
const [, bump] = useState(0);
|