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