@sproutsocial/seeds-react-modal 1.1.0 → 2.0.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 (45) hide show
  1. package/.turbo/turbo-build.log +23 -23
  2. package/CHANGELOG.md +182 -0
  3. package/dist/ModalAction-BB7qJtQj.d.mts +445 -0
  4. package/dist/ModalAction-BB7qJtQj.d.ts +445 -0
  5. package/dist/esm/chunk-ETVICNHP.js +1353 -0
  6. package/dist/esm/chunk-ETVICNHP.js.map +1 -0
  7. package/dist/esm/index.js +11 -11
  8. package/dist/esm/index.js.map +1 -1
  9. package/dist/esm/v2/index.js +12 -20
  10. package/dist/index.d.mts +2 -1
  11. package/dist/index.d.ts +2 -1
  12. package/dist/index.js +1154 -546
  13. package/dist/index.js.map +1 -1
  14. package/dist/v2/index.d.mts +4 -11
  15. package/dist/v2/index.d.ts +4 -11
  16. package/dist/v2/index.js +1152 -545
  17. package/dist/v2/index.js.map +1 -1
  18. package/package.json +8 -7
  19. package/src/index.ts +11 -12
  20. package/src/shared/constants.ts +11 -7
  21. package/src/v2/Modal.tsx +169 -0
  22. package/src/v2/ModalTypes.ts +343 -0
  23. package/src/v2/ModalV2.stories.tsx +413 -128
  24. package/src/v2/MotionConfig.ts +185 -0
  25. package/src/v2/components/ModalAction.tsx +94 -0
  26. package/src/v2/components/ModalBody.tsx +54 -0
  27. package/src/v2/components/ModalCloseWrapper.tsx +35 -0
  28. package/src/v2/components/ModalContent.tsx +288 -11
  29. package/src/v2/components/ModalDescription.tsx +14 -2
  30. package/src/v2/components/ModalFooter.tsx +94 -13
  31. package/src/v2/components/ModalHeader.tsx +77 -34
  32. package/src/v2/components/ModalOverlay.tsx +52 -0
  33. package/src/v2/components/ModalRail.tsx +35 -99
  34. package/src/v2/components/index.ts +11 -7
  35. package/src/v2/index.ts +13 -16
  36. package/dist/ModalRail-5PeilhW7.d.mts +0 -186
  37. package/dist/ModalRail-5PeilhW7.d.ts +0 -186
  38. package/dist/esm/chunk-4ITF4DBY.js +0 -717
  39. package/dist/esm/chunk-4ITF4DBY.js.map +0 -1
  40. package/src/v2/ModalV2.tsx +0 -388
  41. package/src/v2/ModalV2Styles.tsx +0 -180
  42. package/src/v2/ModalV2Types.ts +0 -154
  43. package/src/v2/components/ModalClose.tsx +0 -29
  44. package/src/v2/components/ModalCloseButton.tsx +0 -100
  45. package/src/v2/components/ModalTrigger.tsx +0 -39
@@ -8,34 +8,34 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 32.36 KB
11
+ CJS dist/index.js 58.46 KB
12
12
  CJS dist/v1/index.js 9.86 KB
13
- CJS dist/v2/index.js 24.54 KB
14
- CJS dist/index.js.map 54.80 KB
13
+ CJS dist/v2/index.js 50.48 KB
14
+ CJS dist/index.js.map 201.74 KB
15
15
  CJS dist/v1/index.js.map 13.03 KB
16
- CJS dist/v2/index.js.map 41.40 KB
17
- CJS ⚡️ Build success in 279ms
18
- ESM dist/esm/index.js 567.00 B
16
+ CJS dist/v2/index.js.map 188.43 KB
17
+ CJS ⚡️ Build success in 345ms
19
18
  ESM dist/esm/v1/index.js 165.00 B
20
- ESM dist/esm/v2/index.js 786.00 B
19
+ ESM dist/esm/v2/index.js 596.00 B
20
+ ESM dist/esm/index.js 583.00 B
21
21
  ESM dist/esm/chunk-IYDY4OPB.js 7.12 KB
22
- ESM dist/esm/chunk-4ITF4DBY.js 20.28 KB
23
- ESM dist/esm/index.js.map 963.00 B
22
+ ESM dist/esm/chunk-ETVICNHP.js 45.64 KB
24
23
  ESM dist/esm/v1/index.js.map 71.00 B
25
24
  ESM dist/esm/v2/index.js.map 71.00 B
25
+ ESM dist/esm/index.js.map 1.05 KB
26
26
  ESM dist/esm/chunk-IYDY4OPB.js.map 12.85 KB
27
- ESM dist/esm/chunk-4ITF4DBY.js.map 40.16 KB
28
- ESM ⚡️ Build success in 280ms
27
+ ESM dist/esm/chunk-ETVICNHP.js.map 187.52 KB
28
+ ESM ⚡️ Build success in 354ms
29
29
  DTS Build start
30
- DTS ⚡️ Build success in 24663ms
31
- DTS dist/index.d.ts 973.00 B
32
- DTS dist/v1/index.d.ts 413.00 B
33
- DTS dist/v2/index.d.ts 1.35 KB
34
- DTS dist/Modal-ki8oiGbC.d.ts 2.52 KB
35
- DTS dist/ModalRail-5PeilhW7.d.ts 7.61 KB
36
- DTS dist/index.d.mts 976.00 B
37
- DTS dist/v1/index.d.mts 415.00 B
38
- DTS dist/v2/index.d.mts 1.35 KB
39
- DTS dist/Modal-ki8oiGbC.d.mts 2.52 KB
40
- DTS dist/ModalRail-5PeilhW7.d.mts 7.61 KB
41
- Done in 27.92s.
30
+ DTS ⚡️ Build success in 31689ms
31
+ DTS dist/index.d.ts 975.00 B
32
+ DTS dist/v1/index.d.ts 413.00 B
33
+ DTS dist/v2/index.d.ts 1021.00 B
34
+ DTS dist/Modal-ki8oiGbC.d.ts 2.52 KB
35
+ DTS dist/ModalAction-BB7qJtQj.d.ts 17.39 KB
36
+ DTS dist/index.d.mts 978.00 B
37
+ DTS dist/v1/index.d.mts 415.00 B
38
+ DTS dist/v2/index.d.mts 1022.00 B
39
+ DTS dist/Modal-ki8oiGbC.d.mts 2.52 KB
40
+ DTS dist/ModalAction-BB7qJtQj.d.mts 17.39 KB
41
+ Done in 34.53s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,187 @@
1
1
  # @sproutsocial/seeds-react-modal
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - b1c3b44: ## Modal V2 Complete Rewrite
8
+
9
+ Complete architectural overhaul of Modal V2 with improved API, accessibility, animations, and mobile responsiveness.
10
+
11
+ ### Breaking Changes
12
+
13
+ #### Component Name Changes
14
+
15
+ - **Root component**: `ModalV2` renamed to `Modal`
16
+ - **Removed components**: `ModalClose`, `ModalCloseButton`, `ModalTrigger`
17
+ - **New components**: `ModalBody`, `ModalCloseWrapper`, `ModalAction`, `ModalCustomHeader`, `ModalCustomFooter`
18
+
19
+ #### Removed Exports
20
+
21
+ - **Removed z-index constants**: `DEFAULT_MODAL_Z_INDEX`, `DEFAULT_OVERLAY_Z_INDEX_OFFSET`, `MODAL_PRIORITY_Z_INDEX`
22
+ - These are no longer needed as Radix UI Dialog handles stacking automatically via portal DOM order
23
+ - If you were using these constants, remove them from your code
24
+ - Stacking is now managed by the order modals are opened (last opened appears on top)
25
+
26
+ #### API Changes
27
+
28
+ - **Modal root**: Now built on Radix UI Dialog primitives with simplified props
29
+
30
+ - Removed children-based header composition
31
+ - Added slot-based API: `title`, `subtitle`, `description` props for common use cases
32
+ - Added `modalTrigger` prop for trigger element
33
+ - Added `draggable` prop for draggable modals
34
+ - Added `showOverlay` prop (defaults to `true`)
35
+ - Added `actions` prop for floating action rail
36
+ - **Removed `priority` prop**: z-index management is no longer needed
37
+ - Added `closeButtonAriaLabel` prop (defaults to "Close")
38
+
39
+ - **ModalHeader**: Converted to slot-based API
40
+
41
+ - Now only supports `title` and `subtitle` props
42
+ - Removed `children` prop
43
+ - For custom headers, use new `ModalCustomHeader` component
44
+ - Automatically becomes draggable handle when `<Modal draggable={true} />`
45
+
46
+ - **ModalFooter**: Converted to slot-based API with automatic button wrapping
47
+
48
+ - `primaryButton`: Main action (auto-closes modal)
49
+ - `cancelButton`: Secondary action (auto-closes modal)
50
+ - `leftAction`: Optional left-aligned action (no auto-close, for destructive actions)
51
+ - For custom footers, use new `ModalCustomFooter` component
52
+ - At least one action prop is required (TypeScript enforced)
53
+
54
+ - **ModalBody**: New component for modal content area
55
+ - Replaces direct content in Modal children
56
+ - Provides proper scrolling behavior and padding
57
+
58
+ #### Type Changes
59
+
60
+ - All types renamed from `TypeModalV2*` to `TypeModal*`
61
+ - `TypeModalV2Props` → `TypeModalProps`
62
+ - `TypeModalV2HeaderProps` → `TypeModalHeaderProps`
63
+ - `TypeModalV2FooterProps` → `TypeModalFooterProps`
64
+ - New types: `TypeModalBodyProps`, `TypeModalDescriptionProps`, `TypeModalRailProps`, `TypeModalActionProps`
65
+
66
+ ### New Features
67
+
68
+ #### Draggable Modals
69
+
70
+ - Enable with `draggable={true}` prop
71
+ - Drag from header to reposition modal
72
+ - Constrained to viewport boundaries
73
+ - TypeScript enforces `showOverlay={false}` when draggable (overlay would block interaction)
74
+ - Automatically sets Radix `modal={false}` to allow background interaction
75
+
76
+ #### Floating Action Rail
77
+
78
+ - Always-visible floating close button
79
+ - Support for additional custom actions via `actions` prop
80
+ - Positioned on right side (desktop) or above modal (mobile)
81
+ - Actions defined with `iconName`, `onClick`, `aria-label`
82
+
83
+ #### Mobile Responsiveness (≤780px)
84
+
85
+ - Bottom sheet layout anchored to screen bottom
86
+ - Rounded top corners, flat bottom corners
87
+ - Rail positioned above modal
88
+ - Content height hugs content with scrolling
89
+ - Smooth slide-up animation
90
+
91
+ #### Animation System
92
+
93
+ - Built with Framer Motion `AnimatePresence`
94
+ - Smooth fade + scale animation (desktop)
95
+ - Slide-up animation (mobile)
96
+ - Separate animations for overlay and content
97
+ - Draggable modals use opacity-only animation (no transform conflict)
98
+
99
+ #### Accessibility Improvements
100
+
101
+ - Built on Radix UI Dialog primitives
102
+ - Automatic ARIA attributes and focus management
103
+ - ESC key and outside click to close (when not draggable)
104
+ - Required `aria-label` when no title/subtitle provided (TypeScript enforced)
105
+ - Subtitle automatically wrapped in `Dialog.Description`
106
+
107
+ ### Component Details
108
+
109
+ #### ModalCloseWrapper
110
+
111
+ New utility component that wraps any element and makes it close the modal when clicked. Used internally by `ModalFooter` for automatic close behavior.
112
+
113
+ ```tsx
114
+ <ModalCloseWrapper>
115
+ <Button>Close</Button>
116
+ </ModalCloseWrapper>
117
+ ```
118
+
119
+ #### ModalAction
120
+
121
+ Action button component for the floating rail. Supports two types:
122
+
123
+ - `actionType="close"`: Closes modal on click
124
+ - `actionType="button"`: Custom action with onClick handler
125
+
126
+ #### ModalCustomHeader & ModalCustomFooter
127
+
128
+ Base styled components for custom header/footer layouts when slot-based API isn't sufficient. Provides styling and system props support.
129
+
130
+ ### Technical Improvements
131
+
132
+ #### Improved Stacking Behavior
133
+
134
+ Modal V2 no longer uses explicit z-index values, relying instead on Radix UI Dialog's portal-based stacking:
135
+
136
+ - **Automatic stacking**: Modal elements are portaled to `<body>` and stack naturally via DOM order
137
+ - **Simpler integration**: No z-index conflicts with other portal-based components (tooltips, popovers, etc.)
138
+ - **Better composability**: Works seamlessly with new popout components and other overlays
139
+ - **Predictable behavior**: Last opened modal always appears on top, regardless of configuration
140
+
141
+ **Migration Note**: If you were using the `priority` prop to control modal stacking, remove it. Modals now stack in the order they're opened, which provides more predictable and intuitive behavior.
142
+
143
+ #### Performance Optimizations
144
+
145
+ - **Split rendering paths**: Non-draggable modals now use lightweight `StaticModalContent` component, avoiding unnecessary drag logic, event listeners, and boundary calculations
146
+ - **Conditional component loading**: Draggable functionality only loads when `draggable={true}`, reducing runtime overhead for 99% of use cases
147
+ - **Optimized re-renders**: Removed drag context overhead from static modals entirely
148
+
149
+ #### Type Safety Enhancements
150
+
151
+ - **Discriminated unions for prop relationships**: TypeScript enforces `showOverlay={false}` when `draggable={true}`, preventing invalid configurations at compile time
152
+ - **Required footer actions**: Footer type system ensures at least one action button is provided, eliminating empty footer states
153
+ - **Removed ambiguous APIs**: Eliminated `children` override props from `ModalHeader` and `ModalFooter`, guiding developers toward the slot-based API while providing explicit `ModalCustomHeader`/`ModalCustomFooter` components for advanced use cases
154
+
155
+ #### Code Quality
156
+
157
+ - Removed redundant `width` styled-system import (already included in LAYOUT)
158
+ - Added POSITION system props to ModalOverlay for better positioning control
159
+ - Created `MotionConfig.ts` for centralized animation variants
160
+ - Split styles into component-specific files for better organization
161
+ - Consistent component naming and structure
162
+ - Updated Storybook stories to use semantic theme tokens instead of raw color scale values
163
+
164
+ ### Racine Updates
165
+
166
+ - Export name corrected: `Modal` instead of `ModalV2`
167
+ - All type exports updated to match new names
168
+ - Removed z-index constant exports to match Modal V2 changes
169
+
170
+ ### Patch Changes
171
+
172
+ - Updated dependencies [b1c3b44]
173
+ - @sproutsocial/seeds-react-theme@3.1.1
174
+ - @sproutsocial/seeds-react-box@1.1.5
175
+ - @sproutsocial/seeds-react-icon@1.1.5
176
+ - @sproutsocial/seeds-react-button@1.3.1
177
+
178
+ ## 1.1.1
179
+
180
+ ### Patch Changes
181
+
182
+ - Updated dependencies [5ea5457]
183
+ - @sproutsocial/seeds-react-button@1.3.0
184
+
3
185
  ## 1.1.0
4
186
 
5
187
  ### Minor Changes