@gridui/modal 0.0.0-stage → 1.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.
- package/README.md +77 -2
- package/dist/index.d.ts +31 -0
- package/dist/index.js +252 -0
- package/dist/index.js.map +7 -0
- package/dist/modal/modal.d.ts +12 -0
- package/dist/modal-action/modal-action.d.ts +10 -0
- package/dist/modal-actions/modal-actions.d.ts +9 -0
- package/dist/modal-body/modal-body.d.ts +9 -0
- package/dist/modal-close/modal-close.d.ts +8 -0
- package/dist/modal-description/modal-description.d.ts +10 -0
- package/dist/modal-footer/modal-footer.d.ts +10 -0
- package/dist/modal-footer-note/modal-footer-note.d.ts +9 -0
- package/dist/modal-header/modal-header.d.ts +12 -0
- package/dist/modal-panel/modal-panel.d.ts +10 -0
- package/dist/modal-title/modal-title.d.ts +10 -0
- package/dist/modal-trigger/modal-trigger.d.ts +8 -0
- package/dist/shared/types.d.ts +12 -0
- package/dist/styles.css +275 -0
- package/package.json +51 -3
package/README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @gridui/modal
|
|
2
|
+
|
|
3
|
+
Core family. Public API: `Modal`, `ModalAction`, `ModalActionProps`, `ModalActions`, `ModalActionsProps`, `ModalBody`, `ModalBodyProps`, `ModalClose`, `ModalDescription`, `ModalDescriptionProps`, `ModalFooter`, `ModalFooterNote`, `ModalFooterNoteProps`, `ModalFooterProps`, `ModalHeader`, `ModalHeaderProps`, `ModalPanel`, `ModalPanelProps`, `ModalProps`, `ModalSectionProps`, `ModalSpace`, `ModalSpacing`, `ModalTitle`, `ModalTitleProps`, `ModalTrigger`.
|
|
4
|
+
|
|
5
|
+
Import components from `@gridui/modal` and load `@gridui/modal/styles.css` after Theme.
|
|
6
|
+
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
|
+
|
|
8
|
+
See [component ownership](../../docs/component-ownership.md) and [release history](.changeset/history/).
|
|
9
|
+
|
|
10
|
+
## Modal
|
|
11
|
+
|
|
12
|
+
The centered modal shares Radix Dialog's focus and dismissal behavior with
|
|
13
|
+
Drawer. Its header owns a title cell and a full-height close cell; its footer
|
|
14
|
+
owns an optional note and edge-aligned action cells. Header and footer accept
|
|
15
|
+
independent responsive `paddingBlock` values. The body owns content scrolling;
|
|
16
|
+
small viewports stack footer actions below the note. See the
|
|
17
|
+
[composition example and API](../../docs/component-ownership.md).
|
|
18
|
+
|
|
19
|
+
Modal headers allow visible overflow so the full-cell close button's external
|
|
20
|
+
hover and keyboard-focus outlines remain visible. Only the title/description
|
|
21
|
+
cell scrolls when header content exceeds its viewport limit; it does not clip
|
|
22
|
+
the close action. The header paints above the scrolling body. The close cell
|
|
23
|
+
keeps its separator color on hover; background and outline provide feedback.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Implementation and lifecycle
|
|
27
|
+
|
|
28
|
+
`Modal` provides a centered Radix dialog with a grid-divided header and footer.
|
|
29
|
+
Compose `ModalTrigger`, `ModalPanel`, `ModalHeader`, `ModalBody`, and `ModalFooter`.
|
|
30
|
+
The panel portals to the document body, traps focus, restores trigger focus on
|
|
31
|
+
close, and supports Escape and outside dismissal. Root and panel forward native
|
|
32
|
+
Radix props, including controlled state and dismissal handlers. The body scrolls
|
|
33
|
+
within the viewport while the header and footer remain available. Panel `forceMount`
|
|
34
|
+
retains state and DOM for Modal, Drawer, Popover, DropdownMenu, and AlertDialog.
|
|
35
|
+
Closed retained panels are hidden automatically with React Activity; their effects
|
|
36
|
+
are paused so scroll locking, background accessibility isolation, and focus scopes
|
|
37
|
+
are released. Reopening restores effects and local state. Without `forceMount`,
|
|
38
|
+
Radix retains its normal presence and exit-animation lifecycle. Backdrops retain
|
|
39
|
+
their ordinary open/close lifecycle. Closed retained panels do not run exit
|
|
40
|
+
animations or background effects. This family requires React and React DOM 19.2 or
|
|
41
|
+
newer within version 19. The public `@gridui/overlay` family owns the shared retained-layer lifecycle. Set
|
|
42
|
+
`--gridui-modal-width` on the panel to override its default 37rem width.
|
|
43
|
+
|
|
44
|
+
`ModalHeader` requires a localized `closeLabel` and supplies the full-height
|
|
45
|
+
close cell. Include `ModalTitle` and optional `ModalDescription`; set
|
|
46
|
+
`aria-describedby={undefined}` on the panel when omitting a description.
|
|
47
|
+
Header and footer independently accept `paddingBlock`, defaulting to 24.
|
|
48
|
+
Values use the spacing scale (0, 4, 8, 16, 24, 32, 48, 64), or
|
|
49
|
+
`{ base: 16, md: 24, lg: 32 }` at the shared 40rem and 64rem breakpoints.
|
|
50
|
+
Spacing is internal padding, with a minimum 2.75rem action target.
|
|
51
|
+
|
|
52
|
+
`ModalFooterNote` is optional. `ModalActions` contains `ModalAction` buttons
|
|
53
|
+
that fill their cells with square seams. On narrow screens, actions occupy a
|
|
54
|
+
separate full-width row below the note. Actions preserve Button variants,
|
|
55
|
+
disabled states, and native props. Only `ModalClose` closes the dialog;
|
|
56
|
+
consumers decide when an asynchronous primary action has succeeded.
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
<Modal>
|
|
60
|
+
<ModalTrigger asChild><Button>Display settings</Button></ModalTrigger>
|
|
61
|
+
<ModalPanel>
|
|
62
|
+
<ModalHeader closeLabel="Close" paddingBlock={{ base: 16, md: 24 }}>
|
|
63
|
+
<ModalTitle>Display settings</ModalTitle>
|
|
64
|
+
<ModalDescription>Adjust the current view.</ModalDescription>
|
|
65
|
+
</ModalHeader>
|
|
66
|
+
<ModalBody>{settingsForm}</ModalBody>
|
|
67
|
+
<ModalFooter paddingBlock={16}>
|
|
68
|
+
<ModalFooterNote>Applies to this view.</ModalFooterNote>
|
|
69
|
+
<ModalActions>
|
|
70
|
+
<ModalClose asChild><ModalAction variant="quiet">Cancel</ModalAction></ModalClose>
|
|
71
|
+
<ModalAction onClick={applySettings}>Apply settings</ModalAction>
|
|
72
|
+
</ModalActions>
|
|
73
|
+
</ModalFooter>
|
|
74
|
+
</ModalPanel>
|
|
75
|
+
</Modal>
|
|
76
|
+
```
|
|
77
|
+
|
|
2
78
|
|
|
3
|
-
This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace Root
|
|
5
|
+
* @description Index
|
|
6
|
+
*/
|
|
7
|
+
export type { ModalProps } from "./modal/modal";
|
|
8
|
+
export type { ModalSpace } from "./modal/modal";
|
|
9
|
+
export { Modal } from "./modal/modal";
|
|
10
|
+
export type { ModalActionProps } from "./modal-action/modal-action";
|
|
11
|
+
export { ModalAction } from "./modal-action/modal-action";
|
|
12
|
+
export type { ModalActionsProps } from "./modal-actions/modal-actions";
|
|
13
|
+
export { ModalActions } from "./modal-actions/modal-actions";
|
|
14
|
+
export type { ModalBodyProps } from "./modal-body/modal-body";
|
|
15
|
+
export { ModalBody } from "./modal-body/modal-body";
|
|
16
|
+
export { ModalClose } from "./modal-close/modal-close";
|
|
17
|
+
export type { ModalDescriptionProps } from "./modal-description/modal-description";
|
|
18
|
+
export { ModalDescription } from "./modal-description/modal-description";
|
|
19
|
+
export type { ModalFooterProps } from "./modal-footer/modal-footer";
|
|
20
|
+
export { ModalFooter } from "./modal-footer/modal-footer";
|
|
21
|
+
export type { ModalFooterNoteProps } from "./modal-footer-note/modal-footer-note";
|
|
22
|
+
export { ModalFooterNote } from "./modal-footer-note/modal-footer-note";
|
|
23
|
+
export type { ModalHeaderProps } from "./modal-header/modal-header";
|
|
24
|
+
export { ModalHeader } from "./modal-header/modal-header";
|
|
25
|
+
export type { ModalPanelProps } from "./modal-panel/modal-panel";
|
|
26
|
+
export { ModalPanel } from "./modal-panel/modal-panel";
|
|
27
|
+
export type { ModalTitleProps } from "./modal-title/modal-title";
|
|
28
|
+
export { ModalTitle } from "./modal-title/modal-title";
|
|
29
|
+
export { ModalTrigger } from "./modal-trigger/modal-trigger";
|
|
30
|
+
export type { ModalSectionProps } from "./shared/types";
|
|
31
|
+
export type { ModalSpacing } from "./shared/types";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// src/modal/modal.tsx
|
|
2
|
+
import { OverlayOpen, useOverlayState } from "@gridui/overlay";
|
|
3
|
+
import "@gridui/style-utils/responsive";
|
|
4
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
var Modal = (props) => {
|
|
7
|
+
const state = useOverlayState(props);
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
OverlayOpen.Provider,
|
|
10
|
+
{
|
|
11
|
+
value: state.open,
|
|
12
|
+
children: /* @__PURE__ */ jsx(
|
|
13
|
+
Dialog.Root,
|
|
14
|
+
{
|
|
15
|
+
...props,
|
|
16
|
+
...state
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/modal-action/modal-action.tsx
|
|
24
|
+
import { Button } from "@gridui/button";
|
|
25
|
+
import { cn } from "@gridui/style-utils";
|
|
26
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
27
|
+
var ModalAction = (props) => {
|
|
28
|
+
const { className, ...restProps } = props;
|
|
29
|
+
return /* @__PURE__ */ jsx2(
|
|
30
|
+
Button,
|
|
31
|
+
{
|
|
32
|
+
...restProps,
|
|
33
|
+
className: cn("flex-1 w-auto rounded-none border-0 border-s border-solid border-border first:border-s-0 px-gridui-24 py-(--gridui-modal-padding) min-h-11", className)
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// src/modal-actions/modal-actions.tsx
|
|
39
|
+
import { cn as cn2 } from "@gridui/style-utils";
|
|
40
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
41
|
+
var ModalActions = (props) => {
|
|
42
|
+
const { className, ...restProps } = props;
|
|
43
|
+
return /* @__PURE__ */ jsx3(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
...restProps,
|
|
47
|
+
className: cn2("gridui-modal-actions flex min-w-0", className)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// src/modal-body/modal-body.tsx
|
|
53
|
+
import { cn as cn3 } from "@gridui/style-utils";
|
|
54
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
55
|
+
var ModalBody = (props) => {
|
|
56
|
+
const { className, ...restProps } = props;
|
|
57
|
+
return /* @__PURE__ */ jsx4(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
...restProps,
|
|
61
|
+
className: cn3("min-h-0 min-w-0 overflow-auto overscroll-contain p-gridui-24 wrap-anywhere", className)
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/modal-close/modal-close.tsx
|
|
67
|
+
import * as Dialog2 from "@radix-ui/react-dialog";
|
|
68
|
+
var ModalClose = Dialog2.Close;
|
|
69
|
+
|
|
70
|
+
// src/modal-description/modal-description.tsx
|
|
71
|
+
import { cn as cn4 } from "@gridui/style-utils";
|
|
72
|
+
import * as Dialog3 from "@radix-ui/react-dialog";
|
|
73
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
74
|
+
var ModalDescription = (props) => {
|
|
75
|
+
const {
|
|
76
|
+
className,
|
|
77
|
+
...restProps
|
|
78
|
+
} = props;
|
|
79
|
+
return /* @__PURE__ */ jsx5(
|
|
80
|
+
Dialog3.Description,
|
|
81
|
+
{
|
|
82
|
+
...restProps,
|
|
83
|
+
className: cn4("mt-gridui-8 mb-0 type-supporting text-muted", className)
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// src/modal-footer/modal-footer.tsx
|
|
89
|
+
import { cn as cn5 } from "@gridui/style-utils";
|
|
90
|
+
import { spacingVariables } from "@gridui/style-utils/responsive";
|
|
91
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
92
|
+
var ModalFooter = (props) => {
|
|
93
|
+
const {
|
|
94
|
+
paddingBlock = 24,
|
|
95
|
+
style,
|
|
96
|
+
className,
|
|
97
|
+
...restProps
|
|
98
|
+
} = props;
|
|
99
|
+
return /* @__PURE__ */ jsx6(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
...restProps,
|
|
103
|
+
style: {
|
|
104
|
+
...spacingVariables("modal-space", paddingBlock),
|
|
105
|
+
...style
|
|
106
|
+
},
|
|
107
|
+
className: cn5("gridui-modal-section gridui-modal-footer max-h-[40dvh] overflow-y-auto shrink-0 border-t border-solid border-border", className)
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/modal-footer-note/modal-footer-note.tsx
|
|
113
|
+
import { cn as cn6 } from "@gridui/style-utils";
|
|
114
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
115
|
+
var ModalFooterNote = (props) => {
|
|
116
|
+
const { className, ...restProps } = props;
|
|
117
|
+
return /* @__PURE__ */ jsx7(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
...restProps,
|
|
121
|
+
className: cn6("min-w-0 px-gridui-24 py-(--gridui-modal-padding) type-supporting text-muted wrap-anywhere", className)
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/modal-header/modal-header.tsx
|
|
127
|
+
import { Button as Button2 } from "@gridui/button";
|
|
128
|
+
import { cn as cn7 } from "@gridui/style-utils";
|
|
129
|
+
import { spacingVariables as spacingVariables2 } from "@gridui/style-utils/responsive";
|
|
130
|
+
import * as Dialog4 from "@radix-ui/react-dialog";
|
|
131
|
+
import { X } from "lucide-react";
|
|
132
|
+
import { jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
133
|
+
var ModalHeader = (props) => {
|
|
134
|
+
const {
|
|
135
|
+
closeLabel,
|
|
136
|
+
children,
|
|
137
|
+
paddingBlock = 24,
|
|
138
|
+
style,
|
|
139
|
+
className,
|
|
140
|
+
...restProps
|
|
141
|
+
} = props;
|
|
142
|
+
return /* @__PURE__ */ jsxs(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
...restProps,
|
|
146
|
+
style: {
|
|
147
|
+
...spacingVariables2("modal-space", paddingBlock),
|
|
148
|
+
...style
|
|
149
|
+
},
|
|
150
|
+
className: cn7("gridui-modal-section gridui-modal-header relative z-(--gridui-z-content) overflow-visible shrink-0 grid grid-cols-[minmax(0,1fr)_auto] border-b border-solid border-border", className),
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx8(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: "max-h-[40dvh] min-w-0 overflow-y-auto px-gridui-24 py-(--gridui-modal-padding) wrap-anywhere",
|
|
156
|
+
children
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsx8(
|
|
160
|
+
Dialog4.Close,
|
|
161
|
+
{
|
|
162
|
+
asChild: true,
|
|
163
|
+
children: /* @__PURE__ */ jsx8(
|
|
164
|
+
Button2,
|
|
165
|
+
{
|
|
166
|
+
"aria-label": closeLabel,
|
|
167
|
+
variant: "quiet",
|
|
168
|
+
className: "self-stretch w-gridui-64 min-h-11 rounded-none border-0 border-s border-solid border-border [&:hover:not(:disabled)]:border-border p-0",
|
|
169
|
+
children: /* @__PURE__ */ jsx8(
|
|
170
|
+
X,
|
|
171
|
+
{
|
|
172
|
+
"aria-hidden": "true"
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/modal-panel/modal-panel.tsx
|
|
185
|
+
import { RetainedLayer } from "@gridui/overlay";
|
|
186
|
+
import { cn as cn8 } from "@gridui/style-utils";
|
|
187
|
+
import * as Dialog5 from "@radix-ui/react-dialog";
|
|
188
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
189
|
+
var ModalPanel = (props) => {
|
|
190
|
+
const {
|
|
191
|
+
className,
|
|
192
|
+
forceMount,
|
|
193
|
+
...restProps
|
|
194
|
+
} = props;
|
|
195
|
+
const content = /* @__PURE__ */ jsx9(
|
|
196
|
+
Dialog5.Content,
|
|
197
|
+
{
|
|
198
|
+
...restProps,
|
|
199
|
+
forceMount,
|
|
200
|
+
className: cn8("gridui-modal-panel fixed z-(--gridui-z-dialog) left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col w-[min(calc(100%-32px),var(--gridui-modal-width,37rem))] max-h-[calc(100dvh-32px)] min-w-0 border border-solid border-border bg-background text-foreground type-body", className)
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
return /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
204
|
+
/* @__PURE__ */ jsx9(Dialog5.Portal, { children: /* @__PURE__ */ jsx9(
|
|
205
|
+
Dialog5.Overlay,
|
|
206
|
+
{
|
|
207
|
+
className: "gridui-modal-overlay fixed inset-0 z-(--gridui-z-dialog-backdrop) bg-[light-dark(rgb(0_0_0/25%),rgb(0_0_0/60%))]"
|
|
208
|
+
}
|
|
209
|
+
) }),
|
|
210
|
+
/* @__PURE__ */ jsx9(
|
|
211
|
+
Dialog5.Portal,
|
|
212
|
+
{
|
|
213
|
+
forceMount,
|
|
214
|
+
children: forceMount ? /* @__PURE__ */ jsx9(RetainedLayer, { children: content }) : content
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
] });
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// src/modal-title/modal-title.tsx
|
|
221
|
+
import { cn as cn9 } from "@gridui/style-utils";
|
|
222
|
+
import * as Dialog6 from "@radix-ui/react-dialog";
|
|
223
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
224
|
+
var ModalTitle = (props) => {
|
|
225
|
+
const { className, ...restProps } = props;
|
|
226
|
+
return /* @__PURE__ */ jsx10(
|
|
227
|
+
Dialog6.Title,
|
|
228
|
+
{
|
|
229
|
+
...restProps,
|
|
230
|
+
className: cn9("m-0 type-heading", className)
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
// src/modal-trigger/modal-trigger.tsx
|
|
236
|
+
import * as Dialog7 from "@radix-ui/react-dialog";
|
|
237
|
+
var ModalTrigger = Dialog7.Trigger;
|
|
238
|
+
export {
|
|
239
|
+
Modal,
|
|
240
|
+
ModalAction,
|
|
241
|
+
ModalActions,
|
|
242
|
+
ModalBody,
|
|
243
|
+
ModalClose,
|
|
244
|
+
ModalDescription,
|
|
245
|
+
ModalFooter,
|
|
246
|
+
ModalFooterNote,
|
|
247
|
+
ModalHeader,
|
|
248
|
+
ModalPanel,
|
|
249
|
+
ModalTitle,
|
|
250
|
+
ModalTrigger
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/modal/modal.tsx", "../src/modal-action/modal-action.tsx", "../src/modal-actions/modal-actions.tsx", "../src/modal-body/modal-body.tsx", "../src/modal-close/modal-close.tsx", "../src/modal-description/modal-description.tsx", "../src/modal-footer/modal-footer.tsx", "../src/modal-footer-note/modal-footer-note.tsx", "../src/modal-header/modal-header.tsx", "../src/modal-panel/modal-panel.tsx", "../src/modal-title/modal-title.tsx", "../src/modal-trigger/modal-trigger.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * @author WMXPY\n * @package Modal\n * @namespace Modal\n * @description Modal\n */\n\nimport { OverlayOpen, useOverlayState } from \"@gridui/overlay\";\nimport { type Space } from \"@gridui/style-utils/responsive\";\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalSpace = Space;\n\nexport type ModalProps = ComponentPropsWithRef<typeof Dialog.Root>;\n\nexport const Modal: FC<ModalProps> = (props: ModalProps) => {\n const state = useOverlayState(props);\n return (<OverlayOpen.Provider\n value={state.open}\n >\n <Dialog.Root\n {...props}\n {...state}\n />\n </OverlayOpen.Provider>);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalAction\n * @description Modal Action\n */\n\nimport { Button, type ButtonProps } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport type { FC } from \"react\";\n\nexport type ModalActionProps = ButtonProps;\n\nexport const ModalAction: FC<ModalActionProps> = (props: ModalActionProps) => {\n const { className, ...restProps } = props;\n return (<Button\n {...restProps}\n className={cn(\"flex-1 w-auto rounded-none border-0 border-s border-solid border-border first:border-s-0 px-gridui-24 py-(--gridui-modal-padding) min-h-11\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalActions\n * @description Modal Actions\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalActionsProps = ComponentPropsWithRef<\"div\">;\n\nexport const ModalActions: FC<ModalActionsProps> = (props: ModalActionsProps) => {\n const { className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(\"gridui-modal-actions flex min-w-0\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalBody\n * @description Modal Body\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalBodyProps = ComponentPropsWithRef<\"div\">;\n\nexport const ModalBody: FC<ModalBodyProps> = (props: ModalBodyProps) => {\n const { className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(\"min-h-0 min-w-0 overflow-auto overscroll-contain p-gridui-24 wrap-anywhere\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalClose\n * @description Modal Close\n */\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\n\nexport const ModalClose = Dialog.Close;\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalDescription\n * @description Modal Description\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalDescriptionProps = ComponentPropsWithRef<typeof Dialog.Description>;\n\nexport const ModalDescription: FC<ModalDescriptionProps> = (props: ModalDescriptionProps) => {\n const {\n className,\n ...restProps\n } = props;\n return (<Dialog.Description\n {...restProps}\n className={cn(\"mt-gridui-8 mb-0 type-supporting text-muted\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalFooter\n * @description Modal Footer\n */\n\nimport type { ModalSectionProps } from \"../shared/types\";\nimport { cn } from \"@gridui/style-utils\";\nimport { spacingVariables } from \"@gridui/style-utils/responsive\";\nimport type { FC } from \"react\";\n\nexport type ModalFooterProps = ModalSectionProps;\n\nexport const ModalFooter: FC<ModalFooterProps> = (props: ModalFooterProps) => {\n const {\n paddingBlock = 24,\n style,\n className,\n ...restProps\n } = props;\n return (<div\n {...restProps}\n style={{\n ...spacingVariables(\"modal-space\", paddingBlock),\n ...style,\n }}\n className={cn(\"gridui-modal-section gridui-modal-footer max-h-[40dvh] overflow-y-auto shrink-0 border-t border-solid border-border\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalFooterNote\n * @description Modal Footer Note\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalFooterNoteProps = ComponentPropsWithRef<\"div\">;\n\nexport const ModalFooterNote: FC<ModalFooterNoteProps> = (props: ModalFooterNoteProps) => {\n const { className, ...restProps } = props;\n return (<div\n {...restProps}\n className={cn(\"min-w-0 px-gridui-24 py-(--gridui-modal-padding) type-supporting text-muted wrap-anywhere\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalHeader\n * @description Modal Header\n */\n\nimport type { ModalSectionProps } from \"../shared/types\";\nimport { Button } from \"@gridui/button\";\nimport { cn } from \"@gridui/style-utils\";\nimport { spacingVariables } from \"@gridui/style-utils/responsive\";\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport { X } from \"lucide-react\";\nimport type { FC } from \"react\";\n\nexport type ModalHeaderProps = ModalSectionProps & {\n readonly closeLabel: string;\n};\n\nexport const ModalHeader: FC<ModalHeaderProps> = (props: ModalHeaderProps) => {\n const {\n closeLabel,\n children,\n paddingBlock = 24,\n style,\n className,\n ...restProps\n } = props;\n return (<div\n {...restProps}\n style={{\n ...spacingVariables(\"modal-space\", paddingBlock),\n ...style,\n }}\n className={cn(\"gridui-modal-section gridui-modal-header relative z-(--gridui-z-content) overflow-visible shrink-0 grid grid-cols-[minmax(0,1fr)_auto] border-b border-solid border-border\", className)}\n >\n <div\n className=\"max-h-[40dvh] min-w-0 overflow-y-auto px-gridui-24 py-(--gridui-modal-padding) wrap-anywhere\"\n >\n {children}\n </div>\n <Dialog.Close\n asChild\n >\n <Button\n aria-label={closeLabel}\n variant=\"quiet\"\n className=\"self-stretch w-gridui-64 min-h-11 rounded-none border-0 border-s border-solid border-border [&:hover:not(:disabled)]:border-border p-0\"\n >\n <X\n aria-hidden=\"true\"\n />\n </Button>\n </Dialog.Close>\n </div>);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalPanel\n * @description Modal Panel\n */\n\nimport { RetainedLayer } from \"@gridui/overlay\";\nimport { cn } from \"@gridui/style-utils\";\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalPanelProps = ComponentPropsWithRef<typeof Dialog.Content>;\n\nexport const ModalPanel: FC<ModalPanelProps> = (props: ModalPanelProps) => {\n const {\n className,\n forceMount,\n ...restProps\n } = props;\n const content = (<Dialog.Content\n {...restProps}\n forceMount={forceMount}\n className={cn(\"gridui-modal-panel fixed z-(--gridui-z-dialog) left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col w-[min(calc(100%-32px),var(--gridui-modal-width,37rem))] max-h-[calc(100dvh-32px)] min-w-0 border border-solid border-border bg-background text-foreground type-body\", className)}\n />);\n return (<>\n <Dialog.Portal>\n <Dialog.Overlay\n className=\"gridui-modal-overlay fixed inset-0 z-(--gridui-z-dialog-backdrop) bg-[light-dark(rgb(0_0_0/25%),rgb(0_0_0/60%))]\"\n />\n </Dialog.Portal>\n <Dialog.Portal\n forceMount={forceMount}\n >\n {forceMount ? (<RetainedLayer>\n {content}\n </RetainedLayer>) : content}\n </Dialog.Portal>\n </>);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalTitle\n * @description Modal Title\n */\n\nimport { cn } from \"@gridui/style-utils\";\nimport * as Dialog from \"@radix-ui/react-dialog\";\nimport type { ComponentPropsWithRef, FC } from \"react\";\n\nexport type ModalTitleProps = ComponentPropsWithRef<typeof Dialog.Title>;\n\nexport const ModalTitle: FC<ModalTitleProps> = (props: ModalTitleProps) => {\n const { className, ...restProps } = props;\n return (<Dialog.Title\n {...restProps}\n className={cn(\"m-0 type-heading\", className)}\n />);\n};\n", "/**\n * @author WMXPY\n * @package Modal\n * @namespace ModalTrigger\n * @description Modal Trigger\n */\n\nimport * as Dialog from \"@radix-ui/react-dialog\";\n\nexport const ModalTrigger = Dialog.Trigger;\n"],
|
|
5
|
+
"mappings": ";AAOA,SAAS,aAAa,uBAAuB;AAC7C,OAA2B;AAC3B,YAAY,YAAY;AAYhB;AALD,IAAM,QAAwB,CAAC,UAAsB;AACxD,QAAM,QAAQ,gBAAgB,KAAK;AACnC,SAAQ;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACL,OAAO,MAAM;AAAA,MAEb;AAAA,QAAQ;AAAA,QAAP;AAAA,UACI,GAAG;AAAA,UACH,GAAG;AA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", "jsx", "jsxs", "cn", "Dialog", "jsx", "Dialog"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace Modal
|
|
5
|
+
* @description Modal
|
|
6
|
+
*/
|
|
7
|
+
import { type Space } from "@gridui/style-utils/responsive";
|
|
8
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
9
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
10
|
+
export type ModalSpace = Space;
|
|
11
|
+
export type ModalProps = ComponentPropsWithRef<typeof Dialog.Root>;
|
|
12
|
+
export declare const Modal: FC<ModalProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalAction
|
|
5
|
+
* @description Modal Action
|
|
6
|
+
*/
|
|
7
|
+
import { type ButtonProps } from "@gridui/button";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type ModalActionProps = ButtonProps;
|
|
10
|
+
export declare const ModalAction: FC<ModalActionProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalActions
|
|
5
|
+
* @description Modal Actions
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type ModalActionsProps = ComponentPropsWithRef<"div">;
|
|
9
|
+
export declare const ModalActions: FC<ModalActionsProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalBody
|
|
5
|
+
* @description Modal Body
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type ModalBodyProps = ComponentPropsWithRef<"div">;
|
|
9
|
+
export declare const ModalBody: FC<ModalBodyProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalClose
|
|
5
|
+
* @description Modal Close
|
|
6
|
+
*/
|
|
7
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
8
|
+
export declare const ModalClose: import("react").ForwardRefExoticComponent<Dialog.DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalDescription
|
|
5
|
+
* @description Modal Description
|
|
6
|
+
*/
|
|
7
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type ModalDescriptionProps = ComponentPropsWithRef<typeof Dialog.Description>;
|
|
10
|
+
export declare const ModalDescription: FC<ModalDescriptionProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalFooter
|
|
5
|
+
* @description Modal Footer
|
|
6
|
+
*/
|
|
7
|
+
import type { ModalSectionProps } from "../shared/types";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type ModalFooterProps = ModalSectionProps;
|
|
10
|
+
export declare const ModalFooter: FC<ModalFooterProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalFooterNote
|
|
5
|
+
* @description Modal Footer Note
|
|
6
|
+
*/
|
|
7
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
8
|
+
export type ModalFooterNoteProps = ComponentPropsWithRef<"div">;
|
|
9
|
+
export declare const ModalFooterNote: FC<ModalFooterNoteProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalHeader
|
|
5
|
+
* @description Modal Header
|
|
6
|
+
*/
|
|
7
|
+
import type { ModalSectionProps } from "../shared/types";
|
|
8
|
+
import type { FC } from "react";
|
|
9
|
+
export type ModalHeaderProps = ModalSectionProps & {
|
|
10
|
+
readonly closeLabel: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const ModalHeader: FC<ModalHeaderProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalPanel
|
|
5
|
+
* @description Modal Panel
|
|
6
|
+
*/
|
|
7
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type ModalPanelProps = ComponentPropsWithRef<typeof Dialog.Content>;
|
|
10
|
+
export declare const ModalPanel: FC<ModalPanelProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalTitle
|
|
5
|
+
* @description Modal Title
|
|
6
|
+
*/
|
|
7
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
8
|
+
import type { ComponentPropsWithRef, FC } from "react";
|
|
9
|
+
export type ModalTitleProps = ComponentPropsWithRef<typeof Dialog.Title>;
|
|
10
|
+
export declare const ModalTitle: FC<ModalTitleProps>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace ModalTrigger
|
|
5
|
+
* @description Modal Trigger
|
|
6
|
+
*/
|
|
7
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
8
|
+
export declare const ModalTrigger: import("react").ForwardRefExoticComponent<Dialog.DialogTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @author WMXPY
|
|
3
|
+
* @package Modal
|
|
4
|
+
* @namespace Shared
|
|
5
|
+
* @description Types
|
|
6
|
+
*/
|
|
7
|
+
import { type Responsive, type Space } from "@gridui/style-utils/responsive";
|
|
8
|
+
import type { ComponentPropsWithRef } from "react";
|
|
9
|
+
export type ModalSpacing = Responsive<Space>;
|
|
10
|
+
export type ModalSectionProps = ComponentPropsWithRef<"div"> & {
|
|
11
|
+
readonly paddingBlock?: ModalSpacing;
|
|
12
|
+
};
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--spacing: 0.25rem;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@layer utilities {
|
|
10
|
+
.fixed {
|
|
11
|
+
position: fixed;
|
|
12
|
+
}
|
|
13
|
+
.relative {
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
.inset-0 {
|
|
17
|
+
inset: 0px;
|
|
18
|
+
}
|
|
19
|
+
.top-1\/2 {
|
|
20
|
+
top: calc(1 / 2 * 100%);
|
|
21
|
+
}
|
|
22
|
+
.left-1\/2 {
|
|
23
|
+
left: calc(1 / 2 * 100%);
|
|
24
|
+
}
|
|
25
|
+
.z-\(--gridui-z-content\) {
|
|
26
|
+
z-index: var(--gridui-z-content);
|
|
27
|
+
}
|
|
28
|
+
.z-\(--gridui-z-dialog\) {
|
|
29
|
+
z-index: var(--gridui-z-dialog);
|
|
30
|
+
}
|
|
31
|
+
.z-\(--gridui-z-dialog-backdrop\) {
|
|
32
|
+
z-index: var(--gridui-z-dialog-backdrop);
|
|
33
|
+
}
|
|
34
|
+
.m-0 {
|
|
35
|
+
margin: 0px;
|
|
36
|
+
}
|
|
37
|
+
.mt-gridui-8 {
|
|
38
|
+
margin-top: var(--gridui-space-8);
|
|
39
|
+
}
|
|
40
|
+
.mb-0 {
|
|
41
|
+
margin-bottom: 0px;
|
|
42
|
+
}
|
|
43
|
+
.flex {
|
|
44
|
+
display: flex;
|
|
45
|
+
}
|
|
46
|
+
.grid {
|
|
47
|
+
display: grid;
|
|
48
|
+
}
|
|
49
|
+
.max-h-\[40dvh\] {
|
|
50
|
+
max-height: 40dvh;
|
|
51
|
+
}
|
|
52
|
+
.max-h-\[calc\(100dvh-32px\)\] {
|
|
53
|
+
max-height: calc(100dvh - 32px);
|
|
54
|
+
}
|
|
55
|
+
.min-h-0 {
|
|
56
|
+
min-height: 0px;
|
|
57
|
+
}
|
|
58
|
+
.min-h-11 {
|
|
59
|
+
min-height: calc(var(--spacing) * 11);
|
|
60
|
+
}
|
|
61
|
+
.w-\[min\(calc\(100\%-32px\)\,var\(--gridui-modal-width\,37rem\)\)\] {
|
|
62
|
+
width: min(calc(100% - 32px), var(--gridui-modal-width,37rem));
|
|
63
|
+
}
|
|
64
|
+
.w-auto {
|
|
65
|
+
width: auto;
|
|
66
|
+
}
|
|
67
|
+
.w-gridui-64 {
|
|
68
|
+
width: var(--gridui-space-64);
|
|
69
|
+
}
|
|
70
|
+
.min-w-0 {
|
|
71
|
+
min-width: 0px;
|
|
72
|
+
}
|
|
73
|
+
.flex-1 {
|
|
74
|
+
flex: 1;
|
|
75
|
+
}
|
|
76
|
+
.shrink-0 {
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
}
|
|
79
|
+
.-translate-x-1\/2 {
|
|
80
|
+
--tw-translate-x: calc(calc(1 / 2 * 100%) * -1);
|
|
81
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
82
|
+
}
|
|
83
|
+
.-translate-y-1\/2 {
|
|
84
|
+
--tw-translate-y: calc(calc(1 / 2 * 100%) * -1);
|
|
85
|
+
translate: var(--tw-translate-x) var(--tw-translate-y);
|
|
86
|
+
}
|
|
87
|
+
.grid-cols-\[minmax\(0\,1fr\)_auto\] {
|
|
88
|
+
grid-template-columns: minmax(0,1fr) auto;
|
|
89
|
+
}
|
|
90
|
+
.flex-col {
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
}
|
|
93
|
+
.self-stretch {
|
|
94
|
+
align-self: stretch;
|
|
95
|
+
}
|
|
96
|
+
.overflow-auto {
|
|
97
|
+
overflow: auto;
|
|
98
|
+
}
|
|
99
|
+
.overflow-visible {
|
|
100
|
+
overflow: visible;
|
|
101
|
+
}
|
|
102
|
+
.overflow-y-auto {
|
|
103
|
+
overflow-y: auto;
|
|
104
|
+
}
|
|
105
|
+
.overscroll-contain {
|
|
106
|
+
overscroll-behavior: contain;
|
|
107
|
+
}
|
|
108
|
+
.rounded-none {
|
|
109
|
+
border-radius: 0;
|
|
110
|
+
}
|
|
111
|
+
.border {
|
|
112
|
+
border-style: var(--tw-border-style);
|
|
113
|
+
border-width: 1px;
|
|
114
|
+
}
|
|
115
|
+
.border-0 {
|
|
116
|
+
border-style: var(--tw-border-style);
|
|
117
|
+
border-width: 0px;
|
|
118
|
+
}
|
|
119
|
+
.border-s {
|
|
120
|
+
border-inline-start-style: var(--tw-border-style);
|
|
121
|
+
border-inline-start-width: 1px;
|
|
122
|
+
}
|
|
123
|
+
.border-t {
|
|
124
|
+
border-top-style: var(--tw-border-style);
|
|
125
|
+
border-top-width: 1px;
|
|
126
|
+
}
|
|
127
|
+
.border-b {
|
|
128
|
+
border-bottom-style: var(--tw-border-style);
|
|
129
|
+
border-bottom-width: 1px;
|
|
130
|
+
}
|
|
131
|
+
.border-solid {
|
|
132
|
+
--tw-border-style: solid;
|
|
133
|
+
border-style: solid;
|
|
134
|
+
}
|
|
135
|
+
.border-border {
|
|
136
|
+
border-color: var(--gridui-border);
|
|
137
|
+
}
|
|
138
|
+
.bg-\[light-dark\(rgb\(0_0_0\/25\%\)\,rgb\(0_0_0\/60\%\)\)\] {
|
|
139
|
+
background-color: light-dark(rgb(0 0 0/25%),rgb(0 0 0/60%));
|
|
140
|
+
}
|
|
141
|
+
.bg-background {
|
|
142
|
+
background-color: var(--gridui-background);
|
|
143
|
+
}
|
|
144
|
+
.p-0 {
|
|
145
|
+
padding: 0px;
|
|
146
|
+
}
|
|
147
|
+
.p-gridui-24 {
|
|
148
|
+
padding: var(--gridui-space-24);
|
|
149
|
+
}
|
|
150
|
+
.px-gridui-24 {
|
|
151
|
+
padding-inline: var(--gridui-space-24);
|
|
152
|
+
}
|
|
153
|
+
.py-\(--gridui-modal-padding\) {
|
|
154
|
+
padding-block: var(--gridui-modal-padding);
|
|
155
|
+
}
|
|
156
|
+
.type-heading {
|
|
157
|
+
font: var(--gridui-type-heading);
|
|
158
|
+
letter-spacing: normal;
|
|
159
|
+
text-wrap: balance;
|
|
160
|
+
}
|
|
161
|
+
.type-body {
|
|
162
|
+
font: var(--gridui-type-body);
|
|
163
|
+
letter-spacing: normal;
|
|
164
|
+
}
|
|
165
|
+
.type-supporting {
|
|
166
|
+
font: var(--gridui-type-supporting);
|
|
167
|
+
letter-spacing: normal;
|
|
168
|
+
}
|
|
169
|
+
.wrap-anywhere {
|
|
170
|
+
overflow-wrap: anywhere;
|
|
171
|
+
}
|
|
172
|
+
.text-foreground {
|
|
173
|
+
color: var(--gridui-foreground);
|
|
174
|
+
}
|
|
175
|
+
.text-muted {
|
|
176
|
+
color: var(--gridui-muted);
|
|
177
|
+
}
|
|
178
|
+
.first\:border-s-0:first-child {
|
|
179
|
+
border-inline-start-style: var(--tw-border-style);
|
|
180
|
+
border-inline-start-width: 0px;
|
|
181
|
+
}
|
|
182
|
+
.\[\&\:hover\:not\(\:disabled\)\]\:border-border:hover:not(:disabled) {
|
|
183
|
+
border-color: var(--gridui-border);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
@layer components {
|
|
187
|
+
.gridui-modal-panel[data-state="open"] {
|
|
188
|
+
animation: gridui-surface-enter var(--gridui-motion-duration-normal) var(--gridui-motion-ease-out);
|
|
189
|
+
}
|
|
190
|
+
.gridui-modal-panel[data-state="closed"] {
|
|
191
|
+
animation: gridui-surface-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in);
|
|
192
|
+
}
|
|
193
|
+
.gridui-modal-overlay[data-state="open"] {
|
|
194
|
+
animation: gridui-fade-enter var(--gridui-motion-duration-normal) var(--gridui-motion-ease-out);
|
|
195
|
+
}
|
|
196
|
+
.gridui-modal-overlay[data-state="closed"] {
|
|
197
|
+
animation: gridui-fade-exit var(--gridui-motion-duration-quick) var(--gridui-motion-ease-in);
|
|
198
|
+
}
|
|
199
|
+
@media (prefers-reduced-motion: reduce) {
|
|
200
|
+
.gridui-modal-panel[data-state], .gridui-modal-overlay[data-state] {
|
|
201
|
+
animation: none;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
.gridui-modal-section {
|
|
205
|
+
--gridui-modal-padding: var(--gridui-modal-space);
|
|
206
|
+
}
|
|
207
|
+
.gridui-modal-footer {
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-wrap: wrap;
|
|
210
|
+
align-items: stretch;
|
|
211
|
+
}
|
|
212
|
+
.gridui-modal-footer > :not(.gridui-modal-actions) {
|
|
213
|
+
flex: 1 1 12rem;
|
|
214
|
+
align-self: center;
|
|
215
|
+
}
|
|
216
|
+
.gridui-modal-actions {
|
|
217
|
+
flex: 1 1 auto;
|
|
218
|
+
}
|
|
219
|
+
@media (min-width: 40rem) {
|
|
220
|
+
.gridui-modal-section {
|
|
221
|
+
--gridui-modal-padding: var(--gridui-modal-space-md);
|
|
222
|
+
}
|
|
223
|
+
.gridui-modal-footer {
|
|
224
|
+
flex-wrap: nowrap;
|
|
225
|
+
}
|
|
226
|
+
.gridui-modal-actions {
|
|
227
|
+
margin-inline-start: auto;
|
|
228
|
+
flex: 0 1 auto;
|
|
229
|
+
}
|
|
230
|
+
.gridui-modal-footer > :not(.gridui-modal-actions) + .gridui-modal-actions {
|
|
231
|
+
border-inline-start: 1px solid var(--color-border);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
@media (max-width: 39.999rem) {
|
|
235
|
+
.gridui-modal-footer > :not(.gridui-modal-actions) + .gridui-modal-actions {
|
|
236
|
+
flex-basis: 100%;
|
|
237
|
+
border-top: 1px solid var(--color-border);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
@media (min-width: 64rem) {
|
|
241
|
+
.gridui-modal-section {
|
|
242
|
+
--gridui-modal-padding: var(--gridui-modal-space-lg);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
@property --tw-translate-x {
|
|
247
|
+
syntax: "*";
|
|
248
|
+
inherits: false;
|
|
249
|
+
initial-value: 0;
|
|
250
|
+
}
|
|
251
|
+
@property --tw-translate-y {
|
|
252
|
+
syntax: "*";
|
|
253
|
+
inherits: false;
|
|
254
|
+
initial-value: 0;
|
|
255
|
+
}
|
|
256
|
+
@property --tw-translate-z {
|
|
257
|
+
syntax: "*";
|
|
258
|
+
inherits: false;
|
|
259
|
+
initial-value: 0;
|
|
260
|
+
}
|
|
261
|
+
@property --tw-border-style {
|
|
262
|
+
syntax: "*";
|
|
263
|
+
inherits: false;
|
|
264
|
+
initial-value: solid;
|
|
265
|
+
}
|
|
266
|
+
@layer properties {
|
|
267
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
268
|
+
*, ::before, ::after, ::backdrop {
|
|
269
|
+
--tw-translate-x: 0;
|
|
270
|
+
--tw-translate-y: 0;
|
|
271
|
+
--tw-translate-z: 0;
|
|
272
|
+
--tw-border-style: solid;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/modal",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GridUI React modal",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"**/*.css"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./styles.css": "./dist/styles.css"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.2.0",
|
|
26
|
+
"react-dom": "^19.2.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@gridui/button": "^2.1.1",
|
|
30
|
+
"@gridui/overlay": "^1.0.0",
|
|
31
|
+
"@gridui/style-utils": "^2.1.2",
|
|
32
|
+
"@gridui/theme": "^2.1.2",
|
|
33
|
+
"@radix-ui/react-dialog": "1.3.1",
|
|
34
|
+
"lucide-react": "1.62.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@gridui-internal/configuration": "0.0.0",
|
|
38
|
+
"@jest/globals": "30.5.2",
|
|
39
|
+
"@types/jest": "30.0.0",
|
|
40
|
+
"@types/node": "26.6.5",
|
|
41
|
+
"@types/react": "19.3.0",
|
|
42
|
+
"@types/react-dom": "19.3.0",
|
|
43
|
+
"jest": "30.5.2",
|
|
44
|
+
"react": "19.3.1",
|
|
45
|
+
"react-dom": "19.3.1",
|
|
46
|
+
"typescript": "6.0.3"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "node ../../scripts/compilation/package.ts",
|
|
50
|
+
"compile": "tsc --project tsconfig.json",
|
|
51
|
+
"test": "jest --passWithNoTests",
|
|
52
|
+
"coverage": "jest --coverage --passWithNoTests"
|
|
53
|
+
}
|
|
6
54
|
}
|