@designa8/vibedesign-linear-internal-v1-2-176b 0.0.4 → 0.0.5
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 +1 -1
- package/dist/index.cjs +18 -6
- package/dist/index.js +18 -6
- package/dist/styles.css +5 -0
- package/package.json +1 -1
- package/src/atoms/Modal/Modal.tsx +41 -6
- package/src/atoms/Modal/preview.tsx +108 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @designa8/vibedesign-linear-internal-v1-2-176b
|
|
2
2
|
|
|
3
|
-
Complete design system generated by Atoms Design, version **0.0.
|
|
3
|
+
Complete design system generated by Atoms Design, version **0.0.5**.
|
|
4
4
|
Tokens, atoms, molecules, organisms, and templates — import from the package root;
|
|
5
5
|
never hardcode visual values in consumer code.
|
|
6
6
|
|
package/dist/index.cjs
CHANGED
|
@@ -5145,6 +5145,8 @@ var Modal = React52.forwardRef(
|
|
|
5145
5145
|
description,
|
|
5146
5146
|
footer,
|
|
5147
5147
|
size = "md",
|
|
5148
|
+
placement = "center",
|
|
5149
|
+
hideHeader = false,
|
|
5148
5150
|
showClose = true,
|
|
5149
5151
|
closeLabel = "Close dialog",
|
|
5150
5152
|
"aria-label": ariaLabel,
|
|
@@ -5187,13 +5189,20 @@ var Modal = React52.forwardRef(
|
|
|
5187
5189
|
}, [open, onOpenChange, closeOnScrimClick]);
|
|
5188
5190
|
const state = open ? "open" : "closed";
|
|
5189
5191
|
const hasTitle = title !== void 0 && title !== null;
|
|
5190
|
-
const
|
|
5192
|
+
const headerHidden = hideHeader;
|
|
5193
|
+
const hasHeader = !headerHidden && (hasTitle || showClose);
|
|
5194
|
+
const visibleTitle = hasTitle && !headerHidden;
|
|
5195
|
+
const srOnlyTitle = hasTitle && headerHidden && !ariaLabel;
|
|
5196
|
+
const labelledBy = visibleTitle || srOnlyTitle ? titleId : void 0;
|
|
5191
5197
|
const node = /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
|
|
5192
5198
|
"div",
|
|
5193
5199
|
{
|
|
5194
5200
|
"data-state": state,
|
|
5195
5201
|
"aria-hidden": open ? void 0 : true,
|
|
5196
|
-
className:
|
|
5202
|
+
className: cn40(
|
|
5203
|
+
"fixed inset-0 flex justify-center p-base data-[state=closed]:pointer-events-none",
|
|
5204
|
+
placement === "top" ? "items-end sm:items-start sm:pt-[12dvh]" : "items-end sm:items-center"
|
|
5205
|
+
),
|
|
5197
5206
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
5198
5207
|
children: [
|
|
5199
5208
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
@@ -5214,19 +5223,21 @@ var Modal = React52.forwardRef(
|
|
|
5214
5223
|
},
|
|
5215
5224
|
role: "dialog",
|
|
5216
5225
|
"aria-modal": "true",
|
|
5217
|
-
"aria-labelledby":
|
|
5218
|
-
"aria-label":
|
|
5219
|
-
"aria-describedby": description ? descId : void 0,
|
|
5226
|
+
"aria-labelledby": labelledBy,
|
|
5227
|
+
"aria-label": labelledBy ? void 0 : ariaLabel,
|
|
5228
|
+
"aria-describedby": description && hasHeader ? descId : void 0,
|
|
5220
5229
|
"data-state": state,
|
|
5221
5230
|
"data-modal": "",
|
|
5222
5231
|
className: cn40(
|
|
5223
5232
|
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl border border-hairline bg-canvas text-ink shadow-modal",
|
|
5224
5233
|
"transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:invisible data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
5234
|
+
placement === "top" && "sm:max-h-[calc(88dvh-2rem)]",
|
|
5225
5235
|
WIDTH[size],
|
|
5226
5236
|
className
|
|
5227
5237
|
),
|
|
5228
5238
|
...rest,
|
|
5229
5239
|
children: [
|
|
5240
|
+
srOnlyTitle && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("span", { id: titleId, className: "sr-only", children: title }),
|
|
5230
5241
|
hasHeader && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex shrink-0 items-start justify-between gap-sm px-lg pb-sm pt-lg", children: [
|
|
5231
5242
|
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col gap-xxs", children: [
|
|
5232
5243
|
hasTitle && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { id: titleId, className: "text-heading-sm text-ink", children: title }),
|
|
@@ -5247,7 +5258,8 @@ var Modal = React52.forwardRef(
|
|
|
5247
5258
|
"div",
|
|
5248
5259
|
{
|
|
5249
5260
|
className: cn40(
|
|
5250
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg
|
|
5261
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg",
|
|
5262
|
+
hasHeader ? "pt-xs" : "pt-lg",
|
|
5251
5263
|
bodyClassName
|
|
5252
5264
|
),
|
|
5253
5265
|
children
|
package/dist/index.js
CHANGED
|
@@ -5023,6 +5023,8 @@ var Modal = React52.forwardRef(
|
|
|
5023
5023
|
description,
|
|
5024
5024
|
footer,
|
|
5025
5025
|
size = "md",
|
|
5026
|
+
placement = "center",
|
|
5027
|
+
hideHeader = false,
|
|
5026
5028
|
showClose = true,
|
|
5027
5029
|
closeLabel = "Close dialog",
|
|
5028
5030
|
"aria-label": ariaLabel,
|
|
@@ -5065,13 +5067,20 @@ var Modal = React52.forwardRef(
|
|
|
5065
5067
|
}, [open, onOpenChange, closeOnScrimClick]);
|
|
5066
5068
|
const state = open ? "open" : "closed";
|
|
5067
5069
|
const hasTitle = title !== void 0 && title !== null;
|
|
5068
|
-
const
|
|
5070
|
+
const headerHidden = hideHeader;
|
|
5071
|
+
const hasHeader = !headerHidden && (hasTitle || showClose);
|
|
5072
|
+
const visibleTitle = hasTitle && !headerHidden;
|
|
5073
|
+
const srOnlyTitle = hasTitle && headerHidden && !ariaLabel;
|
|
5074
|
+
const labelledBy = visibleTitle || srOnlyTitle ? titleId : void 0;
|
|
5069
5075
|
const node = /* @__PURE__ */ jsxs46(
|
|
5070
5076
|
"div",
|
|
5071
5077
|
{
|
|
5072
5078
|
"data-state": state,
|
|
5073
5079
|
"aria-hidden": open ? void 0 : true,
|
|
5074
|
-
className:
|
|
5080
|
+
className: cn40(
|
|
5081
|
+
"fixed inset-0 flex justify-center p-base data-[state=closed]:pointer-events-none",
|
|
5082
|
+
placement === "top" ? "items-end sm:items-start sm:pt-[12dvh]" : "items-end sm:items-center"
|
|
5083
|
+
),
|
|
5075
5084
|
style: { zIndex: "var(--z-modal, 1200)" },
|
|
5076
5085
|
children: [
|
|
5077
5086
|
/* @__PURE__ */ jsx52(
|
|
@@ -5092,19 +5101,21 @@ var Modal = React52.forwardRef(
|
|
|
5092
5101
|
},
|
|
5093
5102
|
role: "dialog",
|
|
5094
5103
|
"aria-modal": "true",
|
|
5095
|
-
"aria-labelledby":
|
|
5096
|
-
"aria-label":
|
|
5097
|
-
"aria-describedby": description ? descId : void 0,
|
|
5104
|
+
"aria-labelledby": labelledBy,
|
|
5105
|
+
"aria-label": labelledBy ? void 0 : ariaLabel,
|
|
5106
|
+
"aria-describedby": description && hasHeader ? descId : void 0,
|
|
5098
5107
|
"data-state": state,
|
|
5099
5108
|
"data-modal": "",
|
|
5100
5109
|
className: cn40(
|
|
5101
5110
|
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl border border-hairline bg-canvas text-ink shadow-modal",
|
|
5102
5111
|
"transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:invisible data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
5112
|
+
placement === "top" && "sm:max-h-[calc(88dvh-2rem)]",
|
|
5103
5113
|
WIDTH[size],
|
|
5104
5114
|
className
|
|
5105
5115
|
),
|
|
5106
5116
|
...rest,
|
|
5107
5117
|
children: [
|
|
5118
|
+
srOnlyTitle && /* @__PURE__ */ jsx52("span", { id: titleId, className: "sr-only", children: title }),
|
|
5108
5119
|
hasHeader && /* @__PURE__ */ jsxs46("div", { className: "flex shrink-0 items-start justify-between gap-sm px-lg pb-sm pt-lg", children: [
|
|
5109
5120
|
/* @__PURE__ */ jsxs46("div", { className: "flex min-w-0 flex-1 flex-col gap-xxs", children: [
|
|
5110
5121
|
hasTitle && /* @__PURE__ */ jsx52("h2", { id: titleId, className: "text-heading-sm text-ink", children: title }),
|
|
@@ -5125,7 +5136,8 @@ var Modal = React52.forwardRef(
|
|
|
5125
5136
|
"div",
|
|
5126
5137
|
{
|
|
5127
5138
|
className: cn40(
|
|
5128
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg
|
|
5139
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg",
|
|
5140
|
+
hasHeader ? "pt-xs" : "pt-lg",
|
|
5129
5141
|
bodyClassName
|
|
5130
5142
|
),
|
|
5131
5143
|
children
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,8 @@ import { IconButton } from "../IconButton";
|
|
|
4
4
|
|
|
5
5
|
export type ModalSize = "sm" | "md" | "lg";
|
|
6
6
|
|
|
7
|
+
export type ModalPlacement = "center" | "top";
|
|
8
|
+
|
|
7
9
|
export interface ModalProps
|
|
8
10
|
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title"> {
|
|
9
11
|
/** Controlled open state. */
|
|
@@ -17,6 +19,19 @@ export interface ModalProps
|
|
|
17
19
|
footer?: React.ReactNode;
|
|
18
20
|
/** Panel width: sm 400px, md 520px, lg 680px (full width minus the gutter on phones). */
|
|
19
21
|
size?: ModalSize;
|
|
22
|
+
/**
|
|
23
|
+
* Vertical placement. `center` (default) centers the panel from `sm` up with
|
|
24
|
+
* the mobile bottom-sheet layout below that. `top` anchors the panel near the
|
|
25
|
+
* top of the viewport from `sm` up — the way a command palette opens — while
|
|
26
|
+
* the panel height stays capped and only the body scrolls.
|
|
27
|
+
*/
|
|
28
|
+
placement?: ModalPlacement;
|
|
29
|
+
/**
|
|
30
|
+
* Drop the header row entirely (title, description and close button) while
|
|
31
|
+
* keeping the accessible name from `aria-label`. Useful when the first row of
|
|
32
|
+
* the panel is its own search field, e.g. a command palette.
|
|
33
|
+
*/
|
|
34
|
+
hideHeader?: boolean;
|
|
20
35
|
/** Show the close (x) button in the header. Default true. */
|
|
21
36
|
showClose?: boolean;
|
|
22
37
|
closeLabel?: string;
|
|
@@ -46,6 +61,8 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
46
61
|
description,
|
|
47
62
|
footer,
|
|
48
63
|
size = "md",
|
|
64
|
+
placement = "center",
|
|
65
|
+
hideHeader = false,
|
|
49
66
|
showClose = true,
|
|
50
67
|
closeLabel = "Close dialog",
|
|
51
68
|
"aria-label": ariaLabel,
|
|
@@ -93,13 +110,24 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
93
110
|
|
|
94
111
|
const state = open ? "open" : "closed";
|
|
95
112
|
const hasTitle = title !== undefined && title !== null;
|
|
96
|
-
const
|
|
113
|
+
const headerHidden = hideHeader;
|
|
114
|
+
const hasHeader = !headerHidden && (hasTitle || showClose);
|
|
115
|
+
// A visible title names the dialog; a headerless dialog prefers aria-label and
|
|
116
|
+
// falls back to a visually hidden title so the name is never missing.
|
|
117
|
+
const visibleTitle = hasTitle && !headerHidden;
|
|
118
|
+
const srOnlyTitle = hasTitle && headerHidden && !ariaLabel;
|
|
119
|
+
const labelledBy = visibleTitle || srOnlyTitle ? titleId : undefined;
|
|
97
120
|
|
|
98
121
|
const node = (
|
|
99
122
|
<div
|
|
100
123
|
data-state={state}
|
|
101
124
|
aria-hidden={open ? undefined : true}
|
|
102
|
-
className=
|
|
125
|
+
className={cn(
|
|
126
|
+
"fixed inset-0 flex justify-center p-base data-[state=closed]:pointer-events-none",
|
|
127
|
+
placement === "top"
|
|
128
|
+
? "items-end sm:items-start sm:pt-[12dvh]"
|
|
129
|
+
: "items-end sm:items-center",
|
|
130
|
+
)}
|
|
103
131
|
style={{ zIndex: "var(--z-modal, 1200)" }}
|
|
104
132
|
>
|
|
105
133
|
<div
|
|
@@ -115,19 +143,25 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
115
143
|
}}
|
|
116
144
|
role="dialog"
|
|
117
145
|
aria-modal="true"
|
|
118
|
-
aria-labelledby={
|
|
119
|
-
aria-label={
|
|
120
|
-
aria-describedby={description ? descId : undefined}
|
|
146
|
+
aria-labelledby={labelledBy}
|
|
147
|
+
aria-label={labelledBy ? undefined : ariaLabel}
|
|
148
|
+
aria-describedby={description && hasHeader ? descId : undefined}
|
|
121
149
|
data-state={state}
|
|
122
150
|
data-modal=""
|
|
123
151
|
className={cn(
|
|
124
152
|
"relative flex max-h-[calc(100dvh-2rem)] w-full flex-col overflow-hidden rounded-xl border border-hairline bg-canvas text-ink shadow-modal",
|
|
125
153
|
"transition duration-200 ease-out data-[state=open]:translate-y-0 data-[state=open]:scale-100 data-[state=open]:opacity-100 data-[state=closed]:invisible data-[state=closed]:translate-y-2 data-[state=closed]:scale-[0.98] data-[state=closed]:opacity-0",
|
|
154
|
+
placement === "top" && "sm:max-h-[calc(88dvh-2rem)]",
|
|
126
155
|
WIDTH[size],
|
|
127
156
|
className,
|
|
128
157
|
)}
|
|
129
158
|
{...rest}
|
|
130
159
|
>
|
|
160
|
+
{srOnlyTitle && (
|
|
161
|
+
<span id={titleId} className="sr-only">
|
|
162
|
+
{title}
|
|
163
|
+
</span>
|
|
164
|
+
)}
|
|
131
165
|
{hasHeader && (
|
|
132
166
|
<div className="flex shrink-0 items-start justify-between gap-sm px-lg pb-sm pt-lg">
|
|
133
167
|
<div className="flex min-w-0 flex-1 flex-col gap-xxs">
|
|
@@ -156,7 +190,8 @@ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
|
|
|
156
190
|
{children != null && children !== false && (
|
|
157
191
|
<div
|
|
158
192
|
className={cn(
|
|
159
|
-
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg
|
|
193
|
+
"min-h-0 flex-1 overflow-y-auto overscroll-contain px-lg pb-lg",
|
|
194
|
+
hasHeader ? "pt-xs" : "pt-lg",
|
|
160
195
|
bodyClassName,
|
|
161
196
|
)}
|
|
162
197
|
>
|
|
@@ -5,14 +5,55 @@ import { Icon } from "../Icon";
|
|
|
5
5
|
import { Input } from "../Input";
|
|
6
6
|
import { Textarea } from "../Textarea";
|
|
7
7
|
import { Dropdown } from "../Dropdown";
|
|
8
|
+
import { SearchBar } from "../SearchBar";
|
|
9
|
+
import { ListItem } from "../ListItem";
|
|
10
|
+
import { Badge } from "../Badge";
|
|
11
|
+
|
|
12
|
+
type Command = {
|
|
13
|
+
id: string;
|
|
14
|
+
icon: "plus" | "search" | "user";
|
|
15
|
+
title: string;
|
|
16
|
+
meta: string;
|
|
17
|
+
shortcut: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const COMMANDS: Command[] = [
|
|
21
|
+
{
|
|
22
|
+
id: "new-issue",
|
|
23
|
+
icon: "plus",
|
|
24
|
+
title: "New issue",
|
|
25
|
+
meta: "Create an issue in this project",
|
|
26
|
+
shortcut: "C",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "search",
|
|
30
|
+
icon: "search",
|
|
31
|
+
title: "Search issues",
|
|
32
|
+
meta: "Find by title, label or assignee",
|
|
33
|
+
shortcut: "/",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "members",
|
|
37
|
+
icon: "user",
|
|
38
|
+
title: "Manage members",
|
|
39
|
+
meta: "Invite people and set roles",
|
|
40
|
+
shortcut: "G then M",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
8
43
|
|
|
9
44
|
export default function ModalPreview() {
|
|
10
45
|
const [issueOpen, setIssueOpen] = React.useState(false);
|
|
11
46
|
const [confirmOpen, setConfirmOpen] = React.useState(false);
|
|
47
|
+
const [paletteOpen, setPaletteOpen] = React.useState(false);
|
|
12
48
|
const [title, setTitle] = React.useState("Create a habit tracker");
|
|
13
49
|
const [details, setDetails] = React.useState("");
|
|
14
50
|
const [assignee, setAssignee] = React.useState<string | null>("me");
|
|
15
51
|
const [status, setStatus] = React.useState<string | null>("backlog");
|
|
52
|
+
const [query, setQuery] = React.useState("");
|
|
53
|
+
|
|
54
|
+
const commands = COMMANDS.filter((command) =>
|
|
55
|
+
`${command.title} ${command.meta}`.toLowerCase().includes(query.toLowerCase()),
|
|
56
|
+
);
|
|
16
57
|
|
|
17
58
|
return (
|
|
18
59
|
<div className="w-full max-w-3xl mx-auto p-lg">
|
|
@@ -32,6 +73,17 @@ export default function ModalPreview() {
|
|
|
32
73
|
>
|
|
33
74
|
Delete issue
|
|
34
75
|
</Button>
|
|
76
|
+
<Button
|
|
77
|
+
variant="secondary"
|
|
78
|
+
leadingIcon={<Icon name="search" size={16} />}
|
|
79
|
+
aria-expanded={paletteOpen}
|
|
80
|
+
onClick={() => {
|
|
81
|
+
setQuery("");
|
|
82
|
+
setPaletteOpen(true);
|
|
83
|
+
}}
|
|
84
|
+
>
|
|
85
|
+
Command palette
|
|
86
|
+
</Button>
|
|
35
87
|
</div>
|
|
36
88
|
|
|
37
89
|
<Modal
|
|
@@ -100,6 +152,62 @@ export default function ModalPreview() {
|
|
|
100
152
|
</>
|
|
101
153
|
}
|
|
102
154
|
/>
|
|
155
|
+
|
|
156
|
+
<Modal
|
|
157
|
+
open={paletteOpen}
|
|
158
|
+
onOpenChange={setPaletteOpen}
|
|
159
|
+
placement="top"
|
|
160
|
+
hideHeader
|
|
161
|
+
aria-label="Command palette"
|
|
162
|
+
closeLabel="Close command palette"
|
|
163
|
+
footer={
|
|
164
|
+
<div className="flex w-full flex-wrap items-center justify-between gap-sm">
|
|
165
|
+
<span className="text-body-sm text-muted">
|
|
166
|
+
Jump to anything in the project
|
|
167
|
+
</span>
|
|
168
|
+
<span className="text-body-sm text-muted">Esc to close</span>
|
|
169
|
+
</div>
|
|
170
|
+
}
|
|
171
|
+
>
|
|
172
|
+
<div className="flex flex-col gap-sm">
|
|
173
|
+
<SearchBar
|
|
174
|
+
value={query}
|
|
175
|
+
onValueChange={setQuery}
|
|
176
|
+
placeholder="Type a command or search…"
|
|
177
|
+
aria-label="Search commands"
|
|
178
|
+
actionLabel={null}
|
|
179
|
+
clearable
|
|
180
|
+
/>
|
|
181
|
+
<div className="flex flex-col gap-xxs">
|
|
182
|
+
<p className="px-xs text-caption text-muted">Commands</p>
|
|
183
|
+
{commands.length > 0 ? (
|
|
184
|
+
commands.map((command) => (
|
|
185
|
+
<ListItem
|
|
186
|
+
key={command.id}
|
|
187
|
+
variant="plain"
|
|
188
|
+
icon={command.icon}
|
|
189
|
+
title={command.title}
|
|
190
|
+
meta={command.meta}
|
|
191
|
+
href={undefined}
|
|
192
|
+
onClick={(event) => {
|
|
193
|
+
event.preventDefault();
|
|
194
|
+
setPaletteOpen(false);
|
|
195
|
+
}}
|
|
196
|
+
trailing={
|
|
197
|
+
<Badge tone="neutral" size="sm">
|
|
198
|
+
{command.shortcut}
|
|
199
|
+
</Badge>
|
|
200
|
+
}
|
|
201
|
+
/>
|
|
202
|
+
))
|
|
203
|
+
) : (
|
|
204
|
+
<p className="px-xs py-md text-body-sm text-muted">
|
|
205
|
+
No commands match that search.
|
|
206
|
+
</p>
|
|
207
|
+
)}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
</Modal>
|
|
103
211
|
</div>
|
|
104
212
|
);
|
|
105
213
|
}
|