pentatrion-design 0.0.9 → 0.0.11
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/CHANGELOG.md +11 -0
- package/components/color/ColorPalette.tsx +3 -0
- package/components/color/utils.ts +292 -0
- package/components/input/Color.stories.tsx +18 -0
- package/components/input/Color.tsx +61 -0
- package/components/input/index.ts +1 -0
- package/components/modal/Modal.stories.tsx +65 -3
- package/components/modal/ModalContent.tsx +1 -1
- package/components/notification/Notification.stories.tsx +5 -0
- package/components/notification/NotificationsProvider.tsx +1 -0
- package/components/snack/Snack.tsx +4 -1
- package/components/tabs/Tabs.tsx +1 -4
- package/components/textarea/Textarea.stories.tsx +26 -0
- package/components/textarea/Textarea.tsx +36 -0
- package/components/textarea/index.ts +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/tailwind/components.ts +11 -10
- package/components/notification/NotificationsProvider-ssr.tsx +0 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
## 0.0.11
|
|
2
|
+
|
|
3
|
+
add input/button color
|
|
4
|
+
fix notificationsProvider pointer event none
|
|
5
|
+
|
|
6
|
+
## 0.0.10
|
|
7
|
+
|
|
8
|
+
add textarea
|
|
9
|
+
modal without size className for more flexibility
|
|
10
|
+
tabs without border-radius for more flexibility
|
|
11
|
+
|
|
1
12
|
## 0.0.9
|
|
2
13
|
|
|
3
14
|
modal add ComponentProps to parent
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
const tailwindColors = {
|
|
2
|
+
transparent: "transparent",
|
|
3
|
+
current: "currentColor",
|
|
4
|
+
black: "#000000",
|
|
5
|
+
white: "#ffffff",
|
|
6
|
+
slate: {
|
|
7
|
+
50: "#f8fafc",
|
|
8
|
+
100: "#f1f5f9",
|
|
9
|
+
200: "#e2e8f0",
|
|
10
|
+
300: "#cbd5e1",
|
|
11
|
+
400: "#94a3b8",
|
|
12
|
+
500: "#64748b",
|
|
13
|
+
600: "#475569",
|
|
14
|
+
700: "#334155",
|
|
15
|
+
800: "#1e293b",
|
|
16
|
+
900: "#0f172a",
|
|
17
|
+
950: "#020617",
|
|
18
|
+
},
|
|
19
|
+
gray: {
|
|
20
|
+
50: "#f9fafb",
|
|
21
|
+
100: "#f3f4f6",
|
|
22
|
+
200: "#e5e7eb",
|
|
23
|
+
300: "#d1d5db",
|
|
24
|
+
400: "#9ca3af",
|
|
25
|
+
500: "#6b7280",
|
|
26
|
+
600: "#4b5563",
|
|
27
|
+
700: "#374151",
|
|
28
|
+
800: "#1f2937",
|
|
29
|
+
900: "#111827",
|
|
30
|
+
950: "#030712",
|
|
31
|
+
},
|
|
32
|
+
zinc: {
|
|
33
|
+
50: "#fafafa",
|
|
34
|
+
100: "#f4f4f5",
|
|
35
|
+
200: "#e4e4e7",
|
|
36
|
+
300: "#d4d4d8",
|
|
37
|
+
400: "#a1a1aa",
|
|
38
|
+
500: "#71717a",
|
|
39
|
+
600: "#52525b",
|
|
40
|
+
700: "#3f3f46",
|
|
41
|
+
800: "#27272a",
|
|
42
|
+
900: "#18181b",
|
|
43
|
+
950: "#09090b",
|
|
44
|
+
},
|
|
45
|
+
neutral: {
|
|
46
|
+
50: "#fafafa",
|
|
47
|
+
100: "#f5f5f5",
|
|
48
|
+
200: "#e5e5e5",
|
|
49
|
+
300: "#d4d4d4",
|
|
50
|
+
400: "#a3a3a3",
|
|
51
|
+
500: "#737373",
|
|
52
|
+
600: "#525252",
|
|
53
|
+
700: "#404040",
|
|
54
|
+
800: "#262626",
|
|
55
|
+
900: "#171717",
|
|
56
|
+
950: "#0a0a0a",
|
|
57
|
+
},
|
|
58
|
+
stone: {
|
|
59
|
+
50: "#fafaf9",
|
|
60
|
+
100: "#f5f5f4",
|
|
61
|
+
200: "#e7e5e4",
|
|
62
|
+
300: "#d6d3d1",
|
|
63
|
+
400: "#a8a29e",
|
|
64
|
+
500: "#78716c",
|
|
65
|
+
600: "#57534e",
|
|
66
|
+
700: "#44403c",
|
|
67
|
+
800: "#292524",
|
|
68
|
+
900: "#1c1917",
|
|
69
|
+
950: "#0c0a09",
|
|
70
|
+
},
|
|
71
|
+
red: {
|
|
72
|
+
50: "#fef2f2",
|
|
73
|
+
100: "#fee2e2",
|
|
74
|
+
200: "#fecaca",
|
|
75
|
+
300: "#fca5a5",
|
|
76
|
+
400: "#f87171",
|
|
77
|
+
500: "#ef4444",
|
|
78
|
+
600: "#dc2626",
|
|
79
|
+
700: "#b91c1c",
|
|
80
|
+
800: "#991b1b",
|
|
81
|
+
900: "#7f1d1d",
|
|
82
|
+
950: "#450a0a",
|
|
83
|
+
},
|
|
84
|
+
orange: {
|
|
85
|
+
50: "#fff7ed",
|
|
86
|
+
100: "#ffedd5",
|
|
87
|
+
200: "#fed7aa",
|
|
88
|
+
300: "#fdba74",
|
|
89
|
+
400: "#fb923c",
|
|
90
|
+
500: "#f97316",
|
|
91
|
+
600: "#ea580c",
|
|
92
|
+
700: "#c2410c",
|
|
93
|
+
800: "#9a3412",
|
|
94
|
+
900: "#7c2d12",
|
|
95
|
+
950: "#431407",
|
|
96
|
+
},
|
|
97
|
+
amber: {
|
|
98
|
+
50: "#fffbeb",
|
|
99
|
+
100: "#fef3c7",
|
|
100
|
+
200: "#fde68a",
|
|
101
|
+
300: "#fcd34d",
|
|
102
|
+
400: "#fbbf24",
|
|
103
|
+
500: "#f59e0b",
|
|
104
|
+
600: "#d97706",
|
|
105
|
+
700: "#b45309",
|
|
106
|
+
800: "#92400e",
|
|
107
|
+
900: "#78350f",
|
|
108
|
+
950: "#451a03",
|
|
109
|
+
},
|
|
110
|
+
yellow: {
|
|
111
|
+
50: "#fefce8",
|
|
112
|
+
100: "#fef9c3",
|
|
113
|
+
200: "#fef08a",
|
|
114
|
+
300: "#fde047",
|
|
115
|
+
400: "#facc15",
|
|
116
|
+
500: "#eab308",
|
|
117
|
+
600: "#ca8a04",
|
|
118
|
+
700: "#a16207",
|
|
119
|
+
800: "#854d0e",
|
|
120
|
+
900: "#713f12",
|
|
121
|
+
950: "#422006",
|
|
122
|
+
},
|
|
123
|
+
lime: {
|
|
124
|
+
50: "#f7fee7",
|
|
125
|
+
100: "#ecfccb",
|
|
126
|
+
200: "#d9f99d",
|
|
127
|
+
300: "#bef264",
|
|
128
|
+
400: "#a3e635",
|
|
129
|
+
500: "#84cc16",
|
|
130
|
+
600: "#65a30d",
|
|
131
|
+
700: "#4d7c0f",
|
|
132
|
+
800: "#3f6212",
|
|
133
|
+
900: "#365314",
|
|
134
|
+
950: "#1a2e05",
|
|
135
|
+
},
|
|
136
|
+
green: {
|
|
137
|
+
50: "#f0fdf4",
|
|
138
|
+
100: "#dcfce7",
|
|
139
|
+
200: "#bbf7d0",
|
|
140
|
+
300: "#86efac",
|
|
141
|
+
400: "#4ade80",
|
|
142
|
+
500: "#22c55e",
|
|
143
|
+
600: "#16a34a",
|
|
144
|
+
700: "#15803d",
|
|
145
|
+
800: "#166534",
|
|
146
|
+
900: "#14532d",
|
|
147
|
+
950: "#052e16",
|
|
148
|
+
},
|
|
149
|
+
emerald: {
|
|
150
|
+
50: "#ecfdf5",
|
|
151
|
+
100: "#d1fae5",
|
|
152
|
+
200: "#a7f3d0",
|
|
153
|
+
300: "#6ee7b7",
|
|
154
|
+
400: "#34d399",
|
|
155
|
+
500: "#10b981",
|
|
156
|
+
600: "#059669",
|
|
157
|
+
700: "#047857",
|
|
158
|
+
800: "#065f46",
|
|
159
|
+
900: "#064e3b",
|
|
160
|
+
950: "#022c22",
|
|
161
|
+
},
|
|
162
|
+
teal: {
|
|
163
|
+
50: "#f0fdfa",
|
|
164
|
+
100: "#ccfbf1",
|
|
165
|
+
200: "#99f6e4",
|
|
166
|
+
300: "#5eead4",
|
|
167
|
+
400: "#2dd4bf",
|
|
168
|
+
500: "#14b8a6",
|
|
169
|
+
600: "#0d9488",
|
|
170
|
+
700: "#0f766e",
|
|
171
|
+
800: "#115e59",
|
|
172
|
+
900: "#134e4a",
|
|
173
|
+
950: "#042f2e",
|
|
174
|
+
},
|
|
175
|
+
cyan: {
|
|
176
|
+
50: "#ecfeff",
|
|
177
|
+
100: "#cffafe",
|
|
178
|
+
200: "#a5f3fc",
|
|
179
|
+
300: "#67e8f9",
|
|
180
|
+
400: "#22d3ee",
|
|
181
|
+
500: "#06b6d4",
|
|
182
|
+
600: "#0891b2",
|
|
183
|
+
700: "#0e7490",
|
|
184
|
+
800: "#155e75",
|
|
185
|
+
900: "#164e63",
|
|
186
|
+
950: "#083344",
|
|
187
|
+
},
|
|
188
|
+
sky: {
|
|
189
|
+
50: "#f0f9ff",
|
|
190
|
+
100: "#e0f2fe",
|
|
191
|
+
200: "#bae6fd",
|
|
192
|
+
300: "#7dd3fc",
|
|
193
|
+
400: "#38bdf8",
|
|
194
|
+
500: "#0ea5e9",
|
|
195
|
+
600: "#0284c7",
|
|
196
|
+
700: "#0369a1",
|
|
197
|
+
800: "#075985",
|
|
198
|
+
900: "#0c4a6e",
|
|
199
|
+
950: "#082f49",
|
|
200
|
+
},
|
|
201
|
+
blue: {
|
|
202
|
+
50: "#eff6ff",
|
|
203
|
+
100: "#dbeafe",
|
|
204
|
+
200: "#bfdbfe",
|
|
205
|
+
300: "#93c5fd",
|
|
206
|
+
400: "#60a5fa",
|
|
207
|
+
500: "#3b82f6",
|
|
208
|
+
600: "#2563eb",
|
|
209
|
+
700: "#1d4ed8",
|
|
210
|
+
800: "#1e40af",
|
|
211
|
+
900: "#1e3a8a",
|
|
212
|
+
950: "#172554",
|
|
213
|
+
},
|
|
214
|
+
indigo: {
|
|
215
|
+
50: "#eef2ff",
|
|
216
|
+
100: "#e0e7ff",
|
|
217
|
+
200: "#c7d2fe",
|
|
218
|
+
300: "#a5b4fc",
|
|
219
|
+
400: "#818cf8",
|
|
220
|
+
500: "#6366f1",
|
|
221
|
+
600: "#4f46e5",
|
|
222
|
+
700: "#4338ca",
|
|
223
|
+
800: "#3730a3",
|
|
224
|
+
900: "#312e81",
|
|
225
|
+
950: "#1e1b4b",
|
|
226
|
+
},
|
|
227
|
+
violet: {
|
|
228
|
+
50: "#f5f3ff",
|
|
229
|
+
100: "#ede9fe",
|
|
230
|
+
200: "#ddd6fe",
|
|
231
|
+
300: "#c4b5fd",
|
|
232
|
+
400: "#a78bfa",
|
|
233
|
+
500: "#8b5cf6",
|
|
234
|
+
600: "#7c3aed",
|
|
235
|
+
700: "#6d28d9",
|
|
236
|
+
800: "#5b21b6",
|
|
237
|
+
900: "#4c1d95",
|
|
238
|
+
950: "#2e1065",
|
|
239
|
+
},
|
|
240
|
+
purple: {
|
|
241
|
+
50: "#faf5ff",
|
|
242
|
+
100: "#f3e8ff",
|
|
243
|
+
200: "#e9d5ff",
|
|
244
|
+
300: "#d8b4fe",
|
|
245
|
+
400: "#c084fc",
|
|
246
|
+
500: "#a855f7",
|
|
247
|
+
600: "#9333ea",
|
|
248
|
+
700: "#7e22ce",
|
|
249
|
+
800: "#6b21a8",
|
|
250
|
+
900: "#581c87",
|
|
251
|
+
950: "#3b0764",
|
|
252
|
+
},
|
|
253
|
+
fuchsia: {
|
|
254
|
+
50: "#fdf4ff",
|
|
255
|
+
100: "#fae8ff",
|
|
256
|
+
200: "#f5d0fe",
|
|
257
|
+
300: "#f0abfc",
|
|
258
|
+
400: "#e879f9",
|
|
259
|
+
500: "#d946ef",
|
|
260
|
+
600: "#c026d3",
|
|
261
|
+
700: "#a21caf",
|
|
262
|
+
800: "#86198f",
|
|
263
|
+
900: "#701a75",
|
|
264
|
+
950: "#4a044e",
|
|
265
|
+
},
|
|
266
|
+
pink: {
|
|
267
|
+
50: "#fdf2f8",
|
|
268
|
+
100: "#fce7f3",
|
|
269
|
+
200: "#fbcfe8",
|
|
270
|
+
300: "#f9a8d4",
|
|
271
|
+
400: "#f472b6",
|
|
272
|
+
500: "#ec4899",
|
|
273
|
+
600: "#db2777",
|
|
274
|
+
700: "#be185d",
|
|
275
|
+
800: "#9d174d",
|
|
276
|
+
900: "#831843",
|
|
277
|
+
950: "#500724",
|
|
278
|
+
},
|
|
279
|
+
rose: {
|
|
280
|
+
50: "#fff1f2",
|
|
281
|
+
100: "#ffe4e6",
|
|
282
|
+
200: "#fecdd3",
|
|
283
|
+
300: "#fda4af",
|
|
284
|
+
400: "#fb7185",
|
|
285
|
+
500: "#f43f5e",
|
|
286
|
+
600: "#e11d48",
|
|
287
|
+
700: "#be123c",
|
|
288
|
+
800: "#9f1239",
|
|
289
|
+
900: "#881337",
|
|
290
|
+
950: "#4c0519",
|
|
291
|
+
},
|
|
292
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import { Color } from "./Color";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Input/Color",
|
|
6
|
+
component: Color,
|
|
7
|
+
} satisfies Meta<typeof Color>;
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
export const Basic = () => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="flex flex-col items-start gap-2">
|
|
13
|
+
<Color value="#fecdba" />
|
|
14
|
+
<Color value="#fecdba" label="300" />
|
|
15
|
+
<Color value="#fecdba" showValue={true} />
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ComponentProps, forwardRef, useImperativeHandle, useRef } from "react";
|
|
2
|
+
import type { ThemeColor } from "../../types.d";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useRipple } from "../../hooks";
|
|
5
|
+
|
|
6
|
+
export interface ColorProps extends ComponentProps<"button"> {
|
|
7
|
+
withRipple?: boolean;
|
|
8
|
+
|
|
9
|
+
value?: string;
|
|
10
|
+
color?: ThemeColor;
|
|
11
|
+
label?: string;
|
|
12
|
+
showValue?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Color = forwardRef<HTMLButtonElement, ColorProps>(
|
|
17
|
+
(
|
|
18
|
+
{
|
|
19
|
+
value,
|
|
20
|
+
withRipple = true,
|
|
21
|
+
color = "yellow",
|
|
22
|
+
label,
|
|
23
|
+
showValue = false,
|
|
24
|
+
className,
|
|
25
|
+
...rest
|
|
26
|
+
},
|
|
27
|
+
ref,
|
|
28
|
+
) => {
|
|
29
|
+
const valueToShow = label ?? (showValue ? value : null);
|
|
30
|
+
|
|
31
|
+
const buttonRef = useRef<HTMLButtonElement>(null);
|
|
32
|
+
|
|
33
|
+
useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(
|
|
34
|
+
ref,
|
|
35
|
+
() => buttonRef.current,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const ripples = useRipple(buttonRef);
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<button
|
|
42
|
+
ref={buttonRef}
|
|
43
|
+
data-color={color}
|
|
44
|
+
className="p8n-input-text relative flex h-8 overflow-clip rounded-2xl p-1 outline-offset-[-1px]"
|
|
45
|
+
{...rest}
|
|
46
|
+
>
|
|
47
|
+
{withRipple && ripples}
|
|
48
|
+
<span
|
|
49
|
+
className={clsx(
|
|
50
|
+
"flex items-center justify-center rounded-2xl px-2",
|
|
51
|
+
valueToShow === null && "min-w-12",
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
style={{ backgroundColor: value }}
|
|
55
|
+
>
|
|
56
|
+
{valueToShow}
|
|
57
|
+
</span>
|
|
58
|
+
</button>
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
);
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ModalHeader,
|
|
11
11
|
ModalFooter,
|
|
12
12
|
} from ".";
|
|
13
|
+
import { type Tab, Tabs } from "../tabs/Tabs";
|
|
13
14
|
|
|
14
15
|
const meta = {
|
|
15
16
|
title: "Components/Modal",
|
|
@@ -44,7 +45,7 @@ export const BasicLongText: Story = {
|
|
|
44
45
|
return (
|
|
45
46
|
<Modal {...args}>
|
|
46
47
|
<ModalTrigger>open Modal</ModalTrigger>
|
|
47
|
-
<ModalContent>
|
|
48
|
+
<ModalContent className="w-[600px] max-w-full">
|
|
48
49
|
<ModalHeader>Header</ModalHeader>
|
|
49
50
|
<ModalDescription>
|
|
50
51
|
Lorem ipsum dolor sit amet consectetur adipisicing elit.
|
|
@@ -62,7 +63,7 @@ export const BasicLongText: Story = {
|
|
|
62
63
|
},
|
|
63
64
|
};
|
|
64
65
|
|
|
65
|
-
export const
|
|
66
|
+
export const WithButtons = () => {
|
|
66
67
|
const [isOpen, setIsOpen] = useState(false);
|
|
67
68
|
return (
|
|
68
69
|
<Modal
|
|
@@ -95,7 +96,68 @@ export const Context = () => {
|
|
|
95
96
|
);
|
|
96
97
|
};
|
|
97
98
|
|
|
98
|
-
export const
|
|
99
|
+
export const WithTabs = () => {
|
|
100
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
101
|
+
const [id, setId] = useState<string | number>("css");
|
|
102
|
+
|
|
103
|
+
const tabs: Tab[] = [
|
|
104
|
+
{
|
|
105
|
+
id: "css",
|
|
106
|
+
title: "CSS Export",
|
|
107
|
+
content: (
|
|
108
|
+
<div className="flex h-96 max-h-full flex-col p-4">
|
|
109
|
+
<p>
|
|
110
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere odit
|
|
111
|
+
id omnis molestias quidem necessitatibus aperiam deleniti, neque
|
|
112
|
+
reiciendis iusto dolorem pariatur voluptatem natus reprehenderit
|
|
113
|
+
itaque illum autem consectetur vero?
|
|
114
|
+
</p>
|
|
115
|
+
<p>
|
|
116
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Facere odit
|
|
117
|
+
id omnis molestias quidem necessitatibus aperiam deleniti, neque
|
|
118
|
+
reiciendis iusto dolorem pariatur voluptatem natus reprehenderit
|
|
119
|
+
itaque illum autem consectetur vero?
|
|
120
|
+
</p>
|
|
121
|
+
</div>
|
|
122
|
+
),
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "json",
|
|
126
|
+
title: "JSON Export",
|
|
127
|
+
content: (
|
|
128
|
+
<div className="flex h-96 max-h-full flex-col p-4">
|
|
129
|
+
<p>
|
|
130
|
+
Hello world Hello world Hello world Hello world Hello world Hello
|
|
131
|
+
world Hello world Hello world Hello world Hello world Hello world
|
|
132
|
+
Hello world Hello world Hello world Hello world Hello world Hello
|
|
133
|
+
world Hello world Hello world Hello world Hello world Hello world
|
|
134
|
+
Hello world{" "}
|
|
135
|
+
</p>
|
|
136
|
+
</div>
|
|
137
|
+
),
|
|
138
|
+
},
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<Modal open={isOpen} onOpen={setIsOpen}>
|
|
143
|
+
<ModalTrigger>Generate config</ModalTrigger>
|
|
144
|
+
<ModalContent className="w-full max-w-[600px]">
|
|
145
|
+
<Tabs tabs={tabs} value={id} onChange={setId} className="rounded-2xl">
|
|
146
|
+
<Button
|
|
147
|
+
icon
|
|
148
|
+
variant="text"
|
|
149
|
+
color="gray"
|
|
150
|
+
onClick={() => setIsOpen(false)}
|
|
151
|
+
>
|
|
152
|
+
<i className="fe-cancel"></i>
|
|
153
|
+
</Button>
|
|
154
|
+
</Tabs>
|
|
155
|
+
</ModalContent>
|
|
156
|
+
</Modal>
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const Scrollable = () => {
|
|
99
161
|
const [isOpen, setIsOpen] = useState(false);
|
|
100
162
|
return (
|
|
101
163
|
<Modal
|
|
@@ -31,7 +31,7 @@ export const ModalContent = forwardRef<HTMLDivElement, ComponentProps<"div">>(
|
|
|
31
31
|
<FloatingFocusManager context={floatingContext}>
|
|
32
32
|
<Dialog
|
|
33
33
|
className={clsx(
|
|
34
|
-
"mx-4
|
|
34
|
+
"mx-4",
|
|
35
35
|
`border-${context.color}-2`,
|
|
36
36
|
"motion-safe:animate-fade-in",
|
|
37
37
|
className,
|
|
@@ -46,6 +46,11 @@ export const Context = () => {
|
|
|
46
46
|
<Button onClick={handleClick}>Show info notification</Button>
|
|
47
47
|
<Button onClick={throwError}>Throw custom error</Button>
|
|
48
48
|
<Button onClick={handle404Error}>Throw 404 fetch error</Button>
|
|
49
|
+
<div className="mt-96">
|
|
50
|
+
<a href="#" className="link">
|
|
51
|
+
link
|
|
52
|
+
</a>
|
|
53
|
+
</div>
|
|
49
54
|
</div>
|
|
50
55
|
);
|
|
51
56
|
};
|
package/components/tabs/Tabs.tsx
CHANGED
|
@@ -43,10 +43,7 @@ export function Tabs({
|
|
|
43
43
|
const content = tabs.find((t) => t.id === value)?.content;
|
|
44
44
|
return (
|
|
45
45
|
<div
|
|
46
|
-
className={clsx(
|
|
47
|
-
"ll-tabs overflow-hidden bg-gray-2 shadow md:rounded-sm",
|
|
48
|
-
className,
|
|
49
|
-
)}
|
|
46
|
+
className={clsx("ll-tabs overflow-hidden bg-gray-2 shadow", className)}
|
|
50
47
|
>
|
|
51
48
|
<div
|
|
52
49
|
role="tablist"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Textarea } from "./Textarea";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Textarea",
|
|
6
|
+
component: Textarea,
|
|
7
|
+
} satisfies Meta<typeof Textarea>;
|
|
8
|
+
export default meta;
|
|
9
|
+
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
|
|
12
|
+
export const Playbook: Story = {};
|
|
13
|
+
|
|
14
|
+
export const Context = () => {
|
|
15
|
+
return (
|
|
16
|
+
<div className="grid grid-cols-2 gap-4 lg:grid-cols-3 xl:grid-cols-4">
|
|
17
|
+
<Textarea className="h-24 w-96" color="yellow" />
|
|
18
|
+
<Textarea className="h-24 w-96" color="gray" />
|
|
19
|
+
<Textarea className="h-24 w-96" color="green" />
|
|
20
|
+
<Textarea className="h-24 w-96" color="red" />
|
|
21
|
+
<Textarea className="h-24 w-96" color="orange" />
|
|
22
|
+
<Textarea className="h-24 w-96" color="blue" />
|
|
23
|
+
<Textarea className="h-24 w-96" disabled value="disabled" />
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
import { forwardRef, ComponentProps } from "react";
|
|
3
|
+
import type { ThemeColor } from "../../types.d";
|
|
4
|
+
|
|
5
|
+
export interface TextareaProps extends ComponentProps<"textarea"> {
|
|
6
|
+
variant?: "normal" | "ghost";
|
|
7
|
+
color?: ThemeColor;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
11
|
+
function Textarea(
|
|
12
|
+
{
|
|
13
|
+
variant = "normal",
|
|
14
|
+
color = "yellow",
|
|
15
|
+
disabled = false,
|
|
16
|
+
className,
|
|
17
|
+
...rest
|
|
18
|
+
},
|
|
19
|
+
ref,
|
|
20
|
+
) {
|
|
21
|
+
return (
|
|
22
|
+
<textarea
|
|
23
|
+
data-color={color}
|
|
24
|
+
data-variant={variant}
|
|
25
|
+
ref={ref}
|
|
26
|
+
className={clsx(
|
|
27
|
+
"p8n-textarea min-w-0 appearance-none rounded-2xl bg-transparent p-2 outline-offset-[-1px] filter-none",
|
|
28
|
+
disabled && "disabled",
|
|
29
|
+
className,
|
|
30
|
+
)}
|
|
31
|
+
disabled={disabled}
|
|
32
|
+
{...rest}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from "./Textarea";
|
package/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./components/sortable";
|
|
|
30
30
|
export * from "./components/steps";
|
|
31
31
|
export * from "./components/table";
|
|
32
32
|
export * from "./components/tabs";
|
|
33
|
+
export * from "./components/textarea";
|
|
33
34
|
export * from "./components/tooltip";
|
|
34
35
|
|
|
35
36
|
export * from "./hooks";
|
package/package.json
CHANGED
package/tailwind/components.ts
CHANGED
|
@@ -196,39 +196,40 @@ export const componentsResizeArea: CSSRuleObject = {
|
|
|
196
196
|
};
|
|
197
197
|
|
|
198
198
|
export const componentsInputOutline: CSSRuleObject = {
|
|
199
|
-
":is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text)":
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
":is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea)":
|
|
200
|
+
{
|
|
201
|
+
"@apply outline outline-1 focus-full:outline-2": {},
|
|
202
|
+
},
|
|
203
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="yellow"])':
|
|
203
204
|
{
|
|
204
205
|
"@apply outline-gray-2 hover:outline-gray-3 focus-full:outline-yellow-4":
|
|
205
206
|
{},
|
|
206
207
|
},
|
|
207
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-color="gray"])':
|
|
208
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="gray"])':
|
|
208
209
|
{
|
|
209
210
|
"@apply outline-gray-2 hover:outline-gray-3 focus-full:outline-gray-4":
|
|
210
211
|
{},
|
|
211
212
|
},
|
|
212
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-color="red"])':
|
|
213
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="red"])':
|
|
213
214
|
{
|
|
214
215
|
"@apply outline-red-2 hover:outline-red-3 focus-full:outline-red-4": {},
|
|
215
216
|
},
|
|
216
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-color="orange"])':
|
|
217
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="orange"])':
|
|
217
218
|
{
|
|
218
219
|
"@apply outline-orange-2 hover:outline-orange-3 focus-full:outline-orange-4":
|
|
219
220
|
{},
|
|
220
221
|
},
|
|
221
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-color="blue"])':
|
|
222
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="blue"])':
|
|
222
223
|
{
|
|
223
224
|
"@apply outline-blue-2 hover:outline-blue-3 focus-full:outline-blue-4":
|
|
224
225
|
{},
|
|
225
226
|
},
|
|
226
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-color="green"])':
|
|
227
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-color="green"])':
|
|
227
228
|
{
|
|
228
229
|
"@apply outline-green-2 hover:outline-green-3 focus-full:outline-green-4":
|
|
229
230
|
{},
|
|
230
231
|
},
|
|
231
|
-
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text):where([data-variant="ghost"])':
|
|
232
|
+
':is(.p8n-input-checkbox, .p8n-input-radio, .p8n-input-text, .p8n-textarea):where([data-variant="ghost"])':
|
|
232
233
|
{
|
|
233
234
|
"@apply outline-transparent": {},
|
|
234
235
|
},
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { ReactNode, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { createPortal } from "react-dom";
|
|
3
|
-
import {
|
|
4
|
-
NotificationsContext,
|
|
5
|
-
createNotificationsManager,
|
|
6
|
-
type NotificationsManager,
|
|
7
|
-
} from "./NotificationsContext";
|
|
8
|
-
import { Snack } from "../snack";
|
|
9
|
-
import { Message } from "../../types.d";
|
|
10
|
-
|
|
11
|
-
interface Props {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function NotificationsProvider({ children }: Props) {
|
|
16
|
-
const [notifications, setNotifications] = useState<Message[]>([]);
|
|
17
|
-
const container = useRef<HTMLDivElement>(null!);
|
|
18
|
-
const [isMounted, setIsMounted] = useState(false);
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (!container.current) {
|
|
22
|
-
container.current = document.createElement("div");
|
|
23
|
-
container.current.id = Math.floor(Math.random() * 100000).toString();
|
|
24
|
-
/* .ll-snack-bar */
|
|
25
|
-
container.current.classList.add(
|
|
26
|
-
"fixed",
|
|
27
|
-
"bottom-0",
|
|
28
|
-
"left-0",
|
|
29
|
-
"right-0",
|
|
30
|
-
"z-notification",
|
|
31
|
-
);
|
|
32
|
-
document.body.append(container.current);
|
|
33
|
-
}
|
|
34
|
-
setIsMounted(true);
|
|
35
|
-
return () => {
|
|
36
|
-
container.current && container.current.remove();
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
|
|
40
|
-
const managerRef = useRef<NotificationsManager>();
|
|
41
|
-
|
|
42
|
-
if (typeof window === "undefined") {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!managerRef.current) {
|
|
47
|
-
managerRef.current = createNotificationsManager(setNotifications);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const manager = managerRef.current;
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<>
|
|
54
|
-
<NotificationsContext.Provider value={manager}>
|
|
55
|
-
{children}
|
|
56
|
-
</NotificationsContext.Provider>
|
|
57
|
-
{isMounted &&
|
|
58
|
-
createPortal(
|
|
59
|
-
/* snack-bar-inner */
|
|
60
|
-
<div className="mx-4 mb-4 flex flex-col items-center gap-4">
|
|
61
|
-
{notifications.map((props) => (
|
|
62
|
-
<Snack
|
|
63
|
-
{...props}
|
|
64
|
-
key={props.id}
|
|
65
|
-
onRemove={() => manager.removeNotification(props.id)}
|
|
66
|
-
/>
|
|
67
|
-
))}
|
|
68
|
-
</div>,
|
|
69
|
-
container.current,
|
|
70
|
-
)}
|
|
71
|
-
</>
|
|
72
|
-
);
|
|
73
|
-
}
|