@cmdniels/uikit 1.0.0 → 1.0.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.
@@ -1,3 +1,3 @@
1
1
  import { type ComponentProps } from "react";
2
2
  import InputGroupInput from "../../components/input-group/InputGroupInput";
3
- export default function CopyInput({ disabled, defaultValue, value, onChange, ...props }: ComponentProps<typeof InputGroupInput>): import("react/jsx-runtime").JSX.Element;
3
+ export default function CopyInput({ disabled, defaultValue, value, onChange, children, ...props }: ComponentProps<typeof InputGroupInput>): import("react/jsx-runtime").JSX.Element;
@@ -12,21 +12,34 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { IconCopy } from "@tabler/icons-react";
15
- import { useState, useRef } from "react";
15
+ import { useState, useRef, Children, isValidElement } from "react";
16
16
  import Button from "../../components/button/Button";
17
17
  import InputGroup from "../../components/input-group/InputGroup";
18
18
  import InputGroupAddon from "../../components/input-group/InputGroupAddon";
19
19
  import InputGroupInput from "../../components/input-group/InputGroupInput";
20
20
  export default function CopyInput(_a) {
21
- var { disabled, defaultValue, value, onChange } = _a, props = __rest(_a, ["disabled", "defaultValue", "value", "onChange"]);
21
+ var { disabled, defaultValue, value, onChange, children } = _a, props = __rest(_a, ["disabled", "defaultValue", "value", "onChange", "children"]);
22
22
  const inputRef = useRef(null);
23
23
  const [hasValue, setHasValue] = useState(Boolean(value !== null && value !== void 0 ? value : defaultValue));
24
24
  const handleChange = (e) => {
25
25
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
26
26
  setHasValue(Boolean(e.target.value));
27
27
  };
28
- return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, Object.assign({ ref: inputRef, disabled: disabled, defaultValue: defaultValue, value: value, onChange: handleChange }, props)), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(Button, { variant: "link", className: "h-8 px-2", disabled: disabled !== null && disabled !== void 0 ? disabled : !hasValue, onClick: () => {
29
- var _a, _b;
30
- navigator.clipboard.writeText((_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "");
31
- }, children: _jsx(IconCopy, { className: "size-4" }) }) })] }));
28
+ const handleCopy = () => {
29
+ var _a, _b, _c, _d;
30
+ const inputValue = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
31
+ const text = (_d = (_c = Children.map(children, (child) => {
32
+ if (isValidElement(child) && child.props.children) {
33
+ const inputGroupText = child.props.children;
34
+ if (isValidElement(inputGroupText) && inputGroupText.props.children) {
35
+ const innerText = inputGroupText.props.children;
36
+ if (typeof innerText === "string" || typeof innerText === "number") {
37
+ return innerText;
38
+ }
39
+ }
40
+ }
41
+ })) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : "";
42
+ navigator.clipboard.writeText(text + inputValue);
43
+ };
44
+ return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, Object.assign({ ref: inputRef, disabled: disabled, defaultValue: defaultValue, value: value, onChange: handleChange }, props)), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(Button, { variant: "link", className: "h-8 px-2", disabled: disabled !== null && disabled !== void 0 ? disabled : !hasValue, onClick: handleCopy, children: _jsx(IconCopy, { className: "size-4" }) }) }), children] }));
32
45
  }
@@ -14,5 +14,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  import cn from "../../cn";
15
15
  export default function InputGroup(_a) {
16
16
  var { className } = _a, props = __rest(_a, ["className"]);
17
- return (_jsx("div", Object.assign({ "data-slot": "input-group", role: "group", className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0", className) }, props)));
17
+ return (_jsx("div", Object.assign({ "data-slot": "input-group", role: "group", className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-[3px] has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-[3px] has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className) }, props)));
18
18
  }
@@ -1,3 +1,3 @@
1
1
  import { type ComponentProps } from "react";
2
2
  import InputGroupInput from "../../components/input-group/InputGroupInput";
3
- export default function LinkInput({ disabled, defaultValue, value, onChange, ...props }: ComponentProps<typeof InputGroupInput>): import("react/jsx-runtime").JSX.Element;
3
+ export default function LinkInput({ disabled, defaultValue, value, onChange, children, ...props }: ComponentProps<typeof InputGroupInput>): import("react/jsx-runtime").JSX.Element;
@@ -12,13 +12,13 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  };
13
13
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
14
  import { IconExternalLink } from "@tabler/icons-react";
15
- import { useState, useRef } from "react";
15
+ import { useState, useRef, isValidElement, Children } from "react";
16
16
  import Button from "../../components/button/Button";
17
17
  import InputGroup from "../../components/input-group/InputGroup";
18
18
  import InputGroupAddon from "../../components/input-group/InputGroupAddon";
19
19
  import InputGroupInput from "../../components/input-group/InputGroupInput";
20
20
  export default function LinkInput(_a) {
21
- var { disabled, defaultValue, value, onChange } = _a, props = __rest(_a, ["disabled", "defaultValue", "value", "onChange"]);
21
+ var { disabled, defaultValue, value, onChange, children } = _a, props = __rest(_a, ["disabled", "defaultValue", "value", "onChange", "children"]);
22
22
  const inputRef = useRef(null);
23
23
  const debounceRef = useRef(undefined);
24
24
  const [hasValidValue, setHasValidValue] = useState(/^https?:\/\/.+/.test(String(value !== null && value !== void 0 ? value : defaultValue)));
@@ -32,10 +32,21 @@ export default function LinkInput(_a) {
32
32
  setHasValidValue(/^https?:\/\/.+/.test(e.target.value));
33
33
  }, 300);
34
34
  };
35
- return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, Object.assign({ ref: inputRef, disabled: disabled, defaultValue: defaultValue, value: value, onChange: handleChange }, props)), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(Button, { variant: "link", className: "h-8 px-2", disabled: disabled !== null && disabled !== void 0 ? disabled : !hasValidValue, onClick: () => {
36
- var _a, _b;
37
- if ((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) {
38
- window.open((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.value, "_blank", "noopener,noreferrer");
39
- }
40
- }, children: _jsx(IconExternalLink, { className: "size-4" }) }) })] }));
35
+ const handleCopy = () => {
36
+ var _a, _b, _c, _d;
37
+ const inputValue = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "";
38
+ const text = (_d = (_c = Children.map(children, (child) => {
39
+ if (isValidElement(child) && child.props.children) {
40
+ const inputGroupText = child.props.children;
41
+ if (isValidElement(inputGroupText) && inputGroupText.props.children) {
42
+ const innerText = inputGroupText.props.children;
43
+ if (typeof innerText === "string" || typeof innerText === "number") {
44
+ return innerText;
45
+ }
46
+ }
47
+ }
48
+ })) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : "";
49
+ window.open(text + inputValue, "_blank", "noopener,noreferrer");
50
+ };
51
+ return (_jsxs(InputGroup, { children: [_jsx(InputGroupInput, Object.assign({ ref: inputRef, disabled: disabled, defaultValue: defaultValue, value: value, onChange: handleChange }, props)), _jsx(InputGroupAddon, { align: "inline-end", children: _jsx(Button, { variant: "link", className: "h-8 px-2", disabled: disabled !== null && disabled !== void 0 ? disabled : !hasValidValue, onClick: handleCopy, children: _jsx(IconExternalLink, { className: "size-4" }) }) }), children] }));
41
52
  }
@@ -0,0 +1,2 @@
1
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
2
+ export default function ScrollArea({ className, children, ...props }: ScrollAreaPrimitive.Root.Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
15
+ import cn from "../../cn";
16
+ import ScrollBar from "./ScrollBar";
17
+ export default function ScrollArea(_a) {
18
+ var { className, children } = _a, props = __rest(_a, ["className", "children"]);
19
+ return (_jsxs(ScrollAreaPrimitive.Root, Object.assign({ "data-slot": "scroll-area", className: cn("relative", className) }, props, { children: [_jsx(ScrollAreaPrimitive.Viewport, { "data-slot": "scroll-area-viewport", className: "size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1", children: children }), _jsx(ScrollBar, {}), _jsx(ScrollAreaPrimitive.Corner, {})] })));
20
+ }
@@ -0,0 +1,2 @@
1
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
2
+ export default function ScrollBar({ className, orientation, ...props }: ScrollAreaPrimitive.Scrollbar.Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
15
+ import cn from "../../cn";
16
+ export default function ScrollBar(_a) {
17
+ var { className, orientation = "vertical" } = _a, props = __rest(_a, ["className", "orientation"]);
18
+ return (_jsx(ScrollAreaPrimitive.Scrollbar, Object.assign({ "data-slot": "scroll-area-scrollbar", "data-orientation": orientation, orientation: orientation, className: cn("flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent", className) }, props, { children: _jsx(ScrollAreaPrimitive.Thumb, { "data-slot": "scroll-area-thumb", className: "relative flex-1 rounded-full bg-border" }) })));
19
+ }
package/out/index.d.ts CHANGED
@@ -120,6 +120,8 @@ export { default as PopoverDescription } from "./components/popover/PopoverDescr
120
120
  export { default as PopoverHeader } from "./components/popover/PopoverHeader";
121
121
  export { default as PopoverTitle } from "./components/popover/PopoverTitle";
122
122
  export { default as PopoverTrigger } from "./components/popover/PopoverTrigger";
123
+ export { default as ScrollArea } from "./components/scroll-area/ScrollArea";
124
+ export { default as ScrollBar } from "./components/scroll-area/ScrollBar";
123
125
  export { default as Select } from "./components/select/Select";
124
126
  export { default as SelectContent } from "./components/select/SelectContent";
125
127
  export { default as SelectGroup } from "./components/select/SelectGroup";
package/out/index.js CHANGED
@@ -144,6 +144,9 @@ export { default as PopoverDescription } from "./components/popover/PopoverDescr
144
144
  export { default as PopoverHeader } from "./components/popover/PopoverHeader";
145
145
  export { default as PopoverTitle } from "./components/popover/PopoverTitle";
146
146
  export { default as PopoverTrigger } from "./components/popover/PopoverTrigger";
147
+ // Scroll Area
148
+ export { default as ScrollArea } from "./components/scroll-area/ScrollArea";
149
+ export { default as ScrollBar } from "./components/scroll-area/ScrollBar";
147
150
  // Select
148
151
  export { default as Select } from "./components/select/Select";
149
152
  export { default as SelectContent } from "./components/select/SelectContent";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmdniels/uikit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,6 +35,7 @@
35
35
  "@dnd-kit/modifiers": "^9.0.0",
36
36
  "@dnd-kit/sortable": "^10.0.0",
37
37
  "@dnd-kit/utilities": "^3.2.2",
38
+ "@radix-ui/react-scroll-area": "^1.2.10",
38
39
  "@tabler/icons-react": "^3.35.0",
39
40
  "@tailwindcss/postcss": "^4",
40
41
  "class-variance-authority": "^0.7.1",
@@ -49,7 +50,7 @@
49
50
  "tw-animate-css": "^1.4.0"
50
51
  },
51
52
  "devDependencies": {
52
- "@cmdniels/eslint-config": "1.0.0",
53
+ "@cmdniels/eslint-config": "^1.0.1",
53
54
  "@ladle/react": "^5.1.1",
54
55
  "@types/node": "24.10.1",
55
56
  "@types/react": "^19.2.7",