@alepha/ui 0.27.0 → 0.27.1
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 +56 -15
- package/dist/components/account/account-connections.d.ts.map +1 -1
- package/dist/components/account/account-connections.js +24 -13
- package/dist/components/account/account-connections.js.map +1 -1
- package/dist/components/account/account-delete-dialog.d.ts.map +1 -1
- package/dist/components/account/account-delete-dialog.js +12 -8
- package/dist/components/account/account-delete-dialog.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/components/account/account-keys.js +35 -21
- package/dist/components/account/account-keys.js.map +1 -1
- package/dist/components/account/account-mfa-dialog.d.ts +20 -0
- package/dist/components/account/account-mfa-dialog.d.ts.map +1 -0
- package/dist/components/account/account-mfa-dialog.js +149 -0
- package/dist/components/account/account-mfa-dialog.js.map +1 -0
- package/dist/components/account/account-password-dialog.d.ts.map +1 -1
- package/dist/components/account/account-password-dialog.js +15 -10
- package/dist/components/account/account-password-dialog.js.map +1 -1
- package/dist/components/account/account-profile.d.ts.map +1 -1
- package/dist/components/account/account-profile.js +25 -25
- package/dist/components/account/account-profile.js.map +1 -1
- package/dist/components/account/account-router.d.ts +76 -2
- package/dist/components/account/account-router.d.ts.map +1 -1
- package/dist/components/account/account-router.js +44 -4
- package/dist/components/account/account-router.js.map +1 -1
- package/dist/components/account/account-security.d.ts +11 -1
- package/dist/components/account/account-security.d.ts.map +1 -1
- package/dist/components/account/account-security.js +119 -32
- 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 +46 -24
- package/dist/components/account/account-sessions.js.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-executions-panel.js +4 -9
- package/dist/components/admin/admin-jobs-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-jobs-status-badge.js +3 -3
- package/dist/components/admin/admin-jobs-status-badge.js.map +1 -1
- package/dist/components/admin/admin-jobs-status-labels.d.ts +26 -0
- package/dist/components/admin/admin-jobs-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-jobs-status-labels.js +46 -0
- package/dist/components/admin/admin-jobs-status-labels.js.map +1 -0
- package/dist/components/admin/admin-layout.d.ts.map +1 -1
- package/dist/components/admin/admin-layout.js +5 -3
- package/dist/components/admin/admin-layout.js.map +1 -1
- package/dist/components/admin/admin-notifications-detail-tabs.d.ts +21 -0
- package/dist/components/admin/admin-notifications-detail-tabs.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-detail-tabs.js +122 -0
- package/dist/components/admin/admin-notifications-detail-tabs.js.map +1 -0
- package/dist/components/admin/admin-notifications-detail.d.ts +23 -0
- package/dist/components/admin/admin-notifications-detail.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-detail.js +48 -0
- package/dist/components/admin/admin-notifications-detail.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts +13 -0
- package/dist/components/admin/admin-notifications-preview-body.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-preview-body.js +64 -0
- package/dist/components/admin/admin-notifications-preview-body.js.map +1 -0
- package/dist/components/admin/admin-notifications-preview-tab.d.ts +24 -0
- package/dist/components/admin/admin-notifications-preview-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-preview-tab.js +35 -0
- package/dist/components/admin/admin-notifications-preview-tab.js.map +1 -0
- package/dist/components/admin/admin-notifications-raw-tab.d.ts +18 -0
- package/dist/components/admin/admin-notifications-raw-tab.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-raw-tab.js +53 -0
- package/dist/components/admin/admin-notifications-raw-tab.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-badge.d.ts +17 -0
- package/dist/components/admin/admin-notifications-status-badge.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-badge.js +32 -0
- package/dist/components/admin/admin-notifications-status-badge.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-labels.d.ts +17 -0
- package/dist/components/admin/admin-notifications-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-labels.js +33 -0
- package/dist/components/admin/admin-notifications-status-labels.js.map +1 -0
- package/dist/components/admin/admin-notifications-status-tones.d.ts +44 -0
- package/dist/components/admin/admin-notifications-status-tones.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-status-tones.js +64 -0
- package/dist/components/admin/admin-notifications-status-tones.js.map +1 -0
- package/dist/components/admin/admin-notifications-template-label.d.ts +16 -0
- package/dist/components/admin/admin-notifications-template-label.d.ts.map +1 -0
- package/dist/components/admin/admin-notifications-template-label.js +24 -0
- package/dist/components/admin/admin-notifications-template-label.js.map +1 -0
- package/dist/components/admin/admin-notifications.d.ts +13 -2
- package/dist/components/admin/admin-notifications.d.ts.map +1 -1
- package/dist/components/admin/admin-notifications.js +264 -29
- package/dist/components/admin/admin-notifications.js.map +1 -1
- package/dist/components/admin/admin-router.d.ts +29 -2
- package/dist/components/admin/admin-router.d.ts.map +1 -1
- package/dist/components/admin/admin-router.js +68 -8
- package/dist/components/admin/admin-router.js.map +1 -1
- package/dist/components/admin/admin-sessions.d.ts.map +1 -1
- package/dist/components/admin/admin-sessions.js +1 -1
- package/dist/components/admin/admin-sessions.js.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.d.ts +12 -2
- package/dist/components/admin/admin-user-detail-security-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-security-tab.js +63 -44
- package/dist/components/admin/admin-user-detail-security-tab.js.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.d.ts.map +1 -1
- package/dist/components/admin/admin-user-detail-sessions-tab.js +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 +20 -15
- package/dist/components/admin/admin-user-detail.js.map +1 -1
- package/dist/components/admin/admin-users.js +1 -1
- package/dist/components/admin/admin-users.js.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-executions-panel.js +4 -12
- package/dist/components/admin/admin-workflows-executions-panel.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.d.ts.map +1 -1
- package/dist/components/admin/admin-workflows-status-badge.js +3 -3
- package/dist/components/admin/admin-workflows-status-badge.js.map +1 -1
- package/dist/components/admin/admin-workflows-status-labels.d.ts +19 -0
- package/dist/components/admin/admin-workflows-status-labels.d.ts.map +1 -0
- package/dist/components/admin/admin-workflows-status-labels.js +48 -0
- package/dist/components/admin/admin-workflows-status-labels.js.map +1 -0
- package/dist/components/alepha-table/alepha-table.d.ts +6 -0
- package/dist/components/alepha-table/alepha-table.d.ts.map +1 -1
- package/dist/components/alepha-table/alepha-table.js +33 -5
- package/dist/components/alepha-table/alepha-table.js.map +1 -1
- package/dist/components/auth/auth-login.d.ts.map +1 -1
- package/dist/components/auth/auth-login.js +27 -17
- package/dist/components/auth/auth-login.js.map +1 -1
- package/dist/components/auth/auth-mfa-step.d.ts +25 -0
- package/dist/components/auth/auth-mfa-step.d.ts.map +1 -0
- package/dist/components/auth/auth-mfa-step.js +122 -0
- package/dist/components/auth/auth-mfa-step.js.map +1 -0
- package/dist/components/auth/auth-register.js +2 -2
- package/dist/components/auth/auth-register.js.map +1 -1
- package/dist/components/auth/auth-reset-password.js +2 -2
- package/dist/components/auth/auth-router.d.ts +20 -0
- package/dist/components/auth/auth-router.d.ts.map +1 -1
- package/dist/components/auth/provider-labels.d.ts.map +1 -1
- package/dist/components/auth/provider-labels.js +1 -0
- package/dist/components/auth/provider-labels.js.map +1 -1
- package/dist/components/control/control.d.ts +11 -2
- package/dist/components/control/control.d.ts.map +1 -1
- package/dist/components/control/control.js +7 -2
- package/dist/components/control/control.js.map +1 -1
- package/dist/components/control-array/control-array.d.ts.map +1 -1
- package/dist/components/control-array/control-array.js +55 -10
- package/dist/components/control-array/control-array.js.map +1 -1
- package/dist/components/control-number/control-number.d.ts +5 -0
- package/dist/components/control-number/control-number.d.ts.map +1 -1
- package/dist/components/control-number/control-number.js +1 -0
- package/dist/components/control-number/control-number.js.map +1 -1
- package/dist/components/control-object/control-object.d.ts +12 -1
- package/dist/components/control-object/control-object.d.ts.map +1 -1
- package/dist/components/control-object/control-object.js +2 -1
- package/dist/components/control-object/control-object.js.map +1 -1
- package/dist/components/control-password/control-password.d.ts.map +1 -1
- package/dist/components/control-password/control-password.js +1 -0
- package/dist/components/control-password/control-password.js.map +1 -1
- package/dist/components/detail/detail-layout.d.ts +6 -0
- package/dist/components/detail/detail-layout.d.ts.map +1 -1
- package/dist/components/detail/detail-layout.js +2 -1
- package/dist/components/detail/detail-layout.js.map +1 -1
- package/dist/components/email-body-frame/email-body-frame.d.ts +37 -0
- package/dist/components/email-body-frame/email-body-frame.d.ts.map +1 -0
- package/dist/components/email-body-frame/email-body-frame.js +44 -0
- package/dist/components/email-body-frame/email-body-frame.js.map +1 -0
- package/dist/components/markdown-view/diagram/DiagramLabel.d.ts +33 -0
- package/dist/components/markdown-view/diagram/DiagramLabel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/{FlowchartDiagramLabel.js → DiagramLabel.js} +15 -6
- package/dist/components/markdown-view/diagram/DiagramLabel.js.map +1 -0
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts +0 -5
- package/dist/components/markdown-view/diagram/FlowchartDiagram.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js +2 -6
- package/dist/components/markdown-view/diagram/FlowchartDiagram.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramCluster.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js +2 -3
- package/dist/components/markdown-view/diagram/FlowchartDiagramEdge.js.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js +2 -3
- package/dist/components/markdown-view/diagram/FlowchartDiagramNode.js.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts +20 -11
- package/dist/components/markdown-view/diagram/MermaidFence.d.ts.map +1 -1
- package/dist/components/markdown-view/diagram/MermaidFence.js +48 -13
- package/dist/components/markdown-view/diagram/MermaidFence.js.map +1 -1
- package/dist/components/markdown-view/diagram/SequenceDiagram.d.ts +50 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.js +141 -0
- package/dist/components/markdown-view/diagram/SequenceDiagram.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.d.ts +23 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.js +101 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramFragment.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.d.ts +23 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.js +77 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramMessage.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.d.ts +16 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.js +39 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramNote.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.d.ts +20 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.js +61 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipant.js.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.d.ts +27 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.js +65 -0
- package/dist/components/markdown-view/diagram/SequenceDiagramParticipantActor.js.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.d.ts +155 -0
- package/dist/components/markdown-view/diagram/layoutSequence.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js +478 -0
- package/dist/components/markdown-view/diagram/layoutSequence.js.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceModel.d.ts +132 -0
- package/dist/components/markdown-view/diagram/sequenceModel.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceModel.js +0 -0
- package/dist/components/markdown-view/diagram/sequenceParser.d.ts +32 -0
- package/dist/components/markdown-view/diagram/sequenceParser.d.ts.map +1 -0
- package/dist/components/markdown-view/diagram/sequenceParser.js +312 -0
- package/dist/components/markdown-view/diagram/sequenceParser.js.map +1 -0
- package/dist/components/markdown-view/markdown-view.css +65 -0
- package/dist/components/markdown-view/markdown-view.d.ts +18 -11
- package/dist/components/markdown-view/markdown-view.d.ts.map +1 -1
- package/dist/components/markdown-view/markdown-view.js +30 -16
- package/dist/components/markdown-view/markdown-view.js.map +1 -1
- package/dist/components/nav-shell/nav-page.d.ts +7 -0
- package/dist/components/nav-shell/nav-page.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-page.js.map +1 -1
- package/dist/components/nav-shell/nav-tree-util.d.ts +64 -2
- package/dist/components/nav-shell/nav-tree-util.d.ts.map +1 -1
- package/dist/components/nav-shell/nav-tree-util.js +29 -6
- package/dist/components/nav-shell/nav-tree-util.js.map +1 -1
- package/dist/components/nav-shell/spotlight.d.ts +3 -2
- package/dist/components/nav-shell/spotlight.d.ts.map +1 -1
- package/dist/components/nav-shell/spotlight.js +9 -6
- 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 +9 -2
- package/dist/components/nav-shell/use-nav-breadcrumbs.js.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.d.ts +6 -0
- package/dist/components/nav-shell/use-nav-entries.d.ts.map +1 -1
- package/dist/components/nav-shell/use-nav-entries.js +8 -3
- 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 +1 -1
- package/dist/components/nav-shell/use-nav-tree.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +1 -1
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts +2 -2
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +1 -0
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/avatar.d.ts +2 -2
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/avatar.js +1 -0
- package/dist/components/ui/avatar.js.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +2 -2
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/card.d.ts +2 -2
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/card.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 +1 -1
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/context-menu.d.ts +2 -2
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/context-menu.js +1 -0
- package/dist/components/ui/context-menu.js.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.d.ts +1 -1
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/hover-card.d.ts +1 -1
- package/dist/components/ui/hover-card.js.map +1 -1
- package/dist/components/ui/input-group.d.ts +2 -2
- package/dist/components/ui/input-group.d.ts.map +1 -1
- package/dist/components/ui/input-group.js +1 -0
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/input-otp.d.ts +1 -1
- package/dist/components/ui/input-otp.d.ts.map +1 -1
- package/dist/components/ui/input-otp.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +1 -0
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/menubar.d.ts +2 -2
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/menubar.js +1 -0
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/pagination.d.ts +1 -1
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/pagination.js +1 -0
- package/dist/components/ui/pagination.js.map +1 -1
- package/dist/components/ui/popover.d.ts +1 -1
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/popover.js.map +1 -1
- package/dist/components/ui/progress.d.ts +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/segmented.d.ts +11 -0
- package/dist/components/ui/segmented.d.ts.map +1 -1
- package/dist/components/ui/segmented.js +6 -2
- package/dist/components/ui/segmented.js.map +1 -1
- package/dist/components/ui/select.d.ts +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +1 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/sheet.d.ts +2 -2
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/switch.js +1 -1
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/table.d.ts +2 -2
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/table.js +1 -0
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.d.ts +1 -1
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +1 -0
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts +1 -11
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +0 -10
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/hooks/use-mobile.d.ts +1 -1
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/lib/i18n-fr.d.ts.map +1 -1
- package/dist/lib/i18n-fr.js +252 -2
- package/dist/lib/i18n-fr.js.map +1 -1
- package/package.json +5 -5
- package/src/components/account/__tests__/account-router.spec.ts +25 -0
- package/src/components/account/__tests__/account-security-mfa-gate.browser.spec.tsx +76 -0
- package/src/components/account/account-connections.tsx +50 -18
- package/src/components/account/account-delete-dialog.tsx +24 -9
- package/src/components/account/account-header.tsx +4 -1
- package/src/components/account/account-keys.tsx +73 -29
- package/src/components/account/account-mfa-dialog.tsx +233 -0
- package/src/components/account/account-password-dialog.tsx +42 -12
- package/src/components/account/account-profile.tsx +66 -25
- package/src/components/account/account-router.tsx +47 -6
- package/src/components/account/account-security.tsx +209 -22
- package/src/components/account/account-sessions.tsx +87 -22
- package/src/components/action-error-toaster/__tests__/action-error-toaster.browser.spec.tsx +114 -0
- package/src/components/admin/__tests__/admin-nav-i18n.browser.spec.tsx +152 -0
- package/src/components/admin/__tests__/admin-notifications-preview-body.browser.spec.tsx +128 -0
- package/src/components/admin/__tests__/admin-notifications-raw-tab.browser.spec.tsx +76 -0
- package/src/components/admin/__tests__/admin-notifications-status-badge.browser.spec.tsx +121 -0
- package/src/components/admin/__tests__/admin-router.spec.ts +27 -0
- package/src/components/admin/__tests__/admin-status-labels.browser.spec.tsx +152 -0
- package/src/components/admin/__tests__/admin-user-detail-security-tab.browser.spec.tsx +92 -0
- package/src/components/admin/admin-jobs-executions-panel.tsx +8 -11
- package/src/components/admin/admin-jobs-status-badge.tsx +4 -5
- package/src/components/admin/admin-jobs-status-labels.ts +46 -0
- package/src/components/admin/admin-layout.tsx +9 -3
- package/src/components/admin/admin-notifications-detail-tabs.tsx +167 -0
- package/src/components/admin/admin-notifications-detail.tsx +100 -0
- package/src/components/admin/admin-notifications-preview-body.tsx +104 -0
- package/src/components/admin/admin-notifications-preview-tab.tsx +55 -0
- package/src/components/admin/admin-notifications-raw-tab.tsx +76 -0
- package/src/components/admin/admin-notifications-status-badge.tsx +44 -0
- package/src/components/admin/admin-notifications-status-labels.ts +42 -0
- package/src/components/admin/admin-notifications-status-tones.ts +85 -0
- package/src/components/admin/admin-notifications-template-label.ts +22 -0
- package/src/components/admin/admin-notifications.tsx +398 -31
- package/src/components/admin/admin-router.tsx +65 -8
- package/src/components/admin/admin-sessions.tsx +10 -3
- package/src/components/admin/admin-user-detail-security-tab.tsx +70 -5
- package/src/components/admin/admin-user-detail-sessions-tab.tsx +10 -3
- package/src/components/admin/admin-user-detail.tsx +92 -23
- package/src/components/admin/admin-users.tsx +1 -1
- package/src/components/admin/admin-workflows-executions-panel.tsx +8 -16
- package/src/components/admin/admin-workflows-status-badge.tsx +4 -5
- package/src/components/admin/admin-workflows-status-labels.ts +51 -0
- package/src/components/alepha-table/__tests__/alepha-table-row-key.browser.spec.tsx +106 -0
- package/src/components/alepha-table/alepha-table.tsx +50 -10
- package/src/components/auth/auth-login.tsx +37 -18
- package/src/components/auth/auth-mfa-step.tsx +177 -0
- package/src/components/auth/auth-register.tsx +1 -1
- package/src/components/auth/provider-labels.ts +4 -0
- package/src/components/control/__tests__/control-autofocus.browser.spec.tsx +107 -0
- package/src/components/control/control.tsx +20 -5
- package/src/components/control-array/__tests__/control-array-child-change.browser.spec.tsx +90 -0
- package/src/components/control-array/control-array.tsx +85 -13
- package/src/components/control-number/control-number.tsx +7 -0
- package/src/components/control-object/__tests__/control-object-clear.browser.spec.tsx +100 -0
- package/src/components/control-object/control-object.tsx +21 -2
- package/src/components/control-password/control-password.tsx +2 -1
- package/src/components/detail/__tests__/detail-layout.browser.spec.tsx +36 -0
- package/src/components/detail/detail-layout.tsx +20 -1
- package/src/components/email-body-frame/__tests__/email-body-frame.browser.spec.tsx +52 -0
- package/src/components/email-body-frame/email-body-frame.tsx +81 -0
- package/src/components/markdown-view/__tests__/markdown-view-mermaid.browser.spec.tsx +65 -2
- package/src/components/markdown-view/diagram/{FlowchartDiagramLabel.tsx → DiagramLabel.tsx} +14 -4
- package/src/components/markdown-view/diagram/FlowchartDiagram.tsx +1 -6
- package/src/components/markdown-view/diagram/FlowchartDiagramCluster.tsx +1 -1
- package/src/components/markdown-view/diagram/FlowchartDiagramEdge.tsx +2 -3
- package/src/components/markdown-view/diagram/FlowchartDiagramNode.tsx +2 -3
- package/src/components/markdown-view/diagram/MermaidFence.tsx +65 -15
- package/src/components/markdown-view/diagram/SequenceDiagram.tsx +203 -0
- package/src/components/markdown-view/diagram/SequenceDiagramFragment.tsx +120 -0
- package/src/components/markdown-view/diagram/SequenceDiagramMessage.tsx +100 -0
- package/src/components/markdown-view/diagram/SequenceDiagramNote.tsx +46 -0
- package/src/components/markdown-view/diagram/SequenceDiagramParticipant.tsx +80 -0
- package/src/components/markdown-view/diagram/SequenceDiagramParticipantActor.tsx +74 -0
- package/src/components/markdown-view/diagram/__tests__/sequence-diagram.browser.spec.tsx +267 -0
- package/src/components/markdown-view/diagram/layoutSequence.spec.ts +535 -0
- package/src/components/markdown-view/diagram/layoutSequence.ts +764 -0
- package/src/components/markdown-view/diagram/sequenceModel.ts +141 -0
- package/src/components/markdown-view/diagram/sequenceParser.spec.ts +495 -0
- package/src/components/markdown-view/diagram/sequenceParser.ts +443 -0
- package/src/components/markdown-view/markdown-view.css +65 -0
- package/src/components/markdown-view/markdown-view.tsx +34 -16
- package/src/components/nav-shell/__tests__/nav-tree-util.spec.ts +107 -1
- package/src/components/nav-shell/nav-page.tsx +8 -0
- package/src/components/nav-shell/nav-tree-util.ts +95 -2
- package/src/components/nav-shell/spotlight.tsx +22 -8
- package/src/components/nav-shell/use-nav-breadcrumbs.ts +9 -2
- package/src/components/nav-shell/use-nav-entries.ts +18 -2
- package/src/components/nav-shell/use-nav-tree.ts +4 -1
- package/src/components/ui/alert-dialog.tsx +1 -1
- package/src/components/ui/alert.tsx +2 -2
- package/src/components/ui/avatar.tsx +3 -3
- package/src/components/ui/breadcrumb.tsx +3 -3
- package/src/components/ui/card.tsx +5 -5
- package/src/components/ui/checkbox.tsx +1 -1
- package/src/components/ui/combobox.tsx +8 -8
- package/src/components/ui/command.tsx +4 -4
- package/src/components/ui/context-menu.tsx +7 -7
- package/src/components/ui/dialog.tsx +1 -1
- package/src/components/ui/drawer.tsx +6 -6
- package/src/components/ui/dropdown-menu.tsx +8 -14
- package/src/components/ui/empty.tsx +3 -3
- package/src/components/ui/hover-card.tsx +1 -1
- package/src/components/ui/input-group.tsx +2 -2
- package/src/components/ui/input-otp.tsx +1 -1
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/label.tsx +1 -1
- package/src/components/ui/menubar.tsx +9 -9
- package/src/components/ui/pagination.tsx +1 -1
- package/src/components/ui/popover.tsx +1 -1
- package/src/components/ui/progress.tsx +1 -1
- package/src/components/ui/segmented.tsx +28 -0
- package/src/components/ui/select.tsx +1 -1
- package/src/components/ui/sheet.tsx +4 -4
- package/src/components/ui/switch.tsx +1 -1
- package/src/components/ui/table.tsx +6 -9
- package/src/components/ui/tabs.tsx +1 -1
- package/src/components/ui/textarea.tsx +1 -1
- package/src/components/ui/tooltip.tsx +3 -11
- package/src/components/use-dialog/__tests__/use-dialog-providers.browser.spec.tsx +61 -0
- package/src/hooks/use-mobile.ts +1 -1
- package/src/lib/__tests__/i18n-fr.spec.ts +27 -5
- package/src/lib/i18n-fr.ts +308 -1
- package/dist/components/language-toggle/language-toggle.d.ts +0 -8
- package/dist/components/language-toggle/language-toggle.d.ts.map +0 -1
- package/dist/components/language-toggle/language-toggle.js +0 -49
- package/dist/components/language-toggle/language-toggle.js.map +0 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts +0 -23
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.d.ts.map +0 -1
- package/dist/components/markdown-view/diagram/FlowchartDiagramLabel.js.map +0 -1
- package/dist/components/ui/accordion.d.ts +0 -7
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js +0 -55
- package/dist/components/ui/accordion.js.map +0 -1
- package/dist/components/ui/aspect-ratio.d.ts +0 -5
- package/dist/components/ui/aspect-ratio.d.ts.map +0 -1
- package/dist/components/ui/aspect-ratio.js +0 -15
- package/dist/components/ui/aspect-ratio.js.map +0 -1
- package/dist/components/ui/carousel.d.ts +0 -29
- package/dist/components/ui/carousel.d.ts.map +0 -1
- package/dist/components/ui/carousel.js +0 -144
- package/dist/components/ui/carousel.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js +0 -26
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/direction.d.ts +0 -2
- package/dist/components/ui/direction.d.ts.map +0 -1
- package/dist/components/ui/direction.js +0 -3
- package/dist/components/ui/item.d.ts +0 -23
- package/dist/components/ui/item.d.ts.map +0 -1
- package/dist/components/ui/item.js +0 -122
- package/dist/components/ui/item.js.map +0 -1
- package/dist/components/ui/navigation-menu.d.ts +0 -12
- package/dist/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/components/ui/navigation-menu.js +0 -84
- package/dist/components/ui/navigation-menu.js.map +0 -1
- package/dist/components/ui/radio-group.d.ts +0 -6
- package/dist/components/ui/radio-group.d.ts.map +0 -1
- package/dist/components/ui/radio-group.js +0 -29
- package/dist/components/ui/radio-group.js.map +0 -1
- package/dist/components/ui/scroll-area.d.ts +0 -5
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js +0 -38
- package/dist/components/ui/scroll-area.js.map +0 -1
- package/dist/components/ui/toggle-group.d.ts +0 -12
- package/dist/components/ui/toggle-group.d.ts.map +0 -1
- package/dist/components/ui/toggle-group.js +0 -60
- package/dist/components/ui/toggle-group.js.map +0 -1
- package/dist/components/ui/toggle.d.ts +0 -9
- package/dist/components/ui/toggle.d.ts.map +0 -1
- package/dist/components/ui/toggle.js +0 -38
- package/dist/components/ui/toggle.js.map +0 -1
- package/src/components/language-toggle/language-toggle.tsx +0 -66
- package/src/components/ui/accordion.tsx +0 -77
- package/src/components/ui/aspect-ratio.tsx +0 -22
- package/src/components/ui/carousel.tsx +0 -258
- package/src/components/ui/collapsible.tsx +0 -21
- package/src/components/ui/direction.tsx +0 -6
- package/src/components/ui/item.tsx +0 -200
- package/src/components/ui/navigation-menu.tsx +0 -170
- package/src/components/ui/radio-group.tsx +0 -37
- package/src/components/ui/scroll-area.tsx +0 -53
- package/src/components/ui/toggle-group.tsx +0 -93
- package/src/components/ui/toggle.tsx +0 -44
|
@@ -179,8 +179,17 @@ export interface ControlProps {
|
|
|
179
179
|
*/
|
|
180
180
|
placeholder?: string;
|
|
181
181
|
/**
|
|
182
|
-
* Autofocus the control on mount. Forwarded to the text
|
|
183
|
-
*
|
|
182
|
+
* Autofocus the control on mount. Forwarded to the text, number, password
|
|
183
|
+
* or textarea input the control renders. Ignored by the variants that are
|
|
184
|
+
* not a single focusable field (select, date, upload, array, object).
|
|
185
|
+
*
|
|
186
|
+
* Every forward site carries an `oxlint-disable-next-line
|
|
187
|
+
* jsx-a11y/no-autofocus`. That rule is right about a page that grabs focus
|
|
188
|
+
* unbidden and wrong here: nothing focuses unless a caller passed this prop,
|
|
189
|
+
* and it is the caller the rule should be asking. Left to fire, it did real
|
|
190
|
+
* damage once - a lint pass deleted the forwarding and left the prop
|
|
191
|
+
* declared, so login and dialog forms silently stopped focusing their first
|
|
192
|
+
* field and two components grew `getElementById(...).focus()` workarounds.
|
|
184
193
|
*/
|
|
185
194
|
autoFocus?: boolean;
|
|
186
195
|
/**
|
|
@@ -308,6 +317,7 @@ export const Control = (props: ControlProps) => {
|
|
|
308
317
|
controlProps={merged.objectProps?.controlProps}
|
|
309
318
|
variant={merged.objectProps?.variant}
|
|
310
319
|
defaultExpanded={merged.objectProps?.defaultExpanded}
|
|
320
|
+
clearable={merged.clearable}
|
|
311
321
|
/>,
|
|
312
322
|
);
|
|
313
323
|
}
|
|
@@ -370,6 +380,8 @@ export const Control = (props: ControlProps) => {
|
|
|
370
380
|
description={merged.description ?? props.description}
|
|
371
381
|
slider={merged.slider}
|
|
372
382
|
disabled={merged.disabled}
|
|
383
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
384
|
+
autoFocus={merged.autoFocus}
|
|
373
385
|
/>,
|
|
374
386
|
);
|
|
375
387
|
}
|
|
@@ -509,7 +521,8 @@ export const Control = (props: ControlProps) => {
|
|
|
509
521
|
disabled={merged.disabled}
|
|
510
522
|
maxLength={maxLength || undefined}
|
|
511
523
|
autoComplete={merged.autoComplete}
|
|
512
|
-
|
|
524
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
525
|
+
autoFocus={merged.autoFocus}
|
|
513
526
|
placeholder={merged.placeholder}
|
|
514
527
|
value={String(value ?? "")}
|
|
515
528
|
onChange={(e) => setValue(e.target.value)}
|
|
@@ -535,7 +548,8 @@ export const Control = (props: ControlProps) => {
|
|
|
535
548
|
required={meta.required}
|
|
536
549
|
disabled={merged.disabled}
|
|
537
550
|
autoComplete={merged.autoComplete}
|
|
538
|
-
|
|
551
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
552
|
+
autoFocus={merged.autoFocus}
|
|
539
553
|
inputProps={merged.inputProps}
|
|
540
554
|
icon={resolveIcon(merged.icon, "password")}
|
|
541
555
|
value={String(value ?? "")}
|
|
@@ -607,7 +621,8 @@ export const Control = (props: ControlProps) => {
|
|
|
607
621
|
type={htmlType}
|
|
608
622
|
disabled={merged.disabled}
|
|
609
623
|
autoComplete={autoComplete}
|
|
610
|
-
|
|
624
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
625
|
+
autoFocus={merged.autoFocus}
|
|
611
626
|
placeholder={merged.placeholder}
|
|
612
627
|
value={String(value ?? "")}
|
|
613
628
|
minLength={meta.constraints.minLength}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
2
|
+
import { Alepha, z } from "alepha";
|
|
3
|
+
import { AlephaLogger } from "alepha/logger";
|
|
4
|
+
import { AlephaContext } from "alepha/react";
|
|
5
|
+
import { useForm } from "alepha/react/form";
|
|
6
|
+
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
|
|
10
|
+
import { AutoForm } from "../../auto-form/auto-form.tsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `ControlArray` builds an input of its own for each item and each item field,
|
|
14
|
+
* with a path of its own (`.../1/name`), but wrote through `input.set()` -
|
|
15
|
+
* which sets the ARRAY and makes `FormModel` emit `form:change` for the
|
|
16
|
+
* array's path alone.
|
|
17
|
+
*
|
|
18
|
+
* So a child subscribed through `useFieldValue` never heard about its own
|
|
19
|
+
* edit. It kept rendering the value it had at mount, and the moment anything
|
|
20
|
+
* forced a re-render - removing a sibling, adding a row - the typed value
|
|
21
|
+
* snapped back.
|
|
22
|
+
*/
|
|
23
|
+
describe("ControlArray child changes", () => {
|
|
24
|
+
const start = async () => {
|
|
25
|
+
const alepha = Alepha.create().with(AlephaLogger).with(AlephaReactI18n);
|
|
26
|
+
await alepha.start();
|
|
27
|
+
return alepha;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const mount = (alepha: Alepha, ui: ReactNode) =>
|
|
31
|
+
render(
|
|
32
|
+
<AlephaContext.Provider value={alepha}>{ui}</AlephaContext.Provider>,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const schema = z.object({
|
|
36
|
+
items: z.array(z.object({ name: z.text() })),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const Probe = () => {
|
|
40
|
+
const form = useForm({
|
|
41
|
+
schema,
|
|
42
|
+
initialValues: { items: [{ name: "one" }, { name: "two" }] },
|
|
43
|
+
handler: () => {},
|
|
44
|
+
});
|
|
45
|
+
return <AutoForm form={form} fields={{ items: { label: "Items" } }} />;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Every text box `ControlArray` rendered for the item field, in row order.
|
|
50
|
+
*/
|
|
51
|
+
const nameInputs = (container: HTMLElement) =>
|
|
52
|
+
Array.from(
|
|
53
|
+
container.querySelectorAll<HTMLInputElement>('input[type="text"]'),
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
it("keeps a typed value when a sibling is removed", async () => {
|
|
57
|
+
const alepha = await start();
|
|
58
|
+
const { container } = mount(alepha, <Probe />);
|
|
59
|
+
|
|
60
|
+
await waitFor(() => expect(nameInputs(container)).toHaveLength(2));
|
|
61
|
+
|
|
62
|
+
const second = nameInputs(container)[1];
|
|
63
|
+
fireEvent.change(second, { target: { value: "edited" } });
|
|
64
|
+
await waitFor(() => expect(second.value).toBe("edited"));
|
|
65
|
+
|
|
66
|
+
// Remove the FIRST row: the edited row moves from index 1 to index 0, so
|
|
67
|
+
// its path changes and it re-renders.
|
|
68
|
+
const remove = screen.getAllByRole("button", { name: /remove|delete/i });
|
|
69
|
+
fireEvent.click(remove[0]);
|
|
70
|
+
|
|
71
|
+
await waitFor(() => expect(nameInputs(container)).toHaveLength(1));
|
|
72
|
+
expect(nameInputs(container)[0].value).toBe("edited");
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("keeps a typed value when a row is appended", async () => {
|
|
76
|
+
const alepha = await start();
|
|
77
|
+
const { container } = mount(alepha, <Probe />);
|
|
78
|
+
|
|
79
|
+
await waitFor(() => expect(nameInputs(container)).toHaveLength(2));
|
|
80
|
+
|
|
81
|
+
const second = nameInputs(container)[1];
|
|
82
|
+
fireEvent.change(second, { target: { value: "edited" } });
|
|
83
|
+
await waitFor(() => expect(second.value).toBe("edited"));
|
|
84
|
+
|
|
85
|
+
fireEvent.click(screen.getByRole("button", { name: /add/i }));
|
|
86
|
+
|
|
87
|
+
await waitFor(() => expect(nameInputs(container)).toHaveLength(3));
|
|
88
|
+
expect(nameInputs(container)[1].value).toBe("edited");
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -125,6 +125,17 @@ const colsClass: Record<number, string> = {
|
|
|
125
125
|
4: "grid-cols-4",
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* The keys of a plain object, or nothing.
|
|
130
|
+
*
|
|
131
|
+
* An item that is not an object has no per-field inputs, so there is nothing
|
|
132
|
+
* below it to notify.
|
|
133
|
+
*/
|
|
134
|
+
const objectKeys = (value: unknown): string[] =>
|
|
135
|
+
value && typeof value === "object" && !Array.isArray(value)
|
|
136
|
+
? Object.keys(value as Record<string, unknown>)
|
|
137
|
+
: [];
|
|
138
|
+
|
|
128
139
|
const useArrayItems = (input: BaseInputField | undefined) => {
|
|
129
140
|
const alepha = useAlepha();
|
|
130
141
|
const counter = useRef(0);
|
|
@@ -135,22 +146,81 @@ const useArrayItems = (input: BaseInputField | undefined) => {
|
|
|
135
146
|
: [];
|
|
136
147
|
});
|
|
137
148
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
149
|
+
// The list as last rendered, so a write can diff against it without
|
|
150
|
+
// `setItems` depending on `items` (which would rebuild the callback, and
|
|
151
|
+
// with it every row, on each keystroke).
|
|
152
|
+
const itemsRef = useRef(items);
|
|
153
|
+
itemsRef.current = items;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Tell the CHILD paths what changed.
|
|
157
|
+
*
|
|
158
|
+
* `input.set()` writes the whole array and `FormModel` emits `form:change`
|
|
159
|
+
* for the array's own path only. The per-item and per-field inputs this
|
|
160
|
+
* component builds carry paths of their own (`.../2/name`), so a child
|
|
161
|
+
* subscribed through `useFieldValue` never heard about its own edit and
|
|
162
|
+
* kept re-rendering the value it had at mount.
|
|
163
|
+
*
|
|
164
|
+
* Only what actually differs is emitted: this event is how a row avoids
|
|
165
|
+
* re-rendering when a sibling changes, and announcing every path on every
|
|
166
|
+
* keystroke would give that up.
|
|
167
|
+
*/
|
|
168
|
+
const emitChanged = useCallback(
|
|
169
|
+
(prev: ArrayItem[], next: ArrayItem[]) => {
|
|
170
|
+
const form = input?.form;
|
|
171
|
+
if (!form || !input) return;
|
|
172
|
+
|
|
173
|
+
const emit = (path: string, value: unknown) =>
|
|
174
|
+
void alepha.events.emit(
|
|
175
|
+
"form:change",
|
|
176
|
+
{ id: form.id, path, value },
|
|
177
|
+
{ catch: true },
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
for (let i = 0; i < Math.max(prev.length, next.length); i++) {
|
|
181
|
+
const before = prev[i]?.value;
|
|
182
|
+
const after = next[i]?.value;
|
|
183
|
+
if (before === after) continue;
|
|
184
|
+
|
|
185
|
+
emit(`${input.path}/${i}`, after);
|
|
186
|
+
|
|
187
|
+
for (const key of new Set([
|
|
188
|
+
...objectKeys(before),
|
|
189
|
+
...objectKeys(after),
|
|
190
|
+
])) {
|
|
191
|
+
const beforeField = (before as Record<string, unknown>)?.[key];
|
|
192
|
+
const afterField = (after as Record<string, unknown>)?.[key];
|
|
193
|
+
if (beforeField !== afterField) {
|
|
194
|
+
emit(`${input.path}/${i}/${key}`, afterField);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
[alepha, input],
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
const sync = useCallback(
|
|
203
|
+
(next: unknown[] | undefined) => {
|
|
204
|
+
if (!Array.isArray(next)) {
|
|
205
|
+
emitChanged(itemsRef.current, []);
|
|
206
|
+
setItemsState([]);
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
144
209
|
if (
|
|
145
|
-
|
|
146
|
-
|
|
210
|
+
itemsRef.current.length === next.length &&
|
|
211
|
+
itemsRef.current.every((it, i) => it.value === next[i])
|
|
147
212
|
) {
|
|
148
|
-
return
|
|
213
|
+
return;
|
|
149
214
|
}
|
|
150
215
|
counter.current = 0;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
216
|
+
const rebuilt = next.map((value) => ({ key: counter.current++, value }));
|
|
217
|
+
// A reset or a `setInitialValues` writes the array whole, so the child
|
|
218
|
+
// paths need telling here too - same reason as an edit.
|
|
219
|
+
emitChanged(itemsRef.current, rebuilt);
|
|
220
|
+
setItemsState(rebuilt);
|
|
221
|
+
},
|
|
222
|
+
[emitChanged],
|
|
223
|
+
);
|
|
154
224
|
|
|
155
225
|
useEffect(() => {
|
|
156
226
|
if (!input?.form) return;
|
|
@@ -163,10 +233,12 @@ const useArrayItems = (input: BaseInputField | undefined) => {
|
|
|
163
233
|
|
|
164
234
|
const setItems = useCallback(
|
|
165
235
|
(next: ArrayItem[]) => {
|
|
236
|
+
const prev = itemsRef.current;
|
|
166
237
|
setItemsState(next);
|
|
167
238
|
input?.set(next.map((it) => it.value));
|
|
239
|
+
emitChanged(prev, next);
|
|
168
240
|
},
|
|
169
|
-
[input],
|
|
241
|
+
[input, emitChanged],
|
|
170
242
|
);
|
|
171
243
|
|
|
172
244
|
return { items, setItems, nextKey: () => counter.current++ };
|
|
@@ -46,6 +46,11 @@ export interface ControlNumberProps {
|
|
|
46
46
|
* Disable the input.
|
|
47
47
|
*/
|
|
48
48
|
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Autofocus the input on mount. Ignored by the slider variant, which is not
|
|
51
|
+
* a text field and has nothing to type into.
|
|
52
|
+
*/
|
|
53
|
+
autoFocus?: boolean;
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
export const ControlNumber = (props: ControlNumberProps) => {
|
|
@@ -123,6 +128,8 @@ export const ControlNumber = (props: ControlNumberProps) => {
|
|
|
123
128
|
max={max}
|
|
124
129
|
step={props.step}
|
|
125
130
|
disabled={props.disabled}
|
|
131
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
132
|
+
autoFocus={props.autoFocus}
|
|
126
133
|
value={value ?? ""}
|
|
127
134
|
onChange={(e) => {
|
|
128
135
|
const v = e.target.value;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { fireEvent, render, waitFor } from "@testing-library/react";
|
|
2
|
+
import { Alepha, z } from "alepha";
|
|
3
|
+
import { AlephaLogger } from "alepha/logger";
|
|
4
|
+
import { AlephaContext } from "alepha/react";
|
|
5
|
+
import { type BaseInputField, useFieldValue, useForm } from "alepha/react/form";
|
|
6
|
+
import { AlephaReactI18n } from "alepha/react/i18n";
|
|
7
|
+
import type { ReactNode } from "react";
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
|
|
10
|
+
import { ControlObject } from "../control-object.tsx";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The clear button used to be behind an opt-in `clearable` prop that the only
|
|
14
|
+
* thing mounting this component - `Control` - never passed, so an initialised
|
|
15
|
+
* optional object could be created from the UI and then never removed.
|
|
16
|
+
*
|
|
17
|
+
* The schema answers it now: optional means clearable, and a caller opts out.
|
|
18
|
+
*/
|
|
19
|
+
describe("ControlObject clear", () => {
|
|
20
|
+
const mount = (alepha: Alepha, ui: ReactNode) =>
|
|
21
|
+
render(
|
|
22
|
+
<AlephaContext.Provider value={alepha}>{ui}</AlephaContext.Provider>,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const start = async () => {
|
|
26
|
+
const alepha = Alepha.create().with(AlephaLogger).with(AlephaReactI18n);
|
|
27
|
+
await alepha.start();
|
|
28
|
+
return alepha;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Renders the bound value, so the assertions read form state rather than
|
|
33
|
+
* whether some child input happens to be on screen.
|
|
34
|
+
*/
|
|
35
|
+
const Reporter = (props: { input: BaseInputField }) => {
|
|
36
|
+
const [value] = useFieldValue(props.input);
|
|
37
|
+
return (
|
|
38
|
+
<span data-testid="value">
|
|
39
|
+
{value === undefined ? "∅" : JSON.stringify(value)}
|
|
40
|
+
</span>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const Probe = (props: { required?: boolean; clearable?: boolean }) => {
|
|
45
|
+
const address = z.object({ city: z.text().optional() as never });
|
|
46
|
+
const form = useForm({
|
|
47
|
+
schema: z.object(
|
|
48
|
+
props.required ? { address } : { address: address.optional() as never },
|
|
49
|
+
),
|
|
50
|
+
handler: () => {},
|
|
51
|
+
});
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<ControlObject
|
|
55
|
+
input={form.input.address}
|
|
56
|
+
label="Address"
|
|
57
|
+
clearable={props.clearable}
|
|
58
|
+
/>
|
|
59
|
+
<Reporter input={form.input.address} />
|
|
60
|
+
</>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const initialize = async (ui: ReturnType<typeof render>) => {
|
|
65
|
+
fireEvent.click(await ui.findByRole("button", { name: "Initialize" }));
|
|
66
|
+
await waitFor(() => {
|
|
67
|
+
expect(ui.getByTestId("value").textContent).not.toBe("∅");
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
it("clears an initialised optional object, with no prop passed", async () => {
|
|
72
|
+
const alepha = await start();
|
|
73
|
+
const ui = mount(alepha, <Probe />);
|
|
74
|
+
|
|
75
|
+
await initialize(ui);
|
|
76
|
+
|
|
77
|
+
fireEvent.click(await ui.findByRole("button", { name: "Clear" }));
|
|
78
|
+
await waitFor(() => {
|
|
79
|
+
expect(ui.getByTestId("value").textContent).toBe("∅");
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("offers no clear button on a required object", async () => {
|
|
84
|
+
const alepha = await start();
|
|
85
|
+
const ui = mount(alepha, <Probe required />);
|
|
86
|
+
|
|
87
|
+
await initialize(ui);
|
|
88
|
+
|
|
89
|
+
expect(ui.queryByRole("button", { name: "Clear" })).toBeNull();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("lets a caller opt out with clearable={false}", async () => {
|
|
93
|
+
const alepha = await start();
|
|
94
|
+
const ui = mount(alepha, <Probe clearable={false} />);
|
|
95
|
+
|
|
96
|
+
await initialize(ui);
|
|
97
|
+
|
|
98
|
+
expect(ui.queryByRole("button", { name: "Clear" })).toBeNull();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
@@ -63,7 +63,18 @@ export interface ControlObjectProps {
|
|
|
63
63
|
*/
|
|
64
64
|
i18nPrefix?: string;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Take the clear button away from an optional object.
|
|
67
|
+
*
|
|
68
|
+
* The schema decides by default: an optional or nullable object that has
|
|
69
|
+
* been initialised offers the button, and `false` opts out - the same way
|
|
70
|
+
* round as a text field's `clearable`, and for the same reason. Pass
|
|
71
|
+
* `false` when clearing is not something the API can honour, so the button
|
|
72
|
+
* does not promise an edit that silently does nothing.
|
|
73
|
+
*
|
|
74
|
+
* This used to be opt-IN, which made the button unreachable: `Control` is
|
|
75
|
+
* the only thing that mounts this component and it never passed the prop,
|
|
76
|
+
* so an initialised optional object could not be cleared from the UI at
|
|
77
|
+
* all.
|
|
67
78
|
*/
|
|
68
79
|
clearable?: boolean;
|
|
69
80
|
}
|
|
@@ -90,6 +101,14 @@ export const ControlObject = (props: ControlObjectProps) => {
|
|
|
90
101
|
// ── Init / clear ────────────────────────────────────────────────
|
|
91
102
|
const isInitialized = value != null && typeof value === "object";
|
|
92
103
|
|
|
104
|
+
// `clearable !== false`, not `clearable === true`: the schema is the
|
|
105
|
+
// answer, and a caller opts out. A required object has nothing to clear to.
|
|
106
|
+
const showClear =
|
|
107
|
+
isInitialized &&
|
|
108
|
+
!meta.required &&
|
|
109
|
+
!props.disabled &&
|
|
110
|
+
props.clearable !== false;
|
|
111
|
+
|
|
93
112
|
const fieldNames = Object.keys(z.schema.shape(schema));
|
|
94
113
|
const nestedItems = (props.input as ObjectInputField<ZObject>).items as
|
|
95
114
|
| Record<string, BaseInputField>
|
|
@@ -142,7 +161,7 @@ export const ControlObject = (props: ControlObjectProps) => {
|
|
|
142
161
|
>
|
|
143
162
|
<Plus className="size-4" />
|
|
144
163
|
</Button>
|
|
145
|
-
) :
|
|
164
|
+
) : showClear ? (
|
|
146
165
|
<Button
|
|
147
166
|
type="button"
|
|
148
167
|
variant="ghost"
|
|
@@ -59,7 +59,8 @@ export const ControlPassword = (props: ControlPasswordProps) => {
|
|
|
59
59
|
name={props.name}
|
|
60
60
|
type={reveal ? "text" : "password"}
|
|
61
61
|
autoComplete={props.autoComplete ?? "current-password"}
|
|
62
|
-
|
|
62
|
+
// oxlint-disable-next-line jsx-a11y/no-autofocus
|
|
63
|
+
autoFocus={props.autoFocus}
|
|
63
64
|
disabled={props.disabled}
|
|
64
65
|
required={props.required}
|
|
65
66
|
minLength={props.minLength}
|
|
@@ -125,6 +125,42 @@ describe("DetailLayout", () => {
|
|
|
125
125
|
expect(onBack).toHaveBeenCalled();
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
+
/**
|
|
129
|
+
* The content column carries BOTH axis escapes.
|
|
130
|
+
*
|
|
131
|
+
* It is a flex item on the shell row's horizontal main axis, so without
|
|
132
|
+
* `min-w-0` its `min-width: auto` resolves to its content's min-content
|
|
133
|
+
* width and it refuses to shrink. A tab body wider than the viewport (the
|
|
134
|
+
* epic Flow tab's questline board is `w-max`) then stretches the column
|
|
135
|
+
* past the viewport rather than overflowing inside it: the body's own
|
|
136
|
+
* `overflow-auto` never sees an overflow, so no scrollbar appears, and the
|
|
137
|
+
* row's `overflow-hidden` clips the remainder out of reach.
|
|
138
|
+
*
|
|
139
|
+
* ⚠️ jsdom does no layout, so this can only pin the class. The measurement
|
|
140
|
+
* that proves the behaviour was taken in a real browser: on a 1276px
|
|
141
|
+
* viewport with a 16-card questline the column is 3160px wide and
|
|
142
|
+
* `scrollWidth === clientWidth` without `min-w-0`, and 988px wide with
|
|
143
|
+
* 2172px of horizontal scroll with it.
|
|
144
|
+
*/
|
|
145
|
+
it("lets the content column shrink on both axes", async () => {
|
|
146
|
+
const { container } = await mount(
|
|
147
|
+
<DetailLayout
|
|
148
|
+
aside={<p>identity panel</p>}
|
|
149
|
+
tabs={tabs}
|
|
150
|
+
tab="overview"
|
|
151
|
+
onTabChange={() => {}}
|
|
152
|
+
>
|
|
153
|
+
<p>overview body</p>
|
|
154
|
+
</DetailLayout>,
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const column = container.querySelector("aside")?.nextElementSibling;
|
|
158
|
+
|
|
159
|
+
expect(column).toBeTruthy();
|
|
160
|
+
expect(column?.className).toContain("min-w-0");
|
|
161
|
+
expect(column?.className).toContain("min-h-0");
|
|
162
|
+
});
|
|
163
|
+
|
|
128
164
|
/**
|
|
129
165
|
* `loading` wins over `notFound`. A page computes "not found" as "no record",
|
|
130
166
|
* which is also true on the very first render — ordering it the other way
|
|
@@ -13,6 +13,12 @@ type IconType = ComponentType<SVGProps<SVGSVGElement>>;
|
|
|
13
13
|
export interface DetailTab {
|
|
14
14
|
value: string;
|
|
15
15
|
label: React.ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* A trailing count. Passed through to `Segmented`, which colours it from
|
|
18
|
+
* the segment's own state — see {@link SegmentedOption.count} for why a
|
|
19
|
+
* count folded into `label` cannot be read on the active tab.
|
|
20
|
+
*/
|
|
21
|
+
count?: React.ReactNode;
|
|
16
22
|
/**
|
|
17
23
|
* Rendered at `size-4` before the label. Passed as a component rather than
|
|
18
24
|
* an element so callers hand over data — every detail page used to repeat
|
|
@@ -126,6 +132,7 @@ export const DetailLayout = (props: DetailLayoutProps) => {
|
|
|
126
132
|
const Icon = entry.icon;
|
|
127
133
|
return {
|
|
128
134
|
value: entry.value,
|
|
135
|
+
count: entry.count,
|
|
129
136
|
label: Icon ? (
|
|
130
137
|
<span className="inline-flex items-center gap-1.5">
|
|
131
138
|
<Icon className="size-4" />
|
|
@@ -149,7 +156,19 @@ export const DetailLayout = (props: DetailLayoutProps) => {
|
|
|
149
156
|
{props.aside}
|
|
150
157
|
</aside>
|
|
151
158
|
|
|
152
|
-
|
|
159
|
+
{/* `min-w-0` is not decoration, and it is the horizontal twin of the
|
|
160
|
+
`min-h-0` beside it. This column is a flex item on the row's
|
|
161
|
+
horizontal main axis, so `min-width: auto` resolves to its content's
|
|
162
|
+
min-content width and it refuses to shrink below it. A tab body
|
|
163
|
+
wider than the viewport (the Questline board is `w-max`) then
|
|
164
|
+
stretches this column past the viewport instead of overflowing
|
|
165
|
+
inside it: the body's own `overflow-auto` sees a box as wide as its
|
|
166
|
+
content and never scrolls, and the row's `overflow-hidden` simply
|
|
167
|
+
clips whatever is past the edge, with no scrollbar to reach it.
|
|
168
|
+
Measured on a 1276px viewport with a 16-card questline: without it
|
|
169
|
+
the column is 3160px and `scrollWidth === clientWidth`; with it the
|
|
170
|
+
column is 988px and the body scrolls 2172px. */}
|
|
171
|
+
<div className="flex min-h-0 min-w-0 flex-1 flex-col">
|
|
153
172
|
<div className="bg-background flex h-14 shrink-0 items-center gap-2 border-b px-4">
|
|
154
173
|
{/* `lg` (h-9), not the `sm` (h-7) this started on. The toolbar is
|
|
155
174
|
`h-14`, so at 28px the control filled exactly half of it and
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
import { EmailBodyFrame } from "../email-body-frame.tsx";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An email body is untrusted HTML written by whoever authored the template,
|
|
8
|
+
* rendered inside the admin. These assert the isolation, not the styling.
|
|
9
|
+
*/
|
|
10
|
+
describe("EmailBodyFrame", () => {
|
|
11
|
+
const frameOf = (html: string, dir?: "ltr" | "rtl") => {
|
|
12
|
+
const { container } = render(<EmailBodyFrame html={html} dir={dir} />);
|
|
13
|
+
return container.querySelector("iframe")!;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
it("renders a full document as-is", () => {
|
|
17
|
+
// Wrapping it again would nest <html> inside <html>, and the document
|
|
18
|
+
// already declares its own direction.
|
|
19
|
+
const doc = '<!DOCTYPE html><html dir="rtl"><body>hello</body></html>';
|
|
20
|
+
expect(frameOf(doc).getAttribute("srcdoc")).toBe(doc);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("wraps a bare fragment in a document of its own", () => {
|
|
24
|
+
const srcDoc = frameOf("<p>hello</p>").getAttribute("srcdoc") ?? "";
|
|
25
|
+
expect(srcDoc).toContain("<!DOCTYPE html>");
|
|
26
|
+
expect(srcDoc).toContain("<p>hello</p>");
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("applies the requested direction to a fragment", () => {
|
|
30
|
+
const srcDoc = frameOf("<p>hello</p>", "rtl").getAttribute("srcdoc") ?? "";
|
|
31
|
+
expect(srcDoc).toContain('dir="rtl"');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The sandbox is the whole point of the component.
|
|
36
|
+
*
|
|
37
|
+
* It blocks scripts in an untrusted body, keeps the email's CSS out of the
|
|
38
|
+
* admin's, and blocks top-level navigation - which is what makes the live
|
|
39
|
+
* one-click unsubscribe link the renderer mints inert. Clicking it in a
|
|
40
|
+
* preview would otherwise unsubscribe the recipient.
|
|
41
|
+
*/
|
|
42
|
+
it("sandboxes the frame with no permissions at all", () => {
|
|
43
|
+
const frame = frameOf("<p>hello</p>");
|
|
44
|
+
expect(frame.hasAttribute("sandbox")).toBe(true);
|
|
45
|
+
expect(frame.getAttribute("sandbox")).toBe("");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("renders an empty body rather than crashing on no html", () => {
|
|
49
|
+
const srcDoc = frameOf("").getAttribute("srcdoc") ?? "";
|
|
50
|
+
expect(srcDoc).toContain("<!DOCTYPE html>");
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
3
|
+
void React;
|
|
4
|
+
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
|
|
7
|
+
export interface EmailBodyFrameProps {
|
|
8
|
+
/**
|
|
9
|
+
* Raw email HTML. May be a full document (`<html dir="rtl">…`) or a bare
|
|
10
|
+
* fragment.
|
|
11
|
+
*/
|
|
12
|
+
html: string;
|
|
13
|
+
/**
|
|
14
|
+
* Direction applied only when `html` is a bare fragment. A full document
|
|
15
|
+
* keeps whatever `dir` it declares for itself.
|
|
16
|
+
*/
|
|
17
|
+
dir?: "ltr" | "rtl";
|
|
18
|
+
/**
|
|
19
|
+
* Inline style overrides, mainly for sizing.
|
|
20
|
+
*/
|
|
21
|
+
style?: React.CSSProperties;
|
|
22
|
+
title?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Render email HTML inside a sandboxed `<iframe srcDoc>`, so the email's own
|
|
27
|
+
* document stays scoped to the preview.
|
|
28
|
+
*
|
|
29
|
+
* ⚠️ **Never swap this for `dangerouslySetInnerHTML`.** The HTML fragment
|
|
30
|
+
* parser hoists a body's `<html>` / `<body>` attributes onto the real page,
|
|
31
|
+
* so an email carrying `dir="rtl"` flips the entire admin UI to RTL. An
|
|
32
|
+
* iframe gives it a document of its own.
|
|
33
|
+
*
|
|
34
|
+
* The sandbox is empty on purpose, and it does three jobs:
|
|
35
|
+
*
|
|
36
|
+
* - blocks scripts in a body nobody has reviewed,
|
|
37
|
+
* - keeps the email's CSS out of the admin's,
|
|
38
|
+
* - blocks top-level navigation, which is what makes the **live** one-click
|
|
39
|
+
* unsubscribe link the notification renderer mints inert. Clicking it in a
|
|
40
|
+
* preview would otherwise unsubscribe the recipient.
|
|
41
|
+
*/
|
|
42
|
+
export const EmailBodyFrame = (props: EmailBodyFrameProps) => {
|
|
43
|
+
const dir = props.dir ?? "ltr";
|
|
44
|
+
|
|
45
|
+
const srcDoc = useMemo(() => {
|
|
46
|
+
const content = props.html ?? "";
|
|
47
|
+
// Already a complete document: render it untouched rather than nesting
|
|
48
|
+
// <html> inside <html>. It sets its own direction.
|
|
49
|
+
if (/<html[\s>]/i.test(content)) {
|
|
50
|
+
return content;
|
|
51
|
+
}
|
|
52
|
+
// A fragment gets a minimal document so it renders with the requested
|
|
53
|
+
// direction and readable defaults, still fully isolated.
|
|
54
|
+
return (
|
|
55
|
+
`<!DOCTYPE html><html dir="${dir}"><head><meta charset="utf-8">` +
|
|
56
|
+
`<base target="_blank">` +
|
|
57
|
+
"<style>html,body{margin:0}body{padding:24px 28px;" +
|
|
58
|
+
"font-family:-apple-system,system-ui,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;" +
|
|
59
|
+
"font-size:14px;color:#1b2540;line-height:1.5}</style></head>" +
|
|
60
|
+
`<body dir="${dir}">${content}</body></html>`
|
|
61
|
+
);
|
|
62
|
+
}, [props.html, dir]);
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<iframe
|
|
66
|
+
title={props.title ?? "Email preview"}
|
|
67
|
+
srcDoc={srcDoc}
|
|
68
|
+
sandbox=""
|
|
69
|
+
style={{
|
|
70
|
+
width: "100%",
|
|
71
|
+
height: "100%",
|
|
72
|
+
border: "none",
|
|
73
|
+
// An email is authored against a white ground. Painting it with the
|
|
74
|
+
// admin's surface colour would misrepresent what the recipient saw,
|
|
75
|
+
// and in dark mode it would hide dark text entirely.
|
|
76
|
+
background: "#fff",
|
|
77
|
+
...props.style,
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
};
|