@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.
Files changed (63) hide show
  1. package/CHANGELOG.md +39 -33
  2. package/package.json +4 -4
  3. package/src/__tests__/auth-flow-block.test.tsx +211 -0
  4. package/src/__tests__/auth-flow-bus.test.ts +290 -0
  5. package/src/__tests__/auth-form-error-block.test.tsx +326 -0
  6. package/src/__tests__/auth-form-validation.test.tsx +204 -0
  7. package/src/__tests__/auth-step-title.test.tsx +202 -0
  8. package/src/__tests__/detached-submit-state.test.tsx +216 -0
  9. package/src/__tests__/forgot-password-composed.test.tsx +313 -0
  10. package/src/__tests__/otp-form-composed.test.tsx +487 -0
  11. package/src/__tests__/password-reset-step.test.tsx +269 -0
  12. package/src/__tests__/register-form-composed.test.tsx +739 -0
  13. package/src/__tests__/registry-parity.test.ts +9 -0
  14. package/src/auth/auth-field-errors.tsx +151 -0
  15. package/src/auth/auth-flow-bus.ts +415 -0
  16. package/src/auth/form-error-context.tsx +55 -0
  17. package/src/auth/form-submit-bus.ts +93 -0
  18. package/src/auth/otp-form-context.tsx +80 -0
  19. package/src/blocks/__tests__/button-block.test.tsx +55 -0
  20. package/src/blocks/__tests__/link-block.test.tsx +48 -30
  21. package/src/blocks/__tests__/overlay-sweep.test.tsx +31 -8
  22. package/src/blocks/__tests__/product-gallery-block.test.tsx +12 -4
  23. package/src/blocks/__tests__/product-recommendations-block.test.tsx +9 -2
  24. package/src/blocks/__tests__/store-locator-block.test.tsx +35 -8
  25. package/src/blocks/__tests__/text-block.test.tsx +37 -3
  26. package/src/blocks/__tests__/variant-selector-block.test.tsx +16 -4
  27. package/src/blocks/auth-consent-block.tsx +214 -0
  28. package/src/blocks/auth-error-block.tsx +82 -0
  29. package/src/blocks/auth-field-block.tsx +270 -0
  30. package/src/blocks/auth-flow-block.tsx +251 -0
  31. package/src/blocks/auth-form-block.tsx +391 -47
  32. package/src/blocks/auth-step-block.tsx +81 -0
  33. package/src/blocks/auth-step-title-block.tsx +81 -0
  34. package/src/blocks/block-renderer-registry.tsx +18 -0
  35. package/src/blocks/button-block.tsx +91 -13
  36. package/src/blocks/forgot-password-block.tsx +318 -24
  37. package/src/blocks/link-block.tsx +22 -84
  38. package/src/blocks/otp-code-input-block.tsx +180 -0
  39. package/src/blocks/otp-form-block.tsx +1092 -0
  40. package/src/blocks/otp-phase-block.tsx +71 -0
  41. package/src/blocks/register-form-block.tsx +541 -74
  42. package/src/blocks/text-block.tsx +17 -40
  43. package/src/chrome/__tests__/theme-config-source.test.ts +4 -1
  44. package/src/hooks/__tests__/use-overlay.test.tsx +97 -5
  45. package/src/hooks/use-block-action.ts +87 -4
  46. package/src/hooks/use-overlay.ts +60 -9
  47. package/src/overlays/__tests__/modal-chrome-padding.test.tsx +119 -0
  48. package/src/overlays/__tests__/modal-registry.test.ts +6 -1
  49. package/src/overlays/__tests__/panel-stretch.test.tsx +60 -0
  50. package/src/overlays/__tests__/responsive-chrome.test.tsx +446 -0
  51. package/src/overlays/__tests__/responsive-presentation.test.tsx +192 -0
  52. package/src/overlays/__tests__/theme-modal-mount.test.tsx +12 -1
  53. package/src/overlays/modal-preview-host.tsx +39 -2
  54. package/src/overlays/modal-registry.ts +344 -4
  55. package/src/overlays/overlay-surface.tsx +249 -19
  56. package/src/overlays/overlay-tokens.ts +94 -0
  57. package/src/overlays/theme-modal-mount.tsx +34 -4
  58. package/src/theme-block.tsx +6 -0
  59. package/src/utils/__tests__/inner-root-styles.test.tsx +139 -0
  60. package/src/utils/__tests__/iterator-bindings.test.tsx +9 -3
  61. package/src/utils/index.ts +107 -6
  62. package/src/utils/iterator-utils.ts +39 -2
  63. 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;