@nurimedia/react-ui 0.1.0 → 0.1.2
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/AlertDialog/index.cjs +4 -180
- package/dist/AlertDialog/index.cjs.map +1 -1
- package/dist/AlertDialog/index.js +5 -144
- package/dist/AlertDialog/index.js.map +1 -1
- package/dist/Button/index.cjs +4 -131
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.js +5 -105
- package/dist/Button/index.js.map +1 -1
- package/dist/Checkbox/index.cjs +4 -78
- package/dist/Checkbox/index.cjs.map +1 -1
- package/dist/Checkbox/index.js +5 -42
- package/dist/Checkbox/index.js.map +1 -1
- package/dist/Input/index.cjs +4 -98
- package/dist/Input/index.cjs.map +1 -1
- package/dist/Input/index.js +5 -72
- package/dist/Input/index.js.map +1 -1
- package/dist/Modal/index.cjs +4 -115
- package/dist/Modal/index.cjs.map +1 -1
- package/dist/Modal/index.js +5 -79
- package/dist/Modal/index.js.map +1 -1
- package/dist/Radio/index.cjs +6 -81
- package/dist/Radio/index.cjs.map +1 -1
- package/dist/Radio/index.js +6 -43
- package/dist/Radio/index.js.map +1 -1
- package/dist/Select/index.cjs +4 -111
- package/dist/Select/index.cjs.map +1 -1
- package/dist/Select/index.js +5 -75
- package/dist/Select/index.js.map +1 -1
- package/dist/Switch/index.cjs +4 -66
- package/dist/Switch/index.cjs.map +1 -1
- package/dist/Switch/index.js +5 -30
- package/dist/Switch/index.js.map +1 -1
- package/dist/Textarea/index.cjs +4 -122
- package/dist/Textarea/index.cjs.map +1 -1
- package/dist/Textarea/index.js +5 -96
- package/dist/Textarea/index.js.map +1 -1
- package/dist/Toast/index.cjs +4 -177
- package/dist/Toast/index.cjs.map +1 -1
- package/dist/Toast/index.js +6 -141
- package/dist/Toast/index.js.map +1 -1
- package/dist/Tooltip/index.cjs +6 -100
- package/dist/Tooltip/index.cjs.map +1 -1
- package/dist/Tooltip/index.js +6 -62
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/chunk-2LFW4MM6.cjs +47 -0
- package/dist/chunk-2LFW4MM6.cjs.map +1 -0
- package/dist/chunk-2WKLA5RC.cjs +82 -0
- package/dist/chunk-2WKLA5RC.cjs.map +1 -0
- package/dist/chunk-2YGYLCCA.js +66 -0
- package/dist/chunk-2YGYLCCA.js.map +1 -0
- package/dist/chunk-323VGYMK.cjs +147 -0
- package/dist/chunk-323VGYMK.cjs.map +1 -0
- package/dist/chunk-3H47QMKS.js +47 -0
- package/dist/chunk-3H47QMKS.js.map +1 -0
- package/dist/chunk-3QSLHLC2.cjs +45 -0
- package/dist/chunk-3QSLHLC2.cjs.map +1 -0
- package/dist/chunk-4N5JIGIU.js +82 -0
- package/dist/chunk-4N5JIGIU.js.map +1 -0
- package/dist/chunk-DTGPVOJK.js +99 -0
- package/dist/chunk-DTGPVOJK.js.map +1 -0
- package/dist/chunk-DTQE42F7.js +33 -0
- package/dist/chunk-DTQE42F7.js.map +1 -0
- package/dist/chunk-DYO4PIBB.js +75 -0
- package/dist/chunk-DYO4PIBB.js.map +1 -0
- package/dist/chunk-GBMYANHH.js +149 -0
- package/dist/chunk-GBMYANHH.js.map +1 -0
- package/dist/chunk-I7KJ7WTN.cjs +149 -0
- package/dist/chunk-I7KJ7WTN.cjs.map +1 -0
- package/dist/chunk-JM4HDCLU.cjs +110 -0
- package/dist/chunk-JM4HDCLU.cjs.map +1 -0
- package/dist/chunk-JXJ6G634.cjs +75 -0
- package/dist/chunk-JXJ6G634.cjs.map +1 -0
- package/dist/chunk-LAPTEQ5N.js +45 -0
- package/dist/chunk-LAPTEQ5N.js.map +1 -0
- package/dist/chunk-LRATCHCB.cjs +66 -0
- package/dist/chunk-LRATCHCB.cjs.map +1 -0
- package/dist/chunk-OM4QMC4F.js +110 -0
- package/dist/chunk-OM4QMC4F.js.map +1 -0
- package/dist/chunk-PAXRFQUJ.cjs +33 -0
- package/dist/chunk-PAXRFQUJ.cjs.map +1 -0
- package/dist/chunk-PC3B67B4.cjs +78 -0
- package/dist/chunk-PC3B67B4.cjs.map +1 -0
- package/dist/chunk-PS6QXS5Z.js +11 -0
- package/dist/chunk-PS6QXS5Z.js.map +1 -0
- package/dist/chunk-Q26BJSLP.cjs +99 -0
- package/dist/chunk-Q26BJSLP.cjs.map +1 -0
- package/dist/chunk-R4E4BIPC.cjs +11 -0
- package/dist/chunk-R4E4BIPC.cjs.map +1 -0
- package/dist/chunk-R757N7RU.js +78 -0
- package/dist/chunk-R757N7RU.js.map +1 -0
- package/dist/chunk-RC773ZEY.js +147 -0
- package/dist/chunk-RC773ZEY.js.map +1 -0
- package/dist/index.cjs +54 -899
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -833
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/Select/index.js
CHANGED
|
@@ -1,78 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// src/utils/cx.ts
|
|
7
|
-
function cx(...classes) {
|
|
8
|
-
return classes.filter(Boolean).join(" ");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// src/Select/Select.tsx
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var CaretIcon = () => /* @__PURE__ */ jsx("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M1.1 2.5h5.8L4 5.9z", fill: "currentColor" }) });
|
|
14
|
-
var Select = forwardRef(function Select2({
|
|
15
|
-
options,
|
|
16
|
-
size = "md",
|
|
17
|
-
placeholder,
|
|
18
|
-
value,
|
|
19
|
-
defaultValue,
|
|
20
|
-
onValueChange,
|
|
21
|
-
open,
|
|
22
|
-
defaultOpen,
|
|
23
|
-
onOpenChange,
|
|
24
|
-
disabled = false,
|
|
25
|
-
block = false,
|
|
26
|
-
name,
|
|
27
|
-
required,
|
|
28
|
-
container,
|
|
29
|
-
className,
|
|
30
|
-
"aria-label": ariaLabel
|
|
31
|
-
}, ref) {
|
|
32
|
-
return /* @__PURE__ */ jsxs(
|
|
33
|
-
RadixSelect.Root,
|
|
34
|
-
{
|
|
35
|
-
value,
|
|
36
|
-
defaultValue,
|
|
37
|
-
onValueChange,
|
|
38
|
-
open,
|
|
39
|
-
defaultOpen,
|
|
40
|
-
onOpenChange,
|
|
41
|
-
disabled,
|
|
42
|
-
name,
|
|
43
|
-
required,
|
|
44
|
-
children: [
|
|
45
|
-
/* @__PURE__ */ jsxs(
|
|
46
|
-
RadixSelect.Trigger,
|
|
47
|
-
{
|
|
48
|
-
ref,
|
|
49
|
-
"aria-label": ariaLabel,
|
|
50
|
-
className: cx(
|
|
51
|
-
"nuri-select__trigger",
|
|
52
|
-
`nuri-select__trigger--${size}`,
|
|
53
|
-
block && "nuri-select__trigger--block",
|
|
54
|
-
className
|
|
55
|
-
),
|
|
56
|
-
children: [
|
|
57
|
-
/* @__PURE__ */ jsx("span", { className: "nuri-select__value", children: /* @__PURE__ */ jsx(RadixSelect.Value, { placeholder }) }),
|
|
58
|
-
/* @__PURE__ */ jsx(RadixSelect.Icon, { className: "nuri-select__caret", children: /* @__PURE__ */ jsx(CaretIcon, {}) })
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
),
|
|
62
|
-
/* @__PURE__ */ jsx(RadixSelect.Portal, { container, children: /* @__PURE__ */ jsx(RadixSelect.Content, { className: "nuri-select__content", position: "popper", sideOffset: 6, children: /* @__PURE__ */ jsx(RadixSelect.Viewport, { className: "nuri-select__viewport", children: options.map((option) => /* @__PURE__ */ jsx(
|
|
63
|
-
RadixSelect.Item,
|
|
64
|
-
{
|
|
65
|
-
value: option.value,
|
|
66
|
-
disabled: option.disabled,
|
|
67
|
-
className: "nuri-select__item",
|
|
68
|
-
children: /* @__PURE__ */ jsx(RadixSelect.ItemText, { children: option.label })
|
|
69
|
-
},
|
|
70
|
-
option.value
|
|
71
|
-
)) }) }) })
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
Select
|
|
4
|
+
} from "../chunk-R757N7RU.js";
|
|
5
|
+
import "../chunk-PS6QXS5Z.js";
|
|
76
6
|
export {
|
|
77
7
|
Select
|
|
78
8
|
};
|
package/dist/Select/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Switch/index.cjs
CHANGED
|
@@ -1,71 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});'use client';
|
|
29
2
|
|
|
30
|
-
// src/Switch/index.ts
|
|
31
|
-
var Switch_exports = {};
|
|
32
|
-
__export(Switch_exports, {
|
|
33
|
-
Switch: () => Switch
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(Switch_exports);
|
|
36
3
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var RadixSwitch = __toESM(require("@radix-ui/react-switch"), 1);
|
|
40
|
-
var import_react = require("react");
|
|
4
|
+
var _chunkPAXRFQUJcjs = require('../chunk-PAXRFQUJ.cjs');
|
|
5
|
+
require('../chunk-R4E4BIPC.cjs');
|
|
41
6
|
|
|
42
|
-
// src/utils/cx.ts
|
|
43
|
-
function cx(...classes) {
|
|
44
|
-
return classes.filter(Boolean).join(" ");
|
|
45
|
-
}
|
|
46
7
|
|
|
47
|
-
|
|
48
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
-
var Switch = (0, import_react.forwardRef)(function Switch2({ label, disabled = false, id: idProp, className, ...rest }, ref) {
|
|
50
|
-
const reactId = (0, import_react.useId)();
|
|
51
|
-
const id = idProp ?? `nuri-switch-${reactId}`;
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cx("nuri-switch", className), children: [
|
|
53
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
-
RadixSwitch.Root,
|
|
55
|
-
{
|
|
56
|
-
ref,
|
|
57
|
-
id,
|
|
58
|
-
className: "nuri-switch__control",
|
|
59
|
-
disabled,
|
|
60
|
-
...rest,
|
|
61
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RadixSwitch.Thumb, { className: "nuri-switch__thumb" })
|
|
62
|
-
}
|
|
63
|
-
),
|
|
64
|
-
label != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: id, className: "nuri-switch__label", children: label })
|
|
65
|
-
] });
|
|
66
|
-
});
|
|
67
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
-
0 && (module.exports = {
|
|
69
|
-
Switch
|
|
70
|
-
});
|
|
8
|
+
exports.Switch = _chunkPAXRFQUJcjs.Switch;
|
|
71
9
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/summerhoony/Desktop/projects/nuri-ui/dist/Switch/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,0CAAC","file":"/Users/summerhoony/Desktop/projects/nuri-ui/dist/Switch/index.cjs"}
|
package/dist/Switch/index.js
CHANGED
|
@@ -1,33 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// src/utils/cx.ts
|
|
7
|
-
function cx(...classes) {
|
|
8
|
-
return classes.filter(Boolean).join(" ");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// src/Switch/Switch.tsx
|
|
12
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
var Switch = forwardRef(function Switch2({ label, disabled = false, id: idProp, className, ...rest }, ref) {
|
|
14
|
-
const reactId = useId();
|
|
15
|
-
const id = idProp ?? `nuri-switch-${reactId}`;
|
|
16
|
-
return /* @__PURE__ */ jsxs("div", { className: cx("nuri-switch", className), children: [
|
|
17
|
-
/* @__PURE__ */ jsx(
|
|
18
|
-
RadixSwitch.Root,
|
|
19
|
-
{
|
|
20
|
-
ref,
|
|
21
|
-
id,
|
|
22
|
-
className: "nuri-switch__control",
|
|
23
|
-
disabled,
|
|
24
|
-
...rest,
|
|
25
|
-
children: /* @__PURE__ */ jsx(RadixSwitch.Thumb, { className: "nuri-switch__thumb" })
|
|
26
|
-
}
|
|
27
|
-
),
|
|
28
|
-
label != null && /* @__PURE__ */ jsx("label", { htmlFor: id, className: "nuri-switch__label", children: label })
|
|
29
|
-
] });
|
|
30
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
Switch
|
|
4
|
+
} from "../chunk-DTQE42F7.js";
|
|
5
|
+
import "../chunk-PS6QXS5Z.js";
|
|
31
6
|
export {
|
|
32
7
|
Switch
|
|
33
8
|
};
|
package/dist/Switch/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/Textarea/index.cjs
CHANGED
|
@@ -1,127 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});'use client';
|
|
19
2
|
|
|
20
|
-
// src/Textarea/index.ts
|
|
21
|
-
var Textarea_exports = {};
|
|
22
|
-
__export(Textarea_exports, {
|
|
23
|
-
Textarea: () => Textarea
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(Textarea_exports);
|
|
26
3
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
var import_react = require("react");
|
|
4
|
+
var _chunkQ26BJSLPcjs = require('../chunk-Q26BJSLP.cjs');
|
|
5
|
+
require('../chunk-R4E4BIPC.cjs');
|
|
30
6
|
|
|
31
|
-
// src/utils/cx.ts
|
|
32
|
-
function cx(...classes) {
|
|
33
|
-
return classes.filter(Boolean).join(" ");
|
|
34
|
-
}
|
|
35
7
|
|
|
36
|
-
|
|
37
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var Textarea = (0, import_react.forwardRef)(function Textarea2({
|
|
39
|
-
label,
|
|
40
|
-
hideLabel = false,
|
|
41
|
-
description,
|
|
42
|
-
invalid = false,
|
|
43
|
-
errorMessage,
|
|
44
|
-
block = false,
|
|
45
|
-
resize = "vertical",
|
|
46
|
-
autosize = false,
|
|
47
|
-
maxRows,
|
|
48
|
-
rows = 3,
|
|
49
|
-
disabled = false,
|
|
50
|
-
className,
|
|
51
|
-
id: idProp,
|
|
52
|
-
value,
|
|
53
|
-
onChange,
|
|
54
|
-
"aria-describedby": ariaDescribedby,
|
|
55
|
-
...rest
|
|
56
|
-
}, ref) {
|
|
57
|
-
const reactId = (0, import_react.useId)();
|
|
58
|
-
const id = idProp ?? `nuri-textarea-${reactId}`;
|
|
59
|
-
const messageId = `${id}-message`;
|
|
60
|
-
const innerRef = (0, import_react.useRef)(null);
|
|
61
|
-
const setRefs = (0, import_react.useCallback)(
|
|
62
|
-
(node) => {
|
|
63
|
-
innerRef.current = node;
|
|
64
|
-
if (typeof ref === "function") ref(node);
|
|
65
|
-
else if (ref) ref.current = node;
|
|
66
|
-
},
|
|
67
|
-
[ref]
|
|
68
|
-
);
|
|
69
|
-
const fitHeight = (0, import_react.useCallback)(() => {
|
|
70
|
-
const el = innerRef.current;
|
|
71
|
-
if (!el) return;
|
|
72
|
-
const cs = getComputedStyle(el);
|
|
73
|
-
const borders = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
|
74
|
-
const lineHeight = parseFloat(cs.lineHeight);
|
|
75
|
-
const maxHeight = maxRows != null && !Number.isNaN(lineHeight) ? maxRows * lineHeight + parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom) + borders : Infinity;
|
|
76
|
-
el.style.height = "auto";
|
|
77
|
-
const contentHeight = el.scrollHeight + borders;
|
|
78
|
-
const next = Math.min(contentHeight, maxHeight);
|
|
79
|
-
if (!Number.isNaN(next)) el.style.height = `${next}px`;
|
|
80
|
-
el.style.overflowY = contentHeight > maxHeight ? "auto" : "hidden";
|
|
81
|
-
}, [maxRows]);
|
|
82
|
-
(0, import_react.useLayoutEffect)(() => {
|
|
83
|
-
if (autosize) fitHeight();
|
|
84
|
-
}, [autosize, fitHeight, value]);
|
|
85
|
-
const handleChange = (e) => {
|
|
86
|
-
onChange?.(e);
|
|
87
|
-
if (autosize) fitHeight();
|
|
88
|
-
};
|
|
89
|
-
const message = invalid && errorMessage != null ? errorMessage : description;
|
|
90
|
-
const hasMessage = message != null;
|
|
91
|
-
const describedBy = cx(hasMessage ? messageId : void 0, ariaDescribedby) || void 0;
|
|
92
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: cx("nuri-textarea", block && "nuri-textarea--block", className), children: [
|
|
93
|
-
label != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: id, className: cx("nuri-textarea__label", hideLabel && "nuri-sr-only"), children: label }),
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
-
"textarea",
|
|
96
|
-
{
|
|
97
|
-
ref: setRefs,
|
|
98
|
-
id,
|
|
99
|
-
rows,
|
|
100
|
-
value,
|
|
101
|
-
onChange: handleChange,
|
|
102
|
-
className: cx(
|
|
103
|
-
"nuri-textarea__control",
|
|
104
|
-
invalid && "nuri-textarea__control--invalid",
|
|
105
|
-
(resize === "none" || autosize) && "nuri-textarea__control--resize-none"
|
|
106
|
-
),
|
|
107
|
-
disabled,
|
|
108
|
-
"aria-invalid": invalid || void 0,
|
|
109
|
-
"aria-describedby": describedBy,
|
|
110
|
-
...rest
|
|
111
|
-
}
|
|
112
|
-
),
|
|
113
|
-
hasMessage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
114
|
-
"p",
|
|
115
|
-
{
|
|
116
|
-
id: messageId,
|
|
117
|
-
className: cx("nuri-textarea__message", invalid && "nuri-textarea__message--error"),
|
|
118
|
-
children: message
|
|
119
|
-
}
|
|
120
|
-
)
|
|
121
|
-
] });
|
|
122
|
-
});
|
|
123
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
-
0 && (module.exports = {
|
|
125
|
-
Textarea
|
|
126
|
-
});
|
|
8
|
+
exports.Textarea = _chunkQ26BJSLPcjs.Textarea;
|
|
127
9
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/summerhoony/Desktop/projects/nuri-ui/dist/Textarea/index.cjs"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACF,yDAA8B;AAC9B,iCAA8B;AAC9B;AACE;AACF,8CAAC","file":"/Users/summerhoony/Desktop/projects/nuri-ui/dist/Textarea/index.cjs"}
|
package/dist/Textarea/index.js
CHANGED
|
@@ -1,99 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function cx(...classes) {
|
|
7
|
-
return classes.filter(Boolean).join(" ");
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// src/Textarea/Textarea.tsx
|
|
11
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
var Textarea = forwardRef(function Textarea2({
|
|
13
|
-
label,
|
|
14
|
-
hideLabel = false,
|
|
15
|
-
description,
|
|
16
|
-
invalid = false,
|
|
17
|
-
errorMessage,
|
|
18
|
-
block = false,
|
|
19
|
-
resize = "vertical",
|
|
20
|
-
autosize = false,
|
|
21
|
-
maxRows,
|
|
22
|
-
rows = 3,
|
|
23
|
-
disabled = false,
|
|
24
|
-
className,
|
|
25
|
-
id: idProp,
|
|
26
|
-
value,
|
|
27
|
-
onChange,
|
|
28
|
-
"aria-describedby": ariaDescribedby,
|
|
29
|
-
...rest
|
|
30
|
-
}, ref) {
|
|
31
|
-
const reactId = useId();
|
|
32
|
-
const id = idProp ?? `nuri-textarea-${reactId}`;
|
|
33
|
-
const messageId = `${id}-message`;
|
|
34
|
-
const innerRef = useRef(null);
|
|
35
|
-
const setRefs = useCallback(
|
|
36
|
-
(node) => {
|
|
37
|
-
innerRef.current = node;
|
|
38
|
-
if (typeof ref === "function") ref(node);
|
|
39
|
-
else if (ref) ref.current = node;
|
|
40
|
-
},
|
|
41
|
-
[ref]
|
|
42
|
-
);
|
|
43
|
-
const fitHeight = useCallback(() => {
|
|
44
|
-
const el = innerRef.current;
|
|
45
|
-
if (!el) return;
|
|
46
|
-
const cs = getComputedStyle(el);
|
|
47
|
-
const borders = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
|
|
48
|
-
const lineHeight = parseFloat(cs.lineHeight);
|
|
49
|
-
const maxHeight = maxRows != null && !Number.isNaN(lineHeight) ? maxRows * lineHeight + parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom) + borders : Infinity;
|
|
50
|
-
el.style.height = "auto";
|
|
51
|
-
const contentHeight = el.scrollHeight + borders;
|
|
52
|
-
const next = Math.min(contentHeight, maxHeight);
|
|
53
|
-
if (!Number.isNaN(next)) el.style.height = `${next}px`;
|
|
54
|
-
el.style.overflowY = contentHeight > maxHeight ? "auto" : "hidden";
|
|
55
|
-
}, [maxRows]);
|
|
56
|
-
useLayoutEffect(() => {
|
|
57
|
-
if (autosize) fitHeight();
|
|
58
|
-
}, [autosize, fitHeight, value]);
|
|
59
|
-
const handleChange = (e) => {
|
|
60
|
-
onChange?.(e);
|
|
61
|
-
if (autosize) fitHeight();
|
|
62
|
-
};
|
|
63
|
-
const message = invalid && errorMessage != null ? errorMessage : description;
|
|
64
|
-
const hasMessage = message != null;
|
|
65
|
-
const describedBy = cx(hasMessage ? messageId : void 0, ariaDescribedby) || void 0;
|
|
66
|
-
return /* @__PURE__ */ jsxs("div", { className: cx("nuri-textarea", block && "nuri-textarea--block", className), children: [
|
|
67
|
-
label != null && /* @__PURE__ */ jsx("label", { htmlFor: id, className: cx("nuri-textarea__label", hideLabel && "nuri-sr-only"), children: label }),
|
|
68
|
-
/* @__PURE__ */ jsx(
|
|
69
|
-
"textarea",
|
|
70
|
-
{
|
|
71
|
-
ref: setRefs,
|
|
72
|
-
id,
|
|
73
|
-
rows,
|
|
74
|
-
value,
|
|
75
|
-
onChange: handleChange,
|
|
76
|
-
className: cx(
|
|
77
|
-
"nuri-textarea__control",
|
|
78
|
-
invalid && "nuri-textarea__control--invalid",
|
|
79
|
-
(resize === "none" || autosize) && "nuri-textarea__control--resize-none"
|
|
80
|
-
),
|
|
81
|
-
disabled,
|
|
82
|
-
"aria-invalid": invalid || void 0,
|
|
83
|
-
"aria-describedby": describedBy,
|
|
84
|
-
...rest
|
|
85
|
-
}
|
|
86
|
-
),
|
|
87
|
-
hasMessage && /* @__PURE__ */ jsx(
|
|
88
|
-
"p",
|
|
89
|
-
{
|
|
90
|
-
id: messageId,
|
|
91
|
-
className: cx("nuri-textarea__message", invalid && "nuri-textarea__message--error"),
|
|
92
|
-
children: message
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
] });
|
|
96
|
-
});
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
Textarea
|
|
4
|
+
} from "../chunk-DTGPVOJK.js";
|
|
5
|
+
import "../chunk-PS6QXS5Z.js";
|
|
97
6
|
export {
|
|
98
7
|
Textarea
|
|
99
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|