doom-design-system 0.1.15 → 0.2.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.
- package/dist/components/Accordion/Accordion.d.ts +7 -6
- package/dist/components/Accordion/Accordion.js +36 -28
- package/dist/components/Accordion/Accordion.module.css +78 -22
- package/dist/components/Avatar/Avatar.d.ts +4 -4
- package/dist/components/Avatar/Avatar.js +6 -6
- package/dist/components/Badge/Badge.module.css +3 -3
- package/dist/components/Button/Button.module.css +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.js +7 -7
- package/dist/components/Drawer/Drawer.js +5 -3
- package/dist/components/Drawer/Drawer.module.css +8 -6
- package/dist/components/Form/Form.module.css +1 -0
- package/dist/components/Input/Input.d.ts +3 -2
- package/dist/components/Input/Input.js +15 -3
- package/dist/components/Input/Input.module.css +33 -0
- package/dist/components/Modal/Modal.d.ts +5 -4
- package/dist/components/Modal/Modal.js +13 -6
- package/dist/components/Modal/Modal.module.css +70 -29
- package/dist/components/Popover/Popover.d.ts +3 -3
- package/dist/components/Popover/Popover.js +38 -36
- package/dist/components/ProgressBar/ProgressBar.d.ts +2 -1
- package/dist/components/ProgressBar/ProgressBar.js +10 -5
- package/dist/components/ProgressBar/ProgressBar.module.css +7 -0
- package/dist/components/Select/Select.js +6 -4
- package/dist/components/Select/Select.module.css +2 -2
- package/dist/components/Sheet/Sheet.d.ts +2 -2
- package/dist/components/Sheet/Sheet.js +18 -16
- package/dist/components/Sheet/Sheet.module.css +1 -2
- package/dist/components/Slider/Slider.d.ts +3 -3
- package/dist/components/Slider/Slider.js +11 -7
- package/dist/components/Slider/Slider.module.css +1 -1
- package/dist/components/SplitButton/SplitButton.d.ts +2 -2
- package/dist/components/SplitButton/SplitButton.js +8 -8
- package/dist/components/Tabs/Tabs.js +2 -2
- package/dist/components/Tabs/Tabs.module.css +9 -7
- package/dist/components/Textarea/Textarea.d.ts +8 -3
- package/dist/components/Textarea/Textarea.js +25 -6
- package/dist/components/Textarea/Textarea.module.css +71 -0
- package/dist/styles/themes/definitions.d.ts +312 -300
- package/dist/styles/themes/definitions.js +60 -60
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +2 -2
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
3
|
var t = {};
|
|
4
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -10,10 +10,29 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import React, { useState, useId } from "react";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import { Label } from "../Label/Label.js";
|
|
17
|
+
import styles from "./Textarea.module.css";
|
|
16
18
|
export function Textarea(_a) {
|
|
17
|
-
var { className } = _a, props = __rest(_a, ["className"]);
|
|
18
|
-
|
|
19
|
+
var { label, error, helperText, showCount, className, style, id, required, maxLength, value, defaultValue, onChange } = _a, props = __rest(_a, ["label", "error", "helperText", "showCount", "className", "style", "id", "required", "maxLength", "value", "defaultValue", "onChange"]);
|
|
20
|
+
const reactId = useId();
|
|
21
|
+
const textareaId = id || `textarea-${reactId}`;
|
|
22
|
+
const helperId = `${textareaId}-helper`;
|
|
23
|
+
const errorId = `${textareaId}-error`;
|
|
24
|
+
const [charCount, setCharCount] = useState(((value === null || value === void 0 ? void 0 : value.toString()) || (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.toString()) || "").length);
|
|
25
|
+
const handleChange = (e) => {
|
|
26
|
+
setCharCount(e.target.value.length);
|
|
27
|
+
if (onChange)
|
|
28
|
+
onChange(e);
|
|
29
|
+
};
|
|
30
|
+
// Sync charCount if value is updated externally (controlled)
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (value !== undefined) {
|
|
33
|
+
setCharCount(value.toString().length);
|
|
34
|
+
}
|
|
35
|
+
}, [value]);
|
|
36
|
+
const describedBy = clsx(helperText && helperId, error && errorId) || undefined;
|
|
37
|
+
return (_jsxs("div", { className: clsx(styles.container, className), style: style, children: [label && (_jsx(Label, { htmlFor: textareaId, required: required, children: label })), _jsx("textarea", Object.assign({ className: clsx(styles.textarea, error && styles.error), id: textareaId, required: required, maxLength: maxLength, value: value, defaultValue: defaultValue, onChange: handleChange, "aria-invalid": !!error, "aria-describedby": describedBy }, props)), (error || helperText || (showCount !== null && showCount !== void 0 ? showCount : maxLength !== undefined)) && (_jsxs("div", { className: styles.bottomRow, children: [_jsx("div", { className: styles.messageArea, children: error ? (_jsx("span", { id: errorId, className: clsx(styles.helperText, styles.error), role: "alert", children: error })) : (helperText && (_jsx("span", { id: helperId, className: styles.helperText, children: helperText }))) }), (showCount !== null && showCount !== void 0 ? showCount : maxLength !== undefined) && (_jsxs("span", { className: styles.counter, children: [charCount, maxLength !== undefined ? ` / ${maxLength}` : ""] }))] }))] }));
|
|
19
38
|
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 0.5rem;
|
|
5
|
+
width: 100%;
|
|
6
|
+
}
|
|
7
|
+
|
|
1
8
|
.textarea {
|
|
2
9
|
width: 100%;
|
|
3
10
|
padding: 0.75rem 1rem;
|
|
@@ -6,6 +13,7 @@
|
|
|
6
13
|
color: var(--foreground);
|
|
7
14
|
font-family: inherit;
|
|
8
15
|
resize: vertical;
|
|
16
|
+
min-height: 100px;
|
|
9
17
|
border: var(--border-width) solid var(--card-border);
|
|
10
18
|
border-radius: var(--radius);
|
|
11
19
|
box-shadow: var(--shadow-hard);
|
|
@@ -21,3 +29,66 @@
|
|
|
21
29
|
.textarea::placeholder {
|
|
22
30
|
color: var(--muted);
|
|
23
31
|
}
|
|
32
|
+
.textarea.error {
|
|
33
|
+
border-color: var(--error);
|
|
34
|
+
box-shadow: 5px 5px 0px 0px var(--shadow-error);
|
|
35
|
+
}
|
|
36
|
+
.textarea.error:focus, .textarea.error:focus-visible {
|
|
37
|
+
border-color: var(--error);
|
|
38
|
+
box-shadow: 7px 7px 0px 0px var(--shadow-error);
|
|
39
|
+
}
|
|
40
|
+
.textarea:disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
opacity: 0.7;
|
|
43
|
+
background-color: var(--muted);
|
|
44
|
+
background-image: linear-gradient(45deg, transparent 25%, rgba(0, 0, 0, 0.05) 25%, rgba(0, 0, 0, 0.05) 50%, transparent 50%, transparent 75%, rgba(0, 0, 0, 0.05) 75%, rgba(0, 0, 0, 0.05));
|
|
45
|
+
background-size: 20px 20px;
|
|
46
|
+
box-shadow: none;
|
|
47
|
+
transform: none;
|
|
48
|
+
color: var(--muted-foreground);
|
|
49
|
+
}
|
|
50
|
+
.textarea:disabled::placeholder {
|
|
51
|
+
color: var(--muted-foreground);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.bottomRow {
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: space-between;
|
|
57
|
+
align-items: flex-start;
|
|
58
|
+
gap: 1rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.messageArea {
|
|
62
|
+
flex: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.helperText {
|
|
66
|
+
font-size: var(--text-xs);
|
|
67
|
+
font-weight: var(--font-medium);
|
|
68
|
+
color: var(--muted-foreground);
|
|
69
|
+
display: block;
|
|
70
|
+
}
|
|
71
|
+
.helperText.error {
|
|
72
|
+
color: var(--error);
|
|
73
|
+
font-weight: var(--font-bold);
|
|
74
|
+
text-transform: uppercase;
|
|
75
|
+
animation: textarea-shake 0.3s ease-in-out;
|
|
76
|
+
}
|
|
77
|
+
@keyframes textarea-shake {
|
|
78
|
+
0%, 100% {
|
|
79
|
+
transform: translateX(0);
|
|
80
|
+
}
|
|
81
|
+
25% {
|
|
82
|
+
transform: translateX(-4px);
|
|
83
|
+
}
|
|
84
|
+
75% {
|
|
85
|
+
transform: translateX(4px);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.counter {
|
|
90
|
+
font-size: var(--text-xs);
|
|
91
|
+
font-weight: var(--font-medium);
|
|
92
|
+
color: var(--muted-foreground);
|
|
93
|
+
white-space: nowrap;
|
|
94
|
+
}
|