@akinon/pz-theme 2.0.83-rc.0 → 2.0.84-beta.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/CHANGELOG.md +39 -33
- package/package.json +4 -4
- package/src/__tests__/auth-flow-block.test.tsx +211 -0
- package/src/__tests__/auth-flow-bus.test.ts +290 -0
- package/src/__tests__/auth-form-error-block.test.tsx +326 -0
- package/src/__tests__/auth-form-validation.test.tsx +204 -0
- package/src/__tests__/auth-step-title.test.tsx +202 -0
- package/src/__tests__/detached-submit-state.test.tsx +216 -0
- package/src/__tests__/forgot-password-composed.test.tsx +313 -0
- package/src/__tests__/otp-form-composed.test.tsx +487 -0
- package/src/__tests__/password-reset-step.test.tsx +269 -0
- package/src/__tests__/register-form-composed.test.tsx +739 -0
- package/src/__tests__/registry-parity.test.ts +9 -0
- package/src/auth/auth-field-errors.tsx +151 -0
- package/src/auth/auth-flow-bus.ts +415 -0
- package/src/auth/form-error-context.tsx +55 -0
- package/src/auth/form-submit-bus.ts +93 -0
- package/src/auth/otp-form-context.tsx +80 -0
- package/src/blocks/__tests__/button-block.test.tsx +55 -0
- package/src/blocks/__tests__/link-block.test.tsx +48 -30
- package/src/blocks/__tests__/overlay-sweep.test.tsx +31 -8
- package/src/blocks/__tests__/product-gallery-block.test.tsx +12 -4
- package/src/blocks/__tests__/product-recommendations-block.test.tsx +9 -2
- package/src/blocks/__tests__/store-locator-block.test.tsx +35 -8
- package/src/blocks/__tests__/text-block.test.tsx +37 -3
- package/src/blocks/__tests__/variant-selector-block.test.tsx +16 -4
- package/src/blocks/auth-consent-block.tsx +214 -0
- package/src/blocks/auth-error-block.tsx +82 -0
- package/src/blocks/auth-field-block.tsx +270 -0
- package/src/blocks/auth-flow-block.tsx +251 -0
- package/src/blocks/auth-form-block.tsx +391 -47
- package/src/blocks/auth-step-block.tsx +81 -0
- package/src/blocks/auth-step-title-block.tsx +81 -0
- package/src/blocks/block-renderer-registry.tsx +18 -0
- package/src/blocks/button-block.tsx +91 -13
- package/src/blocks/forgot-password-block.tsx +318 -24
- package/src/blocks/link-block.tsx +22 -84
- package/src/blocks/otp-code-input-block.tsx +180 -0
- package/src/blocks/otp-form-block.tsx +1092 -0
- package/src/blocks/otp-phase-block.tsx +71 -0
- package/src/blocks/register-form-block.tsx +541 -74
- package/src/blocks/text-block.tsx +17 -40
- package/src/chrome/__tests__/theme-config-source.test.ts +4 -1
- package/src/hooks/__tests__/use-overlay.test.tsx +97 -5
- package/src/hooks/use-block-action.ts +87 -4
- package/src/hooks/use-overlay.ts +60 -9
- package/src/overlays/__tests__/modal-chrome-padding.test.tsx +119 -0
- package/src/overlays/__tests__/modal-registry.test.ts +6 -1
- package/src/overlays/__tests__/panel-stretch.test.tsx +60 -0
- package/src/overlays/__tests__/responsive-chrome.test.tsx +446 -0
- package/src/overlays/__tests__/responsive-presentation.test.tsx +192 -0
- package/src/overlays/__tests__/theme-modal-mount.test.tsx +12 -1
- package/src/overlays/modal-preview-host.tsx +39 -2
- package/src/overlays/modal-registry.ts +344 -4
- package/src/overlays/overlay-surface.tsx +249 -19
- package/src/overlays/overlay-tokens.ts +94 -0
- package/src/overlays/theme-modal-mount.tsx +34 -4
- package/src/theme-block.tsx +6 -0
- package/src/utils/__tests__/inner-root-styles.test.tsx +139 -0
- package/src/utils/__tests__/iterator-bindings.test.tsx +9 -3
- package/src/utils/index.ts +107 -6
- package/src/utils/iterator-utils.ts +39 -2
- package/src/utils/part-styles.ts +4 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { getResponsiveValue, partAttrs } from '../utils';
|
|
5
|
+
import { renderComposedChildren } from './render-composed-children';
|
|
6
|
+
import { BlockRendererProps } from './block-renderer-registry';
|
|
7
|
+
import { DesignerPlaceholder } from './product-block-utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* One half of an SMS verification, as a named wrapper whose contents are
|
|
11
|
+
* authored as CHILD blocks: the number entry, or the code entry.
|
|
12
|
+
*
|
|
13
|
+
* Deliberately shaped like `auth-step`, and for the same reason — the phase
|
|
14
|
+
* itself decides nothing about visibility. The OTP FORM renders only the phase
|
|
15
|
+
* it is in, exactly as an auth flow renders only its active step; dropped
|
|
16
|
+
* anywhere else a phase is just a labelled column whose children always show.
|
|
17
|
+
* That is what keeps a phase dressable on its own.
|
|
18
|
+
*
|
|
19
|
+
* Properties: phaseKey.
|
|
20
|
+
* Parts: phase.
|
|
21
|
+
*/
|
|
22
|
+
const OtpPhaseBlock = ({
|
|
23
|
+
block,
|
|
24
|
+
placeholderId,
|
|
25
|
+
sectionId,
|
|
26
|
+
isDesigner = false,
|
|
27
|
+
selectedBlockId,
|
|
28
|
+
currentBreakpoint = 'desktop'
|
|
29
|
+
}: BlockRendererProps) => {
|
|
30
|
+
const phaseKey = String(
|
|
31
|
+
getResponsiveValue(block.properties?.phaseKey, currentBreakpoint, '')
|
|
32
|
+
).trim();
|
|
33
|
+
|
|
34
|
+
const childBlocks = (block.blocks || [])
|
|
35
|
+
.filter((childBlock) => (isDesigner ? true : !childBlock.hidden))
|
|
36
|
+
.sort((a, b) => (a.order || 0) - (b.order || 0));
|
|
37
|
+
|
|
38
|
+
// An empty phase renders nothing a shopper could see; in the canvas it has to
|
|
39
|
+
// say what it is waiting for, or adding one looks like nothing happened.
|
|
40
|
+
if (childBlocks.length === 0 && !isDesigner) return null;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div
|
|
44
|
+
data-otp-phase=""
|
|
45
|
+
// Fills its block wrapper; see the note in auth-step-block.tsx.
|
|
46
|
+
className="w-full"
|
|
47
|
+
data-otp-phase-key={phaseKey || undefined}
|
|
48
|
+
{...partAttrs('phase')}
|
|
49
|
+
style={{
|
|
50
|
+
display: 'flex',
|
|
51
|
+
flexDirection: 'column',
|
|
52
|
+
gap: 'var(--otp-phase-gap, 12px)'
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{childBlocks.length === 0 ? (
|
|
56
|
+
<DesignerPlaceholder label="OTP phase (drop its content here)" />
|
|
57
|
+
) : (
|
|
58
|
+
renderComposedChildren({
|
|
59
|
+
blocks: childBlocks,
|
|
60
|
+
placeholderId,
|
|
61
|
+
sectionId,
|
|
62
|
+
isDesigner,
|
|
63
|
+
selectedBlockId,
|
|
64
|
+
currentBreakpoint
|
|
65
|
+
})
|
|
66
|
+
)}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default OtpPhaseBlock;
|